Improve updating of controller a lot
* GridLogic does not update controllers anymore, the Looperclip does it on state change * Looperclip does not update state and progress together anymoremain
parent
4916088097
commit
a748de09ed
|
@ -95,11 +95,9 @@ void GridLogic::launchScene( int scene )
|
||||||
LooperClip* lc = jack->getLooper( t )->getClip( s );
|
LooperClip* lc = jack->getLooper( t )->getClip( s );
|
||||||
if ( s == scene ) {
|
if ( s == scene ) {
|
||||||
lc->queuePlay();
|
lc->queuePlay();
|
||||||
jack->getControllerUpdater()->setSceneState( t, s, lc->getState() );
|
|
||||||
} else {
|
} else {
|
||||||
if ( lc->playing() ) {
|
if ( lc->playing() ) {
|
||||||
lc->queueStop();
|
lc->queueStop();
|
||||||
jack->getControllerUpdater()->setSceneState( t, s, lc->getState() );
|
|
||||||
} else if ( lc->somethingQueued() ) {
|
} else if ( lc->somethingQueued() ) {
|
||||||
lc->resetQueues();
|
lc->resetQueues();
|
||||||
jack->getControllerUpdater()->setSceneState( t, s, lc->getState() );
|
jack->getControllerUpdater()->setSceneState( t, s, lc->getState() );
|
||||||
|
@ -210,37 +208,31 @@ void GridLogic::pressed( int track, int scene )
|
||||||
|
|
||||||
ilc->resetQueues();
|
ilc->resetQueues();
|
||||||
ilc->queueStop();
|
ilc->queueStop();
|
||||||
jack->getControllerUpdater()->setSceneState(track, i, ilc->getState() );
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
s = lc->getState();
|
|
||||||
#ifdef DEBUG_CLIP
|
#ifdef DEBUG_CLIP
|
||||||
|
s = lc->getState();
|
||||||
printf("GridLogic::pressed() after press state = %s\n", StateString[ int(s) ] );
|
printf("GridLogic::pressed() after press state = %s\n", StateString[ int(s) ] );
|
||||||
#endif
|
#endif
|
||||||
jack->getControllerUpdater()->setSceneState(track, scene, s );
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void GridLogic::clear( int track, int scene )
|
void GridLogic::clear( int track, int scene )
|
||||||
{
|
{
|
||||||
jack->getLooper( track )->getClip( scene )->init();
|
jack->getLooper( track )->getClip( scene )->init();
|
||||||
jack->getControllerUpdater()->setTrackSceneProgress(track, scene, 0 );
|
|
||||||
jack->getControllerUpdater()->setSceneState( track, scene, GridLogic::STATE_EMPTY );
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void GridLogic::released( int track, int scene )
|
void GridLogic::released( int track, int scene )
|
||||||
{
|
{
|
||||||
GridLogic::State s = jack->getLooper( track )->getClip( scene )->getState();
|
// TODO needed?
|
||||||
jack->getControllerUpdater()->setSceneState(track, scene, s );
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void GridLogic::load(int track, int scene, AudioBuffer* ab)
|
void GridLogic::load(int track, int scene, AudioBuffer* ab)
|
||||||
{
|
{
|
||||||
jack->getLooper( track )->getClip( scene )->load( ab );
|
jack->getLooper( track )->getClip( scene )->load( ab );
|
||||||
GridLogic::State s = jack->getLooper( track )->getClip( scene )->getState();
|
|
||||||
jack->getControllerUpdater()->setSceneState(track, scene, s );
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -252,7 +244,6 @@ void GridLogic::updateState()
|
||||||
GridLogic::State st = jack->getLooper( t )->getClip( s )->getState();
|
GridLogic::State st = jack->getLooper( t )->getClip( s )->getState();
|
||||||
EventGuiPrint e( GridLogic::StateString[st] );
|
EventGuiPrint e( GridLogic::StateString[st] );
|
||||||
writeToGuiRingbuffer( &e );
|
writeToGuiRingbuffer( &e );
|
||||||
jack->getControllerUpdater()->setSceneState(t, s, st );
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -60,17 +60,18 @@ void LooperClip::init()
|
||||||
}
|
}
|
||||||
_newBufferInTransit = false;
|
_newBufferInTransit = false;
|
||||||
|
|
||||||
_playhead = 0;
|
|
||||||
_recordhead = 0;
|
_recordhead = 0;
|
||||||
|
_barsRecorded = 0;
|
||||||
|
|
||||||
_playbackSpeed = 1;
|
_playbackSpeed = 1;
|
||||||
_nextPlaybackSpeed = 1;
|
_nextPlaybackSpeed = 1;
|
||||||
_playbackSpeedChange = false;
|
_playbackSpeedChange = false;
|
||||||
|
|
||||||
_beatsPlayed = 0;
|
resetPlayHead();
|
||||||
_barsPlayed = 0;
|
|
||||||
_barsRecorded = 0;
|
jack->getControllerUpdater()->setSceneState(track, scene, getState());
|
||||||
updateController();
|
jack->getControllerUpdater()->setTrackSceneProgress(
|
||||||
|
track, scene, getProgress());
|
||||||
}
|
}
|
||||||
|
|
||||||
void LooperClip::save()
|
void LooperClip::save()
|
||||||
|
@ -181,7 +182,8 @@ void LooperClip::resetPlayHead()
|
||||||
_playbackSpeedChange = false;
|
_playbackSpeedChange = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
updateController();
|
jack->getControllerUpdater()->setTrackSceneProgress(
|
||||||
|
track, scene, getProgress());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -329,7 +331,7 @@ void LooperClip::queuePlay()
|
||||||
_queueStop = false;
|
_queueStop = false;
|
||||||
_queueRecord = false;
|
_queueRecord = false;
|
||||||
}
|
}
|
||||||
updateController();
|
jack->getControllerUpdater()->setSceneState(track, scene, getState());
|
||||||
}
|
}
|
||||||
|
|
||||||
void LooperClip::queueStop()
|
void LooperClip::queueStop()
|
||||||
|
@ -340,7 +342,7 @@ void LooperClip::queueStop()
|
||||||
_queueStop = true;
|
_queueStop = true;
|
||||||
_queueRecord = false;
|
_queueRecord = false;
|
||||||
}
|
}
|
||||||
updateController();
|
jack->getControllerUpdater()->setSceneState(track, scene, getState());
|
||||||
}
|
}
|
||||||
|
|
||||||
void LooperClip::queueRecord()
|
void LooperClip::queueRecord()
|
||||||
|
@ -351,7 +353,7 @@ void LooperClip::queueRecord()
|
||||||
_queueStop = false;
|
_queueStop = false;
|
||||||
_queueRecord = true;
|
_queueRecord = true;
|
||||||
}
|
}
|
||||||
updateController();
|
jack->getControllerUpdater()->setSceneState(track, scene, getState());
|
||||||
}
|
}
|
||||||
|
|
||||||
void LooperClip::setRecording()
|
void LooperClip::setRecording()
|
||||||
|
@ -368,7 +370,7 @@ void LooperClip::setRecording()
|
||||||
_buffer->setBeats( 0 );
|
_buffer->setBeats( 0 );
|
||||||
}
|
}
|
||||||
|
|
||||||
updateController();
|
jack->getControllerUpdater()->setSceneState(track, scene, getState());
|
||||||
}
|
}
|
||||||
|
|
||||||
void LooperClip::setPlaying()
|
void LooperClip::setPlaying()
|
||||||
|
@ -379,12 +381,11 @@ void LooperClip::setPlaying()
|
||||||
|
|
||||||
resetQueues();
|
resetQueues();
|
||||||
|
|
||||||
_beatsPlayed = 0;
|
resetPlayHead();
|
||||||
_playhead = 0;
|
|
||||||
} else {
|
} else {
|
||||||
resetQueues();
|
resetQueues();
|
||||||
}
|
}
|
||||||
updateController();
|
jack->getControllerUpdater()->setSceneState(track, scene, getState());
|
||||||
}
|
}
|
||||||
|
|
||||||
void LooperClip::setStopped()
|
void LooperClip::setStopped()
|
||||||
|
@ -395,17 +396,11 @@ void LooperClip::setStopped()
|
||||||
|
|
||||||
resetQueues();
|
resetQueues();
|
||||||
|
|
||||||
_beatsPlayed = 0;
|
resetPlayHead();
|
||||||
_playhead = 0;
|
|
||||||
|
|
||||||
// set "progress" to zero, as we're stopped!
|
// set "progress" to zero, as we're stopped!
|
||||||
updateController();
|
jack->getControllerUpdater()->setSceneState(
|
||||||
}
|
track, scene, getState());
|
||||||
|
|
||||||
void LooperClip::updateController()
|
|
||||||
{
|
|
||||||
jack->getControllerUpdater()->setSceneState(track, scene, getState());
|
|
||||||
jack->getControllerUpdater()->setTrackSceneProgress(track, scene, getProgress());
|
|
||||||
}
|
}
|
||||||
|
|
||||||
GridLogic::State LooperClip::getState()
|
GridLogic::State LooperClip::getState()
|
||||||
|
@ -525,9 +520,6 @@ void LooperClip::processFreeRec() {
|
||||||
queuePlay();
|
queuePlay();
|
||||||
|
|
||||||
jack->setFreeRecMode(false);
|
jack->setFreeRecMode(false);
|
||||||
|
|
||||||
EventFreeRecordMode e = EventFreeRecordMode(false);
|
|
||||||
writeToGuiRingbuffer(&e);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifdef BUILD_TESTS
|
#ifdef BUILD_TESTS
|
||||||
|
|
|
@ -174,9 +174,6 @@ private:
|
||||||
|
|
||||||
/// Change State to Stopped
|
/// Change State to Stopped
|
||||||
void setStopped();
|
void setStopped();
|
||||||
|
|
||||||
/// Updates all the controllers with the current state
|
|
||||||
void updateController();
|
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif // LUPPP_LOOPER_CLIP_H
|
#endif // LUPPP_LOOPER_CLIP_H
|
||||||
|
|
Loading…
Reference in New Issue