From 049951438a6104400f5328ebd3f64b9f3e8e322b Mon Sep 17 00:00:00 2001 From: Tobias Doerffel Date: Sun, 26 Jan 2014 01:15:43 +0100 Subject: [PATCH] Do not pass default time to processInEvent() We introduced default parameters for MidiTime parameters so there's no need to construct them manually. --- src/core/midi/MidiWinMM.cpp | 17 +++++------------ src/gui/PianoView.cpp | 12 ++++++------ src/gui/piano_roll.cpp | 5 ++--- src/tracks/InstrumentTrack.cpp | 13 ++++--------- 4 files changed, 17 insertions(+), 30 deletions(-) diff --git a/src/core/midi/MidiWinMM.cpp b/src/core/midi/MidiWinMM.cpp index 7920bc3e3..3c0eba0c4 100644 --- a/src/core/midi/MidiWinMM.cpp +++ b/src/core/midi/MidiWinMM.cpp @@ -1,7 +1,7 @@ /* * MidiWinMM.cpp - WinMM MIDI client * - * Copyright (c) 2008-2009 Tobias Doerffel + * Copyright (c) 2008-2014 Tobias Doerffel * * This file is part of Linux MultiMedia Studio - http://lmms.sourceforge.net * @@ -231,28 +231,21 @@ void MidiWinMM::handleInputEvent( HMIDIIN _hm, DWORD _ev ) case MidiNoteOn: case MidiNoteOff: case MidiKeyPressure: - ( *it )->processInEvent( - MidiEvent( cmdtype, chan, par1 - KeysPerOctave, - par2 & 0xff, &_hm ), MidiTime() ); + ( *it )->processInEvent( MidiEvent( cmdtype, chan, par1 - KeysPerOctave, par2 & 0xff, &_hm ) ); break; case MidiControlChange: case MidiProgramChange: case MidiChannelPressure: - ( *it )->processInEvent( - MidiEvent( cmdtype, chan, par1, par2 & 0xff, &_hm ), - MidiTime() ); + ( *it )->processInEvent( MidiEvent( cmdtype, chan, par1, par2 & 0xff, &_hm ) ); break; case MidiPitchBend: - ( *it )->processInEvent( - MidiEvent( cmdtype, chan, par1 + par2*128, 0, &_hm ), - MidiTime() ); + ( *it )->processInEvent( MidiEvent( cmdtype, chan, par1 + par2*128, 0, &_hm ) ); break; default: - qWarning( "WinMM-MIDI: unhandled input " - "event %d\n", cmdtype ); + qWarning( "WinMM-MIDI: unhandled input event %d\n", cmdtype ); break; } } diff --git a/src/gui/PianoView.cpp b/src/gui/PianoView.cpp index 771793247..021964b50 100644 --- a/src/gui/PianoView.cpp +++ b/src/gui/PianoView.cpp @@ -465,7 +465,7 @@ void PianoView::mousePressEvent( QMouseEvent * _me ) velocity = MidiMaxVelocity; } // set note on - m_piano->midiEventProcessor()->processInEvent( MidiEvent( MidiNoteOn, 0, key_num, velocity ), MidiTime() ); + m_piano->midiEventProcessor()->processInEvent( MidiEvent( MidiNoteOn, 0, key_num, velocity ) ); m_piano->setKeyState( key_num, true ); m_lastKey = key_num; @@ -510,7 +510,7 @@ void PianoView::mouseReleaseEvent( QMouseEvent * ) { if( m_piano != NULL ) { - m_piano->midiEventProcessor()->processInEvent( MidiEvent( MidiNoteOff, 0, m_lastKey, 0 ), MidiTime() ); + m_piano->midiEventProcessor()->processInEvent( MidiEvent( MidiNoteOff, 0, m_lastKey, 0 ) ); m_piano->setKeyState( m_lastKey, false ); } @@ -571,7 +571,7 @@ void PianoView::mouseMoveEvent( QMouseEvent * _me ) { if( m_lastKey != -1 ) { - m_piano->midiEventProcessor()->processInEvent( MidiEvent( MidiNoteOff, 0, m_lastKey, 0 ), MidiTime() ); + m_piano->midiEventProcessor()->processInEvent( MidiEvent( MidiNoteOff, 0, m_lastKey, 0 ) ); m_piano->setKeyState( m_lastKey, false ); m_lastKey = -1; } @@ -579,7 +579,7 @@ void PianoView::mouseMoveEvent( QMouseEvent * _me ) { if( _me->pos().y() > PIANO_BASE ) { - m_piano->midiEventProcessor()->processInEvent( MidiEvent( MidiNoteOn, 0, key_num, velocity ), MidiTime() ); + m_piano->midiEventProcessor()->processInEvent( MidiEvent( MidiNoteOn, 0, key_num, velocity ) ); m_piano->setKeyState( key_num, true ); m_lastKey = key_num; } @@ -593,7 +593,7 @@ void PianoView::mouseMoveEvent( QMouseEvent * _me ) } else if( m_piano->isKeyPressed( key_num ) ) { - m_piano->midiEventProcessor()->processInEvent( MidiEvent( MidiKeyPressure, 0, key_num, velocity ), MidiTime() ); + m_piano->midiEventProcessor()->processInEvent( MidiEvent( MidiKeyPressure, 0, key_num, velocity ) ); } } @@ -690,7 +690,7 @@ void PianoView::focusOutEvent( QFocusEvent * ) // hang otherwise for( int i = 0; i < NumKeys; ++i ) { - m_piano->midiEventProcessor()->processInEvent( MidiEvent( MidiNoteOff, 0, i, 0 ), MidiTime() ); + m_piano->midiEventProcessor()->processInEvent( MidiEvent( MidiNoteOff, 0, i, 0 ) ); m_piano->setKeyState( i, false ); } update(); diff --git a/src/gui/piano_roll.cpp b/src/gui/piano_roll.cpp index bf27071fc..6eace8b46 100644 --- a/src/gui/piano_roll.cpp +++ b/src/gui/piano_roll.cpp @@ -2229,15 +2229,14 @@ void pianoRoll::mouseMoveEvent( QMouseEvent * _me ) if( m_noteEditMode == NoteEditVolume ) { n->setVolume( vol ); - m_pattern->instrumentTrack()->processInEvent( - MidiEvent( MidiKeyPressure, 0, n->key(), volumeToMidi( vol ) ), MidiTime() ); + m_pattern->instrumentTrack()->processInEvent( MidiEvent( MidiKeyPressure, 0, n->key(), volumeToMidi( vol ) ) ); } else if( m_noteEditMode == NoteEditPanning ) { n->setPanning( pan ); MidiEvent evt( MidiMetaEvent, 0, n->key(), panningToMidi( pan ) ); evt.setMetaEvent( MidiNotePanning ); - m_pattern->instrumentTrack()->processInEvent( evt, MidiTime() ); + m_pattern->instrumentTrack()->processInEvent( evt ); } } else diff --git a/src/tracks/InstrumentTrack.cpp b/src/tracks/InstrumentTrack.cpp index eef1367c2..aee0c8710 100644 --- a/src/tracks/InstrumentTrack.cpp +++ b/src/tracks/InstrumentTrack.cpp @@ -1127,9 +1127,7 @@ void InstrumentTrackView::toggleInstrumentWindow( bool _on ) void InstrumentTrackView::activityIndicatorPressed() { - model()->processInEvent( - MidiEvent( MidiNoteOn, 0, DefaultKey, MidiMaxVelocity ), - MidiTime() ); + model()->processInEvent( MidiEvent( MidiNoteOn, 0, DefaultKey, MidiMaxVelocity ) ); } @@ -1137,8 +1135,7 @@ void InstrumentTrackView::activityIndicatorPressed() void InstrumentTrackView::activityIndicatorReleased() { - model()->processInEvent( MidiEvent( MidiNoteOff, 0, DefaultKey, 0 ), - MidiTime() ); + model()->processInEvent( MidiEvent( MidiNoteOff, 0, DefaultKey, 0 ) ); } @@ -1149,8 +1146,7 @@ void InstrumentTrackView::midiInSelected() { if( model() ) { - model()->m_midiPort.setReadable( - m_midiInputAction->isChecked() ); + model()->m_midiPort.setReadable( m_midiInputAction->isChecked() ); } } @@ -1161,8 +1157,7 @@ void InstrumentTrackView::midiOutSelected() { if( model() ) { - model()->m_midiPort.setWritable( - m_midiOutputAction->isChecked() ); + model()->m_midiPort.setWritable( m_midiOutputAction->isChecked() ); } }