zynaddsubfx

ZynAddSubFX open source synthesizer
Log | Files | Refs | Submodules | LICENSE

commit 7d9607d15a57d19cde979b9ce72644b66d708cf7
parent 9a4919a8743c925bf7183f7f7a3d9774b51259fd
Author: fundamental <[email protected]>
Date:   Sun, 22 Apr 2012 13:51:49 -0400

CMake: Customizable input/output options

- New compile time options
- customizable in cmake configuration
- jack set to default output
- alsa set to default input

Diffstat:
Msrc/CMakeLists.txt | 4+++-
Msrc/Nio/CMakeLists.txt | 11++---------
Msrc/Nio/EngineMgr.cpp | 22+++-------------------
Msrc/Nio/Nio.cpp | 4++--
4 files changed, 10 insertions(+), 31 deletions(-)

diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt @@ -26,7 +26,9 @@ mark_as_advanced(DSSI_LIBRARIES) # NOTE: These cache variables should normally not be changed in this # file, but either in in CMakeCache.txt before compile, or by passing # parameters directly into cmake using the -D flag. -SET (DefaultOutput alsa CACHE STRING +SET (DefaultInput alsa CACHE STRING + "Default Input module: [null, alsa, oss, jack]") +SET (DefaultOutput jack CACHE STRING "Default Output module: [null, alsa, oss, jack, portaudio]") SET (GuiModule fltk CACHE STRING "GUI module, either fltk, qt or off") SET (CompileTests ${CXXTEST_FOUND} CACHE BOOL "whether tests should be compiled in or not") diff --git a/src/Nio/CMakeLists.txt b/src/Nio/CMakeLists.txt @@ -17,15 +17,8 @@ set(zynaddsubfx_nio_SRCS set(zynaddsubfx_nio_lib ) -if (DefaultOutput STREQUAL alsa) - add_definitions(-DALSA_DEFAULT=1) -elseif(DefaultOutput STREQUAL oss) - add_definitions(-DOSS_DEFAULT=1) -elseif(DefaultOutput STREQUAL jack) - add_definitions(-DJACK_DEFAULT=1) -elseif(DefaultOutput STREQUAL portaudio) - add_definitions(-DPORTAUDIO_DEFAULT=1) -endif() +add_definitions(-DOUT_DEFAULT="${DefaultOutput}") +add_definitions(-DIN_DEFAULT="${DefaultInput}") if(JackEnable) include_directories(${JACK_INCLUDE_DIR}) diff --git a/src/Nio/EngineMgr.cpp b/src/Nio/EngineMgr.cpp @@ -30,44 +30,28 @@ EngineMgr &EngineMgr::getInstance() EngineMgr::EngineMgr() { - Engine *defaultEng = NULL; + Engine *defaultEng = new NulEngine(); //conditional compiling mess (but contained) - engines.push_back(defaultEng = new NulEngine()); + engines.push_back(defaultEng); #if OSS -#if OSS_DEFAULT - engines.push_back(defaultEng = new OssEngine()); -#else engines.push_back(new OssEngine()); #endif -#endif #if ALSA -#if ALSA_DEFAULT - engines.push_back(defaultEng = new AlsaEngine()); -#else engines.push_back(new AlsaEngine()); #endif -#endif #if JACK -#if JACK_DEFAULT - engines.push_back(defaultEng = new JackEngine()); -#else engines.push_back(new JackEngine()); #endif -#endif #if PORTAUDIO -#if PORTAUDIO_DEFAULT - engines.push_back(defaultEng = new PaEngine()); -#else engines.push_back(new PaEngine()); #endif -#endif defaultOut = dynamic_cast<AudioOut *>(defaultEng); defaultIn = dynamic_cast<MidiIn *>(defaultEng); - //Accept command line options + //Accept command line/compile time options if(!Nio::defaultSink.empty()) setOutDefault(Nio::defaultSink); diff --git a/src/Nio/Nio.cpp b/src/Nio/Nio.cpp @@ -17,8 +17,8 @@ EngineMgr *eng = NULL; string postfix; bool Nio::autoConnect = false; -string Nio::defaultSource; -string Nio::defaultSink; +string Nio::defaultSource = IN_DEFAULT; +string Nio::defaultSink = OUT_DEFAULT; bool Nio::start() {