Commit 86034847 authored by Georg Krause's avatar Georg Krause

Disable tempo dial while a clip is recording

parent b084eb87
Pipeline #420 passed with stages
in 54 seconds
......@@ -106,6 +106,7 @@ enum EVENT_TYPE {
//
FREE_REC_MODE,
ENABLE_TEMPO_DIAL,
/// Transport etc
METRONOME_ACTIVE,
......@@ -1271,6 +1272,21 @@ public:
}
};
class EventEnableTempoDial : public EventBase {
public:
int type() {
return int( ENABLE_TEMPO_DIAL );
}
uint32_t size() {
return sizeof ( EventEnableTempoDial );
}
bool enable;
EventEnableTempoDial(bool e) {
enable = e;
}
EventEnableTempoDial (){};
};
#endif // LOOPP_EVENT_H
......@@ -152,6 +152,18 @@ void handleGuiEvents()
}
break;
}
case Event::ENABLE_TEMPO_DIAL: {
if(availableRead >= sizeof(EventEnableTempoDial)) {
EventEnableTempoDial e;
jack_ringbuffer_read ( rbToGui,
(char *)&e,
sizeof (
EventEnableTempoDial ) );
gui->getMasterTrack ()->enableTempoDial (
e.enable );
}
break;
}
case Event::LOOPER_STATE: {
if ( availableRead >= sizeof(EventLooperState) ) {
EventLooperState ev;
......
......@@ -430,6 +430,16 @@ void GMasterTrack::enableFreeRecMode ( bool e ) {
}
}
void GMasterTrack::enableTempoDial ( bool e ) {
if(e) {
tempoDial.activate ();
cout << "Enable\n";
} else {
tempoDial.deactivate ();
cout << "Disable\n";
}
}
float GMasterTrack::getBpm()
{
return bpm;
......
......@@ -67,6 +67,7 @@ public:
void beatLightEnable(bool b);
void tempoDialEnable(bool b);
void enableFreeRecMode ( bool e );
void enableTempoDial ( bool e );
Avtk::Volume *getInputVolume();
Avtk::Volume* getVolume();
......
......@@ -312,6 +312,7 @@ Jack::Jack( std::string name ) :
gui->setupMidiControllers();
recordedClips = 0;
recordingClips = 0;
}
Jack::~Jack()
......@@ -808,4 +809,20 @@ void Jack::subRecordedClip () {
EventFreeRecordMode e = EventFreeRecordMode ( false, true );
writeToGuiRingbuffer ( &e );
}
};
\ No newline at end of file
};
void Jack::addRecordingClip() {
recordingClips++;
if ( recordingClips > 0 ) {
EventEnableTempoDial e = EventEnableTempoDial ( false );
writeToGuiRingbuffer ( &e );
}
}
void Jack::subRecordingClip() {
recordingClips--;
if ( recordingClips == 0 ) {
EventEnableTempoDial e = EventEnableTempoDial ( true );
writeToGuiRingbuffer ( &e );
}
}
\ No newline at end of file
......@@ -157,6 +157,12 @@ public:
void addRecordedClip ();
void subRecordedClip ();
int getRecordingClips () {
return recordingClips;
};
void addRecordingClip ();
void subRecordingClip ();
private:
int lastnframes;
jack_client_t* client;
......@@ -172,6 +178,7 @@ private:
int clipLength;
bool freeRecMode;
unsigned int recordedClips;
unsigned int recordingClips;
vector<Looper*> loopers;
vector<JackSendReturn*> tracksendreturns;
......
......@@ -94,7 +94,10 @@ void LooperClip::save()
void LooperClip::reset()
{
if(_loaded) {
if ( _recording ) {
jack->subRecordingClip ();
}
if ( _loaded ) {
jack->subRecordedClip ();
}
init ();
......@@ -378,10 +381,14 @@ void LooperClip::setRecording()
jack->getControllerUpdater()->setSceneState(track, scene, getState());
jack->addRecordedClip ();
jack->addRecordingClip ();
}
void LooperClip::setPlaying()
{
if ( _recording ) {
jack->subRecordingClip ();
}
if ( _loaded ) {
_playing = true;
_recording = false;
......
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