diff --git a/include/engine.h b/include/engine.h index 995797a0d..3603c0f12 100644 --- a/include/engine.h +++ b/include/engine.h @@ -105,9 +105,16 @@ public: void close( void ); + float framesPerTact( void ) const + { + return( m_frames_per_tact ); + } + void updateFramesPerTact( void ); + private: bool m_hasGUI; + float m_frames_per_tact; mixer * m_mixer; mainWindow * m_mainWindow; diff --git a/src/core/note_play_handle.cpp b/src/core/note_play_handle.cpp index d87720459..0c64e2483 100644 --- a/src/core/note_play_handle.cpp +++ b/src/core/note_play_handle.cpp @@ -89,7 +89,7 @@ notePlayHandle::notePlayHandle( instrumentTrack * _it, ( m_instrumentTrack->getVolume() / 100.0f ) * 127 ), 0, 127 ) ), midiTime::fromFrames( m_framesAhead, - m_instrumentTrack->eng()->getSongEditor()->framesPerTact() ) ); + m_instrumentTrack->eng()->framesPerTact() ) ); } @@ -274,17 +274,12 @@ void notePlayHandle::noteOff( const f_cnt_t _s ) FALSE ); } // send MIDI-note-off-event - // TODO: move framesPerTact() to engine - if( m_instrumentTrack->eng()->getSongEditor() ) - { - m_instrumentTrack->processOutEvent( midiEvent( NOTE_OFF, + m_instrumentTrack->processOutEvent( midiEvent( NOTE_OFF, m_instrumentTrack->m_midiPort->outputChannel(), key(), 0 ), midiTime::fromFrames( m_framesBeforeRelease, - m_instrumentTrack->eng()->getSongEditor() - ->framesPerTact() ) ); - } + m_instrumentTrack->eng()->framesPerTact() ) ); } else { diff --git a/src/tracks/bb_track.cpp b/src/tracks/bb_track.cpp index 3dfa34e8d..faf6cc832 100644 --- a/src/tracks/bb_track.cpp +++ b/src/tracks/bb_track.cpp @@ -385,7 +385,7 @@ bool FASTCALL bbTrack::play( const midiTime & _start, vlist tcos; getTCOsInRange( tcos, _start, _start +static_cast( _frames * - 64 / eng()->getSongEditor()->framesPerTact() ) ); + 64 / eng()->framesPerTact() ) ); if ( tcos.size() == 0 ) { diff --git a/src/tracks/instrument_track.cpp b/src/tracks/instrument_track.cpp index eee44e7da..32946ad66 100644 --- a/src/tracks/instrument_track.cpp +++ b/src/tracks/instrument_track.cpp @@ -631,7 +631,7 @@ void instrumentTrack::processInEvent( const midiEvent & _me, // create (timed) note-play-handle notePlayHandle * nph = new notePlayHandle( this, - _time.frames( eng()->getSongEditor()->framesPerTact() ), + _time.frames( eng()->framesPerTact() ), valueRanges::max, n ); if( eng()->getMixer()->addPlayHandle( nph ) ) @@ -653,8 +653,8 @@ void instrumentTrack::processInEvent( const midiEvent & _me, // recording notes into a pattern note done_note( NULL, midiTime( static_cast( - n->totalFramesPlayed() * 64 / - eng()->getSongEditor()->framesPerTact() ) ), + n->totalFramesPlayed() * 64 / + eng()->framesPerTact() ) ), 0, n->tone(), n->octave(), n->getVolume(), n->getPanning() ); n->noteOff(); @@ -755,8 +755,8 @@ void instrumentTrack::deleteNotePluginData( notePlayHandle * _n ) if( m_notes[_n->key()] == _n ) { note done_note( NULL, midiTime( static_cast( - _n->totalFramesPlayed() * 64 / - eng()->getSongEditor()->framesPerTact() ) ), + _n->totalFramesPlayed() * 64 / + eng()->framesPerTact() ) ), 0, _n->tone(), _n->octave(), _n->getVolume(), _n->getPanning() ); _n->noteOff(); @@ -894,7 +894,7 @@ bool FASTCALL instrumentTrack::play( const midiTime & _start, // calculate samples per tact; need that later when calculating // sample-pos of a note - float frames_per_tact = eng()->getSongEditor()->framesPerTact(); + float frames_per_tact = eng()->framesPerTact(); vlist tcos; if( _tco_num >= 0 ) diff --git a/src/tracks/sample_track.cpp b/src/tracks/sample_track.cpp index 2c53f1e15..2684b2d37 100644 --- a/src/tracks/sample_track.cpp +++ b/src/tracks/sample_track.cpp @@ -100,7 +100,7 @@ void FASTCALL sampleTCO::play( sampleFrame * _ab, f_cnt_t _start_frame, { _start_frame = static_cast( tMax( 0.0f, _start_frame - startPosition() * - eng()->getSongEditor()->framesPerTact() / 64 ) ); + eng()->framesPerTact() / 64 ) ); m_sampleBuffer.play( _ab, _start_frame, _frames ); } @@ -254,8 +254,7 @@ void sampleTCO::paintEvent( QPaintEvent * _pe ) midiTime sampleTCO::getSampleLength( void ) const { return( static_cast( m_sampleBuffer.frames() / - eng()->getSongEditor()->framesPerTact() * - 64 ) ); + eng()->framesPerTact() * 64 ) ); } @@ -445,7 +444,7 @@ bool FASTCALL sampleTrack::play( const midiTime & _start, vlist tcos; getTCOsInRange( tcos, _start, _start+static_cast( _frames * 64 / - eng()->getSongEditor()->framesPerTact() ) ); + eng()->framesPerTact() ) ); if ( tcos.size() == 0 ) { @@ -459,7 +458,7 @@ bool FASTCALL sampleTrack::play( const midiTime & _start, , m_volume, m_volume #endif } ; - float fpt = eng()->getSongEditor()->framesPerTact(); + float fpt = eng()->framesPerTact(); for( vlist::iterator it = tcos.begin(); it != tcos.end(); ++it )