[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[iiwusynth-devel] Program selection and SF loading [was: What I'm plann
From: |
Peter Hanappe |
Subject: |
[iiwusynth-devel] Program selection and SF loading [was: What I'm planning to do with iiwusynth] |
Date: |
Fri, 21 Feb 2003 20:23:14 +0100 |
User-agent: |
Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.0.0) Gecko/20020623 Debian/1.0.0-0.woody.1 |
M. Nentwig wrote:
Soundfont selection: In my opinion still an unsolved problem, even if
the synth behaves like any other SF2 device. It may be less work to
implement a select command, that takes for example the bank filename as
argument, together with channel, bank and prog number.
I made some changes to the soundfont loading API. Previously, when a
SoundFont was loaded, all the presets on the MIDI channels changed to
those of the newly loaded SoundFont. This is how the SBLive works, but
is awkward in some cases. So I added a flag to iiwu_synth_sfload and
sfunload to indicate whether or not the reset the presets. In
addition, as Markus suggested, I added a "iiwu_synth_program_select"
function that takes the SoundFont ID as argument in addtion to the
preset number and bank number. This uniquely defines a preset and
allows you to select a preset that previously was masked. I updated
the shell commands to reflect the changes. Besides the new flags to
sfload and sfunload, the changes should be transparent.
Some documentation below.
Cheers,
Peter
- Shell ------------------------------------
load file [reset]
Load a SoundFont (reset=0|1, optional, default=1
unload id [reset]
Unload the SoundFont with the specified ID (reset=0|1, def=1)
- API ------------------------------------
iiwu_synth_program_select(synth, chan, sfont_id, bank_num, prog_num);
Changes the preset on the channel. The preset is uniquely defined by
the SoundFont ID, the bank number, and preset number. If the preset
does not exist, no changes are made.
iiwu_synth_bank_select(synth, chan, bank_num)
Sets the bank number for the channel. Does not change the preset on
the channel until a subsequent iiwu_synth_program_change is
received.
iiwu_synth_program_change(synth, chan, prog_num);
Changes the preset on the channel. Selects the preset defined by
the bank and program number. The preset is searched in all
SoundFonts, starting in the SoundFont that was loaded last.
iiwu_synth_program_reset(synth)
Reinitializes the presets of all channels. This is similar to
sending a program change message to every channel using the
channel's current program and bank number.
iiwu_synth_sfload(synth, filename, reset_presets)
Loads a new SoundFont. If reset_preset is set,
iiwu_synth_program_reset is called after the SoundFont is loaded. As
a result, the presets on all channels may change to the equivalent
presets (i.e. same bank and program number) in the newly loaded
SoundFont. This is the default behavior of the SoundBlaster Live!
cards.
iiwu_synth_sfunload(synth, sfont_id, reset_presets)
Unload a SoundFont. If reset_presets is set,
iiwu_synth_program_reset is called after the SoundFont is
unloaded. As a result a new preset may be set on the channel,
corresponding to the bank and program number of the channel. This is
the default behavior of the SoundBlaster Live! cards. If
reset_presets is zero, the presets that belong to the unloaded
SoundFont will be removed from the channels and no new preset will
be set on those channels.
iiwu_synth_sfreload(synth, id)
Reload a SoundFont. After reloading the SoundFont, the presets on
the channels should be the same, unless the reloaded SoundFont does
not contain the same set of presets. In that case, some of the
channels may no longer have a preset.