Free Rec Mode Button works now

main
Georg Krause 2019-06-06 10:31:01 +02:00
parent 307a28a84a
commit f41d76b3d7
8 changed files with 83 additions and 4 deletions

View File

@ -47,6 +47,7 @@ const char *EventAutoStopRecClipLengthUp::prettyName =
"auto_stop_rec:clip_length_up"; "auto_stop_rec:clip_length_up";
const char *EventAutoStopRecClipLengthDown::prettyName = const char *EventAutoStopRecClipLengthDown::prettyName =
"auto_stop_rec:clip_length_down"; "auto_stop_rec:clip_length_down";
const char *EventFreeRecordMode::prettyName = "master:free_rec_mode";
EVENT_TYPE Event::getTypeFromName(const char* name) EVENT_TYPE Event::getTypeFromName(const char* name)
{ {

View File

@ -65,11 +65,11 @@ enum EVENT_TYPE {
MASTER_RETURN, MASTER_RETURN,
RECORD, RECORD,
SESSION_SAVE, // save hole session SESSION_SAVE, // save hole session
CLIP_SAVE, // save single clip CLIP_SAVE, // save single clip
STATE_RESET, // reset all state STATE_RESET, // reset all state
STATE_SAVE_FINISH,// save action finished, flush metadata to disk STATE_SAVE_FINISH, // save action finished, flush metadata to disk
STATE_SAVE_BUFFER,// save an individual AudioBuffer* to disk STATE_SAVE_BUFFER, // save an individual AudioBuffer* to disk
REQUEST_SAVE_BUFFER, // gets an audioBuffer of a certain size REQUEST_SAVE_BUFFER, // gets an audioBuffer of a certain size
@ -104,6 +104,9 @@ enum EVENT_TYPE {
AUTO_STOP_REC_CLIP_LENGTH_UP, AUTO_STOP_REC_CLIP_LENGTH_UP,
AUTO_STOP_REC_CLIP_LENGTH_DOWN, AUTO_STOP_REC_CLIP_LENGTH_DOWN,
//
FREE_REC_MODE,
/// Transport etc /// Transport etc
METRONOME_ACTIVE, METRONOME_ACTIVE,
METRONOME_VOLUME, METRONOME_VOLUME,
@ -890,6 +893,32 @@ public:
EventAutoStopRecClipLength(int l) : clipLength(l) {} EventAutoStopRecClipLength(int l) : clipLength(l) {}
}; };
class EventFreeRecordMode : public EventBase {
public:
static const char *prettyName;
bool enable;
const char *name() {
return prettyName;
}
int type() {
return int(FREE_REC_MODE);
}
uint32_t size() {
return sizeof(EventFreeRecordMode);
}
EventFreeRecordMode() {
enable = true;
}
EventFreeRecordMode(bool e) {
enable = e;
}
};
class EventAutoStopRecClipLengthUp : public EventBase { class EventAutoStopRecClipLengthUp : public EventBase {
public: public:
static const char *prettyName; static const char *prettyName;

View File

@ -284,6 +284,17 @@ void handleDspEvents()
break; break;
} }
case Event::FREE_REC_MODE: {
if(availableRead >= sizeof(EventFreeRecordMode)) {
EventFreeRecordMode e;
jack_ringbuffer_read(rbToDsp,
(char *)&e,
sizeof(EventFreeRecordMode));
jack->setFreeRecMode(e.enable);
}
break;
}
case Event::TIME_BPM: { case Event::TIME_BPM: {
if ( availableRead >= sizeof(EventTimeBPM) ) { if ( availableRead >= sizeof(EventTimeBPM) ) {
EventTimeBPM ev; EventTimeBPM ev;

View File

@ -135,6 +135,17 @@ void handleGuiEvents()
} }
break; break;
} }
case Event::FREE_REC_MODE: {
if(availableRead >= sizeof(EventFreeRecordMode)) {
EventFreeRecordMode e;
jack_ringbuffer_read(rbToGui,
(char *)&e,
sizeof(EventFreeRecordMode));
gui->getMasterTrack()->setFreeRecMode(
e.enable);
}
break;
}
case Event::LOOPER_STATE: { case Event::LOOPER_STATE: {
if ( availableRead >= sizeof(EventLooperState) ) { if ( availableRead >= sizeof(EventLooperState) ) {
EventLooperState ev; EventLooperState ev;

View File

@ -231,6 +231,12 @@ static void gmastertrack_autoStopRec_callback(Fl_Widget *w, void *data) {
} }
} }
static void gmastertrack_freeRecMode_callback(Fl_Widget *w, void *data) {
Avtk::LightButton *b = (Avtk::LightButton *)w;
EventFreeRecordMode e = EventFreeRecordMode(!b->value());
writeToDspRingbuffer(&e);
}
#define OFST 55 #define OFST 55
#define COLUMN_RIGHT x + w * 2 / 4.f - 15 #define COLUMN_RIGHT x + w * 2 / 4.f - 15
#define COLUMN_LEFT x + w * 1 / 4.f - 26 #define COLUMN_LEFT x + w * 1 / 4.f - 26
@ -283,6 +289,8 @@ GMasterTrack::GMasterTrack(int x, int y, int w, int h, const char *l)
metronomeButton.callback( gmastertrack_button_callback, 0 ); metronomeButton.callback( gmastertrack_button_callback, 0 );
autoStopRecButton.callback(gmastertrack_autoStopRec_callback, &ID); autoStopRecButton.callback(gmastertrack_autoStopRec_callback, &ID);
freeRec.callback(gmastertrack_freeRecMode_callback, &ID);
freeRec.value(0);
tempoDial.callback( gmastertrack_tempoDial_callback, 0 ); tempoDial.callback( gmastertrack_tempoDial_callback, 0 );
@ -377,6 +385,10 @@ GMasterTrack::setClipLength(int l)
autoStopRecButton.copy_label(str); autoStopRecButton.copy_label(str);
} }
void GMasterTrack::setFreeRecMode(bool e) {
freeRec.value(e);
}
float GMasterTrack::getBpm() float GMasterTrack::getBpm()
{ {
return bpm; return bpm;

View File

@ -61,6 +61,7 @@ public:
void metronomeEnable( bool b ); void metronomeEnable( bool b );
void void
setClipLength(int l); setClipLength(int l);
void setFreeRecMode(bool e);
Avtk::Volume* getInputVolume(); Avtk::Volume* getInputVolume();
Avtk::Volume* getVolume(); Avtk::Volume* getVolume();

View File

@ -782,4 +782,12 @@ Jack::setClipLength(int l)
EventAutoStopRecClipLength e = EventAutoStopRecClipLength(clipLength); EventAutoStopRecClipLength e = EventAutoStopRecClipLength(clipLength);
writeToGuiRingbuffer(&e); writeToGuiRingbuffer(&e);
}
void Jack::setFreeRecMode(bool e)
{
freeRecMode = e;
EventFreeRecordMode ev = EventFreeRecordMode(e);
writeToGuiRingbuffer(&ev);
} }

View File

@ -93,6 +93,9 @@ public:
{ {
return clipLength; return clipLength;
} }
bool getFreeRecMode() {
return freeRecMode;
}
GridLogic* getGridLogic() GridLogic* getGridLogic()
{ {
return gridLogic; return gridLogic;
@ -126,6 +129,7 @@ public:
void void
setClipLength(int l); setClipLength(int l);
void setFreeRecMode(bool e);
jack_client_t* getJackClientPointer() jack_client_t* getJackClientPointer()
{ {
@ -158,6 +162,8 @@ private:
ControllerUpdater* controllerUpdater; ControllerUpdater* controllerUpdater;
int clipLength; int clipLength;
bool freeRecMode;
vector<Looper*> loopers; vector<Looper*> loopers;
vector<JackSendReturn*> tracksendreturns; vector<JackSendReturn*> tracksendreturns;
vector<TrackOutput*> trackOutputs; vector<TrackOutput*> trackOutputs;