fixed MIDI output channel issues (closes #2098722)
git-svn-id: https://lmms.svn.sf.net/svnroot/lmms/trunk/lmms@1579 0778d3d1-df1d-0410-868b-ea421aaaa00d
This commit is contained in:
@@ -1,5 +1,11 @@
|
||||
2008-09-07 Tobias Doerffel <tobydox/at/users/dot/sourceforge/dot/net>
|
||||
|
||||
* include/midi.h:
|
||||
* src/core/midi/midi_client.cpp:
|
||||
* src/core/midi/midi_port.cpp:
|
||||
* src/core/midi/midi_alsa_seq.cpp:
|
||||
fixed MIDI output channel issues (closes #2098722)
|
||||
|
||||
* include/graph.h:
|
||||
* src/gui/widgets/graph.cpp:
|
||||
integrated patch by Attila Herman which adds support for colorized
|
||||
|
||||
@@ -114,6 +114,11 @@ struct midiEvent
|
||||
{
|
||||
}
|
||||
|
||||
inline int channel( void ) const
|
||||
{
|
||||
return m_channel;
|
||||
}
|
||||
|
||||
inline Uint16 key( void ) const
|
||||
{
|
||||
return( m_data.m_param[0] );
|
||||
|
||||
@@ -150,47 +150,47 @@ void midiALSASeq::processOutEvent( const midiEvent & _me,
|
||||
{
|
||||
case MidiNoteOn:
|
||||
snd_seq_ev_set_noteon( &ev,
|
||||
_port->outputChannel(),
|
||||
_me.channel(),
|
||||
_me.key() + KeysPerOctave,
|
||||
_me.velocity() );
|
||||
break;
|
||||
|
||||
case MidiNoteOff:
|
||||
snd_seq_ev_set_noteoff( &ev,
|
||||
_port->outputChannel(),
|
||||
_me.channel(),
|
||||
_me.key() + KeysPerOctave,
|
||||
_me.velocity() );
|
||||
break;
|
||||
|
||||
case MidiKeyPressure:
|
||||
snd_seq_ev_set_keypress( &ev,
|
||||
_port->outputChannel(),
|
||||
_me.channel(),
|
||||
_me.key() + KeysPerOctave,
|
||||
_me.velocity() );
|
||||
break;
|
||||
|
||||
case MidiControlChange:
|
||||
snd_seq_ev_set_controller( &ev,
|
||||
_port->outputChannel(),
|
||||
_me.channel(),
|
||||
_me.m_data.m_param[0],
|
||||
_me.m_data.m_param[1] );
|
||||
break;
|
||||
|
||||
case MidiProgramChange:
|
||||
snd_seq_ev_set_pgmchange( &ev,
|
||||
_port->outputChannel(),
|
||||
_me.channel(),
|
||||
_me.m_data.m_param[0] );
|
||||
break;
|
||||
|
||||
case MidiChannelPressure:
|
||||
snd_seq_ev_set_chanpress( &ev,
|
||||
_port->outputChannel(),
|
||||
_me.channel(),
|
||||
_me.m_data.m_param[0] );
|
||||
break;
|
||||
|
||||
case MidiPitchBend:
|
||||
snd_seq_ev_set_pitchbend( &ev,
|
||||
_port->outputChannel(),
|
||||
_me.channel(),
|
||||
_me.m_data.m_param[0] - 8192 );
|
||||
break;
|
||||
|
||||
|
||||
@@ -278,26 +278,10 @@ void midiClientRaw::processOutEvent( const midiEvent & _me,
|
||||
case MidiNoteOn:
|
||||
case MidiNoteOff:
|
||||
case MidiKeyPressure:
|
||||
if( _port->outputChannel() >= 0 )
|
||||
{
|
||||
sendByte( _me.m_type | _port->outputChannel() );
|
||||
sendByte( _me.m_data.m_param[0] +
|
||||
KeysPerOctave );
|
||||
sendByte( tLimit( (int) _me.m_data.m_param[1],
|
||||
sendByte( _me.m_type | _me.channel() );
|
||||
sendByte( _me.m_data.m_param[0] + KeysPerOctave );
|
||||
sendByte( tLimit( (int) _me.m_data.m_param[1],
|
||||
0, 127 ) );
|
||||
}
|
||||
else
|
||||
{
|
||||
for( Sint8 i = 0; i < MidiChannelCount; ++i )
|
||||
{
|
||||
sendByte( _me.m_type | i );
|
||||
sendByte( _me.m_data.m_param[0] +
|
||||
KeysPerOctave );
|
||||
sendByte( tLimit( (int)
|
||||
_me.m_data.m_param[1],
|
||||
0, 127 ) );
|
||||
}
|
||||
}
|
||||
break;
|
||||
|
||||
default:
|
||||
|
||||
@@ -137,10 +137,10 @@ void midiPort::processInEvent( const midiEvent & _me, const midiTime & _time )
|
||||
}
|
||||
}
|
||||
midiEvent ev = _me;
|
||||
if( m_defaultVelocityInEnabledModel.value() == TRUE &&
|
||||
if( m_defaultVelocityInEnabledModel.value() == true &&
|
||||
_me.velocity() > 0 )
|
||||
{
|
||||
ev.velocity() = DefaultVolume;
|
||||
ev.velocity() = MidiMaxVelocity;
|
||||
}
|
||||
m_midiEventProcessor->processInEvent( ev, _time );
|
||||
}
|
||||
@@ -156,10 +156,16 @@ void midiPort::processOutEvent( const midiEvent & _me, const midiTime & _time )
|
||||
( outputChannel() == _me.m_channel && outputChannel() != 0 ) )
|
||||
{
|
||||
midiEvent ev = _me;
|
||||
// we use/display MIDI channels 1...16 but we need 0...15 for
|
||||
// the outside world
|
||||
if( ev.m_channel > 0 )
|
||||
{
|
||||
--ev.m_channel;
|
||||
}
|
||||
if( m_defaultVelocityOutEnabledModel.value() == true &&
|
||||
_me.velocity() > 0 )
|
||||
{
|
||||
ev.velocity() = DefaultVolume;
|
||||
ev.velocity() = MidiMaxVelocity;
|
||||
}
|
||||
m_midiClient->processOutEvent( ev, _time, this );
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user