Merge pull request #909 from diizy/stable-1.1

Some fixes: StereoEnhancer, Midievents
This commit is contained in:
Vesa V
2014-06-29 10:42:44 +03:00
5 changed files with 20 additions and 21 deletions

View File

@@ -23,11 +23,10 @@
*/
#ifndef _DSP_EFFECT_LIBRARY_H
#define _DSP_EFFECT_LIBRARY_H
#include <math.h>
#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<sample_t>(*/ ( _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:

View File

@@ -28,6 +28,7 @@
#include <stdint.h>
#include "lmms_constants.h"
#include <QtCore/QtGlobal>
#include <math.h>

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();