improved MIDI-support
git-svn-id: https://lmms.svn.sf.net/svnroot/lmms/trunk/lmms@429 0778d3d1-df1d-0410-868b-ea421aaaa00d
This commit is contained in:
17
ChangeLog
17
ChangeLog
@@ -1,3 +1,20 @@
|
||||
2006-11-19 Tobias Doerffel <tobydox/at/users/dot/sourceforge/dot/net>
|
||||
|
||||
* plugins/vst_base/lvsl_server.c:
|
||||
proper handling of pitch-bend-events
|
||||
|
||||
* plugins/vestige/vestige.h:
|
||||
* plugins/vestige/vestige.cpp:
|
||||
handle MIDI-events by forwarding them to VST-plugin
|
||||
|
||||
* include/instrument.h:
|
||||
* src/tracks/instrument_track.cpp:
|
||||
if supported by according instrument, it now can handle all incoming
|
||||
MIDI-events (except Noteon and Noteoff)
|
||||
|
||||
* src/midi/midi_alsa_seq.cpp:
|
||||
more complete implementation of MIDI-event-handling
|
||||
|
||||
2006-11-15 Javier Serrano Polo <jasp00/at/terra/dot/es>
|
||||
|
||||
* include/audio_alsa.h:
|
||||
|
||||
1
TODO
1
TODO
@@ -1,3 +1,4 @@
|
||||
- MIDI over Ethernet-support
|
||||
- lock m_instrument in instrumentTrack-class for not crashing when using m_instrument in notePlayHandle::supportsParallelizing() while instrument is being deleted or so
|
||||
- try to make vestige-plugin-dlls relative
|
||||
- do song-editor-tempo-connection to vst-plugin inside remoteVSTPlugin
|
||||
|
||||
@@ -2,8 +2,8 @@
|
||||
# Process this file with autoconf to produce a configure script.
|
||||
|
||||
AC_PREREQ(2.50)
|
||||
AC_INIT(lmms, 0.2.1-svn20061115, lmms-devel/at/lists/dot/sf/dot/net)
|
||||
AM_INIT_AUTOMAKE(lmms, 0.2.1-svn20061115)
|
||||
AC_INIT(lmms, 0.2.1-svn20061119, lmms-devel/at/lists/dot/sf/dot/net)
|
||||
AM_INIT_AUTOMAKE(lmms, 0.2.1-svn20061119)
|
||||
|
||||
AM_CONFIG_HEADER(config.h)
|
||||
|
||||
|
||||
@@ -55,6 +55,7 @@
|
||||
// forward-declarations
|
||||
class instrumentTrack;
|
||||
class notePlayHandle;
|
||||
class midiEvent;
|
||||
|
||||
|
||||
class instrument : public QWidget, public plugin
|
||||
@@ -98,6 +99,14 @@ public:
|
||||
return( TRUE );
|
||||
}
|
||||
|
||||
// sub-classes can re-implement this for receiving all incoming
|
||||
// MIDI-events except NoteOn and NoteOff
|
||||
inline virtual bool handleMidiEvent( const midiEvent & _me,
|
||||
const midiTime & _time )
|
||||
{
|
||||
return( FALSE );
|
||||
}
|
||||
|
||||
// instantiate instrument-plugin with given name or return NULL
|
||||
// on failure
|
||||
static instrument * FASTCALL instantiate( const QString & _plugin_name,
|
||||
|
||||
@@ -364,6 +364,21 @@ void vestigeInstrument::deleteNotePluginData( notePlayHandle * _n )
|
||||
|
||||
|
||||
|
||||
bool vestigeInstrument::handleMidiEvent( const midiEvent & _me,
|
||||
const midiTime & _time )
|
||||
{
|
||||
m_pluginMutex.lock();
|
||||
if( m_plugin != NULL )
|
||||
{
|
||||
m_plugin->enqueueMidiEvent( _me, _time );
|
||||
}
|
||||
m_pluginMutex.unlock();
|
||||
return( TRUE );
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
void vestigeInstrument::openPlugin( void )
|
||||
{
|
||||
#ifdef QT4
|
||||
|
||||
@@ -84,6 +84,9 @@ public:
|
||||
return( FALSE );
|
||||
}
|
||||
|
||||
virtual bool handleMidiEvent( const midiEvent & _me,
|
||||
const midiTime & _time );
|
||||
|
||||
|
||||
protected slots:
|
||||
void openPlugin( void );
|
||||
|
||||
@@ -512,8 +512,18 @@ void VSTPlugin::enqueueMidiEvent( const midiEvent & _event,
|
||||
event.reserved1 = 0;
|
||||
event.reserved2 = 0;
|
||||
event.midiData[0] = _event.m_type + _event.m_channel;
|
||||
event.midiData[1] = _event.key();
|
||||
event.midiData[2] = _event.velocity();
|
||||
switch( _event.m_type )
|
||||
{
|
||||
case PITCH_BEND:
|
||||
event.midiData[1] = _event.m_data.m_param[0] & 0x7f;
|
||||
event.midiData[2] = _event.m_data.m_param[0] >> 7;
|
||||
break;
|
||||
// TODO: handle more special cases
|
||||
default:
|
||||
event.midiData[1] = _event.key();
|
||||
event.midiData[2] = _event.velocity();
|
||||
break;
|
||||
}
|
||||
event.midiData[3] = 0;
|
||||
m_midiEvents.push_back( event );
|
||||
}
|
||||
|
||||
@@ -192,10 +192,11 @@ void midiALSASeq::processOutEvent( const midiEvent & _me,
|
||||
_me.velocity() );
|
||||
break;
|
||||
|
||||
case PITCH_BEND:
|
||||
snd_seq_ev_set_pitchbend( &ev,
|
||||
case CONTROL_CHANGE:
|
||||
snd_seq_ev_set_controller( &ev,
|
||||
_port->outputChannel(),
|
||||
_me.m_data.m_param[0] - 8192 );
|
||||
_me.m_data.m_param[0],
|
||||
_me.m_data.m_param[1] );
|
||||
break;
|
||||
|
||||
case PROGRAM_CHANGE:
|
||||
@@ -210,6 +211,12 @@ void midiALSASeq::processOutEvent( const midiEvent & _me,
|
||||
_me.m_data.m_param[0] );
|
||||
break;
|
||||
|
||||
case PITCH_BEND:
|
||||
snd_seq_ev_set_pitchbend( &ev,
|
||||
_port->outputChannel(),
|
||||
_me.m_data.m_param[0] - 8192 );
|
||||
break;
|
||||
|
||||
default:
|
||||
printf( "ALSA-sequencer: unhandled output event %d\n",
|
||||
(int) _me.m_type );
|
||||
@@ -519,6 +526,38 @@ void midiALSASeq::run( void )
|
||||
), midiTime() );
|
||||
break;
|
||||
|
||||
case SND_SEQ_EVENT_CONTROLLER:
|
||||
dest->processInEvent( midiEvent( CONTROL_CHANGE,
|
||||
ev->data.control.channel,
|
||||
ev->data.control.param,
|
||||
ev->data.control.value ),
|
||||
midiTime() );
|
||||
break;
|
||||
|
||||
case SND_SEQ_EVENT_PGMCHANGE:
|
||||
dest->processInEvent( midiEvent( PROGRAM_CHANGE,
|
||||
ev->data.control.channel,
|
||||
ev->data.control.param,
|
||||
ev->data.control.value ),
|
||||
midiTime() );
|
||||
break;
|
||||
|
||||
case SND_SEQ_EVENT_CHANPRESS:
|
||||
dest->processInEvent( midiEvent(
|
||||
CHANNEL_PRESSURE,
|
||||
ev->data.control.channel,
|
||||
ev->data.control.param,
|
||||
ev->data.control.value ),
|
||||
midiTime() );
|
||||
break;
|
||||
|
||||
case SND_SEQ_EVENT_PITCHBEND:
|
||||
dest->processInEvent( midiEvent( PITCH_BEND,
|
||||
ev->data.control.channel,
|
||||
ev->data.control.value + 8192,
|
||||
0 ), midiTime() );
|
||||
break;
|
||||
|
||||
case SND_SEQ_EVENT_SENSING:
|
||||
case SND_SEQ_EVENT_CLOCK:
|
||||
break;
|
||||
|
||||
@@ -683,13 +683,18 @@ void instrumentTrack::processInEvent( const midiEvent & _me,
|
||||
break;
|
||||
|
||||
case KEY_PRESSURE:
|
||||
if( m_notes[_me.key()] != NULL )
|
||||
if( !m_instrument->handleMidiEvent( _me, _time ) &&
|
||||
m_notes[_me.key()] != NULL )
|
||||
{
|
||||
m_notes[_me.key()]->setVolume( _me.velocity() *
|
||||
100 / 128 );
|
||||
}
|
||||
break;
|
||||
|
||||
case PITCH_BEND:
|
||||
m_instrument->handleMidiEvent( _me, _time );
|
||||
break;
|
||||
|
||||
/* case PITCH_BEND:
|
||||
if( m_pitchBendKnob != NULL )
|
||||
{
|
||||
@@ -704,7 +709,7 @@ void instrumentTrack::processInEvent( const midiEvent & _me,
|
||||
break;*/
|
||||
|
||||
default:
|
||||
printf( "channel-track: unhandled MIDI-event %d\n",
|
||||
printf( "instrument-track: unhandled MIDI-event %d\n",
|
||||
_me.m_type );
|
||||
break;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user