sf2 understands panning midi meta events now

git-svn-id: https://lmms.svn.sf.net/svnroot/lmms/trunk/lmms@1942 0778d3d1-df1d-0410-868b-ea421aaaa00d
This commit is contained in:
Andrew Kelley
2008-12-16 11:46:41 +00:00
parent 7fe4f1e60c
commit 87a9be583f
5 changed files with 29 additions and 0 deletions

View File

@@ -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 <drfaygo/at/gmail/dot/com>

View File

@@ -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

View File

@@ -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 )

View File

@@ -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 );

View File

@@ -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: