Use channel -1 for GUI-generated MIDI events, fixes #807

This commit is contained in:
Vesa
2014-06-29 10:19:28 +03:00
parent edc97edb9e
commit fe3c5a9aa4
3 changed files with 11 additions and 11 deletions

View File

@@ -101,7 +101,7 @@ void Piano::handleKeyPress( int key, int midiVelocity )
}
if( isValidKey( key ) )
{
m_midiEvProc->processInEvent( MidiEvent( MidiNoteOn, 0, key, midiVelocity ) );
m_midiEvProc->processInEvent( MidiEvent( MidiNoteOn, -1, key, midiVelocity ) );
m_pressedKeys[key] = true;
}
}
@@ -118,7 +118,7 @@ void Piano::handleKeyRelease( int key )
{
if( isValidKey( key ) )
{
m_midiEvProc->processInEvent( MidiEvent( MidiNoteOff, 0, key, 0 ) );
m_midiEvProc->processInEvent( MidiEvent( MidiNoteOff, -1, key, 0 ) );
m_pressedKeys[key] = false;
}
}

View File

@@ -1987,7 +1987,7 @@ void PianoRoll::testPlayNote( note * n )
m_pattern->instrumentTrack()->pianoModel()->handleKeyPress( n->key(), n->midiVelocity( baseVelocity ) );
MidiEvent event( MidiMetaEvent, 0, n->key(), panningToMidi( n->getPanning() ) );
MidiEvent event( MidiMetaEvent, -1, n->key(), panningToMidi( n->getPanning() ) );
event.setMetaEvent( MidiNotePanning );
@@ -2380,12 +2380,12 @@ void PianoRoll::mouseMoveEvent( QMouseEvent * _me )
const int baseVelocity = m_pattern->instrumentTrack()->midiPort()->baseVelocity();
m_pattern->instrumentTrack()->processInEvent( MidiEvent( MidiKeyPressure, 0, n->key(), n->midiVelocity( baseVelocity ) ) );
m_pattern->instrumentTrack()->processInEvent( MidiEvent( MidiKeyPressure, -1, n->key(), n->midiVelocity( baseVelocity ) ) );
}
else if( m_noteEditMode == NoteEditPanning )
{
n->setPanning( pan );
MidiEvent evt( MidiMetaEvent, 0, n->key(), panningToMidi( pan ) );
MidiEvent evt( MidiMetaEvent, -1, n->key(), panningToMidi( pan ) );
evt.setMetaEvent( MidiNotePanning );
m_pattern->instrumentTrack()->processInEvent( evt );
}

View File

@@ -472,7 +472,7 @@ void PianoView::mousePressEvent( QMouseEvent * _me )
velocity = m_piano->instrumentTrack()->midiPort()->baseVelocity();
}
// set note on
m_piano->midiEventProcessor()->processInEvent( MidiEvent( MidiNoteOn, 0, key_num, velocity ) );
m_piano->midiEventProcessor()->processInEvent( MidiEvent( MidiNoteOn, -1, key_num, velocity ) );
m_piano->setKeyState( key_num, true );
m_lastKey = key_num;
@@ -517,7 +517,7 @@ void PianoView::mouseReleaseEvent( QMouseEvent * )
{
if( m_piano != NULL )
{
m_piano->midiEventProcessor()->processInEvent( MidiEvent( MidiNoteOff, 0, m_lastKey, 0 ) );
m_piano->midiEventProcessor()->processInEvent( MidiEvent( MidiNoteOff, -1, m_lastKey, 0 ) );
m_piano->setKeyState( m_lastKey, false );
}
@@ -578,7 +578,7 @@ void PianoView::mouseMoveEvent( QMouseEvent * _me )
{
if( m_lastKey != -1 )
{
m_piano->midiEventProcessor()->processInEvent( MidiEvent( MidiNoteOff, 0, m_lastKey, 0 ) );
m_piano->midiEventProcessor()->processInEvent( MidiEvent( MidiNoteOff, -1, m_lastKey, 0 ) );
m_piano->setKeyState( m_lastKey, false );
m_lastKey = -1;
}
@@ -586,7 +586,7 @@ void PianoView::mouseMoveEvent( QMouseEvent * _me )
{
if( _me->pos().y() > PIANO_BASE )
{
m_piano->midiEventProcessor()->processInEvent( MidiEvent( MidiNoteOn, 0, key_num, velocity ) );
m_piano->midiEventProcessor()->processInEvent( MidiEvent( MidiNoteOn, -1, key_num, velocity ) );
m_piano->setKeyState( key_num, true );
m_lastKey = key_num;
}
@@ -600,7 +600,7 @@ void PianoView::mouseMoveEvent( QMouseEvent * _me )
}
else if( m_piano->isKeyPressed( key_num ) )
{
m_piano->midiEventProcessor()->processInEvent( MidiEvent( MidiKeyPressure, 0, key_num, velocity ) );
m_piano->midiEventProcessor()->processInEvent( MidiEvent( MidiKeyPressure, -1, key_num, velocity ) );
}
}
@@ -697,7 +697,7 @@ void PianoView::focusOutEvent( QFocusEvent * )
// hang otherwise
for( int i = 0; i < NumKeys; ++i )
{
m_piano->midiEventProcessor()->processInEvent( MidiEvent( MidiNoteOff, 0, i, 0 ) );
m_piano->midiEventProcessor()->processInEvent( MidiEvent( MidiNoteOff, -1, i, 0 ) );
m_piano->setKeyState( i, false );
}
update();