2013-04-20 12:37:36 +02:00
|
|
|
|
|
|
|
#ifndef LUPPP_EVENT_H
|
|
|
|
#define LUPPP_EVENT_H
|
|
|
|
|
|
|
|
#include <stdint.h>
|
|
|
|
|
|
|
|
/*
|
|
|
|
event.hxx
|
|
|
|
|
|
|
|
This file provides declarations for each type of event that the engine uses.
|
|
|
|
|
|
|
|
*/
|
|
|
|
|
2013-05-13 23:04:12 +02:00
|
|
|
#include "looper.hxx"
|
|
|
|
|
2013-04-20 12:37:36 +02:00
|
|
|
namespace Event
|
|
|
|
{
|
|
|
|
enum {
|
|
|
|
MASTER_VOL,
|
|
|
|
RECORD,
|
2013-05-13 23:04:12 +02:00
|
|
|
|
2013-07-26 02:27:19 +02:00
|
|
|
TRACK_SIGNAL_LEVEL,
|
|
|
|
|
2013-05-20 00:57:12 +02:00
|
|
|
LOOPER_LOAD,
|
2013-05-13 23:04:12 +02:00
|
|
|
LOOPER_STATE,
|
2013-05-16 14:38:46 +02:00
|
|
|
LOOPER_PROGRESS,
|
2013-05-16 02:38:11 +02:00
|
|
|
LOOPER_LOOP_LENGTH,
|
|
|
|
|
2013-05-16 00:27:31 +02:00
|
|
|
METRONOME_ACTIVE,
|
2013-05-16 16:17:49 +02:00
|
|
|
|
2013-05-16 18:16:18 +02:00
|
|
|
TIME_BPM,
|
2013-05-16 18:45:46 +02:00
|
|
|
TIME_TEMPO_TAP,
|
2013-05-16 18:16:18 +02:00
|
|
|
|
2013-05-16 16:17:49 +02:00
|
|
|
GUI_PRINT,
|
2013-04-20 12:37:36 +02:00
|
|
|
};
|
|
|
|
};
|
|
|
|
|
|
|
|
using namespace Event;
|
|
|
|
|
|
|
|
class AudioBuffer;
|
|
|
|
|
|
|
|
class EventBase
|
|
|
|
{
|
|
|
|
public:
|
|
|
|
virtual ~EventBase() {}
|
|
|
|
|
|
|
|
virtual int type() = 0;
|
|
|
|
virtual uint32_t size() = 0;
|
|
|
|
};
|
|
|
|
|
|
|
|
class EventMasterVol : public EventBase
|
|
|
|
{
|
|
|
|
public:
|
|
|
|
int type() { return int(MASTER_VOL); }
|
|
|
|
uint32_t size() { return sizeof(EventMasterVol); }
|
|
|
|
float vol;
|
|
|
|
|
|
|
|
EventMasterVol(float v)
|
|
|
|
{
|
|
|
|
vol = v;
|
|
|
|
}
|
|
|
|
};
|
|
|
|
|
2013-05-13 23:04:12 +02:00
|
|
|
class EventLooperState : public EventBase
|
|
|
|
{
|
|
|
|
public:
|
|
|
|
int type() { return int(LOOPER_STATE); }
|
|
|
|
uint32_t size() { return sizeof(EventLooperState); }
|
|
|
|
|
2013-05-15 03:17:08 +02:00
|
|
|
int track;
|
2013-07-25 16:20:16 +02:00
|
|
|
int scene;
|
2013-05-13 23:04:12 +02:00
|
|
|
Looper::State state;
|
|
|
|
EventLooperState(){}
|
2013-07-25 16:20:16 +02:00
|
|
|
EventLooperState(int t, int sc, Looper::State s) : track(t), scene(sc), state(s){}
|
2013-05-13 23:04:12 +02:00
|
|
|
};
|
|
|
|
|
2013-05-16 14:38:46 +02:00
|
|
|
class EventLooperProgress : public EventBase
|
|
|
|
{
|
|
|
|
public:
|
|
|
|
int type() { return int(LOOPER_PROGRESS); }
|
|
|
|
uint32_t size() { return sizeof(EventLooperProgress); }
|
|
|
|
|
|
|
|
int track;
|
|
|
|
float progress;
|
|
|
|
EventLooperProgress(){}
|
|
|
|
EventLooperProgress(int t, float p) : track(t), progress(p) {}
|
|
|
|
};
|
|
|
|
|
2013-05-16 02:38:11 +02:00
|
|
|
class EventLooperLoopLength : public EventBase
|
|
|
|
{
|
|
|
|
public:
|
|
|
|
int type() { return int(LOOPER_LOOP_LENGTH); }
|
|
|
|
uint32_t size() { return sizeof(EventLooperLoopLength); }
|
|
|
|
|
|
|
|
int track;
|
|
|
|
float scale; // multiply length by this
|
|
|
|
EventLooperLoopLength(){}
|
|
|
|
EventLooperLoopLength(int t, float s) : track(t), scale(s){}
|
|
|
|
};
|
|
|
|
|
2013-05-20 00:57:12 +02:00
|
|
|
class EventLooperLoad : public EventBase
|
2013-04-20 12:37:36 +02:00
|
|
|
{
|
|
|
|
public:
|
2013-05-20 02:08:10 +02:00
|
|
|
int type() { return int(LOOPER_LOAD); }
|
2013-05-20 00:57:12 +02:00
|
|
|
uint32_t size() { return sizeof(EventLooperLoad); }
|
2013-04-20 12:37:36 +02:00
|
|
|
|
2013-05-20 00:57:12 +02:00
|
|
|
int track;
|
|
|
|
int clip;
|
2013-05-20 02:08:10 +02:00
|
|
|
void* audioBuffer;
|
2013-04-20 12:37:36 +02:00
|
|
|
|
2013-05-20 00:57:12 +02:00
|
|
|
EventLooperLoad(){}
|
2013-05-20 02:08:10 +02:00
|
|
|
EventLooperLoad(int t, int c, void* ab) : track(t), clip(c), audioBuffer(ab)
|
|
|
|
{
|
|
|
|
cout << "ab ptr = " << audioBuffer << endl;
|
|
|
|
}
|
2013-04-20 12:37:36 +02:00
|
|
|
};
|
|
|
|
|
2013-05-16 00:27:31 +02:00
|
|
|
class EventMetronomeActive : public EventBase
|
2013-04-20 12:37:36 +02:00
|
|
|
{
|
|
|
|
public:
|
2013-05-16 00:27:31 +02:00
|
|
|
int type() { return int(METRONOME_ACTIVE); }
|
|
|
|
uint32_t size() { return sizeof(EventMetronomeActive); }
|
2013-04-20 12:37:36 +02:00
|
|
|
|
2013-05-16 00:27:31 +02:00
|
|
|
bool active;
|
2013-04-20 12:37:36 +02:00
|
|
|
|
2013-05-16 00:27:31 +02:00
|
|
|
EventMetronomeActive() : active(false) {}
|
|
|
|
EventMetronomeActive(bool a) : active(a) {}
|
2013-04-20 12:37:36 +02:00
|
|
|
};
|
|
|
|
|
2013-05-16 18:16:18 +02:00
|
|
|
class EventTimeBPM : public EventBase
|
|
|
|
{
|
|
|
|
public:
|
|
|
|
int type() { return int(TIME_BPM); }
|
|
|
|
uint32_t size() { return sizeof(EventTimeBPM); }
|
|
|
|
|
|
|
|
float bpm;
|
|
|
|
|
|
|
|
EventTimeBPM(){}
|
|
|
|
EventTimeBPM(float b) : bpm(b) {}
|
|
|
|
};
|
|
|
|
|
2013-07-26 02:27:19 +02:00
|
|
|
class EventTrackSignalLevel : public EventBase
|
|
|
|
{
|
|
|
|
public:
|
|
|
|
int type() { return int(TRACK_SIGNAL_LEVEL); }
|
|
|
|
uint32_t size() { return sizeof(EventTrackSignalLevel); }
|
|
|
|
|
|
|
|
int track;
|
|
|
|
float left;
|
|
|
|
float right;
|
|
|
|
|
|
|
|
EventTrackSignalLevel(){}
|
|
|
|
EventTrackSignalLevel(int t, float l,float r) : track(t), left(l), right(r) {}
|
|
|
|
};
|
|
|
|
|
2013-05-16 18:45:46 +02:00
|
|
|
class EventTimeTempoTap : public EventBase
|
|
|
|
{
|
|
|
|
public:
|
|
|
|
int type() { return int(TIME_TEMPO_TAP); }
|
|
|
|
uint32_t size() { return sizeof(EventTimeTempoTap); }
|
|
|
|
|
|
|
|
// no data needed, the event itself is an "event",
|
|
|
|
// jack measures time intervals in frames & does math
|
|
|
|
EventTimeTempoTap(){}
|
|
|
|
};
|
|
|
|
|
2013-04-20 12:37:36 +02:00
|
|
|
|
2013-05-16 16:17:49 +02:00
|
|
|
// prints the string S in the GUI console
|
|
|
|
class EventGuiPrint : public EventBase
|
|
|
|
{
|
|
|
|
public:
|
|
|
|
int type() { return int(GUI_PRINT); }
|
|
|
|
uint32_t size() { return sizeof(EventGuiPrint); }
|
|
|
|
|
|
|
|
char stringArray[50];
|
|
|
|
|
|
|
|
EventGuiPrint(){}
|
|
|
|
EventGuiPrint(const char* s)
|
|
|
|
{
|
|
|
|
if ( strlen( s ) > 50 )
|
|
|
|
{
|
|
|
|
// this will be called from an RT context, and should be removed from
|
|
|
|
// production code. It is here for the programmer to notice when they
|
|
|
|
// are using code which causes too long a message.
|
|
|
|
cout << "EventGuiPrint() error! Size of string too long!" << endl;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
// move the sting into this event
|
|
|
|
strcpy( &stringArray[0], s );
|
|
|
|
}
|
|
|
|
}
|
|
|
|
char* getMessage()
|
|
|
|
{
|
|
|
|
return &stringArray[0];
|
|
|
|
}
|
|
|
|
};
|
|
|
|
|
2013-04-20 12:37:36 +02:00
|
|
|
#endif // LUPPP_EVENT_H
|
|
|
|
|