mirror of
https://github.com/vale981/openAV-Luppp
synced 2025-03-05 09:01:39 -05:00
-Updated GridLogic and LooperClip state logic, now mostly working using LooperClip data
This commit is contained in:
parent
9459d0a355
commit
7218a86da4
2 changed files with 43 additions and 28 deletions
|
@ -7,7 +7,7 @@
|
|||
extern Jack* jack;
|
||||
|
||||
|
||||
const char* StateString[8] = {
|
||||
const char* GridLogic::StateString[8] = {
|
||||
"empty",
|
||||
"playing",
|
||||
"play queued",
|
||||
|
@ -28,24 +28,29 @@ GridLogic::GridLogic()
|
|||
|
||||
void GridLogic::pressed( int track, int scene )
|
||||
{
|
||||
//printf("before press state = %s\n", StateString[ int(state[track*NTRACKS + scene]) ] );
|
||||
/*
|
||||
if ( state[track*NSCENES + scene] == STATE_EMPTY )
|
||||
state[track*NSCENES + scene] = STATE_RECORD_QUEUED;
|
||||
LooperClip* lc = jack->getLooper( track )->getClip( scene );
|
||||
GridLogic::State s = lc->getState();
|
||||
|
||||
if ( state[track*NSCENES + scene] == STATE_STOPPED )
|
||||
state[track*NSCENES + scene] = STATE_PLAY_QUEUED;
|
||||
printf("before press state = %s\n", StateString[ int(s) ] );
|
||||
|
||||
if ( state[track*NSCENES + scene] == STATE_PLAYING )
|
||||
state[track*NSCENES + scene] = STATE_STOP_QUEUED;
|
||||
if ( s == STATE_EMPTY )
|
||||
lc->queueRecord();
|
||||
|
||||
if ( state[track*NSCENES + scene] == STATE_RECORDING )
|
||||
state[track*NSCENES + scene] = STATE_STOP_QUEUED;
|
||||
if ( s == STATE_STOPPED )
|
||||
lc->queuePlay();
|
||||
|
||||
//printf("after press state = %s\n", StateString[ int(state[track*NSCENES + scene]) ] );
|
||||
if ( s == STATE_PLAYING )
|
||||
lc->queueStop();
|
||||
|
||||
jack->getControllerUpdater()->setSceneState(track, scene, state[track*NSCENES + scene]);
|
||||
*/
|
||||
if ( s == STATE_RECORDING )
|
||||
lc->queueStop();
|
||||
|
||||
|
||||
s = lc->getState();
|
||||
|
||||
printf("after press state = %s\n", StateString[ int(s) ] );
|
||||
|
||||
jack->getControllerUpdater()->setSceneState(track, scene, s );
|
||||
}
|
||||
|
||||
|
||||
|
@ -77,6 +82,14 @@ void GridLogic::bar()
|
|||
{
|
||||
int track = i / NSCENES;
|
||||
int scene = i - track * NSCENES;
|
||||
jack->getLooper( track )->getClip( scene )->bar();
|
||||
|
||||
GridLogic::State s = jack->getLooper( track )->getClip( scene )->getState();
|
||||
|
||||
if ( s != STATE_EMPTY )
|
||||
{
|
||||
printf("%i, %i:after bar() state = %s\n", track, scene, StateString[ int(s) ] );
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -86,6 +86,8 @@ void LooperClip::record(int count, float* L, float* R)
|
|||
_recordhead++;
|
||||
}
|
||||
}
|
||||
|
||||
_loaded = true;
|
||||
}
|
||||
|
||||
unsigned long LooperClip::recordSpaceAvailable()
|
||||
|
@ -164,44 +166,44 @@ void LooperClip::bar()
|
|||
{
|
||||
jack->getControllerUpdater()->setSceneState(track, scene, s );
|
||||
}
|
||||
|
||||
_playhead = 0;
|
||||
}
|
||||
|
||||
|
||||
void LooperClip::queuePlay()
|
||||
{
|
||||
_queuePlay = true;
|
||||
_queueStop = false;
|
||||
_queuePlay = true;
|
||||
_queueStop = false;
|
||||
_queueRecord = false;
|
||||
}
|
||||
void LooperClip::queueStop()
|
||||
{
|
||||
_playing = false;
|
||||
_playhead = 0;
|
||||
_queueStop = true;
|
||||
_queuePlay = false;
|
||||
_queueRecord = false;
|
||||
}
|
||||
|
||||
void LooperClip::queueRecord()
|
||||
{
|
||||
_recording = true;
|
||||
_playing = false;
|
||||
_queueRecord = true;
|
||||
_queuePlay = false;
|
||||
_queueStop = false;
|
||||
}
|
||||
|
||||
GridLogic::State LooperClip::getState()
|
||||
{
|
||||
GridLogic::State s = GridLogic::STATE_EMPTY;
|
||||
|
||||
if ( _loaded )
|
||||
if ( _loaded )
|
||||
s = GridLogic::STATE_STOPPED;
|
||||
else if ( _playing )
|
||||
if ( _playing )
|
||||
s = GridLogic::STATE_PLAYING;
|
||||
else if ( _recording )
|
||||
if ( _recording )
|
||||
s = GridLogic::STATE_RECORDING;
|
||||
else if ( _queuePlay )
|
||||
if ( _queuePlay )
|
||||
s = GridLogic::STATE_PLAY_QUEUED;
|
||||
else if ( _queueStop )
|
||||
if ( _queueStop )
|
||||
s = GridLogic::STATE_STOP_QUEUED;
|
||||
else if ( _queueRecord )
|
||||
if ( _queueRecord )
|
||||
s = GridLogic::STATE_RECORD_QUEUED;
|
||||
|
||||
return s;
|
||||
|
|
Loading…
Add table
Reference in a new issue