Hi,

 

>Despite the fact that this function ignores two of its arguments, I just dont 
>know how to properly tell it which channels to map to which output buffers.

 

fluid_synth_process(int len, int nout, float** out) behaves like 
fluid_synth_nwrite_float(int len, float** left, float** right). Both functions 
are intended

to return synthesized buffers for a number of stereo audio channels 
(synth->audio_channels). fluid_synth_process() seems adapted to send audio to 
audio card with multiples

stereo audio channels (unlike fluid_synth_write_float(), 
fluid_synth_write_s16() which are only useful for only one stereo audio 
channel).

The internal mixer stereo audio channels buffers (from 0 to audio_channels-1) 
are outputed in the out array in an interleaving format:

(l_audio_chan_0, r_audio_chan_0, l_audio_chan_1, r_audio_chan_1,....). 
Consequently nout and out array must be set to sufficient size (nout >= 2 x 
synth->audio_channels).

 

The way a MIDI channel number is mapped to an audio channel number is done 
inside the fluidsynth mixer in fluid_rvoice_buffers_mix().

During fluid_rvoice_buffers_mix(), the function is instructed by the voice to 
select (mapping) the audio channel buffer number m to mix this voice.

In the actual version the mapping m is function of the MIDI channel of the 
voice:

     m= 2 x ( MIDI channel number % buf_count) with

     with buf_count = max (audio_channels, audio_groups).

 

Somes pictures are attached to illustrates this.

Hope the author of this API could tell more about the intended unused 
parameters int nin, float** in.

jjc

> Message du 26/04/18 14:42
> De : "Tom M." 
> A : fluid-dev@nongnu.org
> Copie à : 
> Objet : [fluid-dev] API design: fluid_synth_process()
> 
> I thought to release a beta in the nearer future. But I would like to have 
> the API ready before I do so. One function that still strikes me is 
> fluid_synth_process() [1]. It's lacking a real implementation for 15 years. 
> If we dont get it right now, we'll never do, so we better discuss it.
> 
> This function is used for pulling synthesized audio from the synth. It's said 
> to become the "generic interface in future versions". Although its usage is 
> discouraged as being still "experimental", it's already established due to 
> being required for the callback function of new_fluid_audio_driver2() [2].
> 
> Despite the fact that this function ignores two of its arguments, I just dont 
> know how to properly tell it which channels to map to which output buffers. 
> I'm thinking here in the scope of a "future release" that might support 
> surround audio and rendering effects of each midi channel to separate stereo 
> / surround buffers.
> 
> Does anybody have an idea how to deal with this function (preferably without 
> changing its signature)? Any idea of how those two ignored arguments could be 
> used? Would welcome any thoughts (esp. from a user perspective).
> 
> Tom
> 
> [1]: 
> http://www.fluidsynth.org/api/synth_8h.html#a1ac90e2732aa652679305f78cbd66670
> [2]: 
> http://www.fluidsynth.org/api/audio_8h.html#a3959d8add1dea97e507a5ea2c802c0bc
> 
> _______________________________________________
> fluid-dev mailing list
> fluid-dev@nongnu.org
> https://lists.nongnu.org/mailman/listinfo/fluid-dev
>
_______________________________________________
fluid-dev mailing list
fluid-dev@nongnu.org
https://lists.nongnu.org/mailman/listinfo/fluid-dev

Reply via email to