fluid-dev
[Top][All Lists]
Advanced

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

Re: [fluid-dev] Propose change: all_notes_off, all_sounds_off


From: David Henningsson
Subject: Re: [fluid-dev] Propose change: all_notes_off, all_sounds_off
Date: Wed, 26 Jan 2011 11:22:41 +0100
User-agent: Mozilla/5.0 (X11; U; Linux x86_64; en-US; rv:1.9.2.13) Gecko/20101208 Thunderbird/3.1.7

On 2011-01-26 00:23, jimmy wrote:

Propose changes for handling of "All notes off", "All sounds off".

GOAL FOR THIS PATCH:
--------------------
Turn off all notes/sounds on all channels at once.

If FluidSynth allows the parameter "chan" value -1 to mean operate on all 
channels, it is a reasonably simple and efficient change.
--------------------


The code changes are in:

    static int fluid_synth_all_notes_off_LOCAL(fluid_synth_t* synth, int chan)
    static int fluid_synth_all_sounds_off_LOCAL(fluid_synth_t* synth, int chan)

will affect behaviors of:

    int fluid_synth_all_notes_off(fluid_synth_t* synth, int chan)
    int fluid_synth_all_sounds_off(fluid_synth_t* synth, int chan)

the main difference between the two functions are:

    fluid_synth_all_notes_off() will calls fluid_voice_noteoff();
    fluid_synth_all_sounds_off_LOCAL() will calls fluid_voice_off(();

although, I don't know what's the differences between fluid_voice_noteoff(), 
and fluid_voice_off();

fluid_voice_noteoff will make the voice advance to its release phase.
Fluid_voice_off will cut it off immediately.


---

Previously, "All notes off", "All sounds off" will only operate on individual 
channel.

To do so for 16, 32, 48, 64 channels, one has to loop through for each channel. 
 Not too bad, but looking at the implementation, it is just not effecient at 
all.

This patch is based on somewhat dated fluidsynth.svn399.20101221 (5 week old) 
code.

Let's hear if this is a reasonable change to the code base, or not.

Can you elaborate on where this is useful? These are not public API functions and aren't used anywhere. I was thinking of removing the ones not starting with _LOCAL.

----- Patch starts below: -----
diff -ur fluidsynth.svn399.20101221/src/synth/fluid_synth.c 
fluidsynth.svn399.20101221.jnAllSoundsOff/src/synth/fluid_synth.c
--- fluidsynth.svn399.20101221/src/synth/fluid_synth.c  2010-12-21 
19:02:53.000000000 -0500
+++ fluidsynth.svn399.20101221.jnAllSoundsOff/src/synth/fluid_synth.c   
2011-01-25 12:57:46.000000000 -0500
@@ -1455,7 +1455,7 @@
  /**
   * Turn off all notes on a MIDI channel (put them into release phase).
   * @param synth FluidSynth instance
- * @param chan MIDI channel number (0 to MIDI channel count - 1)
+ * @param chan MIDI channel number (0 to MIDI channel count - 1), (chan=-1 
selects all channels)
   * @return FLUID_OK on success, FLUID_FAILED otherwise
   */
  int
@@ -1467,7 +1467,7 @@
    return fluid_synth_all_notes_off_LOCAL (synth, chan);

-1 won't pass through here - will be stopped on the line above:

fluid_return_val_if_fail (chan >= 0 && chan < synth->midi_channels, FLUID_FAILED);

Same thing might apply to the other functions.

// David



reply via email to

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