diff --git a/ChangeLog b/ChangeLog index 0eabb8ca6..3b1d21c44 100644 --- a/ChangeLog +++ b/ChangeLog @@ -18,6 +18,16 @@ changed modifier detection from mainWindow::isCtrlPressed etc to Qt framework detection. Fixes a bunch of little glitches and enables horizontal scroll wheels. + + * plugins/sf2_player/sf2_player.cpp: + * plugins/sf2_player/sf2_player.h: + * include/note_play_handle.h: + * src/core/note_play_handle.cpp: + * include/instrument.h: + * src/tracks/instrument_track.cpp: + experimental support for note panning in SF2 player (I'm not sure + what m_maxChannels should be or how to find it out. I just picked + what worked for my setup.) 2008-12-15 Paul Giblock diff --git a/include/instrument.h b/include/instrument.h index ea73289f0..df3032402 100644 --- a/include/instrument.h +++ b/include/instrument.h @@ -63,6 +63,11 @@ public: sampleFrame * /* _working_buf */ ) { } + + // event called when a note's panning changes + virtual void updatePanning( notePlayHandle * ) + { + } // needed for deleting plugin-specific-data of a note - plugin has to // cast void-ptr so that the plugin-data is deleted properly diff --git a/plugins/sf2_player/sf2_player.cpp b/plugins/sf2_player/sf2_player.cpp index 2a34c2ce6..a2f195d7c 100644 --- a/plugins/sf2_player/sf2_player.cpp +++ b/plugins/sf2_player/sf2_player.cpp @@ -600,6 +600,17 @@ void sf2Instrument::playNote( notePlayHandle * _n, sampleFrame * ) } +void sf2Instrument::updatePanning( notePlayHandle * _n ) +{ + short ctrl = 0x0A; // PAN_MSB + int pan = 0 + + ( (float)( _n->getPanning() - PanningLeft ) ) / + ( (float)( PanningRight - PanningLeft ) ) * + ( (float)( 127 - 0 ) ); + fluid_synth_cc( m_synth, _n->channel(), ctrl, pan ); +} + + // Could we get iph-based instruments support sample-exact models by using a // frame-length of 1 while rendering? void sf2Instrument::play( sampleFrame * _working_buffer ) diff --git a/plugins/sf2_player/sf2_player.h b/plugins/sf2_player/sf2_player.h index 1a277e377..1d0670d3c 100644 --- a/plugins/sf2_player/sf2_player.h +++ b/plugins/sf2_player/sf2_player.h @@ -59,6 +59,8 @@ public: virtual void playNote( notePlayHandle * _n, sampleFrame * _working_buffer ); virtual void deleteNotePluginData( notePlayHandle * _n ); + + virtual void updatePanning( notePlayHandle * ); virtual void saveSettings( QDomDocument & _doc, QDomElement & _parent ); diff --git a/src/tracks/instrument_track.cpp b/src/tracks/instrument_track.cpp index b3fcd6230..e16259481 100644 --- a/src/tracks/instrument_track.cpp +++ b/src/tracks/instrument_track.cpp @@ -307,6 +307,7 @@ void instrumentTrack::processInEvent( const midiEvent & _me, if( m_notes[_me.key()] != NULL ) { m_notes[_me.key()]->setPanning( _me.getPanning() ); + m_instrument->updatePanning( m_notes[_me.key()] ); } break; default: