Commit a748de09 authored by Georg Krause's avatar Georg Krause

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 anymore
parent 49160880
Pipeline #313 passed with stages
in 1 minute and 52 seconds
......@@ -95,11 +95,9 @@ void GridLogic::launchScene( int scene )
LooperClip* lc = jack->getLooper( t )->getClip( s );
if ( s == scene ) {
lc->queuePlay();
jack->getControllerUpdater()->setSceneState( t, s, lc->getState() );
} else {
if ( lc->playing() ) {
lc->queueStop();
jack->getControllerUpdater()->setSceneState( t, s, lc->getState() );
} else if ( lc->somethingQueued() ) {
lc->resetQueues();
jack->getControllerUpdater()->setSceneState( t, s, lc->getState() );
......@@ -210,37 +208,31 @@ void GridLogic::pressed( int track, int scene )
ilc->resetQueues();
ilc->queueStop();
jack->getControllerUpdater()->setSceneState(track, i, ilc->getState() );
}
}
}
s = lc->getState();
#ifdef DEBUG_CLIP
s = lc->getState();
printf("GridLogic::pressed() after press state = %s\n", StateString[ int(s) ] );
#endif
jack->getControllerUpdater()->setSceneState(track, scene, s );
}
void GridLogic::clear( int track, int scene )
{
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 )
{
GridLogic::State s = jack->getLooper( track )->getClip( scene )->getState();
jack->getControllerUpdater()->setSceneState(track, scene, s );
// TODO needed?
}
void GridLogic::load(int track, int scene, AudioBuffer* 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();
EventGuiPrint e( GridLogic::StateString[st] );
writeToGuiRingbuffer( &e );
jack->getControllerUpdater()->setSceneState(t, s, st );
}
}
}
......
......@@ -60,17 +60,18 @@ void LooperClip::init()
}
_newBufferInTransit = false;
_playhead = 0;
_recordhead = 0;
_barsRecorded = 0;
_playbackSpeed = 1;
_nextPlaybackSpeed = 1;
_playbackSpeedChange = false;
_beatsPlayed = 0;
_barsPlayed = 0;
_barsRecorded = 0;
updateController();
resetPlayHead();
jack->getControllerUpdater()->setSceneState(track, scene, getState());
jack->getControllerUpdater()->setTrackSceneProgress(
track, scene, getProgress());
}
void LooperClip::save()
......@@ -181,7 +182,8 @@ void LooperClip::resetPlayHead()
_playbackSpeedChange = false;
}
updateController();
jack->getControllerUpdater()->setTrackSceneProgress(
track, scene, getProgress());
}
}
......@@ -329,7 +331,7 @@ void LooperClip::queuePlay()
_queueStop = false;
_queueRecord = false;
}
updateController();
jack->getControllerUpdater()->setSceneState(track, scene, getState());
}
void LooperClip::queueStop()
......@@ -340,7 +342,7 @@ void LooperClip::queueStop()
_queueStop = true;
_queueRecord = false;
}
updateController();
jack->getControllerUpdater()->setSceneState(track, scene, getState());
}
void LooperClip::queueRecord()
......@@ -351,7 +353,7 @@ void LooperClip::queueRecord()
_queueStop = false;
_queueRecord = true;
}
updateController();
jack->getControllerUpdater()->setSceneState(track, scene, getState());
}
void LooperClip::setRecording()
......@@ -368,7 +370,7 @@ void LooperClip::setRecording()
_buffer->setBeats( 0 );
}
updateController();
jack->getControllerUpdater()->setSceneState(track, scene, getState());
}
void LooperClip::setPlaying()
......@@ -379,12 +381,11 @@ void LooperClip::setPlaying()
resetQueues();
_beatsPlayed = 0;
_playhead = 0;
resetPlayHead();
} else {
resetQueues();
}
updateController();
jack->getControllerUpdater()->setSceneState(track, scene, getState());
}
void LooperClip::setStopped()
......@@ -395,17 +396,11 @@ void LooperClip::setStopped()
resetQueues();
_beatsPlayed = 0;
_playhead = 0;
resetPlayHead();
// set "progress" to zero, as we're stopped!
updateController();
}
void LooperClip::updateController()
{
jack->getControllerUpdater()->setSceneState(track, scene, getState());
jack->getControllerUpdater()->setTrackSceneProgress(track, scene, getProgress());
jack->getControllerUpdater()->setSceneState(
track, scene, getState());
}
GridLogic::State LooperClip::getState()
......@@ -525,9 +520,6 @@ void LooperClip::processFreeRec() {
queuePlay();
jack->setFreeRecMode(false);
EventFreeRecordMode e = EventFreeRecordMode(false);
writeToGuiRingbuffer(&e);
}
#ifdef BUILD_TESTS
......
......@@ -174,9 +174,6 @@ private:
/// Change State to Stopped
void setStopped();
/// Updates all the controllers with the current state
void updateController();
};
#endif // LUPPP_LOOPER_CLIP_H
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment