sf2player: added support for pitch-bending

git-svn-id: https://lmms.svn.sf.net/svnroot/lmms/trunk/lmms@1293 0778d3d1-df1d-0410-868b-ea421aaaa00d
This commit is contained in:
Tobias Doerffel
2008-07-07 08:34:27 +00:00
parent 98a984b94d
commit 61f2990c19
3 changed files with 20 additions and 1 deletions

View File

@@ -1,5 +1,16 @@
2008-07-07 Tobias Doerffel <tobydox/at/users/dot/sourceforge/dot/net>
* plugins/sf2_player/sf2_player.cpp:
* plugins/sf2_player/sf2_player.h:
added support for pitch-bending
* include/instrument_track.h:
* include/note_play_handle.h:
* src/core/note_play_handle.cpp:
* src/tracks/instrument_track.cpp:
- additionally provide frequency without pitch-wheel
- added instrumentTrack::midiPitch()
* include/instrument.h:
* include/instrument_track.h:
* include/midi_controller.h:

View File

@@ -75,6 +75,7 @@ sf2Instrument::sf2Instrument( instrumentTrack * _instrument_track ) :
m_font( NULL ),
m_fontId( 0 ),
m_filename( "" ),
m_lastMidiPitch( 8192 ),
m_bankNum( -1, -1, 999, this, tr("Bank") ),
m_patchNum( -1, -1, 127, this, tr("Patch") ),
m_gain( 1.0f, 0.0f, 5.0f, 0.01f, this, tr( "Gain" ) ),
@@ -468,7 +469,8 @@ void sf2Instrument::playNote( notePlayHandle * _n, bool, sampleFrame * )
const f_cnt_t tfp = _n->totalFramesPlayed();
int midiNote = (int)floor( 12.0 * ( log2( _n->frequency() ) - LOG440 ) - 4.0 );
int midiNote = (int)floor( 12.0 * ( log2( _n->unpitchedFrequency() ) -
LOG440 ) - 4.0 );
// out of range?
if( midiNote <= 0 || midiNote >= 128 )
@@ -499,6 +501,11 @@ void sf2Instrument::play( bool _try_parallelizing,
const fpp_t frames = engine::getMixer()->framesPerPeriod();
m_synthMutex.lock();
if( m_lastMidiPitch != getInstrumentTrack()->midiPitch() )
{
m_lastMidiPitch = getInstrumentTrack()->midiPitch();
fluid_synth_pitch_bend( m_synth, 1, m_lastMidiPitch );
}
if( m_internalSampleRate < engine::getMixer()->processingSampleRate() &&
m_srcState != NULL )

View File

@@ -130,6 +130,7 @@ private:
int m_notesRunning[128];
sample_rate_t m_internalSampleRate;
int m_lastMidiPitch;
lcdSpinBoxModel m_bankNum;
lcdSpinBoxModel m_patchNum;