-Updated Looper to 0 its buffers, and APC support is improved

main
Harry van Haaren 2013-05-19 22:12:31 +01:00
parent 44396b5ed9
commit 1120f3782b
4 changed files with 14 additions and 7 deletions

View File

@ -31,8 +31,9 @@ void AkaiAPC::clipSelect(int t, int clip, ClipMode cm)
case CLIP_MODE_PLAYING: data[2] = 1; break;
case CLIP_MODE_PLAY_QUEUED: data[2] = 2; break;
case CLIP_MODE_RECORDING: data[2] = 3; break;
// case flashing red light?: data[2] = 4; break;
case CLIP_MODE_RECORD_QUEUED: data[2] = 4; break;
case CLIP_MODE_LOADED: data[2] = 5; break;
case CLIP_MODE_STOP_QUEUED: data[2] = 6; break;
}
jack->writeApcOutput( &data[0] );

View File

@ -15,12 +15,13 @@ class Controller
*/
enum ClipMode {
CLIP_MODE_EMPTY,
CLIP_MODE_PLAYING,
CLIP_MODE_PLAY_QUEUED,
CLIP_MODE_LOADED,
CLIP_MODE_STOP_QUEUED,
CLIP_MODE_RECORDING,
CLIP_MODE_RECORD_QUEUED,
CLIP_MODE_EMPTY,
};
Controller(){};

View File

@ -20,6 +20,9 @@ Looper::Looper(int t) :
playPoint (0),
lastWrittenSampleIndex(0)
{
// pre-zero the internal sample
memset( &sample[0], 0, SAMPLE_SIZE );
// init faust pitch shift variables
fSamplingFreq = 44100;
IOTA = 0;
@ -48,7 +51,7 @@ void Looper::midi(unsigned char* data)
{
case 48: setState( STATE_RECORD_QUEUED ); break;
case 53: setState( STATE_PLAY_QUEUED ); break;
case 52: setState( STATE_STOPPED ); break;
case 52: setState( STATE_STOP_QUEUED ); break;
}
}
else if ( data[0] - 128 == track )
@ -62,7 +65,7 @@ void Looper::midi(unsigned char* data)
{
switch ( data[1] )
{
case 7: gain = int(data[2])/127.f; break;
case 7: gain = int(data[2])/127.f; break;
}
}
@ -111,7 +114,7 @@ void Looper::updateControllers()
if (state == STATE_STOP_QUEUED )
{
jack->getControllerUpdater()->clipSelect(track, currentClip, Controller::CLIP_MODE_LOADED);
jack->getControllerUpdater()->clipSelect(track, currentClip, Controller::CLIP_MODE_STOP_QUEUED);
}
else if ( state == STATE_STOPPED )
{
@ -193,7 +196,7 @@ void Looper::bar()
endPoint = 0;
lastWrittenSampleIndex = 0;
}
if ( state == STATE_PLAY_QUEUED )
if ( state == STATE_STOP_QUEUED )
{
EventGuiPrint e( "Looper Q->Stopped" );
writeToGuiRingbuffer( &e );

View File

@ -8,6 +8,8 @@
#include "buffers.hxx"
#include "observer/observer.hxx"
#define SAMPLE_SIZE 44100*60
using namespace std;
class Looper : public Observer // for notifications
@ -50,7 +52,7 @@ class Looper : public Observer // for notifications
int endPoint, lastWrittenSampleIndex;
float playPoint;
float sample[44100*60];
float sample[SAMPLE_SIZE];
// Pitch Shifting
void pitchShift(int count, float* input, float* output);