1
1
// ------------------------------------------------------------------------
2
2
// audioio-jack.cpp: Interface to JACK audio framework
3
// Copyright (C) 2001-2003 Kai Vehmanen
3
// Copyright (C) 2001-2003,2008 Kai Vehmanen
6
// eca-style-version: 3
6
// eca-style-version: 3 (see Ecasound Programmer's Guide)
8
8
// This program is free software; you can redistribute it and/or modify
9
9
// it under the terms of the GNU General Public License as published by
93
92
if (jackmgr_rep != 0) {
94
93
string my_in_portname ("in"), my_out_portname ("out");
96
if (label() == "jack_generic") {
97
my_in_portname = my_out_portname = secondparam_rep;
101
// if (workstring.size() == 0) workstring = label();
95
if (label() == "jack" &&
96
params_rep.size() > 2 &&
97
params_rep[2].size() > 0) {
98
my_in_portname = my_out_portname = params_rep[2];
100
/* note: deprecated interface */
101
else if (label() == "jack_generic" &&
102
params_rep.size() > 1) {
103
my_in_portname = my_out_portname = params_rep[1];
103
106
jackmgr_rep->open(myid_rep);
133
136
/* - make automatic connections */
135
if (label() == "jack_alsa") {
138
if (label() == "jack" &&
139
params_rep.size() > 1 &&
140
params_rep[1].size() > 0) {
141
/* note: if 2nd param given, use it as the client to autoconnect to */
142
jackmgr_rep->auto_connect_jack_port_client(myid_rep, params_rep[1], channels());
144
else if (label() == "jack_multi") {
146
for(i = 0; i < channels(); i++) {
147
if (static_cast<int>(params_rep.size()) > i + 1 &&
148
params_rep[i + 1].size() > 0) {
149
ECA_LOG_MSG(ECA_LOGGER::user_objects,
150
"adding auto connection from " +
151
my_out_portname + "_" + kvu_numtostr(i + 1) +
154
jackmgr_rep->auto_connect_jack_port(myid_rep, i + 1, params_rep[i + 1]);
160
else if (label() == "jack_alsa") {
161
/* note: deprecated feature: 'alsa_pcm' is hidden in the port
162
list returned by jack_get_ports(), but as you can still
163
connect with the direct backend names, we have to keep this
164
code around to be backward compatible */
136
165
string in_aconn_portprefix, out_aconn_portprefix;
138
167
in_aconn_portprefix = "alsa_pcm:capture_";
150
else if (label() == "jack_auto") {
151
jackmgr_rep->auto_connect_jack_port_client(myid_rep, secondparam_rep, channels());
179
/* note: deprecated interface, plain "jack" should be used now */
180
else if (label() == "jack_auto" &&
181
params_rep.size() > 1 &&
182
params_rep[1].size() > 0) {
183
jackmgr_rep->auto_connect_jack_port_client(myid_rep, params_rep[1], channels());
227
259
if (label() == "jack_generic")
228
260
return "label,portname";
230
if (label() == "jack_auto")
262
else if (label() == "jack_auto")
231
263
return "label,client";
233
/* jack, jack_alsa */
265
else if (label() == "jack_multi") {
266
string paramlist = "label,";
268
for(i = 0; i < channels(); i++) {
269
paramlist += ",dstport" + kvu_numtostr(i + 1);
275
return "label,client,portprefix";
237
278
void AUDIO_IO_JACK::set_parameter(int param, std::string value)
241
case 1: { set_label(value); break; }
242
case 2: { secondparam_rep = value; break; }
280
if (param > static_cast<int>(params_rep.size()))
281
params_rep.resize(param);
283
params_rep[param - 1] = value;
246
290
std::string AUDIO_IO_JACK::get_parameter(int param) const
250
case 1: { return label(); }
251
case 2: { return secondparam_rep; }
292
if (param > 0 && param <= static_cast<int>(params_rep.size()))
293
return params_rep[param - 1];
295
return AUDIO_IO::get_parameter(param);