mirror of
https://github.com/ZDoom/fluidsynth.git
synced 2024-11-10 15:01:40 +00:00
Added MIDI channel pressure.
This commit is contained in:
parent
ce3002381a
commit
15322a71ba
3 changed files with 48 additions and 0 deletions
|
@ -332,6 +332,17 @@ fluid_channel_get_cc(fluid_channel_t* chan, int num)
|
|||
return ((num >= 0) && (num < 128))? chan->cc[num] : 0;
|
||||
}
|
||||
|
||||
/*
|
||||
* fluid_channel_pressure
|
||||
*/
|
||||
int
|
||||
fluid_channel_pressure(fluid_channel_t* chan, int val)
|
||||
{
|
||||
chan->channel_pressure = val;
|
||||
fluid_synth_modulate_voices(chan->synth, chan->channum, 0, FLUID_MOD_CHANNELPRESSURE);
|
||||
return FLUID_OK;
|
||||
}
|
||||
|
||||
/*
|
||||
* fluid_channel_pitch_bend
|
||||
*/
|
||||
|
|
|
@ -88,6 +88,7 @@ int fluid_channel_set_banknum(fluid_channel_t* chan, unsigned int bank);
|
|||
int fluid_channel_set_prognum(fluid_channel_t* chan, int prognum);
|
||||
int fluid_channel_get_prognum(fluid_channel_t* chan);
|
||||
int fluid_channel_cc(fluid_channel_t* chan, int ctrl, int val);
|
||||
int fluid_channel_pressure(fluid_channel_t* chan, int val);
|
||||
int fluid_channel_pitch_bend(fluid_channel_t* chan, int val);
|
||||
int fluid_channel_pitch_wheel_sens(fluid_channel_t* chan, int val);
|
||||
int fluid_channel_get_cc(fluid_channel_t* chan, int num);
|
||||
|
|
|
@ -997,6 +997,39 @@ fluid_synth_modulate_voices_all(fluid_synth_t* synth, int chan)
|
|||
return FLUID_OK;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set the MIDI channel pressure controller value.
|
||||
* @param synth FluidSynth instance
|
||||
* @param chan MIDI channel number
|
||||
* @param val MIDI channel pressure value (7 bit, 0-127)
|
||||
* @return FLUID_OK on success
|
||||
*
|
||||
* Assign to the MIDI channel pressure controller value on a specific MIDI channel
|
||||
* in real time.
|
||||
*/
|
||||
int
|
||||
fluid_synth_channel_pressure(fluid_synth_t* synth, int chan, int val)
|
||||
{
|
||||
|
||||
/* fluid_mutex_lock(synth->busy); /\* Don't interfere with the audio thread *\/ */
|
||||
/* fluid_mutex_unlock(synth->busy); */
|
||||
|
||||
/* check the ranges of the arguments */
|
||||
if ((chan < 0) || (chan >= synth->midi_channels)) {
|
||||
FLUID_LOG(FLUID_WARN, "Channel out of range");
|
||||
return FLUID_FAILED;
|
||||
}
|
||||
|
||||
if (synth->verbose) {
|
||||
FLUID_LOG(FLUID_INFO, "channelpressure\t%d\t%d", chan, val);
|
||||
}
|
||||
|
||||
/* set the channel pressure value in the channel */
|
||||
fluid_channel_pressure(synth->channel[chan], val);
|
||||
|
||||
return FLUID_OK;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set the MIDI pitch bend controller value.
|
||||
* @param synth FluidSynth instance
|
||||
|
@ -3033,6 +3066,9 @@ int fluid_synth_handle_midi_event(void* data, fluid_midi_event_t* event)
|
|||
case PROGRAM_CHANGE:
|
||||
return fluid_synth_program_change(synth, chan, fluid_midi_event_get_program(event));
|
||||
|
||||
case CHANNEL_PRESSURE:
|
||||
return fluid_synth_channel_pressure(synth, chan, fluid_midi_event_get_program(event));
|
||||
|
||||
case PITCH_BEND:
|
||||
return fluid_synth_pitch_bend(synth, chan, fluid_midi_event_get_pitch(event));
|
||||
|
||||
|
|
Loading…
Reference in a new issue