From 711c3124bb939a8edfa8e483001307826d0c5d86 Mon Sep 17 00:00:00 2001 From: Bent Bisballe Nyeng Date: Sun, 8 Feb 2015 10:30:21 +0100 Subject: [PATCH] Wait for the drumkit to get loaded before starting playback (by Sergey 'Jin' Bostandzhyan) --- drumgizmo/Makefile.am | 1 + drumgizmo/drumgizmoc.cc | 58 ++++++++++++++++++++++++++++++++++++++++++++++++- 2 files changed, 58 insertions(+), 1 deletion(-) (limited to 'drumgizmo') diff --git a/drumgizmo/Makefile.am b/drumgizmo/Makefile.am index aaef1ee..687485d 100644 --- a/drumgizmo/Makefile.am +++ b/drumgizmo/Makefile.am @@ -25,6 +25,7 @@ drumgizmo_SOURCES = \ EXTRA_DIST = \ audioinputenginedl.h \ audiooutputenginedl.h \ + drumgizmoc.h \ jackclient.h endif diff --git a/drumgizmo/drumgizmoc.cc b/drumgizmo/drumgizmoc.cc index 61f8eaa..d8479fa 100644 --- a/drumgizmo/drumgizmoc.cc +++ b/drumgizmo/drumgizmoc.cc @@ -30,8 +30,10 @@ #include #include #include +#include #include "drumgizmo.h" +#include "drumgizmoc.h" #include "audiooutputenginedl.h" #include "audioinputenginedl.h" @@ -64,7 +66,29 @@ static const char usage_str[] = " -h, --help Print this message and exit.\n" ; -int main(int argc, char *argv[]) +CliMain::CliMain() : MessageReceiver(MSGRCV_UI), loading(false) +{} + +CliMain::~CliMain() +{} + +void CliMain::handleMessage(Message *msg) +{ + switch(msg->type()) { + case Message::LoadStatus: + { + LoadStatusMessage *ls = (LoadStatusMessage*)msg; + if(ls->numer_of_files_loaded == ls->number_of_files) { + loading = false; + } + } + break; + default: + break; + } +} + +int CliMain::run(int argc, char *argv[]) { int c; @@ -243,11 +267,27 @@ int main(int argc, char *argv[]) printf("Using kitfile: %s\n", kitfile.c_str()); DrumGizmo gizmo(oe, ie); + if(kitfile == "" || !gizmo.loadkit(kitfile)) { printf("Failed to load \"%s\".\n", kitfile.c_str()); return 1; } + printf("Loading drumkit, this may take a while..."); + fflush(stdout); + loading = true; + while (loading) { +#ifdef WIN32 + SleepEx(500, FALSE); +#else + usleep(500000); +#endif/*WIN32*/ + handleMessages(); + printf("."); + fflush(stdout); + } + printf("done.\n"); + gizmo.setSamplerate(oe->samplerate()); if(!gizmo.init(preload)) { @@ -264,3 +304,19 @@ int main(int argc, char *argv[]) return 0; } + +int main(int argc, char *argv[]) +{ + + CliMain* cli = new CliMain(); + if (cli == NULL) { + printf("Could not initialize command line client\n"); + return 1; + } + + cli->run(argc, argv); + delete cli; + + return 0; + +} -- cgit v1.2.3 From 225adcb9d4b13e2b3ada5f9674729f90b91483fc Mon Sep 17 00:00:00 2001 From: Bent Bisballe Nyeng Date: Sun, 8 Feb 2015 12:10:25 +0100 Subject: [PATCH] Wait for the drumkit to get loaded before starting playback (by Sergey 'Jin' Bostandzhyan) --- drumgizmo/drumgizmoc.h | 45 +++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 45 insertions(+) create mode 100644 drumgizmo/drumgizmoc.h (limited to 'drumgizmo') diff --git a/drumgizmo/drumgizmoc.h b/drumgizmo/drumgizmoc.h new file mode 100644 index 0000000..4b6d4a1 --- /dev/null +++ b/drumgizmo/drumgizmoc.h @@ -0,0 +1,45 @@ +/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ +/*************************************************************************** + * drumgizmoc.h + * + * Mon Jan 12 00:36:37 CET 2015 + * Copyright 2015 Sergey 'Jin' Bostandzhyan + * jin@mediatomb.cc + ****************************************************************************/ + +/* + * This file is part of DrumGizmo. + * + * DrumGizmo is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * DrumGizmo is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with DrumGizmo; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. + */ + +#ifndef __DRUMGIZMOC_H__ +#define __DRUMGIZMOC_H__ + +#include "messagereceiver.h" + +class CliMain : public MessageReceiver { +public: + CliMain(); + virtual ~CliMain(); + + int run(int argc, char *argv[]); + void handleMessage(Message *msg); +private: + bool loading; +}; + +#endif//__DRUMGIZMOC_H__ + -- cgit v1.2.3 From 0fdf66b095324a7cc410589b12e682c94e664715 Mon Sep 17 00:00:00 2001 From: Jonas Suhr Christensen Date: Mon, 9 Feb 2015 20:18:40 +0100 Subject: Extended usage information. --- drumgizmo/drumgizmoc.cc | 28 +++++++++++++++++++++++----- 1 file changed, 23 insertions(+), 5 deletions(-) (limited to 'drumgizmo') diff --git a/drumgizmo/drumgizmoc.cc b/drumgizmo/drumgizmoc.cc index d8479fa..4bfd608 100644 --- a/drumgizmo/drumgizmoc.cc +++ b/drumgizmo/drumgizmoc.cc @@ -57,13 +57,31 @@ static const char usage_str[] = "Usage: %s [options] drumkitfile\n" "Options:\n" " -p, --preload Load entire kit audio files into memory (uses ALOT of memory).\n" -" -i, --inputengine dummy|test|jackmidi|midifile Use said event input engine.\n" -" -I, --inputparms parmlist Set input engine parameters.\n" -" -o, --outputengine dummy|alsa|jack|sndfile Use said audio output engine.\n" -" -O, --outputparms parmlist Set output engine parameters.\n" -" -e, --endpos Number of samples to process, -1: infinite.\n" +" -i, --inputengine dummy|test|jackmidi|midifile Use said event input engine.\n" +" -I, --inputparms parmlist Set input engine parameters.\n" +" -o, --outputengine dummy|alsa|jack|sndfile Use said audio output engine.\n" +" -O, --outputparms parmlist Set output engine parameters.\n" +" -e, --endpos Number of samples to process, -1: infinite.\n" " -v, --version Print version information and exit.\n" " -h, --help Print this message and exit.\n" +"\n" +"Input engine parameters:\n" +" jackmidi: midimap=\n" +" midifile: file=, speed= (default 1.0),\n" +" track= (default -1, all tracks)\n" +" midimap=, loop=\n" +" test: p= (default 0.1)\n" +" instr= (default -1, random instrument)\n" +" len= (default -1, forever)\n" +" dummy:\n" +"\n" +"Output engine parameters:\n" +" alsa: dev= (default 'default'), frames= (default 32)\n" +" srate= (default 441000)\n" +" wavfile: file= (default 'output'), srate= (default 44100)\n" +" jackaudio:\n" +" dummy:\n" +"\n" ; CliMain::CliMain() : MessageReceiver(MSGRCV_UI), loading(false) -- cgit v1.2.3 From 56dea4ff4571de433642ce397c199c021ee94f55 Mon Sep 17 00:00:00 2001 From: Lars Bisballe Jensen Date: Fri, 13 Feb 2015 14:28:07 +0100 Subject: Mismatch with expected option parms now fixed for jackaudio and wavfile. Was called jack and sndfile before --- drumgizmo/drumgizmoc.cc | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'drumgizmo') diff --git a/drumgizmo/drumgizmoc.cc b/drumgizmo/drumgizmoc.cc index 61f8eaa..ce4d9e2 100644 --- a/drumgizmo/drumgizmoc.cc +++ b/drumgizmo/drumgizmoc.cc @@ -57,7 +57,7 @@ static const char usage_str[] = " -p, --preload Load entire kit audio files into memory (uses ALOT of memory).\n" " -i, --inputengine dummy|test|jackmidi|midifile Use said event input engine.\n" " -I, --inputparms parmlist Set input engine parameters.\n" -" -o, --outputengine dummy|alsa|jack|sndfile Use said audio output engine.\n" +" -o, --outputengine dummy|alsa|jackaudio|wavfile Use said audio output engine.\n" " -O, --outputparms parmlist Set output engine parameters.\n" " -e, --endpos Number of samples to process, -1: infinite.\n" " -v, --version Print version information and exit.\n" @@ -110,7 +110,7 @@ int main(int argc, char *argv[]) case 'o': outputengine = optarg; if(outputengine == "help") { - printf("Available output engines: alsa, jack, sndfile.\n"); + printf("Available output engines: alsa, jackaudio, wavfile.\n"); return 0; } break; -- cgit v1.2.3 From 8660860404db3fed04a1d9373d6b90a8f173c809 Mon Sep 17 00:00:00 2001 From: Bent Bisballe Nyeng Date: Fri, 13 Feb 2015 19:37:02 +0100 Subject: Remove wavfile.la in output module dir. --- drumgizmo/output/wavfile/Makefile.am | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'drumgizmo') diff --git a/drumgizmo/output/wavfile/Makefile.am b/drumgizmo/output/wavfile/Makefile.am index ae0eb76..ad26294 100644 --- a/drumgizmo/output/wavfile/Makefile.am +++ b/drumgizmo/output/wavfile/Makefile.am @@ -26,4 +26,4 @@ wavfile_la_LIBADD = wavfile_la_SOURCES = $(wavfilebuildsources) install-exec-hook: - rm -f $(DESTDIR)$(libdir)/alsa.la + rm -f $(DESTDIR)$(libdir)/wavfile.la -- cgit v1.2.3 From 60c6a871670e586beca2a76075efe996db833a96 Mon Sep 17 00:00:00 2001 From: Lars Bisballe Jensen Date: Mon, 16 Feb 2015 12:44:19 +0100 Subject: Minor correction to options, sndfile changed to wavfile --- drumgizmo/drumgizmoc.cc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'drumgizmo') diff --git a/drumgizmo/drumgizmoc.cc b/drumgizmo/drumgizmoc.cc index 6315491..02e926e 100644 --- a/drumgizmo/drumgizmoc.cc +++ b/drumgizmo/drumgizmoc.cc @@ -59,7 +59,7 @@ static const char usage_str[] = " -a, --async-load Load drumkit in the background and start the engine immediately.\n" " -i, --inputengine dummy|test|jackmidi|midifile Use said event input engine.\n" " -I, --inputparms parmlist Set input engine parameters.\n" -" -o, --outputengine dummy|alsa|jackaudio|sndfile Use said audio output engine.\n" +" -o, --outputengine dummy|alsa|jackaudio|wavfile Use said audio output engine.\n" " -O, --outputparms parmlist Set output engine parameters.\n" " -e, --endpos Number of samples to process, -1: infinite.\n" " -v, --version Print version information and exit.\n" -- cgit v1.2.3