diff options
author | Bent Bisballe Nyeng <deva@aasimon.org> | 2013-12-01 20:41:50 +0100 |
---|---|---|
committer | Bent Bisballe Nyeng <deva@aasimon.org> | 2013-12-01 20:41:50 +0100 |
commit | 5288afdaa77bf51fab48a7764b08fe7b7d500c82 (patch) | |
tree | 808dee10e56bebe692b5160610e81d4c6bf3717f /src | |
parent | 4eb7875822c67506b2d866e34c5e523fe32b5b3a (diff) |
Fix floting point exception. Fix AudioFile deletion prior to string evalutation.
Diffstat (limited to 'src')
-rw-r--r-- | src/drumkitloader.cc | 36 |
1 files changed, 6 insertions, 30 deletions
diff --git a/src/drumkitloader.cc b/src/drumkitloader.cc index eae9848..bf01db6 100644 --- a/src/drumkitloader.cc +++ b/src/drumkitloader.cc @@ -87,6 +87,7 @@ void DrumKitLoader::loadKit(DrumKit *kit) } fraction = total_num_audiofiles / 200; + if(fraction == 0) fraction = 1; { // Now actually queue them for loading: Instruments::iterator i = kit->instruments.begin(); @@ -128,51 +129,26 @@ void DrumKitLoader::thread_main() // Only sleep if queue is empty. if(size == 0) semaphore.wait(); - AudioFile *audiofile = NULL; - + std::string filename; { MutexAutolock l(mutex); if(load_queue.size() == 0) continue; - audiofile = load_queue.front(); + AudioFile *audiofile = load_queue.front(); load_queue.pop_front(); + filename = audiofile->filename; + audiofile->load(); } -#if 0 -#ifdef WIN32 - SleepEx(5000, FALSE); -#else - usleep(5000); -#endif/*WIN32*/ -#endif - - audiofile->load(); loaded++; if(loaded % fraction == 0 || loaded == total_num_audiofiles) { LoadStatusMessage *ls = new LoadStatusMessage(); ls->number_of_files = total_num_audiofiles; ls->numer_of_files_loaded = loaded; - ls->current_file = audiofile->filename; + ls->current_file = filename; msghandler.sendMessage(MSGRCV_UI, ls); } } DEBUG(loader, "Loader thread finished."); } - -#ifdef TEST_DRUMKITLOADER -//Additional dependency files -//deps: -//Required cflags (autoconf vars may be used) -//cflags: -//Required link options (autoconf vars may be used) -//libs: -#include "test.h" - -TEST_BEGIN; - -// TODO: Put some testcode here (see test.h for usable macros). - -TEST_END; - -#endif/*TEST_DRUMKITLOADER*/ |