gtkIOStream  1.7.0
GTK+ << C++ IOStream operators for GTK+. Now with ORBing, numerical computation, audio client and more ...
JackBase.H
Go to the documentation of this file.
1 /* Copyright 2000-2018 Matt Flax <flatmax@flatmax.org>
2  This file is part of GTK+ IOStream class set
3 
4  GTK+ IOStream is free software; you can redistribute it and/or modify
5  it under the terms of the GNU General Public License as published by
6  the Free Software Foundation; either version 2 of the License, or
7  (at your option) any later version.
8 
9  GTK+ IOStream is distributed in the hope that it will be useful,
10  but WITHOUT ANY WARRANTY; without even the implied warranty of
11  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12  GNU General Public License for more details.
13 
14  You have received a copy of the GNU General Public License
15  along with GTK+ IOStream
16  */
17 #ifndef JACKBASE_H_
18 #define JACKBASE_H_
19 
20 #include <Debug.H>
21 
22 #include <jack/jack.h>
23 #include <string>
24 #include <vector>
25 #include <iostream>
26 #include <sstream>
27 #include <algorithm>
28 using namespace std;
29 
30 #include <stdlib.h>
31 
32 #include <assert.h>
33 
34 #define JACK_SERVER_NOT_FOUND_ERROR -10+JACK_ERROR_OFFSET
35 #define JACK_CLIENT_OPEN_ERROR -11+JACK_ERROR_OFFSET
36 #define JACK_SET_CALLBACK_ERROR -12+JACK_ERROR_OFFSET
37 #define JACK_INPUT_PORT_CREATION_ERROR -13+JACK_ERROR_OFFSET
38 #define JACK_OUTPUT_PORT_CREATION_ERROR -14+JACK_ERROR_OFFSET
39 #define JACK_ACTIVATE_ERROR -15+JACK_ERROR_OFFSET
40 #define JACK_HAS_NO_CAPTURE_PORTS_ERROR -16+JACK_ERROR_OFFSET
41 #define JACK_HAS_NO_PLAYBACK_PORTS_ERROR -17+JACK_ERROR_OFFSET
42 #define JACK_CLOSE_CLIENT_ERROR -18+JACK_ERROR_OFFSET
43 #define JACK_SET_BUFFER_SIZE_ERROR -19+JACK_ERROR_OFFSET
44 #define JACK_SET_BUFFSIZE_CALLBACK_ERROR -20+JACK_ERROR_OFFSET
45 #define JACK_DEACTIVATE_CLIENT_ERROR -21+JACK_ERROR_OFFSET
46 #define JACK_CLIENT_NULL_ERROR -22+JACK_ERROR_OFFSET
47 #define JACK_PORT_CALLBACK_SETUP_ERROR -23+JACK_ERROR_OFFSET
48 #define JACK_NOPORTS_ERROR -24+JACK_ERROR_OFFSET
49 #define JACK_PORT_CONNECT_ERROR -25+JACK_ERROR_OFFSET
50 #define JACK_PORTNAME_NOTFOUND_ERROR -26+JACK_ERROR_OFFSET
51 #define JACK_DRAG_OPTION_UNKNOWN_ERROR -27+JACK_ERROR_OFFSET
52 #define JACK_PORT_DISCONNECT_ERROR -28+JACK_ERROR_OFFSET
53 #define JACK_UNKNOWN_DND_TYPE_ERROR -29+JACK_ERROR_OFFSET
54 #define JACK_NETPORT_AUTOCONNECT_ERROR -30+JACK_ERROR_OFFSET
55 
56 class JackDebug : public Debug {
57 public:
58  JackDebug(void) {
59 #ifndef NDEBUG
60  errors[JACK_SERVER_NOT_FOUND_ERROR]=string("The jack server wasn't found");
61  errors[JACK_CLIENT_OPEN_ERROR]=string("The jack client failed to start");
62  errors[JACK_SET_CALLBACK_ERROR]=string("The Client failed to register its callback with the server");
63  errors[JACK_INPUT_PORT_CREATION_ERROR]=string("The Client failed to register input ports with the server");
64  errors[JACK_OUTPUT_PORT_CREATION_ERROR]=string("The Client failed to register output ports with the server");
65  errors[JACK_ACTIVATE_ERROR]=string("Couldn't activate the client");
66  errors[JACK_HAS_NO_CAPTURE_PORTS_ERROR]=string("The server has no capture ports");
67  errors[JACK_HAS_NO_PLAYBACK_PORTS_ERROR]=string("The server has no playback ports");
68  errors[JACK_CLOSE_CLIENT_ERROR]=string("Couldn't close the client");
69  errors[JACK_SET_BUFFER_SIZE_ERROR]=string("Couldn't set the buffer size");
70  errors[JACK_SET_BUFFSIZE_CALLBACK_ERROR]=string("Couldn't set the callback to handle Jack audio buffer size changes.");
71  errors[JACK_DEACTIVATE_CLIENT_ERROR]=string("Couldn't deactivate the Jack client.");
72  errors[JACK_CLIENT_NULL_ERROR]=string("Client doesn't exist, please use the connect method first.");
73  errors[JACK_PORT_CALLBACK_SETUP_ERROR]=string("Couldn't connect the port monitoring callback. ");
74  errors[JACK_NOPORTS_ERROR]=string("Couldn't find any ports with that name. ");
75  errors[JACK_PORT_CONNECT_ERROR]=string("Couldn't connect the ports together. ");
76  errors[JACK_PORTNAME_NOTFOUND_ERROR]=string("Couldn't find that port name. ");
77  errors[JACK_DRAG_OPTION_UNKNOWN_ERROR]=string("Couldn't find the target widget, perhaps the client has closed. ");
78  errors[JACK_PORT_DISCONNECT_ERROR]=string("Couldn't disconnect the ports. ");
79  errors[JACK_UNKNOWN_DND_TYPE_ERROR]=string("Unknown drop signal, expecting either CONNECT_PORTS or DISCONNECT_PORTS. ");
80  errors[JACK_NETPORT_AUTOCONNECT_ERROR]=string("Error when trying to autoconnect networked ports. ");
81 
82 #endif
83  }
84 };
85 
89 class JackBase {
92  void init() {
93  connect1To1=true; // start by default connecting one to one.
94  client=NULL;
95  reSyncPorts();
96  }
97 
100  void clearPorts() {
101  physicalInputPortCnt=physicalOutputPortCnt=0;
102  inputPorts.resize(0);
103  inputLatencies.resize(0);
104  outputPorts.resize(0);
105  outputLatencies.resize(0);
106  }
107 protected:
108  jack_client_t *client;
109  string clientName;
110 
111  //string serverName; ///< The name of the server
112  jack_options_t jackOptions;
113  jack_status_t status;
114 
117 
118  vector<jack_port_t *> inputPorts;
119  vector<jack_port_t *> outputPorts;
120 
121  vector<jack_nframes_t> inputLatencies;
122  vector<jack_nframes_t> outputLatencies;
123 
130  virtual void determineLatencies() {
131  jack_latency_range_t range;
132  for (unsigned int i=0; i < inputPorts.size(); i++) {
133  jack_port_get_latency_range(inputPorts[i], JackCaptureLatency, &range);
134  if (range.min != range.max) {
135  cout<<"JackClient::determineLatencies : input : min = "<<range.min<<" max = "<<range.max<<endl;
136  assert("don't know how to handle latencies which has a range which is different");
137  }
138  inputLatencies[i]=range.min;
139  cout<<"input port "<<i<<" latency = "<<inputLatencies[i]<<endl;
140  }
141  for (unsigned int i=0; i < outputPorts.size(); i++) {
142  jack_port_get_latency_range(outputPorts[i], JackPlaybackLatency, &range);
143  if (range.min != range.max) {
144  cout<<"JackClient::determineLatencies : output : min = "<<range.min<<" max = "<<range.max<<endl;
145  assert("don't know how to handle latencies which has a range which is different");
146  }
147  outputLatencies[i]=range.min;
148  cout<<"output port "<<i<<" latency = "<<outputLatencies[i]<<endl;
149  }
150  }
151 
159  int getPortListAndCount(JackPortFlags flags, vector<jack_port_t *> *ports, const char *portNamePattern, const char *typeNamePattern) {
160  int cnt=NO_ERROR;
161  if (client) {
162  const char **portsStrs = jack_get_ports(client, portNamePattern, typeNamePattern, flags);
163  for (cnt=0; portsStrs[cnt]!=NULL; cnt++)
164  if (ports)
165  ports->push_back(jack_port_by_name(client, portsStrs[cnt]));
166  free(portsStrs);
167  } else
169  return cnt;
170  }
171 
179  int getPortListAndCount(JackPortFlags flags, vector<string> *ports, const char *portNamePattern, const char *typeNamePattern) {
180  int cnt=NO_ERROR;
181  if (client) {
182  const char **portsStrs = jack_get_ports(client, portNamePattern, typeNamePattern, flags);
183  if (portsStrs) {
184  for (cnt=0; portsStrs[cnt]!=NULL; cnt++)
185  if (ports)
186  ports->push_back(portsStrs[cnt]);
187  free(portsStrs);
188  }
189  } else
191  return cnt;
192  }
193 
196  virtual void reSyncPorts(void) {
197  //cout<<"JackBase::reSyncPorts"<<endl;
198  clearPorts(); // remove previous knowledge
199  }
200 
203  virtual void reSyncConnections(void) {
204  // do nothing
205  }
206 
207 public:
208  bool connect1To1;
209 
213  init();
214  }
215 
219  JackBase(string clientName_) {
220  cout<<"JackBase "<<clientName_<<endl;
221  init();
222  int res=connect(clientName_);
223  if (res!=0)
224  JackDebug().evaluateError(res);
225  else
226  cout<<"JackBase connected"<<endl;
227  }
228 
233  JackBase(string clientName_, string serverName) {
234  init();
235  connect(clientName_, serverName);
236  }
237 
239  virtual ~JackBase() {}
240 
244  virtual int stopClient(void) {
245  if (client)
246  if (jack_deactivate(client)!=0)
248  return 0;
249  }
250 
254  virtual int disconnect(void) {
255  stopClient();
256  if (client)
257  if (jack_client_close(client)!=0)
259  client=NULL;
260  return 0;
261  }
262 
266  int getSampleRate(void) const {
267  int fs=jack_get_sample_rate ( client );
268  return fs;
269  }
270 
277  virtual int createPorts(string inName, int inCnt, string outName, int outCnt) {
278  inputLatencies.resize(inCnt);
279  inputPorts.resize(inCnt);
280  for (int i=0; i < inCnt; i++) {
281  ostringstream convert;
282  convert<<i;
283  string portName=inName+convert.str();
284  inputPorts[i] = jack_port_register(client, portName.c_str(), JACK_DEFAULT_AUDIO_TYPE, JackPortIsInput, 0);
285  if (inputPorts[i] == NULL)
287  }
288 
289  outputLatencies.resize(outCnt);
290  outputPorts.resize(outCnt);
291  for (int i=0; i < outCnt; i++) {
292  ostringstream convert;
293  convert<<i;
294  string portName=outName+convert.str();
295  outputPorts[i] = jack_port_register(client, portName.c_str(), JACK_DEFAULT_AUDIO_TYPE, JackPortIsOutput, 0);
296  if (outputPorts[i] == NULL)
298  }
299  determineLatencies();
300  return 0;
301  }
302 
306  virtual int destroyPorts(){
307  int ret=NO_ERROR;
308  if (client){
309  for (int i=0; i<inputPorts.size(); i++){
310  if (inputPorts[i])
311  jack_port_unregister(client, inputPorts[i]);
312  inputPorts[i]=NULL;
313  }
314  inputPorts.resize(0);
315  for (int i=0; i<outputPorts.size(); i++){
316  if (outputPorts[i])
317  jack_port_unregister(client, outputPorts[i]);
318  outputPorts[i]=NULL;
319  }
320  outputPorts.resize(0);
321  } else
323  return ret;
324  }
325 
330  void getPhysicalPorts(vector<jack_port_t *> &inPorts, vector<jack_port_t *> &outPorts) {
331  if (client) {
332  // find the number of input ports
333  getPortListAndCount((JackPortFlags)(JackPortIsPhysical|JackPortIsInput), &inPorts, NULL, NULL);
334  // find the number of output ports
335  getPortListAndCount((JackPortFlags)(JackPortIsPhysical|JackPortIsOutput), &outPorts, NULL, NULL);
336  } else
338  }
339 
344  void getPhysicalPortCount(int &in, int &out) {
345  in=out=0;
346  if (client) {
347  // find the number of input ports
348  in=getPortListAndCount((JackPortFlags)(JackPortIsPhysical|JackPortIsInput), (vector<jack_port_t *> *)NULL, NULL, NULL);
349  // find the number of output ports
350  out=getPortListAndCount((JackPortFlags)(JackPortIsPhysical|JackPortIsOutput), (vector<jack_port_t *> *)NULL, NULL, NULL);
351  } else
353  }
354 
358  bool connected(){
359  if (client)
360  return true;
361  return false;
362  }
363 
369  virtual int connect(string clientName_) {
370  return connect(clientName_, string());
371  }
372 
379  virtual int connect(const string &clientName_, const string &serverName) {
380  clientName = clientName_;
381 
382  if (client) // make sure not connected
383  disconnect();
384 
385  /* open a client connection to the JACK server */
386  //char *server_name;
387  jackOptions=JackNullOption;
388  if (serverName.length()>0) {
389  jackOptions=JackServerName;
390  client=jack_client_open(clientName.c_str(), jackOptions, &status, serverName.c_str());
391  } else
392  client=jack_client_open(clientName.c_str(), jackOptions, &status);
393  if (client==NULL) {
394  cerr<<"connect: jack_client_open() failed, status = 0x"<<hex<<status<<endl;
395  if ( status & JackServerFailed )
397  return JACK_CLIENT_OPEN_ERROR;
398  }
399 
400  if (status & JackServerStarted)
401  cerr<<"JACK server started"<<endl;
402  if ( status & JackNameNotUnique ) {
403  clientName = jack_get_client_name ( client );
404  cerr<<"unique name '"<<clientName<<"' assigned";
405  }
406 
407  //jack_on_shutdown ( client, jack_shutdown, 0 );
408 
409  inputLatencies.resize(0);
410  outputLatencies.resize(0);
411 
412  return NO_ERROR;
413  }
414 
418  virtual void print(ostream &os) {
419  os<<"JackBase : "<<inputPorts.size()<<" input ports, "<<outputPorts.size()<<" output ports.\n";
420  os<<"Input ports : \t\t\t Output ports:\n";
421  for (int i=0; i<max(inputPorts.size(), outputPorts.size()); i++) {
422  if (inputPorts.size()>i)
423  os<<'\t'<<jack_port_name(inputPorts[i])<<"\t\t";
424  else
425  os<<"\t\t\t\t\t";
426  if (outputPorts.size()>i)
427  os<<jack_port_name(outputPorts[i])<<'\n';
428  else
429  os<<'\n';
430  }
431  }
432 
436  string getClientName() {
437  return clientName;
438  }
439 
443  virtual void setClientName(string cn) {
444  clientName=cn;
445  }
446 
451  string portNameFromPort(jack_port_id_t p) {
452  if (client)
453  return shortPortNameFromPortName(jack_port_name(jack_port_by_id(client, p)));
454  else
455  return string();
456  }
457 
462  string portNameFromPort(jack_port_t *p) {
463  return shortPortNameFromPortName(jack_port_name(p));
464  }
465 
470  string clientNameFromPort(jack_port_id_t p) {
471  if (client)
472  return clientNameFromPort(jack_port_by_id(client, p));
473  else
474  return string();
475  }
476 
481  string clientNameFromPort(jack_port_t *p) {
482  return clientNameFromPortNames(jack_port_name(p), jack_port_short_name(p));
483  }
484 
489  string clientNameFromPortName(string fullPortName) {
490  return fullPortName.substr(0, fullPortName.find(':'));
491  }
492 
498  string clientNameFromPortNames(string fullPortName, string shortPortName) {
499  fullPortName=fullPortName.substr(0, fullPortName.find(shortPortName)-1);
500  return fullPortName;
501  }
502 
503  string shortPortNameFromPortName(const string fullPortName) {
504  string res=fullPortName;
505  return res.substr(res.find(":")+1, string::npos);
506  }
507 
511  bool operator==(const string &cn) {
512  return clientName.find(cn)!=string::npos;
513  }
514 
519  return inputPorts.size();
520  }
521 
526  jack_port_t *getInputPort(int i) {
527  if (i<0 || i>inputPorts.size())
528  return NULL;
529  return inputPorts[i];
530  }
531 
536  jack_port_t *getOutputPort(int i) {
537  if (i<0 || i>outputPorts.size())
538  return NULL;
539  return outputPorts[i];
540  }
541 
545  void addInputPort(jack_port_t *inP) {
546  inputPorts.push_back(inP);
547  }
548 
552  void addOutputPort(jack_port_t *outP) {
553  outputPorts.push_back(outP);
554  }
555 
564  int populatInOutPorts(const string &inName, vector<string> &inPorts, const string &outName, vector<string> &outPorts) {
565  if (inName.find(':')==string::npos) // if we have no ':' then get all ports
566  getPortListAndCount((JackPortFlags)JackPortIsInput, &inPorts, inName.c_str(), NULL);
567  else
568  inPorts.push_back(inName);
569  if (outName.find(':')==string::npos) // if we have no ':' then get all ports
570  getPortListAndCount((JackPortFlags)JackPortIsOutput, &outPorts, outName.c_str(), NULL);
571  else
572  outPorts.push_back(outName);
573 
574  // if the vector of ports to connect is empty, report error
575  if (inPorts.size()==0)
576  return JackDebug().evaluateError(JACK_NOPORTS_ERROR, string("Tried using the input name ")+inName);
577  if (outPorts.size()==0)
578  return JackDebug().evaluateError(JACK_NOPORTS_ERROR, string("Tried using the output name ")+outName);
579 
580  return NO_ERROR;
581  }
582 
591  int connectPorts(const string inName, const string outName) {
592  //cout<<"JackBase::connectPorts : inName = "<<inName<<" outName = "<<outName<<endl;
593  if (!client)
595 
596  int res=NO_ERROR;
597  vector<string> inPorts, outPorts;
598  if ((res=populatInOutPorts(inName, inPorts, outName, outPorts))!=NO_ERROR)
599  return res;
600 
601  // if the vector of ports is >1
602  vector<string>::iterator op=outPorts.begin();
603  for (vector<string>::iterator ip=inPorts.begin(); ip!=inPorts.end(); ++ip) {
604  for (; op!=outPorts.end(); ++op) {
605  if (!jack_port_connected_to(jack_port_by_name(client, (*op).c_str()), (*ip).c_str())) // if not already connected, then try to connect
606  if (jack_connect(client, (*op).c_str(), (*ip).c_str())<0)
607  res=JackDebug().evaluateError(JACK_PORT_CONNECT_ERROR, string("Tried to connect the output port ")+(*op)+" to the input port "+(*ip));
608  if (connect1To1) { // when connecting 1 to 1, connect only one and then break
609  op++;
610  break;
611  }
612  }
613  if (connect1To1 && op==outPorts.end()) // if we are connecting 1 to 1 and the output port list is completely iterated out, then exit.
614  break;
615  else if (!connect1To1) // if we aren't connecting 1 to 1, then start the output ports from the beginning so it can iterate all the way through.
616  op=outPorts.begin();
617  }
618  return res;
619  }
620 
629  virtual int disconnectPorts(const string &inName, const string &outName) {
630  cout<<"JackBase::disconnectPorts : inName = "<<inName<<" outName = "<<outName<<endl;
631  if (!client)
633 
634  int res=NO_ERROR;
635  vector<string> inPorts, outPorts;
636  if ((res=populatInOutPorts(outName, outPorts, inName, inPorts))!=NO_ERROR) // in the case of disconnection, the input and output port name meanings are reversed.
637  return res;
638 
639  // if the vector of ports is >1
640  for (vector<string>::iterator ip=inPorts.begin(); ip!=inPorts.end(); ++ip)
641  for (vector<string>::iterator op=outPorts.begin(); op!=outPorts.end(); ++op)
642  if (jack_port_connected_to(jack_port_by_name(client, (*ip).c_str()), (*op).c_str())) // if connected, then try to dis-connect
643  if (jack_disconnect(client, (*ip).c_str(), (*op).c_str())<0)
644  res=JackDebug().evaluateError(JACK_PORT_DISCONNECT_ERROR, string("Tried to disconnect the output port ")+(*ip)+" to the input port "+(*op));
645  return res;
646  }
647 
651  void setClient(jack_client_t *c) {
652  client=c;
653  }
654 
655 // /** Allow printing of port information to an ostream.
656 // \param os The ostream to output to.
657 // \param jpm The JackBase to print out.
658 // */
659 // friend ostream &operator<<(ostream &os, JackBase &jpm);
660 };
661 
662 //ostream &operator<<(ostream &os, JackBase &jpm){
663 // jpm.print(os);
664 // return os;
665 //}
666 
667 
672 public:
673  map<string, map<string, vector<string> > > inputPortNamesAndConnections;
674  vector<string> outputPortNames;
675 
679  // iterate through each of the input ports and make a vector of their connections.
680  for (vector<jack_port_t *>::iterator p=inputPorts.begin(); p!=inputPorts.end(); ++p) {
681  const char**cons=jack_port_get_connections(*p); // for each input port find all of its connections
682  string thisPortName=jack_port_short_name(*p); // this is the port name we are interrogating which is the key to the port connections map
683  inputPortNamesAndConnections[thisPortName]=map<string, vector<string> >(); // start with an empty list of connections
684  //cout<<"Port : "<<jack_port_name(*p)<<endl;
685  if (cons) {
686  for (int i=0; cons[i]!=NULL; i++) { // add each client/port which this input port is connected to.
687  string shortPN=shortPortNameFromPortName(cons[i]); // This is the name of the port which is connected to thisPortName
688  // if this port name isn't already in the list of connected port names for this client, then add it to the vector for this client
689  if (find(inputPortNamesAndConnections[thisPortName][clientNameFromPortNames(cons[i], shortPN)].begin(), inputPortNamesAndConnections[thisPortName][clientNameFromPortNames(cons[i], shortPN)].end(), shortPN)
690  == inputPortNamesAndConnections[thisPortName][clientNameFromPortNames(cons[i], shortPN)].end())
691  inputPortNamesAndConnections[thisPortName][clientNameFromPortNames(cons[i], shortPN)].push_back(shortPN); // add it to the connected client's port list
692  //cout<<"\t"<<clientNameFromPortNames(cons[i], shortPN)<<":"<<shortPN<<endl;
693  }
694  delete [] cons;
695  }
696  }
697  }
698 };
699 #endif // JACKBASE_H_
int populatInOutPorts(const string &inName, vector< string > &inPorts, const string &outName, vector< string > &outPorts)
Definition: JackBase.H:564
virtual ~JackBase()
Destructor.
Definition: JackBase.H:239
#define JACK_PORT_CONNECT_ERROR
error when ports can&#39;t be connected
Definition: JackBase.H:49
#define JACK_SERVER_NOT_FOUND_ERROR
The jack server wasn&#39;t found.
Definition: JackBase.H:34
virtual void reSyncConnections(void)
Definition: JackBase.H:203
virtual int createPorts(string inName, int inCnt, string outName, int outCnt)
Definition: JackBase.H:277
int physicalOutputPortCnt
The number of physical input ports.
Definition: JackBase.H:116
jack_port_t * getInputPort(int i)
Definition: JackBase.H:526
#define JACK_UNKNOWN_DND_TYPE_ERROR
error when a GUI drop signals neither CONNECT_PORTS nor DISCONNECT_PORTS
Definition: JackBase.H:53
virtual void determineLatencies()
Definition: JackBase.H:130
JackBase(string clientName_, string serverName)
Definition: JackBase.H:233
vector< string > outputPortNames
The output port names.
Definition: JackBase.H:674
#define JACK_DEACTIVATE_CLIENT_ERROR
Couldn&#39;t deactivate the client.
Definition: JackBase.H:45
string clientName
The name of this client.
Definition: JackBase.H:109
bool connected()
Definition: JackBase.H:358
virtual int disconnectPorts(const string &inName, const string &outName)
Definition: JackBase.H:629
virtual int disconnect(void)
Definition: JackBase.H:254
string clientNameFromPort(jack_port_id_t p)
Definition: JackBase.H:470
string clientNameFromPort(jack_port_t *p)
Definition: JackBase.H:481
#define JACK_CLIENT_NULL_ERROR
client is null
Definition: JackBase.H:46
virtual int connect(string clientName_)
Definition: JackBase.H:369
string clientNameFromPortName(string fullPortName)
Definition: JackBase.H:489
#define JACK_PORT_DISCONNECT_ERROR
error when ports can&#39;t be connected
Definition: JackBase.H:52
#define JACK_INPUT_PORT_CREATION_ERROR
The Client failed to register input ports.
Definition: JackBase.H:37
int getPortListAndCount(JackPortFlags flags, vector< jack_port_t *> *ports, const char *portNamePattern, const char *typeNamePattern)
Definition: JackBase.H:159
#define JACK_PORT_CALLBACK_SETUP_ERROR
error when trying to connect the port monitoring callbacks
Definition: JackBase.H:47
virtual int evaluateError(int errorNum)
Definition: Debug.H:132
bool operator==(const string &cn)
Definition: JackBase.H:511
JackDebug(void)
Definition: JackBase.H:58
jack_options_t jackOptions
Options for jack.
Definition: JackBase.H:112
#define JACK_HAS_NO_CAPTURE_PORTS_ERROR
The server has no capture ports.
Definition: JackBase.H:40
STL namespace.
void getPhysicalPortCount(int &in, int &out)
Definition: JackBase.H:344
#define JACK_SET_CALLBACK_ERROR
The Client failed to register its callback with the server.
Definition: JackBase.H:36
vector< jack_nframes_t > outputLatencies
The output latencies, one for each port.
Definition: JackBase.H:122
float p
virtual void reSyncPorts(void)
Definition: JackBase.H:196
string shortPortNameFromPortName(const string fullPortName)
Definition: JackBase.H:503
void init()
Definition: JackBase.H:92
#define NO_ERROR
There is no error.
Definition: Debug.H:33
jack_port_t * getOutputPort(int i)
Definition: JackBase.H:536
#define JACK_CLIENT_OPEN_ERROR
The Client failed to start.
Definition: JackBase.H:35
#define JACK_SET_BUFFER_SIZE_ERROR
Couldn&#39;t set the buffer size.
Definition: JackBase.H:43
#define JACK_NOPORTS_ERROR
error when no ports are found matching a name
Definition: JackBase.H:48
void addInputPort(jack_port_t *inP)
Definition: JackBase.H:545
#define JACK_SET_BUFFSIZE_CALLBACK_ERROR
Couldn&#39;t set the buffer size callback.
Definition: JackBase.H:44
#define JACK_NETPORT_AUTOCONNECT_ERROR
error when trying to connect network ports automatically.
Definition: JackBase.H:54
#define JACK_PORTNAME_NOTFOUND_ERROR
error when the port name is not found
Definition: JackBase.H:50
virtual int stopClient(void)
Definition: JackBase.H:244
int getSampleRate(void) const
Definition: JackBase.H:266
virtual int connect(const string &clientName_, const string &serverName)
Definition: JackBase.H:379
jack_status_t status
The status of jack.
Definition: JackBase.H:113
virtual void print(ostream &os)
Definition: JackBase.H:418
int getInputPortSize()
Definition: JackBase.H:518
vector< jack_nframes_t > inputLatencies
The input latencies, one for each port.
Definition: JackBase.H:121
jack_client_t * client
The jack client.
Definition: JackBase.H:108
string portNameFromPort(jack_port_id_t p)
Definition: JackBase.H:451
void clearPorts()
Definition: JackBase.H:100
#define JACK_HAS_NO_PLAYBACK_PORTS_ERROR
The server has no playback.
Definition: JackBase.H:41
JackBase(string clientName_)
Definition: JackBase.H:219
vector< jack_port_t * > inputPorts
The input ports.
Definition: JackBase.H:118
bool connect1To1
When true, then connections are made in a 1 to 1 manner. When False, then connections are made in an ...
Definition: JackBase.H:208
void getPhysicalPorts(vector< jack_port_t *> &inPorts, vector< jack_port_t *> &outPorts)
Definition: JackBase.H:330
string clientNameFromPortNames(string fullPortName, string shortPortName)
Definition: JackBase.H:498
void setClient(jack_client_t *c)
Definition: JackBase.H:651
#define JACK_ACTIVATE_ERROR
Couldn&#39;t activate the client with the server.
Definition: JackBase.H:39
Definition: Debug.H:112
int getPortListAndCount(JackPortFlags flags, vector< string > *ports, const char *portNamePattern, const char *typeNamePattern)
Definition: JackBase.H:179
#define JACK_OUTPUT_PORT_CREATION_ERROR
The Client failed to register output ports.
Definition: JackBase.H:38
virtual int destroyPorts()
Definition: JackBase.H:306
void findInputConnections()
Definition: JackBase.H:678
map< string, map< string, vector< string > > > inputPortNamesAndConnections
The input port names which map to a vector of the connected clients and each of their connected ports...
Definition: JackBase.H:673
#define JACK_CLOSE_CLIENT_ERROR
Couldn&#39;t stop the client error.
Definition: JackBase.H:42
#define JACK_DRAG_OPTION_UNKNOWN_ERROR
error when the the drag and drop drops to a widget which can&#39;t be found
Definition: JackBase.H:51
vector< jack_port_t * > outputPorts
The output ports.
Definition: JackBase.H:119
string portNameFromPort(jack_port_t *p)
Definition: JackBase.H:462
int connectPorts(const string inName, const string outName)
Definition: JackBase.H:591
JackBase()
Definition: JackBase.H:212
virtual void setClientName(string cn)
Definition: JackBase.H:443
void addOutputPort(jack_port_t *outP)
Definition: JackBase.H:552
string getClientName()
Definition: JackBase.H:436
int physicalInputPortCnt
The number of physical input ports.
Definition: JackBase.H:115
gtkIOStream: /tmp/gtkiostream/include/JackBase.H Source File
GTK+ IOStream  Beta