-Reworked clip loading in ClipSelector

This commit is contained in:
Harry van Haaren 2013-07-27 14:15:24 +01:00
parent 864cd1637f
commit 9347dcd215
2 changed files with 7 additions and 8 deletions

View file

@ -55,13 +55,9 @@ class ClipState
ClipState()
{
state = CLIP_EMPTY;
loaded = false;
name = "";
}
ClipState(std::string n)
{
state = CLIP_EMPTY;
name = n;
}
State state;
bool loaded;
@ -96,7 +92,9 @@ class ClipSelector : public Fl_Button
// parameter. Recording won't provide a name, or "..." or something
void loadClip( int clip, std::string name = "" )
{
clips[clip].loaded = true;
clips[clip].name = name;
clips[clip].state = ClipState::CLIP_LOADED;
}
// this function converts the Looper::State into the UI represnted
@ -319,7 +317,7 @@ class ClipSelector : public Fl_Button
else if ( strcmp(m->label(), "Load") == 0 )
{
clipSelectorLoad( ID, clipNum );
clips[clipNum].state = ClipState::CLIP_LOADED;
loadClip( clipNum, "loaded" );
}
else if ( strcmp(m->label(), "1") == 0 ) {
EventLooperLoopLength e = EventLooperLoopLength(ID, 1);

View file

@ -32,7 +32,8 @@ static string choose_file()
static void clipSelectorLoad(int track, int scene)
{
AudioBuffer* ab = Worker::loadSample( choose_file() );
string filePathName = choose_file();
AudioBuffer* ab = Worker::loadSample( filePathName );
EventLooperLoad e = EventLooperLoad( track, scene, ab );
writeToDspRingbuffer( &e );
}