-Cleanup Looper
This commit is contained in:
parent
6b72cc5115
commit
5823cad680
3 changed files with 8 additions and 109 deletions
2
TODO
2
TODO
|
@ -1,6 +1,8 @@
|
|||
|
||||
=== NEW
|
||||
|
||||
- Remove TimeObserver obligation from Looper, not needed as GridLogic handles Time now
|
||||
|
||||
- Add AudioBuffer soundfile writer in order to check contents (looper distortion bug)
|
||||
|
||||
- Update recording mechanism to request buffers when they're getting full
|
||||
|
|
112
src/looper.cxx
112
src/looper.cxx
|
@ -164,45 +164,17 @@ void Looper::setRequestedBuffer(int s, AudioBuffer* ab)
|
|||
void Looper::setSample(int scene, AudioBuffer* ab)
|
||||
{
|
||||
clips[scene].load( ab );
|
||||
/*
|
||||
vector<float>& buf = ab->getData();
|
||||
if ( buf.size() > SAMPLE_SIZE )
|
||||
{
|
||||
EventGuiPrint e( "Looper setSample() ERROR size > incoming sample" );
|
||||
writeToGuiRingbuffer( &e );
|
||||
}
|
||||
else
|
||||
{
|
||||
char buffer [50];
|
||||
sprintf (buffer, "Looper setSample() writing to scene %i",scene);
|
||||
EventGuiPrint e( buffer );
|
||||
writeToGuiRingbuffer( &e );
|
||||
|
||||
numBeats = ab->getBeats();
|
||||
float* s = &sample[sc];
|
||||
float* b = &buf[0];
|
||||
for (unsigned int i = 0; i < buf.size(); i++)
|
||||
{
|
||||
*s++ = *b++;
|
||||
}
|
||||
|
||||
endPoint = buf.size();
|
||||
lastWrittenSampleIndex = buf.size();
|
||||
|
||||
//memcpy( &sample[0], &buf[0], buf.size() ); // copy sample data to pre-allocated buffer
|
||||
}
|
||||
*/
|
||||
|
||||
char buffer [50];
|
||||
sprintf (buffer, "Looper setSample() writing to scene %i",scene);
|
||||
EventGuiPrint e( buffer );
|
||||
writeToGuiRingbuffer( &e );
|
||||
}
|
||||
|
||||
void Looper::process(int nframes, Buffers* buffers)
|
||||
{
|
||||
float* in = buffers->audio[Buffers::MASTER_INPUT];
|
||||
|
||||
// FIXME:
|
||||
// using the track output causes distortion: clipping / not proper writing.
|
||||
// writing to master fixes issue, so its due to trackOutput or Looper writing...?
|
||||
//float* out = buffers->audio[Buffers::TRACK_0 + track];
|
||||
float* out = buffers->audio[Buffers::MASTER_OUT_R];
|
||||
float* out = buffers->audio[Buffers::TRACK_0 + track];
|
||||
|
||||
// process each clip individually: this allows for playback of one clip,
|
||||
// while another clip records.
|
||||
|
@ -291,78 +263,6 @@ void Looper::process(int nframes, Buffers* buffers)
|
|||
*/
|
||||
}
|
||||
|
||||
|
||||
void Looper::bar()
|
||||
{
|
||||
/*
|
||||
int barTmpState = state;
|
||||
// queue stop recording -> stop recording, now calculate beats in loop
|
||||
if ( stopRecordOnBar )
|
||||
{
|
||||
stopRecordOnBar = false;
|
||||
}
|
||||
|
||||
if ( playedBeats >= numBeats )
|
||||
{
|
||||
playPoint = 0;
|
||||
playedBeats = 0;
|
||||
}
|
||||
|
||||
if ( state == STATE_PLAY_QUEUED )
|
||||
{
|
||||
EventGuiPrint e( "Looper Q->Playing" );
|
||||
writeToGuiRingbuffer( &e );
|
||||
state = STATE_PLAYING;
|
||||
playPoint = 0;
|
||||
endPoint = lastWrittenSampleIndex;
|
||||
|
||||
EventLooperState e2( track, scene, STATE_PLAYING );
|
||||
writeToGuiRingbuffer( &e2 );
|
||||
}
|
||||
if ( state == STATE_RECORD_QUEUED )
|
||||
{
|
||||
EventGuiPrint e( "Looper Q->Recording" );
|
||||
writeToGuiRingbuffer( &e );
|
||||
|
||||
EventLooperState e2( track, scene, STATE_RECORDING );
|
||||
writeToGuiRingbuffer( &e2 );
|
||||
|
||||
state = STATE_RECORDING;
|
||||
playPoint = 0;
|
||||
endPoint = 0;
|
||||
lastWrittenSampleIndex = 0;
|
||||
}
|
||||
if ( state == STATE_STOP_QUEUED )
|
||||
{
|
||||
EventGuiPrint e( "Looper Q->Stopped" );
|
||||
writeToGuiRingbuffer( &e );
|
||||
|
||||
EventLooperState e2( track, scene, STATE_STOPPED );
|
||||
writeToGuiRingbuffer( &e2 );
|
||||
|
||||
state = STATE_STOPPED;
|
||||
endPoint = lastWrittenSampleIndex;
|
||||
}
|
||||
|
||||
if ( barTmpState != state )
|
||||
{
|
||||
updateControllers();
|
||||
}
|
||||
*/
|
||||
}
|
||||
|
||||
void Looper::beat()
|
||||
{
|
||||
/*
|
||||
if (state == STATE_RECORDING || stopRecordOnBar )
|
||||
{
|
||||
numBeats++;
|
||||
}
|
||||
playedBeats++;
|
||||
*
|
||||
*/
|
||||
}
|
||||
|
||||
void Looper::pitchShift(int count, float* input, float* output)
|
||||
{
|
||||
float fSlow0 = windowSize;
|
||||
|
|
|
@ -32,9 +32,6 @@ class Looper : public AudioProcessor, public TimeObserver
|
|||
|
||||
void midi(unsigned char* data);
|
||||
|
||||
void bar();
|
||||
void beat();
|
||||
|
||||
void setFpb(int f) { /*fpb = f;*/ }
|
||||
|
||||
void queuePlayScene( int sc );
|
||||
|
|
Loading…
Reference in a new issue