14 jack_default_audio_sample_t * in, * out;
17 jack_transport_state_t ts = jack_transport_query(jack->
mClient, NULL);
18 if (ts == JackTransportRolling) {
19 in = (jack_default_audio_sample_t *) jack_port_get_buffer (jack->
mInput_port, nframes);
20 out = (jack_default_audio_sample_t *) jack_port_get_buffer (jack->
mOutput_port, nframes);
28 }
else if (ts == JackTransportStopped) {
46 int in_device,
int out_device,
47 unsigned in_chans,
unsigned out_chans)
48 :
IO(s_rate, b_size, in_device, out_device, in_chans, out_chans) {
67 jack_options_t options = JackNullOption;
71 char * server_name =
"CSL_SERVER";
72 char * client_name =
"CSL_CLIENT";
73 options |= (jack_options_t) JackServerName;
75 mClient = jack_client_open (client_name, options, &status, server_name);
77 logMsg (
kLogError,
"jack_client_open() failed, " "status = 0x%2.0x", status);
78 if (status & JackServerFailed) {
82 if (status & JackServerStarted) {
83 logMsg(
"\tJACK server started");
85 if (status & JackNameNotUnique) {
86 client_name = jack_get_client_name(
mClient);
93 logMsg (
"engine sample rate: %g", jack_get_sample_rate (
mClient));
94 mInput_port = jack_port_register (
mClient,
"input", JACK_DEFAULT_AUDIO_TYPE, JackPortIsInput, 0);
95 mOutput_port = jack_port_register (
mClient,
"output", JACK_DEFAULT_AUDIO_TYPE, JackPortIsOutput, 0);
104 ports = jack_get_ports (
mClient, NULL, NULL, JackPortIsPhysical|JackPortIsOutput);
113 ports = jack_get_ports (
mClient, NULL, NULL, JackPortIsPhysical|JackPortIsInput);
void logMsg(const char *format,...)
These are the public logging messages.
unsigned mNumFrames
num frames used in each buffer
AdditiveInstrument.h – Sum-of-sines synthesis instrument class.
jack_port_t * mInput_port
void pullInput(Buffer &outBuffer, SampleBuffer out=0)
get a buffer from the CSL graph
void close()
open/close start/stop methods
void jack_shutdown(void *arg)
JackIO is an IO that uses a thread and a timer to call its graph's nextBuffer(); it doesn't do anythi...
jack_port_t * mOutput_port
unsigned mNumChannels
num channels in buffer (num mono buffers)
IO – the abstract I/O scheduling class; subclasses interface to specific I/O APIs.
void stop()
stop the timer thread
void start()
start my timer thread
IO_Status mStatus
status flag
Buffer – the multi-channel sample buffer class (passed around between generators and IO guys)...
Buffer mOutputBuffer
the output buffer I use (passed to nextBuffer calls)
int JackCallback(jack_nframes_t nframes, void *arg)
Base class of CSL exceptions (written upper-case). Has a string message.
void open()
open/close start/stop methods