More fixes

This commit is contained in:
Vesa
2014-08-23 16:04:50 +03:00
parent 9972cb3d4d
commit 5e4308507b
10 changed files with 71 additions and 27 deletions

View File

@@ -26,6 +26,7 @@
#include "MemoryManager.h"
#include <QtGlobal>
#include <stdint.h>
MemoryPoolVector MemoryManager::s_memoryPools;

View File

@@ -76,7 +76,8 @@ NotePlayHandle::NotePlayHandle( InstrumentTrack* instrumentTrack,
m_baseDetuning( NULL ),
m_songGlobalParentOffset( 0 ),
m_midiChannel( midiEventChannel >= 0 ? midiEventChannel : instrumentTrack->midiPort()->realOutputChannel() ),
m_origin( origin )
m_origin( origin ),
m_frequencyNeedsUpdate( false )
{
lock();
if( hasParent() == false )
@@ -97,6 +98,24 @@ NotePlayHandle::NotePlayHandle( InstrumentTrack* instrumentTrack,
updateFrequency();
setFrames( _frames );
// inform attached components about new MIDI note (used for recording in Piano Roll)
if( m_origin == OriginMidiInput )
{
m_instrumentTrack->midiNoteOn( *this );
}
if( hasParent() || ! m_instrumentTrack->isArpeggioEnabled() )
{
const int baseVelocity = m_instrumentTrack->midiPort()->baseVelocity();
// send MidiNoteOn event
m_instrumentTrack->processOutEvent(
MidiEvent( MidiNoteOn, midiChannel(), midiKey(), midiVelocity( baseVelocity ) ),
MidiTime::fromFrames( offset(), engine::framesPerTick() ),
offset() );
}
unlock();
}
@@ -189,25 +208,9 @@ void NotePlayHandle::play( sampleFrame * _working_buffer )
}
lock();
if( m_totalFramesPlayed == 0 )
if( m_frequencyNeedsUpdate )
{
// inform attached components about new MIDI note (used for recording in Piano Roll)
if( m_origin == OriginMidiInput )
{
m_instrumentTrack->midiNoteOn( *this );
}
if( hasParent() || ! m_instrumentTrack->isArpeggioEnabled() )
{
const int baseVelocity = m_instrumentTrack->midiPort()->baseVelocity();
// send MidiNoteOn event
m_instrumentTrack->processOutEvent(
MidiEvent( MidiNoteOn, midiChannel(), midiKey(), midiVelocity( baseVelocity ) ),
MidiTime::fromFrames( offset(), engine::framesPerTick() ),
offset() );
}
updateFrequency();
}
// number of frames that can be played this period

View File

@@ -148,7 +148,7 @@ InstrumentTrack::~InstrumentTrack()
silenceAllNotes( true );
// now we're save deleting the instrument
delete m_instrument;
if( m_instrument ) delete m_instrument;
}
@@ -538,9 +538,7 @@ void InstrumentTrack::updateBaseNote()
for( NotePlayHandleList::Iterator it = m_processHandles.begin();
it != m_processHandles.end(); ++it )
{
( *it )->lock();
( *it )->updateFrequency();
( *it )->unlock();
( *it )->setFrequencyUpdate();
}
}