2013-05-13 23:04:12 +02:00
|
|
|
|
|
|
|
#ifndef LUPPP_LOOPER_H
|
|
|
|
#define LUPPP_LOOPER_H
|
|
|
|
|
2013-05-17 10:24:24 +02:00
|
|
|
#include <vector>
|
2013-05-13 23:04:12 +02:00
|
|
|
#include <iostream>
|
|
|
|
|
|
|
|
#include "buffers.hxx"
|
2013-07-27 19:34:48 +02:00
|
|
|
|
2013-07-27 23:36:58 +02:00
|
|
|
#include "audioprocessor.hxx"
|
2013-07-27 19:34:48 +02:00
|
|
|
|
|
|
|
#include "looperclip.hxx"
|
2013-07-31 11:55:48 +02:00
|
|
|
#include "observer/time.hxx"
|
2013-05-15 03:55:51 +02:00
|
|
|
|
2013-05-13 23:04:12 +02:00
|
|
|
using namespace std;
|
|
|
|
|
2013-07-27 19:24:04 +02:00
|
|
|
/** Looper
|
|
|
|
* The class which reads from LooperClips, and reads/ writes the data using the
|
|
|
|
* track buffer. Scene recording / playback is the essential functionality here.
|
|
|
|
**/
|
2013-07-31 11:55:48 +02:00
|
|
|
class Looper : public AudioProcessor, public TimeObserver
|
2013-05-13 23:04:12 +02:00
|
|
|
{
|
|
|
|
public:
|
2013-05-17 10:24:24 +02:00
|
|
|
Looper(int t);
|
2013-05-13 23:04:12 +02:00
|
|
|
|
2013-08-06 23:20:37 +02:00
|
|
|
/// *sets* the sample
|
2013-05-20 02:08:10 +02:00
|
|
|
void setSample(int c, AudioBuffer* ab);
|
2013-05-20 00:57:12 +02:00
|
|
|
|
2013-08-06 23:20:37 +02:00
|
|
|
/// *sets* the new audiobuffer, but the content gets copied to the new buffer.
|
|
|
|
/// Used for infinite lenght recording
|
|
|
|
void setRequestedBuffer(int s, AudioBuffer* ab);
|
|
|
|
|
2013-05-18 20:52:12 +02:00
|
|
|
void midi(unsigned char* data);
|
2013-05-18 17:37:03 +02:00
|
|
|
|
2013-07-27 19:34:48 +02:00
|
|
|
void setFpb(int f) { /*fpb = f;*/ }
|
2013-05-13 23:04:12 +02:00
|
|
|
|
2013-08-01 20:58:26 +02:00
|
|
|
void queuePlayScene( int sc );
|
2013-07-27 19:24:04 +02:00
|
|
|
|
2013-08-07 01:33:38 +02:00
|
|
|
void play(int scene, bool r);
|
2013-08-07 01:16:27 +02:00
|
|
|
void setRecord(int scene, bool r);
|
|
|
|
|
2013-05-15 03:55:51 +02:00
|
|
|
|
2013-07-27 20:06:28 +02:00
|
|
|
LooperClip* getClip(int scene);
|
|
|
|
|
2013-05-19 03:01:22 +02:00
|
|
|
void updateControllers();
|
2013-05-16 14:38:46 +02:00
|
|
|
void process(int nframes, Buffers* buffers);
|
2013-05-13 23:04:12 +02:00
|
|
|
|
|
|
|
private:
|
2013-05-18 20:52:12 +02:00
|
|
|
const int track;
|
2013-05-15 05:05:36 +02:00
|
|
|
|
2013-08-01 20:58:26 +02:00
|
|
|
/// variables used to determing the current actions of the looper
|
|
|
|
int playingScene;
|
|
|
|
int queuedScene;
|
|
|
|
|
2013-07-27 19:24:04 +02:00
|
|
|
float* tmpRecordBuffer;
|
2013-07-31 12:46:45 +02:00
|
|
|
LooperClip clips[10];
|
2013-07-27 19:34:48 +02:00
|
|
|
|
2013-05-17 10:24:24 +02:00
|
|
|
// Pitch Shifting
|
|
|
|
void pitchShift(int count, float* input, float* output);
|
|
|
|
vector<float> tmpBuffer;
|
|
|
|
int IOTA;
|
|
|
|
float fVec0[65536];
|
|
|
|
float semitoneShift;
|
|
|
|
float windowSize;
|
|
|
|
float fRec0[2];
|
|
|
|
float crossfadeSize;
|
|
|
|
float fSamplingFreq;
|
2013-07-30 19:34:47 +02:00
|
|
|
|
|
|
|
int uiUpdateConstant;
|
|
|
|
int uiUpdateCounter;
|
2013-05-13 23:04:12 +02:00
|
|
|
};
|
|
|
|
|
|
|
|
#endif // LUPPP_LOOPER_H
|