mirror of
https://github.com/vale981/openAV-Luppp
synced 2025-03-05 17:11:40 -05:00
-LooperClips now just normal instances, not pointers to
This commit is contained in:
parent
71677bad30
commit
48c47f398f
2 changed files with 9 additions and 9 deletions
|
@ -24,7 +24,7 @@ Looper::Looper(int t) :
|
||||||
|
|
||||||
for(int i = 0; i < 10; i++ )
|
for(int i = 0; i < 10; i++ )
|
||||||
{
|
{
|
||||||
clips[i] = new LooperClip();
|
clips[i] = LooperClip();
|
||||||
}
|
}
|
||||||
|
|
||||||
// init faust pitch shift variables
|
// init faust pitch shift variables
|
||||||
|
@ -44,7 +44,7 @@ Looper::Looper(int t) :
|
||||||
|
|
||||||
LooperClip* Looper::getClip(int scene)
|
LooperClip* Looper::getClip(int scene)
|
||||||
{
|
{
|
||||||
return clips[scene];
|
return &clips[scene];
|
||||||
}
|
}
|
||||||
|
|
||||||
void Looper::midi(unsigned char* data)
|
void Looper::midi(unsigned char* data)
|
||||||
|
@ -148,7 +148,7 @@ void Looper::updateControllers()
|
||||||
|
|
||||||
void Looper::setSample(int scene, AudioBuffer* ab)
|
void Looper::setSample(int scene, AudioBuffer* ab)
|
||||||
{
|
{
|
||||||
clips[scene]->load( ab );
|
clips[scene].load( ab );
|
||||||
/*
|
/*
|
||||||
vector<float>& buf = ab->getData();
|
vector<float>& buf = ab->getData();
|
||||||
if ( buf.size() > SAMPLE_SIZE )
|
if ( buf.size() > SAMPLE_SIZE )
|
||||||
|
@ -195,28 +195,28 @@ void Looper::process(int nframes, Buffers* buffers)
|
||||||
{
|
{
|
||||||
// handle state of clip, and do what needs doing:
|
// handle state of clip, and do what needs doing:
|
||||||
// record into buffer, play from buffer, etc
|
// record into buffer, play from buffer, etc
|
||||||
if ( clips[clip]->recording() )
|
if ( clips[clip].recording() )
|
||||||
{
|
{
|
||||||
// copy data from input buffer to recording buffer
|
// copy data from input buffer to recording buffer
|
||||||
|
|
||||||
if ( clips[clip]->nframesAvailable() < LOOPER_SAMPLES_BEFORE_REQUEST )
|
if ( clips[clip].nframesAvailable() < LOOPER_SAMPLES_BEFORE_REQUEST )
|
||||||
{
|
{
|
||||||
// request bigger buffer for this track/scene
|
// request bigger buffer for this track/scene
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else if ( clips[clip]->playing() )
|
else if ( clips[clip].playing() )
|
||||||
{
|
{
|
||||||
//printf("Looper %i playing()\n", track );
|
//printf("Looper %i playing()\n", track );
|
||||||
// copy data into tmpBuffer, then pitch-stretch into track buffer
|
// copy data into tmpBuffer, then pitch-stretch into track buffer
|
||||||
for(int i = 0; i < nframes; i++ )
|
for(int i = 0; i < nframes; i++ )
|
||||||
{
|
{
|
||||||
out[i] = clips[clip]->getSample();
|
out[i] = clips[clip].getSample();
|
||||||
}
|
}
|
||||||
|
|
||||||
// update UI of progress
|
// update UI of progress
|
||||||
if ( uiUpdateCounter > uiUpdateConstant )
|
if ( uiUpdateCounter > uiUpdateConstant )
|
||||||
{
|
{
|
||||||
EventLooperProgress e(track, clips[clip]->getProgress() );
|
EventLooperProgress e(track, clips[clip].getProgress() );
|
||||||
writeToGuiRingbuffer( &e );
|
writeToGuiRingbuffer( &e );
|
||||||
//printf("writing event\n");
|
//printf("writing event\n");
|
||||||
uiUpdateCounter = 0;
|
uiUpdateCounter = 0;
|
||||||
|
|
|
@ -44,7 +44,7 @@ class Looper : public AudioProcessor, public TimeObserver
|
||||||
const int track;
|
const int track;
|
||||||
|
|
||||||
float* tmpRecordBuffer;
|
float* tmpRecordBuffer;
|
||||||
LooperClip* clips[10];
|
LooperClip clips[10];
|
||||||
|
|
||||||
// Pitch Shifting
|
// Pitch Shifting
|
||||||
void pitchShift(int count, float* input, float* output);
|
void pitchShift(int count, float* input, float* output);
|
||||||
|
|
Loading…
Add table
Reference in a new issue