Please make sure to include the mailing list when replying.


On 10.12.20 15:10, d...@mozart.co.uk wrote:
Hi Tom,


fluid_synth_set_channel_type() changes the type only. It does not assign new 
presets. To do this, either add a call to fluid_synth_program_reset() or send 
some fluid_synth_program_change() messages afterwards.

 >And make sure to implement proper error handling by checking the return 
values of those functions.


Thanks for the suggestion.   I was already sending a program change to all 
channels (except the one where I actually want percussion)  and the voices were 
coming out fine on all but channel 9.   So I’ve included a reset:

        settings = new_fluid_settings();

        fluid_settings_setint( settings, "synth.midi-channels", 65 );

// create the synthesizer

// with percussion channel = 64

        synth = new_fluid_synth( settings );

        fluid_synth_set_channel_type( synth, 64, CHANNEL_TYPE_DRUM);

// Set the standard MIDI percussion channel to melodic:

        fluid_synth_set_channel_type( synth, 9, CHANNEL_TYPE_MELODIC);

// Reset:

        fluid_synth_system_reset( synth );

And it hasn’t changed:  I’m still getting percussion sounds on channel 9.

As a work-around I’ve gone over to using channel 9 as my percussion channel, 
and that works fine.

[I have to admit I wasn’t checking error returns but I’ll do that next.]

Dave

David Webber
Mozart Music Software
https://www.mozart.co.uk


I forgot that you have to set the bank as well:

fluid_synth_set_channel_type( synth, 9, CHANNEL_TYPE_MELODIC);
fluid_synth_bank_select(synth, 9, 0); // bank 0
fluid_synth_program_reset();

Alternatively, use fluid_synth_program_select() right away.


Tom

_______________________________________________
fluid-dev mailing list
fluid-dev@nongnu.org
https://lists.nongnu.org/mailman/listinfo/fluid-dev

Reply via email to