Sf2Player: update pitch wheel sensitivity based on pitch range

Fluidsynth supports setting the pitch wheel sensitivity, therefore make
use of it and set values from the recently introduced pitch range model.
This commit is contained in:
Tobias Doerffel
2014-01-26 14:09:05 +01:00
parent 0a5665ae16
commit 43f76f5357
2 changed files with 14 additions and 3 deletions

View File

@@ -87,7 +87,8 @@ sf2Instrument::sf2Instrument( InstrumentTrack * _instrument_track ) :
m_font( NULL ),
m_fontId( 0 ),
m_filename( "" ),
m_lastMidiPitch( 8192 ),
m_lastMidiPitch( -1 ),
m_lastMidiPitchRange( -1 ),
m_channel( 1 ),
m_bankNum( 0, 0, 999, this, tr("Bank") ),
m_patchNum( 0, 0, 127, this, tr("Patch") ),
@@ -679,12 +680,21 @@ void sf2Instrument::play( sampleFrame * _working_buffer )
const fpp_t frames = engine::mixer()->framesPerPeriod();
m_synthMutex.lock();
if( m_lastMidiPitch != instrumentTrack()->midiPitch() )
const int currentMidiPitch = instrumentTrack()->midiPitch();
if( m_lastMidiPitch != currentMidiPitch )
{
m_lastMidiPitch = instrumentTrack()->midiPitch();
m_lastMidiPitch = currentMidiPitch;
fluid_synth_pitch_bend( m_synth, m_channel, m_lastMidiPitch );
}
const int currentMidiPitchRange = instrumentTrack()->midiPitchRange();
if( m_lastMidiPitchRange != currentMidiPitchRange )
{
m_lastMidiPitchRange = currentMidiPitchRange;
fluid_synth_pitch_wheel_sens( m_synth, m_channel, m_lastMidiPitchRange );
}
if( m_internalSampleRate < engine::mixer()->processingSampleRate() &&
m_srcState != NULL )
{

View File

@@ -129,6 +129,7 @@ private:
int m_notesRunning[128];
sample_rate_t m_internalSampleRate;
int m_lastMidiPitch;
int m_lastMidiPitchRange;
int m_channel;
lcdSpinBoxModel m_bankNum;