summaryrefslogtreecommitdiff
path: root/libs/ardour/audioengine.cc
diff options
context:
space:
mode:
authorPaul Davis <paul@linuxaudiosystems.com>2010-06-26 13:45:59 +0000
committerPaul Davis <paul@linuxaudiosystems.com>2010-06-26 13:45:59 +0000
commit37978aa21437b9bb308efeb9828fbe4a06077cee (patch)
treef7b3b681e0e42c233ded6715ea824114d9e5c3ec /libs/ardour/audioengine.cc
parentecb0cd5d119d28092a8f48e4521ac5eba197bb54 (diff)
lots of details relating to MIDI file management; try to ignore ALSA sequencer MIDI ports named "Midi-Through"
git-svn-id: svn://localhost/ardour2/branches/3.0@7305 d708f5d6-7413-0410-9779-e7cbd77b26cf
Diffstat (limited to 'libs/ardour/audioengine.cc')
-rw-r--r--libs/ardour/audioengine.cc41
1 files changed, 31 insertions, 10 deletions
diff --git a/libs/ardour/audioengine.cc b/libs/ardour/audioengine.cc
index 2282a20809..79aa5d9ff8 100644
--- a/libs/ardour/audioengine.cc
+++ b/libs/ardour/audioengine.cc
@@ -1109,16 +1109,21 @@ AudioEngine::n_physical_outputs (DataType type) const
{
GET_PRIVATE_JACK_POINTER_RET (_jack,0);
const char ** ports;
- uint32_t i = 0;
+ uint32_t cnt = 0;
if ((ports = jack_get_ports (_priv_jack, NULL, type.to_jack_type(), JackPortIsPhysical|JackPortIsInput)) == 0) {
return 0;
}
- for (i = 0; ports[i]; ++i) {}
+ for (uint32_t i = 0; ports[i]; ++i) {
+ if (!strstr (ports[i], "Midi-Through")) {
+ cnt++;
+ }
+ }
+
free (ports);
- return i;
+ return cnt;
}
uint32_t
@@ -1126,16 +1131,21 @@ AudioEngine::n_physical_inputs (DataType type) const
{
GET_PRIVATE_JACK_POINTER_RET (_jack,0);
const char ** ports;
- uint32_t i = 0;
-
+ uint32_t cnt = 0;
+
if ((ports = jack_get_ports (_priv_jack, NULL, type.to_jack_type(), JackPortIsPhysical|JackPortIsOutput)) == 0) {
return 0;
}
- for (i = 0; ports[i]; ++i) {}
+ for (uint32_t i = 0; ports[i]; ++i) {
+ if (!strstr (ports[i], "Midi-Through")) {
+ cnt++;
+ }
+ }
+
free (ports);
- return i;
+ return cnt;
}
void
@@ -1150,6 +1160,9 @@ AudioEngine::get_physical_inputs (DataType type, vector<string>& ins)
if (ports) {
for (uint32_t i = 0; ports[i]; ++i) {
+ if (strstr (ports[i], "Midi-Through")) {
+ continue;
+ }
ins.push_back (ports[i]);
}
free (ports);
@@ -1168,6 +1181,9 @@ AudioEngine::get_physical_outputs (DataType type, vector<string>& outs)
}
for (i = 0; ports[i]; ++i) {
+ if (strstr (ports[i], "Midi-Through")) {
+ continue;
+ }
outs.push_back (ports[i]);
}
free (ports);
@@ -1179,6 +1195,7 @@ AudioEngine::get_nth_physical (DataType type, uint32_t n, int flag)
GET_PRIVATE_JACK_POINTER_RET (_jack,"");
const char ** ports;
uint32_t i;
+ uint32_t idx;
string ret;
assert(type != DataType::NIL);
@@ -1187,10 +1204,14 @@ AudioEngine::get_nth_physical (DataType type, uint32_t n, int flag)
return ret;
}
- for (i = 0; i < n && ports[i]; ++i) {}
+ for (i = 0, idx = 0; idx < n && ports[i]; ++i) {
+ if (!strstr (ports[i], "Midi-Through")) {
+ ++idx;
+ }
+ }
- if (ports[i]) {
- ret = ports[i];
+ if (ports[idx]) {
+ ret = ports[idx];
}
free ((const char **) ports);