zynaddsubfx

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

commit 1bfcfae86c38c0cf1c4da2eeba3fba8d93da3183
parent 207676179e69c4d399ba971eee5c225bcbd35349
Author: fundamental <[email protected]>
Date:   Tue,  4 May 2010 12:08:48 -0400

Nio: Command line opts

Everything appears to work
new options: -I -O or --input --output
just specifiy the driver

Diffstat:
Msrc/Nio/EngineMgr.cpp | 8+++++---
Msrc/Nio/OutMgr.cpp | 54+-----------------------------------------------------
Msrc/Nio/OutMgr.h | 2--
3 files changed, 6 insertions(+), 58 deletions(-)

diff --git a/src/Nio/EngineMgr.cpp b/src/Nio/EngineMgr.cpp @@ -25,7 +25,7 @@ EngineMgr *sysEngine; EngineMgr::EngineMgr() { - Engine *defaultEng; + Engine *defaultEng = NULL; //conditional compiling mess (but contained) engines.push_back(defaultEng = new NulEngine(sysOut)); @@ -97,8 +97,9 @@ void EngineMgr::start() sysIn->current = defaultIn; //open up the default output(s) + cout << "Starting Audio: " << defaultOut->name << endl; defaultOut->setAudioEn(true); - if(defaultOut->getAudioEn()) { + if(!defaultOut->getAudioEn()) { cerr << "ERROR: The default audio output failed to open!" << endl; } else { //recover @@ -106,8 +107,9 @@ void EngineMgr::start() sysOut->currentOut->setAudioEn(true); } + cout << "Starting MIDI: " << defaultIn->name << endl; defaultIn->setMidiEn(true); - if(defaultIn->getMidiEn()) { + if(!defaultIn->getMidiEn()) { cerr << "ERROR: The default MIDI input failed to open!" << endl; } else { //recover diff --git a/src/Nio/OutMgr.cpp b/src/Nio/OutMgr.cpp @@ -32,29 +32,6 @@ OutMgr::~OutMgr() delete [] outl; } -#if 0 //reenable to get secondary inputs working -void OutMgr::add(AudioOut *driver) -{ - pthread_mutex_lock(&mutex); - unmanagedOuts.push_back(driver); - if(running())//hotplug - driver->Start(); - pthread_mutex_unlock(&mutex); -} - -void OutMgr::remove(AudioOut *out) -{ - pthread_mutex_lock(&mutex); - unmanagedOuts.remove(out); - out->Stop();//tells engine to stop - - //gives a dummy sample to make sure it is not stuck - out->out(Stereo<Sample>(Sample(SOUND_BUFFER_SIZE, 0.0), - Sample(SOUND_BUFFER_SIZE, 0.0))); - pthread_mutex_unlock(&mutex); -} -#endif - /* Sequence of a tick * 1) lets see if we have any stuff to do via midi * 2) Lets do that stuff @@ -95,38 +72,9 @@ string OutMgr::getDriver() const return currentOut->name; } -void OutMgr::run() -{ -#if 0 - defaultOut = dynamic_cast<AudioOut *>(sysEngine->defaultEng); - if(!defaultOut) { - cerr << "ERROR: It looks like someone broke the Nio Output\n" - << " Attempting to recover by defaulting to the\n" - << " Null Engine." << endl; - defaultOut = dynamic_cast<AudioOut *>(sysEngine->getEng("NULL")); - } - - currentOut = defaultOut; - //open up the default output - if(!defaultOut->Start()) { - cerr << "ERROR: The default Audio Output Failed to Open!" << endl; - } - else { - currentOut = defaultOut = dynamic_cast<AudioOut *>(sysEngine->getEng("NULL")); - defaultOut->Start(); - } -#endif -} - bool OutMgr::setSink(string name) { - AudioOut *sink = NULL; - for(list<Engine*>::iterator itr = sysEngine->engines.begin(); - itr != sysEngine->engines.end(); ++itr) { - AudioOut *out = dynamic_cast<AudioOut *>(*itr); - if(out && out->name == name) - sink = out; - } + AudioOut *sink = getOut(name); if(!sink) return false; diff --git a/src/Nio/OutMgr.h b/src/Nio/OutMgr.h @@ -38,8 +38,6 @@ class OutMgr */ std::string getDriver() const; - void run(); - bool setSink(std::string name); std::string getSink() const;