fluid-dev
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [fluid-dev] New "bank offset" feature and selecting sfont/bank/prese


From: Peter Hanappe
Subject: Re: [fluid-dev] New "bank offset" feature and selecting sfont/bank/preset...
Date: Thu, 29 Jul 2004 23:55:49 +0200
User-agent: Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.5) Gecko/20031107 Debian/1.5-3

Ken Ellinwood wrote:
> The attached patch adds the ability to specify a "bank offset" when
> loading a sound font.  This patch was developed against the latest
> code in the savannah CVS repository, which from all apperances seems
> to be fully operational again.
>
> Here's what the patch does:
>
> First, I fixed the handling of a MIDI bank select controller 0, e.g., bank
> select MSB (or "coarse" bank select according to my spec).  Prior to
> this fix a channel's bank number was only changed upon reception of
> MIDI bank select controller 32, e.g, bank select LSB (or "fine"
> bank-select according to my spec).

I made the changes for the bank select (in CVS). I must admit I'm a
little confused about what the correct behavior is. I thought the
following three messages had to be sent together, in this order:

  BankSelect_MSB + BankSelect_LSB + ProgramChange

The select bank is then: BankSelect_MSB * 128 + BankSelect_LSB.
Sending only a ProgramChange, without the BankSelect, is fine too.
In that case the previous bank will be used.

However, what should the synth do when it receives the
BankSelect_MSB? Or when it receives BankSelect_MSB + ProgramChange,
without a BankSelect_LSB?

1) Do nothing, just store the value of BankSelect_MSB somewhere until a
   BankSelect_LSB comes in (that is what the synth did)
2) Set the bank number to BankSelect_MSB and store the value
   until a BankSelect_LSB comes in (this is the solution
   you propose.)
3) Set the bank number to BankSelect_MSB * 128 and store the value.

What do other synths do?


> The bank offset is a new argument to the command line "load"
> operation.  The bank offset value is added to the soundfont's internal
> bank numbers and allows the presets of multiple soundfonts which
> internally use the same banks to be accessed via MIDI commands.  For
> example, if you have two soundfonts which both contain presets in bank
> 0, it was previously impossible to select presets from both soundfonts
> using MIDI commands.  Now if you load one soundfont with bank offset 0
> and the other with bank offset 1, presets from both can be assigned
> via MIDI commands using combinations of bank select and program
> change.

I very much agree to the idea. However, I have some reservations about
the proposed changes to the code. The main problems are the changes to
the fluid_sfont and fluid_sfloader structures. Strictly speaking, they
break binary compatibility with previous versions of the library. Also
the redux patch does. Adding functions to the API should not break
compatibily so I propose the following:

- add two new functions (this does not break compatibilty):

   fluid_synth_set_bank_offset(synth, sfont_id, offset)
   fluid_synth_get_bank_offset(synth, sfont_id)

- the sfonts and sfloaders do not have to know about the offsets.
  The synth manages the bank offsets internally and stores a list
  of pairs (sfont_id, bank_offset).

  All calls to fluid_sfont_get_preset() such as:

    fluid_sfont_get_preset(sfont, banknum, prognum)

  are replaced with

    offset = fluid_synth_get_bank_offset(synth, sfont_id)
    fluid_sfont_get_preset(sfont, banknum - offset, prognum)

I'll be happy to change the 'select' and 'load' commands.

Does that seem alright to you?

Cheers!
P

>
>
> Enjoy,
>
> Ken
>
>






reply via email to

[Prev in Thread] Current Thread [Next in Thread]