Commit d210216c authored by Georg Krause's avatar Georg Krause

Disable Free Mode if >= 1 Clip is recorded

parent 74e5ab65
Pipeline #411 passed with stages
in 2 minutes and 23 seconds
......@@ -896,6 +896,7 @@ public:
class EventFreeRecordMode : public EventBase {
public:
static const char *prettyName;
bool active;
bool enable;
const char *name() {
......@@ -911,10 +912,17 @@ public:
}
EventFreeRecordMode() {
active = true;
enable = true;
}
EventFreeRecordMode(bool a) {
active = a;
enable = true;
}
EventFreeRecordMode(bool e) {
EventFreeRecordMode ( bool a, bool e ) {
active = a;
enable = e;
}
};
......
......@@ -294,7 +294,9 @@ void handleDspEvents()
jack_ringbuffer_read(rbToDsp,
(char *)&e,
sizeof(EventFreeRecordMode));
jack->setFreeRecMode(e.enable);
if(jack->getRecordedClips() == 0)
jack->setFreeRecMode (
e.active );
}
break;
}
......
......@@ -143,12 +143,12 @@ void handleGuiEvents()
sizeof(EventFreeRecordMode));
GMasterTrack *gm =
gui->getMasterTrack();
gm->setFreeRecMode(
e.enable);
gm->metronomeEnable(!e.enable);
gm->tapEnable(!e.enable);
gm->beatLightEnable(!e.enable);
gm->tempoDialEnable(!e.enable);
gm->setFreeRecMode ( e.active );
gm->metronomeEnable ( !e.active );
gm->tapEnable ( !e.active );
gm->beatLightEnable ( !e.active );
gm->tempoDialEnable ( !e.active );
gm->enableFreeRecMode ( e.enable );
}
break;
}
......
......@@ -422,6 +422,14 @@ void GMasterTrack::setFreeRecMode(bool e) {
freeRec.value(e);
}
void GMasterTrack::enableFreeRecMode ( bool e ) {
if ( e ) {
freeRec.activate ();
} else {
freeRec.deactivate ();
}
}
float GMasterTrack::getBpm()
{
return bpm;
......
......@@ -66,6 +66,7 @@ public:
void tapEnable(bool b);
void beatLightEnable(bool b);
void tempoDialEnable(bool b);
void enableFreeRecMode ( bool e );
Avtk::Volume *getInputVolume();
Avtk::Volume* getVolume();
......
......@@ -222,7 +222,7 @@ void GridLogic::pressed( int track, int scene )
void GridLogic::clear( int track, int scene )
{
jack->getLooper( track )->getClip( scene )->init();
jack->getLooper( track )->getClip( scene )->reset();
}
void GridLogic::released( int track, int scene )
......
......@@ -311,6 +311,7 @@ Jack::Jack( std::string name ) :
// call into the GUI, telling it to register default controllers
gui->setupMidiControllers();
recordedClips = 0;
}
Jack::~Jack()
......@@ -792,4 +793,21 @@ void Jack::setFreeRecMode(bool e)
writeToGuiRingbuffer(&ev);
if(e)
getLogic()->metronomeEnable(false);
}
\ No newline at end of file
}
void Jack::addRecordedClip () {
recordedClips++;
cout << "Recorded Clips: " << recordedClips << "\n";
if ( recordedClips > 0 ) {
EventFreeRecordMode e = EventFreeRecordMode ( false, false );
writeToGuiRingbuffer ( &e );
}
};
void Jack::subRecordedClip () {
recordedClips--;
cout << "Recorded Clips: " << recordedClips << "\n";
if ( recordedClips == 0 ) {
EventFreeRecordMode e = EventFreeRecordMode ( false, true );
writeToGuiRingbuffer ( &e );
}
};
\ No newline at end of file
......@@ -149,6 +149,14 @@ public:
JackSendReturn *getJackSendReturn(int t);
float smoothing_value;
// Functions to count number of clips
int getRecordedClips () {
return recordedClips;
};
void addRecordedClip ();
void subRecordedClip ();
private:
int lastnframes;
jack_client_t* client;
......@@ -163,6 +171,7 @@ private:
int clipLength;
bool freeRecMode;
unsigned int recordedClips;
vector<Looper*> loopers;
vector<JackSendReturn*> tracksendreturns;
......
......@@ -94,7 +94,10 @@ void LooperClip::save()
void LooperClip::reset()
{
init();
if(_loaded) {
jack->subRecordedClip ();
}
init ();
}
/// loads a sample: eg from disk, unloading current sample if necessary
......@@ -374,6 +377,7 @@ void LooperClip::setRecording()
}
jack->getControllerUpdater()->setSceneState(track, scene, getState());
jack->addRecordedClip ();
}
void LooperClip::setPlaying()
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment