[SCM] calf/master: + JACK host: implement '-M index' option in JACK1-compatible way
js at users.alioth.debian.org
js at users.alioth.debian.org
Tue May 7 15:39:23 UTC 2013
The following commit has been merged in the master branch:
commit 0291ecb6dbcb001b5509411e2ad0f164544bd904
Author: Krzysztof Foltman <wdev at foltman.com>
Date: Sat Feb 28 12:37:59 2009 +0000
+ JACK host: implement '-M index' option in JACK1-compatible way
diff --git a/src/calf/jackhost.h b/src/calf/jackhost.h
index deeb182..fdf557d 100644
--- a/src/calf/jackhost.h
+++ b/src/calf/jackhost.h
@@ -105,6 +105,11 @@ public:
jack_client_close(client);
}
+ const char **get_ports(const char *name_re, const char *type_re, unsigned long flags)
+ {
+ return jack_get_ports(client, name_re, type_re, flags);
+ }
+
static int do_jack_process(jack_nframes_t nframes, void *p);
static int do_jack_bufsize(jack_nframes_t numsamples, void *p);
};
diff --git a/src/jackhost.cpp b/src/jackhost.cpp
index 17bd959..41243e3 100644
--- a/src/jackhost.cpp
+++ b/src/jackhost.cpp
@@ -199,6 +199,7 @@ struct host_session: public main_window_owner_iface, public calf_plugins::progre
// these are not saved
jack_client client;
string autoconnect_midi;
+ int autoconnect_midi_index;
set<int> chains;
vector<jack_host_base *> plugins;
main_window *main_win;
@@ -247,6 +248,7 @@ host_session::host_session()
main_win = new main_window;
main_win->set_owner(this);
progress_window = NULL;
+ autoconnect_midi_index = -1;
}
std::string host_session::get_next_instance_name(const std::string &effect_name)
@@ -465,6 +467,21 @@ void host_session::connect()
client.connect(autoconnect_midi, cnp + plugins[i]->get_midi_port()->name);
}
}
+ else
+ if (autoconnect_midi_index != -1) {
+ const char **ports = client.get_ports("(system|alsa_pcm):.*", JACK_DEFAULT_MIDI_TYPE, JackPortIsOutput);
+ for (int j = 0; ports[j]; j++)
+ {
+ if (j + 1 == autoconnect_midi_index) {
+ for (unsigned int i = 0; i < plugins.size(); i++)
+ {
+ if (plugins[i]->get_midi())
+ client.connect(ports[j], cnp + plugins[i]->get_midi_port()->name);
+ }
+ break;
+ }
+ }
+ }
}
#if USE_LASH
if (lash_client)
@@ -762,8 +779,9 @@ int main(int argc, char *argv[])
sess.midi_name = string(optarg) + "_%d";
break;
case 'M':
- if (atoi(optarg))
- sess.autoconnect_midi = "system:midi_capture_" + string(optarg);
+ if (atoi(optarg)) {
+ sess.autoconnect_midi_index = atoi(optarg);
+ }
else
sess.autoconnect_midi = string(optarg);
break;
--
calf audio plugins packaging
More information about the pkg-multimedia-commits
mailing list