Loopp/src/looper.hxx

60 lines
1.0 KiB
C++
Raw Normal View History

#ifndef LUPPP_LOOPER_H
#define LUPPP_LOOPER_H
#include <iostream>
#include "buffers.hxx"
#include "observer/observer.hxx"
using namespace std;
class Looper : public Observer // for notifications
{
public:
enum State {
STATE_PLAYING = 0,
STATE_PLAY_QUEUED,
STATE_RECORDING,
STATE_RECORD_QUEUED,
STATE_STOPPED,
STATE_STOP_QUEUED,
};
2013-05-15 03:17:08 +02:00
Looper(int t) :
track(t),
2013-05-15 05:20:10 +02:00
state(STATE_STOPPED),
numBeats (4),
playedBeats(0),
stopRecordOnBar(false),
endPoint (0),
playPoint (0),
lastWrittenSampleIndex(0)
{}
void bar();
void beat();
void setFpb(int f) { fpb = f; }
void setState(State s);
void setLoopLength(float l);
void process(int nframes, Buffers* buffers);
private:
2013-05-15 03:17:08 +02:00
int track;
2013-05-15 05:20:10 +02:00
State state;
int fpb;
int numBeats;
int playedBeats;
bool stopRecordOnBar;
int endPoint, playPoint, lastWrittenSampleIndex;
float sample[44100*60];
};
#endif // LUPPP_LOOPER_H