Unify of single clips and the hole session
This introduces a new Event, called EventSaveClip which starts saving of a single clip. On the other side, the confusing and not anymore needed no_dealloc option in the EventStateSaveBuffer was removed. I think this is now easier to understand. Possible problem: The differentiation of the saving location is done by checking if gui->saveBufferPath is set, feedback here is welcome.main
parent
7961658933
commit
0b5b7bf199
|
@ -65,7 +65,8 @@ enum EVENT_TYPE {
|
||||||
MASTER_RETURN,
|
MASTER_RETURN,
|
||||||
RECORD,
|
RECORD,
|
||||||
|
|
||||||
SESSION_SAVE, // save action
|
SESSION_SAVE, // save hole session
|
||||||
|
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
|
||||||
|
@ -550,6 +551,25 @@ public:
|
||||||
EventSessionSave() {}
|
EventSessionSave() {}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
class EventClipSave : public EventBase
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
int type()
|
||||||
|
{
|
||||||
|
return int(CLIP_SAVE);
|
||||||
|
}
|
||||||
|
uint32_t size()
|
||||||
|
{
|
||||||
|
return sizeof(EventClipSave);
|
||||||
|
}
|
||||||
|
|
||||||
|
int track;
|
||||||
|
int scene;
|
||||||
|
|
||||||
|
EventClipSave(): track(0), scene(0) {};
|
||||||
|
EventClipSave(int t, int s): track(t), scene(s) {}
|
||||||
|
};
|
||||||
|
|
||||||
class EventStateReset : public EventBase
|
class EventStateReset : public EventBase
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
|
@ -1034,9 +1054,8 @@ public:
|
||||||
int scene;
|
int scene;
|
||||||
// pointer to the AudioBuffer to be saved
|
// pointer to the AudioBuffer to be saved
|
||||||
AudioBuffer* ab;
|
AudioBuffer* ab;
|
||||||
bool no_dealloc;
|
|
||||||
|
|
||||||
EventStateSaveBuffer(): track(0), scene(0), ab(0), no_dealloc(0) {}
|
EventStateSaveBuffer(): track(0), scene(0), ab(0) {}
|
||||||
EventStateSaveBuffer(int t, int s, AudioBuffer* a): track(t), scene(s), ab(a) {}
|
EventStateSaveBuffer(int t, int s, AudioBuffer* a): track(t), scene(s), ab(a) {}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
@ -107,19 +107,14 @@ void handleDspEvents()
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case Event::STATE_SAVE_BUFFER: {
|
case Event::CLIP_SAVE: {
|
||||||
if ( availableRead >= sizeof(EventStateReset) ) {
|
if ( availableRead >= sizeof(EventClipSave) ) {
|
||||||
EventStateSaveBuffer ev;
|
EventClipSave ev;
|
||||||
jack_ringbuffer_read( rbToDsp, (char*)&ev, sizeof(EventStateSaveBuffer) );
|
jack_ringbuffer_read( rbToDsp, (char*)&ev, sizeof(EventClipSave) );
|
||||||
printf("jack got save buffer in %d, %d\n", ev.track, ev.scene);
|
printf("jack got save buffer in %d, %d\n", ev.track, ev.scene);
|
||||||
LooperClip* lc = jack->getLooper(ev.track)->getClip(ev.scene);
|
LooperClip* lc = jack->getLooper(ev.track)->getClip(ev.scene);
|
||||||
if(!lc) break;
|
if(!lc) break;
|
||||||
EventStateSaveBuffer e;
|
lc->save();
|
||||||
e.track = ev.track;
|
|
||||||
e.scene = ev.scene;
|
|
||||||
e.ab = lc->getAudioBuffer();
|
|
||||||
e.no_dealloc = 1;
|
|
||||||
writeToGuiRingbuffer( &e );
|
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
|
@ -214,14 +214,10 @@ void handleGuiEvents()
|
||||||
#ifdef DEBUG_SAVE
|
#ifdef DEBUG_SAVE
|
||||||
cout << "EventSaveBuffer: " << ev.track << " " << ev.scene << " " << ev.ab->getID() << endl;
|
cout << "EventSaveBuffer: " << ev.track << " " << ev.scene << " " << ev.ab->getID() << endl;
|
||||||
#endif
|
#endif
|
||||||
gui->getDiskWriter()->writeAudioBuffer( ev.track, ev.scene, ev.ab );
|
if(gui->saveBufferPath.empty()) {
|
||||||
// de allocate the AudioBuffer only if reqested
|
|
||||||
if(!ev.no_dealloc) {
|
|
||||||
gui->getDiskWriter()->writeAudioBuffer( ev.track, ev.scene, ev.ab );
|
gui->getDiskWriter()->writeAudioBuffer( ev.track, ev.scene, ev.ab );
|
||||||
delete ev.ab;
|
|
||||||
} else {
|
} else {
|
||||||
gui->getDiskWriter()->writeAudioBuffer(ev.track, ev.scene, ev.ab,
|
gui->getDiskWriter()->writeAudioBuffer(ev.track, ev.scene, ev.ab, gui->saveBufferPath.c_str());
|
||||||
gui->saveBufferPath.c_str());
|
|
||||||
gui->saveBufferPath = "";
|
gui->saveBufferPath = "";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -247,10 +247,8 @@ string Gui::getProjectsDir()
|
||||||
|
|
||||||
void Gui::selectSaveSample( int track, int scene )
|
void Gui::selectSaveSample( int track, int scene )
|
||||||
{
|
{
|
||||||
EventStateSaveBuffer e;
|
EventClipSave e = EventClipSave(track, scene);
|
||||||
e.track = track,
|
writeToDspRingbuffer( &e );
|
||||||
e.scene = scene,
|
|
||||||
writeToDspRingbuffer( &e );
|
|
||||||
}
|
}
|
||||||
|
|
||||||
char *
|
char *
|
||||||
|
|
Loading…
Reference in New Issue