From c2997b9b1a5b831e76b1779aa957f2312a6e5089 Mon Sep 17 00:00:00 2001 From: Bent Bisballe Nyeng Date: Wed, 23 Mar 2016 22:38:44 +0100 Subject: Settings. --- drumgizmo/drumgizmoc.cc | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'drumgizmo') diff --git a/drumgizmo/drumgizmoc.cc b/drumgizmo/drumgizmoc.cc index 24d16e8..357877d 100644 --- a/drumgizmo/drumgizmoc.cc +++ b/drumgizmo/drumgizmoc.cc @@ -372,7 +372,8 @@ int CliMain::run(int argc, char* argv[]) printf("Using kitfile: %s\n", kitfile.c_str()); - DrumGizmo gizmo(oe.get(), ie.get()); + Settings settings; + DrumGizmo gizmo(settings, oe.get(), ie.get()); gizmo.setFrameSize(oe->getBufferSize()); -- cgit v1.2.3 From 057ef1d83ba263fb2adf1aa86f8e281ab0065c43 Mon Sep 17 00:00:00 2001 From: Bent Bisballe Nyeng Date: Fri, 8 Apr 2016 00:15:32 +0200 Subject: Refactoring to finally get rid of MessageHandler/Receiver in favor of the new Settings mechanism. --- drumgizmo/drumgizmoc.cc | 76 ++++++++++++++++++------------------------------- drumgizmo/drumgizmoc.h | 17 ----------- 2 files changed, 28 insertions(+), 65 deletions(-) (limited to 'drumgizmo') diff --git a/drumgizmo/drumgizmoc.cc b/drumgizmo/drumgizmoc.cc index 357877d..e993dc3 100644 --- a/drumgizmo/drumgizmoc.cc +++ b/drumgizmo/drumgizmoc.cc @@ -92,36 +92,7 @@ static const char usage_str[] = " dummy:\n" "\n"; -CliMain::CliMain() - : MessageReceiver(MSGRCV_UI) -{ - loading = true; // Block by default -} - -CliMain::~CliMain() -{ - hug_close(); -} - -void CliMain::handleMessage(Message* msg) -{ - switch(msg->type()) - { - case Message::LoadStatus: - { - auto ls = static_cast(msg); - if(ls->numer_of_files_loaded == ls->number_of_files) - { - loading = false; - } - } - break; - default: - break; - } -} - -int CliMain::run(int argc, char* argv[]) +int main(int argc, char* argv[]) { int c; @@ -383,21 +354,37 @@ int CliMain::run(int argc, char* argv[]) return 1; } - printf("Loading drumkit, this may take a while..."); - fflush(stdout); - loading = true; - while(async == false && loading) + printf("Loading drumkit, this may take a while:\n"); + + if(!async) { + while(settings.drumkit_load_status.load() != LoadStatus::Done) + { #ifdef WIN32 - SleepEx(500, FALSE); + SleepEx(10, FALSE); #else - usleep(500000); + usleep(10000); #endif /*WIN32*/ - handleMessages(); - printf("."); - fflush(stdout); + + int total = settings.number_of_files.load(); + int loaded = settings.number_of_files_loaded.load(); + + printf("\r%d of %d ", loaded, total); + fflush(stdout); + + if(settings.drumkit_load_status.load() == LoadStatus::Error) + { + printf("\nLoad error\n"); + return 1; + } + + if(loaded == total) + { + //break; + } + } + printf("\ndone\n"); } - printf("done.\n"); gizmo.setSamplerate(oe->getSamplerate()); @@ -412,14 +399,7 @@ int CliMain::run(int argc, char* argv[]) printf("Quit.\n"); fflush(stdout); - return 0; -} - -int main(int argc, char* argv[]) -{ - CliMain cli; - - cli.run(argc, argv); + hug_close(); return 0; } diff --git a/drumgizmo/drumgizmoc.h b/drumgizmo/drumgizmoc.h index 231aec6..cc2f96c 100644 --- a/drumgizmo/drumgizmoc.h +++ b/drumgizmo/drumgizmoc.h @@ -24,21 +24,4 @@ * along with DrumGizmo; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. */ - #pragma once - -#include "messagereceiver.h" - -class CliMain : public MessageReceiver -{ -public: - CliMain(); - virtual ~CliMain(); - - int run(int argc, char* argv[]); - void handleMessage(Message* msg); - -private: - bool loading; -}; - -- cgit v1.2.3 From fb7bb2ee352cf83a7596a7ed7ba2913a2257e540 Mon Sep 17 00:00:00 2001 From: Bent Bisballe Nyeng Date: Wed, 13 Apr 2016 18:30:56 +0200 Subject: New Semaphore method wait with timeout. --- drumgizmo/output/jackaudio.cc | 1 - 1 file changed, 1 deletion(-) (limited to 'drumgizmo') diff --git a/drumgizmo/output/jackaudio.cc b/drumgizmo/output/jackaudio.cc index 7710e14..abd7d4f 100644 --- a/drumgizmo/output/jackaudio.cc +++ b/drumgizmo/output/jackaudio.cc @@ -33,7 +33,6 @@ JackAudioOutputEngine::JackAudioOutputEngine(JackClient& client) : AudioOutputEngine{} , client(client) , channels{} - , sema{"jackaudio"} { client.add(*this); } -- cgit v1.2.3