summaryrefslogtreecommitdiff
path: root/drumgizmo/enginefactory.cc
diff options
context:
space:
mode:
authorChristian Glöckner <cgloeckner@freenet.de>2016-01-25 14:14:22 +0100
committerAndré Nusser <andre.nusser@googlemail.com>2016-02-09 09:03:17 +0100
commit100e2d3bd46f64df730c8a375559680c577036ef (patch)
tree952e0ce0a1c5b6efb792c50617baa1484ba51e39 /drumgizmo/enginefactory.cc
parente5a773e80bee619987aacd40cc3205acfe146e9c (diff)
applied clang-format
Diffstat (limited to 'drumgizmo/enginefactory.cc')
-rw-r--r--drumgizmo/enginefactory.cc61
1 files changed, 37 insertions, 24 deletions
diff --git a/drumgizmo/enginefactory.cc b/drumgizmo/enginefactory.cc
index 06f8141..b5368ac 100644
--- a/drumgizmo/enginefactory.cc
+++ b/drumgizmo/enginefactory.cc
@@ -29,14 +29,12 @@
#include "cpp11fix.h" // required for c++11
#include "enginefactory.h"
-EngineFactory::EngineFactory()
- : input{}
- , output{}
+EngineFactory::EngineFactory() : input{}, output {}
#ifdef USE_JACK
- , jack{nullptr}
+, jack { nullptr }
#endif
{
- // list available input engines
+// list available input engines
#ifdef HAVE_INPUT_DUMMY
input.push_back("inputdummy");
#endif
@@ -46,8 +44,8 @@ EngineFactory::EngineFactory()
#ifdef HAVE_INPUT_JACKMIDI
input.push_back("jackmidi");
#endif
-
- // list available output engines
+
+// list available output engines
#ifdef HAVE_OUTPUT_DUMMY
output.push_back("outputdummy");
#endif
@@ -63,70 +61,85 @@ EngineFactory::EngineFactory()
}
#ifdef USE_JACK
-void EngineFactory::prepareJack() {
- if (jack == nullptr) {
+void EngineFactory::prepareJack()
+{
+ if (jack == nullptr)
+ {
jack = std::make_unique<JackClient>();
}
}
#endif
-std::list<std::string> const & EngineFactory::getInputEngines() const {
+std::list<std::string> const &EngineFactory::getInputEngines() const
+{
return input;
}
-std::list<std::string> const & EngineFactory::getOutputEngines() const {
+std::list<std::string> const &EngineFactory::getOutputEngines() const
+{
return output;
}
-std::unique_ptr<AudioInputEngine> EngineFactory::createInput(std::string const & name) {
+std::unique_ptr<AudioInputEngine>
+EngineFactory::createInput(std::string const &name)
+{
#ifdef HAVE_INPUT_DUMMY
- if (name == "dummy") {
+ if (name == "dummy")
+ {
return std::make_unique<DummyInputEngine>();
}
#endif
#ifdef HAVE_INPUT_MIDIFILE
- if (name == "midifile") {
+ if (name == "midifile")
+ {
return std::make_unique<MidifileInputEngine>();
}
#endif
#ifdef HAVE_INPUT_JACKMIDI
- if (name == "jackmidi") {
+ if (name == "jackmidi")
+ {
prepareJack();
return std::make_unique<JackMidiInputEngine>(*jack);
}
#endif
-
+
// todo: add more engines
-
+
std::cerr << "[EngineFactory] Unsupported input engine '" << name << "'\n";
return nullptr;
}
-std::unique_ptr<AudioOutputEngine> EngineFactory::createOutput(std::string const & name) {
+std::unique_ptr<AudioOutputEngine>
+EngineFactory::createOutput(std::string const &name)
+{
#ifdef HAVE_OUTPUT_DUMMY
- if (name == "dummy") {
+ if (name == "dummy")
+ {
return std::make_unique<DummyOutputEngine>();
}
#endif
#ifdef HAVE_OUTPUT_WAVFILE
- if (name == "wavfile") {
+ if (name == "wavfile")
+ {
return std::make_unique<WavfileOutputEngine>();
}
#endif
#ifdef HAVE_OUTPUT_ALSA
- if (name == "alsa") {
+ if (name == "alsa")
+ {
return std::make_unique<AlsaOutputEngine>();
}
#endif
#ifdef HAVE_OUTPUT_JACKAUDIO
- if (name == "jackaudio") {
+ if (name == "jackaudio")
+ {
prepareJack();
return std::make_unique<JackAudioOutputEngine>(*jack);
}
#endif
-
+
// todo: add more engines
-
+
std::cerr << "[EngineFactory] Unsupported output engine '" << name << "'\n";
return nullptr;
}