diff --git a/include/DspEffectLibrary.h b/include/DspEffectLibrary.h index 5231184a1..6f5cd0cae 100644 --- a/include/DspEffectLibrary.h +++ b/include/DspEffectLibrary.h @@ -23,11 +23,10 @@ */ -#ifndef _DSP_EFFECT_LIBRARY_H -#define _DSP_EFFECT_LIBRARY_H - -#include +#ifndef DSP_EFFECT_LIBRARY_H +#define DSP_EFFECT_LIBRARY_H +#include "lmms_math.h" #include "templates.h" #include "lmms_constants.h" #include "lmms_basics.h" @@ -213,8 +212,7 @@ namespace DspEffectLibrary { // TODO: somehow remove these horrible aliases... m_cap = ( _in + m_cap*m_frequency ) * m_gain1; - return( /*saturate(*/ ( _in + m_cap*m_ratio ) * - m_gain2/* )*/ ); + return( ( _in + m_cap*m_ratio ) * m_gain2 ); } void setFrequency( const sample_t _frequency ) @@ -335,10 +333,10 @@ namespace DspEffectLibrary void nextSample( sample_t& inLeft, sample_t& inRight ) { - const float toRad = 3.141592 / 180; - - inLeft += inRight * sinf( m_wideCoeff * .5 * toRad); - inRight -= inLeft * sinf( m_wideCoeff * .5 * toRad); + const float toRad = F_PI / 180; + const sample_t tmp = inLeft; + inLeft += inRight * sinf( m_wideCoeff * ( .5 * toRad ) ); + inRight -= tmp * sinf( m_wideCoeff * ( .5 * toRad ) ); } private: diff --git a/include/lmms_math.h b/include/lmms_math.h index 6f361c971..7c965eb77 100644 --- a/include/lmms_math.h +++ b/include/lmms_math.h @@ -28,6 +28,7 @@ #include #include "lmms_constants.h" +#include #include diff --git a/src/core/Piano.cpp b/src/core/Piano.cpp index 93fa34869..ddf69c6e3 100644 --- a/src/core/Piano.cpp +++ b/src/core/Piano.cpp @@ -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; } } diff --git a/src/gui/PianoRoll.cpp b/src/gui/PianoRoll.cpp index 59a1cd488..66a6f6971 100644 --- a/src/gui/PianoRoll.cpp +++ b/src/gui/PianoRoll.cpp @@ -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 ); } diff --git a/src/gui/PianoView.cpp b/src/gui/PianoView.cpp index af4b07339..d0e38fd1c 100644 --- a/src/gui/PianoView.cpp +++ b/src/gui/PianoView.cpp @@ -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();