commit ce87b9cbfb6cc7dc2003c03293a1242cffc707a7
parent ca0dafe866fca151e6807acc07857c7894242046
Author: fundamental <mark.d.mccurry@gmail.com>
Date: Mon, 25 Jul 2011 01:41:34 -0400
Nio: Added named output for jack
Adding named output based upon patch:
sf.net/tracker/?func=detail&aid=2839212&group_id=62934&atid=502314
This could be extended to other backends that have named outputs, the one one
that comes to mind is ALSA MIDI
Diffstat:
4 files changed, 26 insertions(+), 1 deletion(-)
diff --git a/src/Nio/JackEngine.cpp b/src/Nio/JackEngine.cpp
@@ -23,6 +23,7 @@
#include <fcntl.h>
#include <sys/stat.h>
+#include "Nio.h"
#include "InMgr.h"
#include "../Misc/Master.h"
@@ -52,6 +53,9 @@ bool JackEngine::connectServer(string server)
string clientname = "zynaddsubfx";
+ string postfix = Nio::getInstance().getPostfix();
+ if(!postfix.empty())
+ clientname += "_" + postfix;
jack_status_t jackstatus;
bool use_server_name = server.size() && server.compare("default") != 0;
jack_options_t jopts = (jack_options_t)
diff --git a/src/Nio/Nio.cpp b/src/Nio/Nio.cpp
@@ -16,7 +16,8 @@ Nio &Nio::getInstance()
Nio::Nio()
:in(InMgr::getInstance()),//Enable input wrapper
out(OutMgr::getInstance()),//Initialize the Output Systems
- eng(EngineMgr::getInstance())//Initialize The Engines
+ eng(EngineMgr::getInstance()),//Initialize The Engines
+ postfix("")//no default postfix
{}
Nio::~Nio()
@@ -67,6 +68,17 @@ bool Nio::setSink(string name)
{
return out.setSink(name);
}
+
+void Nio::setPostfix(std::string post)
+{
+ postfix = post;
+}
+
+std::string Nio::getPostfix(void) const
+{
+ return postfix;
+}
+
set<string> Nio::getSources() const
{
diff --git a/src/Nio/Nio.h b/src/Nio/Nio.h
@@ -21,6 +21,9 @@ class Nio
bool setSource(std::string name);
bool setSink(std::string name);
+ void setPostfix(std::string post);
+ std::string getPostfix(void) const;
+
std::set<std::string> getSources() const;
std::set<std::string> getSinks() const;
@@ -33,6 +36,7 @@ class Nio
class InMgr ∈
class OutMgr &out;
class EngineMgr ŋ
+ std::string postfix;
};
#endif
diff --git a/src/main.cpp b/src/main.cpp
@@ -293,6 +293,7 @@ int main(int argc, char *argv[])
{"no-gui", 2, NULL, 'U'},
{"dummy", 2, NULL, 'Y'},
{"help", 2, NULL, 'h'},
+ {"named", 1, NULL, 'N'},
{"output", 1, NULL, 'O'},
{"input", 1, NULL, 'I'},
{0, 0, 0, 0}
@@ -375,6 +376,9 @@ int main(int argc, char *argv[])
case 'D':
dump.startnow();
break;
+ case 'N':
+ Nio::getInstance().setPostfix(optarguments);
+ break;
case 'I':
if(optarguments) {
if(Nio::getInstance().setDefaultSource(optarguments))
@@ -405,6 +409,7 @@ int main(int argc, char *argv[])
<< " -S , --swap\t\t\t\t Swap Left <--> Right\n"
<< " -D , --dump\t\t\t\t Dumps midi note ON/OFF commands\n"
<< " -U , --no-gui\t\t\t\t Run ZynAddSubFX without user interface\n"
+ << " -N , --named\t\t\t\t postfix IO Name when possible\n"
<< " -O , --output\t\t\t\t Set Output Engine\n"
<< " -I , --input\t\t\t\t Set Input Engine" << endl;