-Renamed GridState::LOADED to STOPPED

This commit is contained in:
Harry van Haaren 2013-08-22 00:26:01 +01:00
parent 44f6e26da1
commit 96b78f0c5a
6 changed files with 52 additions and 62 deletions

View file

@ -133,10 +133,10 @@ class ClipSelector : public Fl_Button
{
case GridLogic::STATE_EMPTY:
break;
case GridLogic::STATE_LOADED:
case GridLogic::STATE_STOPPED:
clips[clipNum].load();
clips[clipNum].unqueue();
//printf("clipSelector setState() clip %i = STATE_LOADED\n", clipNum);
//printf("clipSelector setState() clip %i = STATE_STOPPED\n", clipNum);
break;
case GridLogic::STATE_PLAYING:
//printf("clipSelector setState() clip %i = STATE_PLAYING\n", clipNum);
@ -164,12 +164,6 @@ class ClipSelector : public Fl_Button
clips[clipNum].queue();
//printf("clipSelector setState() clip %i = STATE_RECORD_QUEUED\n", clipNum);
break;
/*
case GridLogic::STATE_STOPPED:
clips[clipNum].stop();
printf("clipSelector setState() clip %i = STATE_STOPPED\n", clipNum);
break;
*/
case GridLogic::STATE_STOP_QUEUED:
//printf("clipSelector setState() clip %i = STATE_STOP_QUEUED\n", clipNum);
clips[clipNum].stopRecord();

View file

@ -73,7 +73,7 @@ void AkaiAPC::setSceneState(int t, int clip, GridLogic::State s)
case GridLogic::STATE_PLAY_QUEUED: data[2] = 2; break;
case GridLogic::STATE_RECORDING: data[2] = 3; break;
case GridLogic::STATE_RECORD_QUEUED: data[2] = 4; break;
case GridLogic::STATE_LOADED: data[2] = 5; break;
case GridLogic::STATE_STOPPED: data[2] = 5; break;
case GridLogic::STATE_STOP_QUEUED: data[2] = 6; break;
}

View file

@ -33,7 +33,7 @@ void GridLogic::pressed( int track, int scene )
if ( state[track*NSCENES + scene] == STATE_EMPTY )
state[track*NSCENES + scene] = STATE_RECORD_QUEUED;
if ( state[track*NSCENES + scene] == STATE_LOADED )
if ( state[track*NSCENES + scene] == STATE_STOPPED )
state[track*NSCENES + scene] = STATE_PLAY_QUEUED;
if ( state[track*NSCENES + scene] == STATE_PLAYING )
@ -80,20 +80,19 @@ void GridLogic::bar()
if ( state[i] == STATE_PLAY_QUEUED )
{
state[i] = STATE_PLAYING;
jack->getLooper( track )->getClip( scene )->play();
jack->getLooper( track )->getClip( scene )->queuePlay();
change = true;
}
else if ( state[i] == STATE_STOP_QUEUED )
else if ( state[i] == STATE_STOP_QUEUED )
{
state[i] = STATE_LOADED;
jack->getLooper( track )->getClip( scene )->stop();
state[i] = STATE_STOPPED;
jack->getLooper( track )->getClip( scene )->queueStop();
change = true;
}
else if ( state[i] == STATE_RECORD_QUEUED )
else if ( state[i] == STATE_RECORD_QUEUED )
{
state[i] = STATE_RECORDING;
jack->getLooper( track )->getClip( scene )->record();
jack->getLooper( track )->getClip( scene )->queueRecord();
change = true;
}
@ -101,7 +100,6 @@ void GridLogic::bar()
{
jack->getControllerUpdater()->setSceneState(track, scene, state[track*NSCENES + scene] );
}
}
}

View file

@ -32,7 +32,7 @@ class GridLogic : public TimeObserver
STATE_EMPTY = 0,
STATE_PLAYING,
STATE_PLAY_QUEUED,
STATE_LOADED,
STATE_STOPPED,
STATE_STOP_QUEUED,
STATE_RECORDING,
STATE_RECORD_QUEUED,

View file

@ -9,8 +9,6 @@
LooperClip::LooperClip()
{
_state = GridLogic::STATE_EMPTY;
_loaded = false;
_playing = false;
_recording = false;
@ -113,22 +111,25 @@ long LooperClip::getBufferLenght()
return _recordhead;
}
bool LooperClip::loaded()
{
return _loaded;
}
void LooperClip::play()
void LooperClip::queuePlay()
{
_playing = true;
_playhead = 0;
}
void LooperClip::stop()
void LooperClip::queueStop()
{
_playing = false;
_playhead = 0;
}
void LooperClip::queueRecord()
{
_recording = true;
_playing = false;
}
bool LooperClip::playing()
{
return _playing;
@ -139,22 +140,20 @@ bool LooperClip::recording()
return _recording;
}
void LooperClip::record()
bool LooperClip::loaded()
{
/*
if ( !r && duration )
{
setBeats( duration );
}
*/
_recording = true;
_playing = false;
return _loaded;
}
void LooperClip::newBufferInTransit(bool n)
{
_newBufferInTransit = n;
}
void LooperClip::newBufferInTransit(bool n){_newBufferInTransit = n;}
bool LooperClip::newBufferInTransit(){return _newBufferInTransit;}
bool LooperClip::newBufferInTransit()
{
return _newBufferInTransit;
}
float LooperClip::getSample(float playSpeed)
{

View file

@ -5,8 +5,6 @@
#include <stdio.h>
#include "config.hxx"
#include "gridlogic.hxx"
class AudioBuffer;
/** LooperClip
@ -33,44 +31,45 @@ class LooperClip
/// loads a sample: eg from disk, unloading current sample if necessary
void load( AudioBuffer* ab );
/// used to update the size of the buffer for this looperclip. The current
/// data is copied into the new buffer, then the smaller buffer is sent
/// for de-allocation
void setRequestedBuffer( AudioBuffer* ab );
/// audio functionality
float getSample(float playSpeed);
void record(int count, float* L, float* R);
unsigned long recordSpaceAvailable();
void setBeats(int beats);
/// get clip state
bool loaded();
bool playing();
bool recording();
/// get buffer details
int getBeats();
long getBufferLenght();
int getBeats();
long getBufferLenght();
size_t audioBufferSize();
/// set clip state
void play();
void stop();
void record();
void queuePlay();
void queueStop();
void queueRecord();
float getProgress();
/// set buffer state
void setBeats(int beats);
/// Luppp internal buffer resizing
void newBufferInTransit(bool n);
bool newBufferInTransit();
size_t recordSpaceAvailable();
float getSample(float playSpeed);
float getProgress();
/** used to update the size of the buffer for this looperclip. The current
* data is copied into the new buffer, then the smaller buffer is sent
* for de-allocation.
**/
void setRequestedBuffer( AudioBuffer* ab );
private:
// internally, Luppp needs more than just the current state of the clip to
// accuratly handle it. Hence some bools are purposed: the *current*
// state of the grid is kept up to date by GridLogic.
GridLogic::State _state;
/** Luppp needs more than the current state of the clip to accuratly handle
* it. The current state of the grid is kept up-to-date by GridLogic
* abstracting detail away, sending GridLogic::State to Controllers.
**/
bool _loaded;
bool _playing;
bool _recording;