-Fixed LooperClip / Looper interaction, now uses recording() and playing() to determine action to take

This commit is contained in:
Harry van Haaren 2013-08-22 01:40:25 +01:00
parent 0e8c5ea91b
commit c2d8e045ce
3 changed files with 14 additions and 4 deletions

View file

@ -60,11 +60,9 @@ void Looper::process(unsigned int nframes, Buffers* buffers)
// while another clip records.
for ( int clip = 0; clip < NSCENES; clip++ )
{
GridLogic::State s = clips[clip]->getState();
// handle state of clip, and do what needs doing:
// record into buffer, play from buffer, etc
if ( s == GridLogic::STATE_RECORDING )
if ( clips[clip]->recording() )
{
if ( clips[clip]->recordSpaceAvailable() < LOOPER_SAMPLES_BEFORE_REQUEST &&
!clips[clip]->newBufferInTransit() )
@ -78,7 +76,7 @@ void Looper::process(unsigned int nframes, Buffers* buffers)
float* input = buffers->audio[Buffers::MASTER_INPUT];
clips[clip]->record( nframes, input, 0 );
}
else if ( s == GridLogic::STATE_PLAYING )
else if ( clips[clip]->playing() )
{
// copy data into tmpBuffer, then pitch-stretch into track buffer
long targetFrames = clips[clip]->getBeats() * fpb;

View file

@ -215,6 +215,16 @@ GridLogic::State LooperClip::getState()
return s;
}
bool LooperClip::playing()
{
return _playing;
}
bool LooperClip::recording()
{
return _recording;
}
void LooperClip::newBufferInTransit(bool n)
{
_newBufferInTransit = n;

View file

@ -41,6 +41,8 @@ class LooperClip
/// analyses current _playing _recording vars, returns the current State
GridLogic::State getState();
bool playing();
bool recording();
/// get buffer details
int getBeats();