summaryrefslogtreecommitdiff
path: root/src/drumkitloader.cc
diff options
context:
space:
mode:
Diffstat (limited to 'src/drumkitloader.cc')
-rw-r--r--src/drumkitloader.cc37
1 files changed, 19 insertions, 18 deletions
diff --git a/src/drumkitloader.cc b/src/drumkitloader.cc
index 814a98d..94daf79 100644
--- a/src/drumkitloader.cc
+++ b/src/drumkitloader.cc
@@ -45,21 +45,34 @@ DrumKitLoader::DrumKitLoader(Settings& settings, DrumKit& kit,
, resamplers(resamplers)
, rand(rand)
{
- run();
- run_semaphore.wait(); // Wait for the thread to actually start.
}
DrumKitLoader::~DrumKitLoader()
{
- DEBUG(loader, "~DrumKitLoader() pre\n");
+ assert(!running);
+}
+void DrumKitLoader::init()
+{
+ run();
+ run_semaphore.wait(); // Wait for the thread to actually start.
+}
+
+void DrumKitLoader::deinit()
+{
if(running)
{
framesize_semaphore.post();
- stop();
- }
- DEBUG(loader, "~DrumKitLoader() post\n");
+ {
+ std::lock_guard<std::mutex> guard(mutex);
+ load_queue.clear();
+ }
+
+ running = false;
+ semaphore.post();
+ wait_stop();
+ }
}
bool DrumKitLoader::loadkit(const std::string& file)
@@ -140,18 +153,6 @@ void DrumKitLoader::loadKit(DrumKit *kit)
semaphore.post(); // Start loader loop.
}
-void DrumKitLoader::stop()
-{
- {
- std::lock_guard<std::mutex> guard(mutex);
- load_queue.clear();
- }
-
- running = false;
- semaphore.post();
- wait_stop();
-}
-
void DrumKitLoader::skip()
{
std::lock_guard<std::mutex> guard(mutex);