Loopp/src/looper.hxx

74 lines
1.6 KiB
C++
Raw Normal View History

#ifndef LUPPP_LOOPER_H
#define LUPPP_LOOPER_H
#include <vector>
#include <iostream>
#include "buffers.hxx"
2013-07-27 19:34:48 +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"
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
{
public:
Looper(int t);
/// *sets* the sample
void setSample(int c, AudioBuffer* ab);
/// *sets* the new audiobuffer, but the content gets copied to the new buffer.
/// Used for infinite lenght recording
void setRequestedBuffer(int s, AudioBuffer* ab);
void midi(unsigned char* data);
2013-07-27 19:34:48 +02:00
void setFpb(int f) { /*fpb = f;*/ }
void queuePlayScene( int sc );
2013-07-27 19:24:04 +02:00
void play(int scene, bool r);
void setRecord(int scene, bool r);
LooperClip* getClip(int scene);
void updateControllers();
void process(int nframes, Buffers* buffers);
private:
const int track;
/// variables used to determing the current actions of the looper
int playingScene;
int queuedScene;
2013-07-27 19:24:04 +02:00
float* tmpRecordBuffer;
LooperClip clips[10];
2013-07-27 19:34:48 +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;
int uiUpdateConstant;
int uiUpdateCounter;
};
#endif // LUPPP_LOOPER_H