diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/drumkitloader.cc | 14 | ||||
-rw-r--r-- | src/drumkitloader.h | 1 |
2 files changed, 10 insertions, 5 deletions
diff --git a/src/drumkitloader.cc b/src/drumkitloader.cc index 69f656b..a2e1923 100644 --- a/src/drumkitloader.cc +++ b/src/drumkitloader.cc @@ -86,6 +86,8 @@ void DrumKitLoader::loadKit(DrumKit *kit) } } + fraction = total_num_audiofiles / 200; + { // Now actually queue them for loading: Instruments::iterator i = kit->instruments.begin(); while(i != kit->instruments.end()) { @@ -146,11 +148,13 @@ void DrumKitLoader::thread_main() audiofile->load(); loaded++; - LoadStatusMessage *ls = new LoadStatusMessage(); - ls->number_of_files = total_num_audiofiles; - ls->numer_of_files_loaded = loaded; - ls->current_file = audiofile->filename; - msghandler.sendMessage(MSGRCV_UI, ls); + 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; + msghandler.sendMessage(MSGRCV_UI, ls); + } } DEBUG(loader, "Loader thread finished."); diff --git a/src/drumkitloader.h b/src/drumkitloader.h index be24812..0534de8 100644 --- a/src/drumkitloader.h +++ b/src/drumkitloader.h @@ -91,6 +91,7 @@ private: volatile bool running; std::list<AudioFile*> load_queue; size_t total_num_audiofiles; + size_t fraction; size_t loaded; }; |