summaryrefslogtreecommitdiff
path: root/drumgizmo/enginefactory.h
diff options
context:
space:
mode:
authorChristian Glöckner <cgloeckner@freenet.de>2016-01-22 12:55:09 +0100
committerAndré Nusser <andre.nusser@googlemail.com>2016-02-09 09:03:16 +0100
commitb2b5116d8c3451f4f5699e328b46beea6c994d21 (patch)
tree6e543f55560a9c9832b2ad8deffa362ff3f7bbc1 /drumgizmo/enginefactory.h
parente30fbdecd1e80c2145eac9a9e97d6b0ee14343b2 (diff)
improved engine factory structure
Diffstat (limited to 'drumgizmo/enginefactory.h')
-rw-r--r--drumgizmo/enginefactory.h54
1 files changed, 47 insertions, 7 deletions
diff --git a/drumgizmo/enginefactory.h b/drumgizmo/enginefactory.h
index 93ce67b..c599040 100644
--- a/drumgizmo/enginefactory.h
+++ b/drumgizmo/enginefactory.h
@@ -25,18 +25,58 @@
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA.
*/
#pragma once
+#include <list>
+#include <string>
#include <memory>
#include "cpp11fix.h" // required for c++11
#include "audioinputengine.h"
#include "audiooutputengine.h"
-// todo: ifdef jack enabled
-#include "jackclient.h"
+#if defined(HAVE_INPUT_JACKMIDI) || defined(HAVE_OUTPUT_JACKAUDIO)
+ #define USE_JACK
+ #include "jackclient.h"
+#endif
-using JackClientPtr = std::unique_ptr<JackClient>;
-using InputEnginePtr = std::unique_ptr<AudioInputEngine>;
-using OutputEnginePtr = std::unique_ptr<AudioOutputEngine>;
+#ifdef HAVE_INPUT_DUMMY
+ #include "input/inputdummy.h"
+#endif
-InputEnginePtr createInputEngine(JackClientPtr& jack, std::string const & name);
-OutputEnginePtr createOutputEngine(JackClientPtr& jack, std::string const & name);
+#ifdef HAVE_INPUT_MIDIFILE
+ #include "input/midifile.h"
+#endif
+
+#ifdef HAVE_OUTPUT_DUMMY
+ #include "output/outputdummy.h"
+#endif
+
+#ifdef HAVE_OUTPUT_WAVFILE
+ #include "output/wavfile.h"
+#endif
+
+#ifdef HAVE_OUTPUT_ALSA
+ #include "output/alsa.h"
+#endif
+
+#ifdef HAVE_OUTPUT_JACKAUDIO
+ #include "output/jackaudio.h"
+#endif
+
+class EngineFactory {
+ private:
+ std::list<std::string> input, output; // available engines
+#ifdef USE_JACK
+ std::unique_ptr<JackClient> jack;
+
+ void prepareJack();
+#endif
+
+ public:
+ EngineFactory();
+
+ std::list<std::string> const & getInputEngines() const;
+ std::list<std::string> const & getOutputEngines() const;
+
+ std::unique_ptr<AudioInputEngine> createInput(std::string const & name);
+ std::unique_ptr<AudioOutputEngine> createOutput(std::string const & name);
+};