mirror of
https://github.com/vale981/openAV-Luppp
synced 2025-03-04 16:51:37 -05:00
-Looper recording / quantizing working
This commit is contained in:
parent
de2ddc8657
commit
2021054fd2
2 changed files with 22 additions and 23 deletions
|
@ -21,5 +21,5 @@ void Looper::setState(State s)
|
|||
*/
|
||||
|
||||
// quantize?!
|
||||
state |= s;
|
||||
state = s;
|
||||
}
|
||||
|
|
|
@ -24,7 +24,7 @@ class Looper : public Observer // for notifications
|
|||
|
||||
Looper(int t) :
|
||||
track(t),
|
||||
state(0),
|
||||
state(STATE_STOPPED),
|
||||
endPoint (0),
|
||||
playPoint (0),
|
||||
lastWrittenSampleIndex(0)
|
||||
|
@ -35,37 +35,37 @@ class Looper : public Observer // for notifications
|
|||
void bar()
|
||||
{
|
||||
cout << "Looper " << track << " got bar()" << flush;
|
||||
cout << endl;
|
||||
}
|
||||
|
||||
void beat()
|
||||
{
|
||||
//cout << "Looper " << track << " got beat()" << flush;
|
||||
if ( state & STATE_PLAY_QUEUED )
|
||||
playPoint = 0;
|
||||
|
||||
if ( state == STATE_PLAY_QUEUED )
|
||||
{
|
||||
state = 0;
|
||||
cout << " Q->Playing ";
|
||||
cout << " Q->Playing endpoint = " << endPoint;
|
||||
state = STATE_PLAYING;
|
||||
playPoint = 0;
|
||||
endPoint = lastWrittenSampleIndex;
|
||||
}
|
||||
if ( state & STATE_RECORD_QUEUED )
|
||||
if ( state == STATE_RECORD_QUEUED )
|
||||
{
|
||||
state = 0;
|
||||
cout << " Q->Recording ";
|
||||
state = STATE_RECORDING;
|
||||
playPoint = 0;
|
||||
endPoint = 0;
|
||||
lastWrittenSampleIndex = 0;
|
||||
}
|
||||
if ( state & STATE_PLAY_QUEUED )
|
||||
if ( state == STATE_PLAY_QUEUED )
|
||||
{
|
||||
state = 0;
|
||||
cout << " Q->Stopped ";
|
||||
state = STATE_STOPPED;
|
||||
endPoint = lastWrittenSampleIndex;
|
||||
}
|
||||
cout << endl;
|
||||
}
|
||||
|
||||
void beat()
|
||||
{
|
||||
//cout << "Looper " << track << " got beat()" << flush;
|
||||
}
|
||||
|
||||
void setFpb(int f)
|
||||
{
|
||||
fpb = f;
|
||||
|
@ -79,22 +79,21 @@ class Looper : public Observer // for notifications
|
|||
float* in = buffers->audio[Buffers::MASTER_INPUT];
|
||||
float* out = buffers->audio[Buffers::MASTER_OUTPUT];
|
||||
|
||||
if ( state & STATE_PLAYING )
|
||||
if ( state == STATE_PLAYING )
|
||||
{
|
||||
cout << "playing" << endl;
|
||||
for(int i = 0; i < nframes; i++)
|
||||
{
|
||||
if ( playPoint >= endPoint )
|
||||
if ( playPoint < endPoint )
|
||||
{
|
||||
playPoint = 0;
|
||||
out[i] += sample[playPoint++];
|
||||
}
|
||||
out[i] += sample[playPoint++];
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
else if ( state & STATE_RECORDING )
|
||||
else if ( state == STATE_RECORDING )
|
||||
{
|
||||
cout << "recording" << endl;
|
||||
cout << "recording " << endl;
|
||||
for(int i = 0; i < nframes; i++)
|
||||
{
|
||||
if ( lastWrittenSampleIndex < 44100 * 60 )
|
||||
|
@ -107,7 +106,7 @@ class Looper : public Observer // for notifications
|
|||
|
||||
private:
|
||||
int track;
|
||||
unsigned int state;
|
||||
State state;
|
||||
|
||||
int fpb;
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue