summaryrefslogtreecommitdiff
path: root/src/drumkitloader.cc
diff options
context:
space:
mode:
authorBent Bisballe Nyeng <deva@aasimon.org>2013-10-12 19:36:06 +0200
committerBent Bisballe Nyeng <deva@aasimon.org>2013-10-12 19:36:06 +0200
commitad906c6eef29cb39bd674948e5ae27879ed51844 (patch)
tree55ad8d0c4af38439b2696b8ecd5737edf0865223 /src/drumkitloader.cc
parentee18be9fad42203db5a6d25565d392093defccbe (diff)
Don't send a message to the GUI on /each/ file that has been loaded. Decimation is the key.
Diffstat (limited to 'src/drumkitloader.cc')
-rw-r--r--src/drumkitloader.cc14
1 files changed, 9 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.");