summaryrefslogtreecommitdiff
path: root/src/drumkitloader.cc
diff options
context:
space:
mode:
authorBent Bisballe Nyeng <deva@aasimon.org>2015-05-22 10:34:21 +0200
committerBent Bisballe Nyeng <deva@aasimon.org>2015-05-22 10:34:21 +0200
commitbef1d5542f926a3b942374707dd56041013d35ff (patch)
tree71161b4239db1de08d5a3ee60399a596490f3486 /src/drumkitloader.cc
parentacf59a4f960b3e45db566675551b8158b47e1554 (diff)
Added framesize control mechanism to the engine, and made us of it in the cachemanager and drumkitloader.
Diffstat (limited to 'src/drumkitloader.cc')
-rw-r--r--src/drumkitloader.cc12
1 files changed, 11 insertions, 1 deletions
diff --git a/src/drumkitloader.cc b/src/drumkitloader.cc
index 2b66ae0..413d3f4 100644
--- a/src/drumkitloader.cc
+++ b/src/drumkitloader.cc
@@ -34,6 +34,7 @@
DrumKitLoader::DrumKitLoader()
: semaphore("drumkitloader")
+ , framesize(0)
{
run();
run_semaphore.wait(); // Wait for the thread to actually start.
@@ -64,6 +65,13 @@ void DrumKitLoader::skip()
load_queue.clear();
}
+void DrumKitLoader::setFrameSize(size_t framesize)
+{
+ MutexAutolock l(mutex);
+ this->framesize = framesize;
+ framesize_semaphore.post(); // Signal that the framesize has been set.
+}
+
bool DrumKitLoader::isDone()
{
MutexAutolock l(mutex);
@@ -120,6 +128,8 @@ void DrumKitLoader::thread_main()
run_semaphore.post(); // Signal that the thread has been started.
+ framesize_semaphore.wait(); // Wait until the framesize has been set.
+
while(running) {
size_t size;
{
@@ -137,7 +147,7 @@ void DrumKitLoader::thread_main()
AudioFile *audiofile = load_queue.front();
load_queue.pop_front();
filename = audiofile->filename;
- audiofile->load(PRELOADSIZE);
+ audiofile->load(framesize * CHUNK_MULTIPLIER + framesize);
}
loaded++;