...
 
Commits (5)
...@@ -106,6 +106,7 @@ enum EVENT_TYPE { ...@@ -106,6 +106,7 @@ enum EVENT_TYPE {
// //
FREE_REC_MODE, FREE_REC_MODE,
ENABLE_TEMPO_DIAL,
/// Transport etc /// Transport etc
METRONOME_ACTIVE, METRONOME_ACTIVE,
...@@ -1271,6 +1272,21 @@ public: ...@@ -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 #endif // LOOPP_EVENT_H
...@@ -305,7 +305,8 @@ void handleDspEvents() ...@@ -305,7 +305,8 @@ void handleDspEvents()
if ( availableRead >= sizeof(EventTimeBPM) ) { if ( availableRead >= sizeof(EventTimeBPM) ) {
EventTimeBPM ev; EventTimeBPM ev;
jack_ringbuffer_read( rbToDsp, (char*)&ev, sizeof(EventTimeBPM) ); jack_ringbuffer_read( rbToDsp, (char*)&ev, sizeof(EventTimeBPM) );
jack->getTimeManager()->queueBpmChange(ev.bpm); if(jack->getRecordingClips() == 0)
jack->getTimeManager()->queueBpmChange(ev.bpm);
} }
break; break;
} }
...@@ -313,7 +314,7 @@ void handleDspEvents() ...@@ -313,7 +314,7 @@ void handleDspEvents()
if ( availableRead >= sizeof(EventTimeTempoTap) ) { if ( availableRead >= sizeof(EventTimeTempoTap) ) {
EventTimeTempoTap ev; EventTimeTempoTap ev;
jack_ringbuffer_read( rbToDsp, (char*)&ev, sizeof(EventTimeTempoTap) ); jack_ringbuffer_read( rbToDsp, (char*)&ev, sizeof(EventTimeTempoTap) );
if(!jack->getFreeRecMode()) if(!jack->getFreeRecMode() && jack->getRecordingClips() == 0)
jack->getTimeManager()->tap(); jack->getTimeManager()->tap();
} }
break; break;
......
...@@ -152,6 +152,20 @@ void handleGuiEvents() ...@@ -152,6 +152,20 @@ void handleGuiEvents()
} }
break; 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 );
gui->getMasterTrack ()->tapEnable (
e.enable );
}
break;
}
case Event::LOOPER_STATE: { case Event::LOOPER_STATE: {
if ( availableRead >= sizeof(EventLooperState) ) { if ( availableRead >= sizeof(EventLooperState) ) {
EventLooperState ev; EventLooperState ev;
......
...@@ -430,6 +430,14 @@ void GMasterTrack::enableFreeRecMode ( bool e ) { ...@@ -430,6 +430,14 @@ void GMasterTrack::enableFreeRecMode ( bool e ) {
} }
} }
void GMasterTrack::enableTempoDial ( bool e ) {
if(e) {
tempoDial.activate ();
} else {
tempoDial.deactivate ();
}
}
float GMasterTrack::getBpm() float GMasterTrack::getBpm()
{ {
return bpm; return bpm;
......
...@@ -67,6 +67,7 @@ public: ...@@ -67,6 +67,7 @@ public:
void beatLightEnable(bool b); void beatLightEnable(bool b);
void tempoDialEnable(bool b); void tempoDialEnable(bool b);
void enableFreeRecMode ( bool e ); void enableFreeRecMode ( bool e );
void enableTempoDial ( bool e );
Avtk::Volume *getInputVolume(); Avtk::Volume *getInputVolume();
Avtk::Volume* getVolume(); Avtk::Volume* getVolume();
......
...@@ -312,6 +312,7 @@ Jack::Jack( std::string name ) : ...@@ -312,6 +312,7 @@ Jack::Jack( std::string name ) :
gui->setupMidiControllers(); gui->setupMidiControllers();
recordedClips = 0; recordedClips = 0;
recordingClips = 0;
} }
Jack::~Jack() Jack::~Jack()
...@@ -797,7 +798,6 @@ void Jack::setFreeRecMode(bool e) ...@@ -797,7 +798,6 @@ void Jack::setFreeRecMode(bool e)
void Jack::addRecordedClip () { void Jack::addRecordedClip () {
recordedClips++; recordedClips++;
cout << "Recorded Clips: " << recordedClips << "\n";
if ( recordedClips > 0 ) { if ( recordedClips > 0 ) {
EventFreeRecordMode e = EventFreeRecordMode ( false, false ); EventFreeRecordMode e = EventFreeRecordMode ( false, false );
writeToGuiRingbuffer ( &e ); writeToGuiRingbuffer ( &e );
...@@ -805,9 +805,24 @@ void Jack::addRecordedClip () { ...@@ -805,9 +805,24 @@ void Jack::addRecordedClip () {
}; };
void Jack::subRecordedClip () { void Jack::subRecordedClip () {
recordedClips--; recordedClips--;
cout << "Recorded Clips: " << recordedClips << "\n";
if ( recordedClips == 0 ) { if ( recordedClips == 0 ) {
EventFreeRecordMode e = EventFreeRecordMode ( false, true ); EventFreeRecordMode e = EventFreeRecordMode ( false, true );
writeToGuiRingbuffer ( &e ); 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: ...@@ -157,6 +157,12 @@ public:
void addRecordedClip (); void addRecordedClip ();
void subRecordedClip (); void subRecordedClip ();
int getRecordingClips () {
return recordingClips;
};
void addRecordingClip ();
void subRecordingClip ();
private: private:
int lastnframes; int lastnframes;
jack_client_t* client; jack_client_t* client;
...@@ -172,6 +178,7 @@ private: ...@@ -172,6 +178,7 @@ private:
int clipLength; int clipLength;
bool freeRecMode; bool freeRecMode;
unsigned int recordedClips; unsigned int recordedClips;
unsigned int recordingClips;
vector<Looper*> loopers; vector<Looper*> loopers;
vector<JackSendReturn*> tracksendreturns; vector<JackSendReturn*> tracksendreturns;
......
...@@ -94,7 +94,10 @@ void LooperClip::save() ...@@ -94,7 +94,10 @@ void LooperClip::save()
void LooperClip::reset() void LooperClip::reset()
{ {
if(_loaded) { if ( _recording ) {
jack->subRecordingClip ();
}
if ( _loaded ) {
jack->subRecordedClip (); jack->subRecordedClip ();
} }
init (); init ();
...@@ -378,10 +381,14 @@ void LooperClip::setRecording() ...@@ -378,10 +381,14 @@ void LooperClip::setRecording()
jack->getControllerUpdater()->setSceneState(track, scene, getState()); jack->getControllerUpdater()->setSceneState(track, scene, getState());
jack->addRecordedClip (); jack->addRecordedClip ();
jack->addRecordingClip ();
} }
void LooperClip::setPlaying() void LooperClip::setPlaying()
{ {
if ( _recording ) {
jack->subRecordingClip ();
}
if ( _loaded ) { if ( _loaded ) {
_playing = true; _playing = true;
_recording = false; _recording = false;
......