NotePlayHandle: cleanups, header dependency reductions etc.

* do not include instrument_track.h in note_play_handle.h by making
  two functions non-inline
* renamed notePlayHandleVector / constNotePlayHandleVector to
  NotePlayHandleList / ConstNotePlayHandleList and changed typedef
  to QList (which has faster insert- and remove-operations).
* removed unused method willFinishThisPeriod()

Signed-off-by: Tobias Doerffel <tobias.doerffel@gmail.com>
(cherry picked from commit 08ea133aa2)
This commit is contained in:
Tobias Doerffel
2009-06-15 14:36:56 +02:00
parent 33dd77f55c
commit cafb24fe9a
11 changed files with 45 additions and 83 deletions

View File

@@ -33,6 +33,7 @@
#include "controller_rack_view.h"
#include "fx_mixer.h"
#include "fx_mixer_view.h"
#include "instrument_track.h"
#include "ladspa_2_lmms.h"
#include "main_window.h"
#include "mixer.h"
@@ -41,6 +42,7 @@
#include "preset_preview_play_handle.h"
#include "project_journal.h"
#include "project_notes.h"
#include "plugin.h"
#include "song_editor.h"
#include "song.h"

View File

@@ -305,7 +305,7 @@ void arpeggiator::processNote( notePlayHandle * _n )
const int selected_arp = m_arpModel.value();
constNotePlayHandleVector cnphv = notePlayHandle::nphsOfInstrumentTrack(
ConstNotePlayHandleList cnphv = notePlayHandle::nphsOfInstrumentTrack(
_n->getInstrumentTrack() );
if( m_arpModeModel.value() != FreeMode && cnphv.size() == 0 )
{

View File

@@ -33,6 +33,7 @@
#include "embed.h"
#include "engine.h"
#include "envelope_and_lfo_parameters.h"
#include "instrument.h"
#include "instrument_track.h"
#include "note_play_handle.h"

View File

@@ -136,7 +136,7 @@ notePlayHandle::~notePlayHandle()
m_instrumentTrack->m_notes[key()] = NULL;
}
for( notePlayHandleVector::iterator it = m_subNotes.begin();
for( NotePlayHandleList::Iterator it = m_subNotes.begin();
it != m_subNotes.end(); ++it )
{
delete *it;
@@ -252,7 +252,7 @@ void notePlayHandle::play( sampleFrame * _working_buffer )
}
// play sub-notes (e.g. chords)
for( notePlayHandleVector::iterator it = m_subNotes.begin();
for( NotePlayHandleList::Iterator it = m_subNotes.begin();
it != m_subNotes.end(); )
{
( *it )->play( _working_buffer );
@@ -316,7 +316,7 @@ void notePlayHandle::noteOff( const f_cnt_t _s )
}
// first note-off all sub-notes
for( notePlayHandleVector::iterator it = m_subNotes.begin();
for( NotePlayHandleList::Iterator it = m_subNotes.begin();
it != m_subNotes.end(); ++it )
{
( *it )->noteOff( _s );
@@ -373,10 +373,19 @@ float notePlayHandle::volumeLevel( const f_cnt_t _frame )
bool notePlayHandle::isArpeggioBaseNote( void ) const
{
return isBaseNote() && ( m_partOfArpeggio ||
m_instrumentTrack->arpeggiatorEnabled() );
}
void notePlayHandle::mute( void )
{
// mute all sub-notes
for( notePlayHandleVector::iterator it = m_subNotes.begin();
for( NotePlayHandleList::Iterator it = m_subNotes.begin();
it != m_subNotes.end(); ++it )
{
( *it )->mute();
@@ -391,7 +400,7 @@ int notePlayHandle::index( void ) const
{
const playHandleVector & phv = engine::getMixer()->playHandles();
int idx = 0;
for( constPlayHandleVector::const_iterator it = phv.begin();
for( constPlayHandleVector::ConstIterator it = phv.begin();
it != phv.end(); ++it )
{
const notePlayHandle * nph =
@@ -414,13 +423,13 @@ int notePlayHandle::index( void ) const
constNotePlayHandleVector notePlayHandle::nphsOfInstrumentTrack(
ConstNotePlayHandleList notePlayHandle::nphsOfInstrumentTrack(
const instrumentTrack * _it, bool _all_ph )
{
const playHandleVector & phv = engine::getMixer()->playHandles();
constNotePlayHandleVector cnphv;
ConstNotePlayHandleList cnphv;
for( constPlayHandleVector::const_iterator it = phv.begin();
for( constPlayHandleVector::ConstIterator it = phv.begin();
it != phv.end(); ++it )
{
const notePlayHandle * nph =
@@ -466,7 +475,7 @@ void notePlayHandle::updateFrequency( void )
m_instrumentTrack->pitchModel()->value() / ( 100 * 12.0f ) );
m_unpitchedFrequency = BaseFreq * powf( 2.0f, pitch );
for( notePlayHandleVector::iterator it = m_subNotes.begin();
for( NotePlayHandleList::Iterator it = m_subNotes.begin();
it != m_subNotes.end(); ++it )
{
( *it )->updateFrequency();
@@ -500,7 +509,7 @@ void notePlayHandle::resize( const bpm_t _new_tempo )
m_frames = (f_cnt_t)new_frames;
m_totalFramesPlayed = (f_cnt_t)( completed * new_frames );
for( notePlayHandleVector::iterator it = m_subNotes.begin();
for( NotePlayHandleList::Iterator it = m_subNotes.begin();
it != m_subNotes.end(); ++it )
{
( *it )->resize( _new_tempo );

View File

@@ -4,7 +4,7 @@
* preset_preview_play_handle.cpp - implementation of class
* presetPreviewPlayHandle
*
* Copyright (c) 2005-2008 Tobias Doerffel <tobydox/at/users.sourceforge.net>
* Copyright (c) 2005-2009 Tobias Doerffel <tobydox/at/users.sourceforge.net>
*
* This file is part of Linux MultiMedia Studio - http://lmms.sourceforge.net
*
@@ -32,6 +32,7 @@
#include "preset_preview_play_handle.h"
#include "debug.h"
#include "engine.h"
#include "instrument.h"
#include "instrument_track.h"
#include "midi_port.h"
#include "mmp.h"
@@ -230,10 +231,10 @@ void presetPreviewPlayHandle::cleanup( void )
constNotePlayHandleVector presetPreviewPlayHandle::nphsOfInstrumentTrack(
ConstNotePlayHandleList presetPreviewPlayHandle::nphsOfInstrumentTrack(
const instrumentTrack * _it )
{
constNotePlayHandleVector cnphv;
ConstNotePlayHandleList cnphv;
s_previewTC->lockData();
if( s_previewTC->previewNote() != NULL &&
s_previewTC->previewNote()->getInstrumentTrack() == _it )

View File

@@ -522,7 +522,7 @@ void instrumentTrack::setName( const QString & _new_name )
void instrumentTrack::updateBaseNote( void )
{
engine::getMixer()->lock();
for( QList<notePlayHandle *>::iterator it = m_processHandles.begin();
for( NotePlayHandleList::Iterator it = m_processHandles.begin();
it != m_processHandles.end(); ++it )
{
( *it )->updateFrequency();
@@ -584,7 +584,7 @@ bool instrumentTrack::play( const midiTime & _start,
}
// Handle automation: detuning
for( QList<notePlayHandle *>::iterator it = m_processHandles.begin();
for( NotePlayHandleList::Iterator it = m_processHandles.begin();
it != m_processHandles.end(); ++it )
{
( *it )->processMidiTime( _start );