From 07e346f4cfa4ae3db6266bb73e06ae833bd1eae3 Mon Sep 17 00:00:00 2001 From: Paul Giblock Date: Mon, 14 Apr 2008 05:16:41 +0000 Subject: [PATCH] SF2-player HQ support git-svn-id: https://lmms.svn.sf.net/svnroot/lmms/trunk/lmms@917 0778d3d1-df1d-0410-868b-ea421aaaa00d --- plugins/sf2_player/sf2_player.cpp | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-) diff --git a/plugins/sf2_player/sf2_player.cpp b/plugins/sf2_player/sf2_player.cpp index 62610f444..113ed558c 100644 --- a/plugins/sf2_player/sf2_player.cpp +++ b/plugins/sf2_player/sf2_player.cpp @@ -219,13 +219,13 @@ void sf2Instrument::updatePatch( void ) void sf2Instrument::updateSampleRate( void ) { double tempRate; + + // Set & get, returns the true sample rate + fluid_settings_setnum( m_settings, "synth.sample-rate", engine::getMixer()->sampleRate() ); + fluid_settings_getnum( m_settings, "synth.sample-rate", &tempRate ); + m_internalSampleRate = static_cast( tempRate ); if( m_filename != "" ) { - // Set & get, returns the true sample rate - fluid_settings_setnum( m_settings, "synth.sample-rate", engine::getMixer()->sampleRate() ); - fluid_settings_getnum( m_settings, "synth.sample-rate", &tempRate ); - m_internalSampleRate = static_cast( tempRate ); - // New synth fluid_synth_t * synth = new_fluid_synth( m_settings ); @@ -246,17 +246,18 @@ void sf2Instrument::updateSampleRate( void ) void sf2Instrument::playNote( notePlayHandle * _n, bool, sampleFrame * ) { - const float LOG440 = 2.64345267649f; + const double LOG440 = 2.643452676486187f; const f_cnt_t tfp = _n->totalFramesPlayed(); - int midiNote = (int)floor( 12 * ( log2( _n->frequency() ) - LOG440 ) - 4 ); + int midiNote = (int)floor( 12.0 * ( log2( _n->frequency() ) - LOG440 ) - 4.0 ); // out of range? if( midiNote <= 0 || midiNote >= 128 ) { return; } + printf("Note: %d\n", midiNote); if ( tfp == 0 ) {