...
 
Commits (6)
......@@ -84,9 +84,21 @@ int DiskReader::loadPreferences()
cJSON* ctlr = cJSON_GetArrayItem( ctlrs, i );
if( ctlr && strcmp(ctlr->valuestring, "") != 0 ) {
LOOPP_NOTE("Loading controller %s", ctlr->valuestring);
stringstream s;
s << getenv("HOME") << "/.config/soundship/loopp/controllers/" << ctlr->valuestring;
gui->addMidiControllerToSetup( s.str() );
// TODO This is a really dirty hack. This way its possible to load
// default controllers also from user installed mappings. But it will also
// generate a lot of Error messages. This needs some refactoring to be done properly.
stringstream s_home;
s_home << getenv ( "HOME" )
<< "/.config/soundship/loopp/controllers/"
<< ctlr->valuestring;
gui->addMidiControllerToSetup (
s_home.str () );
stringstream s_share;
s_share << "/usr/share/loopp/"
<< ctlr->valuestring;
gui->addMidiControllerToSetup (
s_share.str () );
}
}
} else {
......
......@@ -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
......@@ -305,7 +305,8 @@ void handleDspEvents()
if ( availableRead >= sizeof(EventTimeBPM) ) {
EventTimeBPM ev;
jack_ringbuffer_read( rbToDsp, (char*)&ev, sizeof(EventTimeBPM) );
jack->getTimeManager()->queueBpmChange(ev.bpm);
if(jack->getRecordingClips() == 0)
jack->getTimeManager()->queueBpmChange(ev.bpm);
}
break;
}
......@@ -313,7 +314,7 @@ void handleDspEvents()
if ( availableRead >= sizeof(EventTimeTempoTap) ) {
EventTimeTempoTap ev;
jack_ringbuffer_read( rbToDsp, (char*)&ev, sizeof(EventTimeTempoTap) );
if(!jack->getFreeRecMode())
if(!jack->getFreeRecMode() && jack->getRecordingClips() == 0)
jack->getTimeManager()->tap();
}
break;
......
......@@ -152,6 +152,20 @@ 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 );
gui->getMasterTrack ()->tapEnable (
e.enable );
}
break;
}
case Event::LOOPER_STATE: {
if ( availableRead >= sizeof(EventLooperState) ) {
EventLooperState ev;
......
......@@ -430,6 +430,14 @@ void GMasterTrack::enableFreeRecMode ( bool e ) {
}
}
void GMasterTrack::enableTempoDial ( bool e ) {
if(e) {
tempoDial.activate ();
} else {
tempoDial.deactivate ();
}
}
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()
......@@ -797,7 +798,6 @@ void Jack::setFreeRecMode(bool e)
void Jack::addRecordedClip () {
recordedClips++;
cout << "Recorded Clips: " << recordedClips << "\n";
if ( recordedClips > 0 ) {
EventFreeRecordMode e = EventFreeRecordMode ( false, false );
writeToGuiRingbuffer ( &e );
......@@ -805,9 +805,24 @@ void Jack::addRecordedClip () {
};
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
};
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;
......