@@ -36,7 +36,7 @@ Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. | |||
#endif | |||
#if HAVE_CELT | |||
#include "celt/celt.h" | |||
#include <celt/celt.h> | |||
#endif | |||
#define MIN(x,y) ((x)<(y) ? (x) : (y)) | |||
@@ -153,12 +153,15 @@ namespace Jack | |||
} | |||
//port = fGraphManager->GetPort ( port_id ); | |||
netj.capture_ports = | |||
jack_slist_append (netj.capture_ports, (void *)(intptr_t)port_id); | |||
netj.capture_ports = jack_slist_append (netj.capture_ports, (void *)(intptr_t)port_id); | |||
if( netj.bitdepth == CELT_MODE ) { | |||
#if HAVE_CELT | |||
#if HAVE_CELT_API_0_7 || HAVE_CELT_API_0_8 | |||
#if HAVE_CELT_API_0_11 | |||
celt_int32 lookahead; | |||
CELTMode *celt_mode = celt_mode_create( netj.sample_rate, netj.period_size, NULL ); | |||
netj.capture_srcs = jack_slist_append(netj.capture_srcs, celt_decoder_create_custom( celt_mode, 1, NULL ) ); | |||
#elif HAVE_CELT_API_0_7 || HAVE_CELT_API_0_8 | |||
celt_int32 lookahead; | |||
CELTMode *celt_mode = celt_mode_create( netj.sample_rate, netj.period_size, NULL ); | |||
netj.capture_srcs = jack_slist_append(netj.capture_srcs, celt_decoder_create( celt_mode, 1, NULL ) ); | |||
@@ -202,12 +205,13 @@ namespace Jack | |||
} | |||
//port = fGraphManager->GetPort ( port_id ); | |||
netj.playback_ports = | |||
jack_slist_append (netj.playback_ports, (void *)(intptr_t)port_id); | |||
netj.playback_ports = jack_slist_append (netj.playback_ports, (void *)(intptr_t)port_id); | |||
if( netj.bitdepth == CELT_MODE ) { | |||
#if HAVE_CELT | |||
#if HAVE_CELT_API_0_7 || HAVE_CELT_API_0_8 | |||
#if HAVE_CELT_API_0_11 | |||
CELTMode *celt_mode = celt_mode_create( netj.sample_rate, netj.period_size, NULL ); | |||
netj.playback_srcs = jack_slist_append(netj.playback_srcs, celt_encoder_create_custom( celt_mode, 1, NULL ) ); | |||
#elif HAVE_CELT_API_0_7 || HAVE_CELT_API_0_8 | |||
CELTMode *celt_mode = celt_mode_create( netj.sample_rate, netj.period_size, NULL ); | |||
netj.playback_srcs = jack_slist_append(netj.playback_srcs, celt_encoder_create( celt_mode, 1, NULL ) ); | |||
#else | |||
@@ -697,10 +701,18 @@ namespace Jack | |||
{ | |||
// audio port, decode celt data. | |||
CELTDecoder *decoder = (CELTDecoder *)src_node->data; | |||
#if HAVE_CELT_API_0_8 | HAVE_CELT_API_0_11 | |||
if( !packet_payload ) | |||
celt_decode_float( decoder, NULL, net_period_down, buf, nframes ); | |||
else | |||
celt_decode_float( decoder, packet_bufX, net_period_down, buf, nframes ); | |||
#else | |||
if( !packet_payload ) | |||
celt_decode_float( decoder, NULL, net_period_down, buf ); | |||
celt_decode_float( decoder, NULL, net_period_down, buf ); | |||
else | |||
celt_decode_float( decoder, packet_bufX, net_period_down, buf ); | |||
celt_decode_float( decoder, packet_bufX, net_period_down, buf ); | |||
#endif | |||
src_node = jack_slist_next (src_node); | |||
} | |||
@@ -746,8 +758,12 @@ namespace Jack | |||
jack_default_audio_sample_t *floatbuf = (jack_default_audio_sample_t *)alloca (sizeof(jack_default_audio_sample_t) * nframes ); | |||
memcpy( floatbuf, buf, nframes * sizeof(jack_default_audio_sample_t) ); | |||
CELTEncoder *encoder = (CELTEncoder *)src_node->data; | |||
#if HAVE_CELT_API_0_8 | HAVE_CELT_API_0_11 | |||
encoded_bytes = celt_encode_float( encoder, floatbuf, nframes, packet_bufX, net_period_up ); | |||
#else | |||
encoded_bytes = celt_encode_float( encoder, floatbuf, NULL, packet_bufX, net_period_up ); | |||
if( encoded_bytes != (int)net_period_up ) | |||
#endif | |||
if( encoded_bytes != (int)net_period_up ) | |||
jack_error( "something in celt changed. netjack needs to be changed to handle this." ); | |||
src_node = jack_slist_next( src_node ); | |||
} | |||
@@ -365,7 +365,7 @@ void netjack_attach( netjack_driver_state_t *netj ) | |||
if( netj->bitdepth == CELT_MODE ) | |||
{ | |||
#if HAVE_CELT | |||
#if HAVE_CELT_API_0_7 || HAVE_CELT_API_0_8 | |||
#if HAVE_CELT_API_0_7 || HAVE_CELT_API_0_8 || HAVE_CELT_API_0_11 | |||
celt_int32 lookahead; | |||
netj->celt_mode = celt_mode_create( netj->sample_rate, netj->period_size, NULL ); | |||
#else | |||
@@ -398,7 +398,9 @@ void netjack_attach( netjack_driver_state_t *netj ) | |||
if( netj->bitdepth == CELT_MODE ) { | |||
#if HAVE_CELT | |||
#if HAVE_CELT_API_0_7 || HAVE_CELT_API_0_8 | |||
#if HAVE_CELT_API_0_11 | |||
netj->capture_srcs = jack_slist_append(netj->capture_srcs, celt_decoder_create_custom( netj->celt_mode, 1, NULL ) ); | |||
#elif HAVE_CELT_API_0_7 || HAVE_CELT_API_0_8 | |||
netj->capture_srcs = jack_slist_append(netj->capture_srcs, celt_decoder_create( netj->celt_mode, 1, NULL ) ); | |||
#else | |||
netj->capture_srcs = jack_slist_append(netj->capture_srcs, celt_decoder_create( netj->celt_mode ) ); | |||
@@ -444,7 +446,10 @@ void netjack_attach( netjack_driver_state_t *netj ) | |||
jack_slist_append (netj->playback_ports, port); | |||
if( netj->bitdepth == CELT_MODE ) { | |||
#if HAVE_CELT | |||
#if HAVE_CELT_API_0_7 || HAVE_CELT_API_0_8 | |||
#if HAVE_CELT_API_0_11 | |||
CELTMode *celt_mode = celt_mode_create( netj->sample_rate, netj->period_size, NULL ); | |||
netj->playback_srcs = jack_slist_append(netj->playback_srcs, celt_decoder_create_custom( celt_mode, 1, NULL ) ); | |||
#elif HAVE_CELT_API_0_7 || HAVE_CELT_API_0_8 | |||
CELTMode *celt_mode = celt_mode_create( netj->sample_rate, netj->period_size, NULL ); | |||
netj->playback_srcs = jack_slist_append(netj->playback_srcs, celt_encoder_create( celt_mode, 1, NULL ) ); | |||
#else | |||
@@ -1368,21 +1368,20 @@ render_payload_to_jack_ports_celt (void *packet_payload, jack_nframes_t net_peri | |||
if (jack_port_is_audio (porttype)) | |||
{ | |||
// audio port, decode celt data. | |||
CELTDecoder *decoder = src_node->data; | |||
#if HAVE_CELT_API_0_8 | HAVE_CELT_API_0_11 | |||
if( !packet_payload ) | |||
celt_decode_float( decoder, NULL, net_period_down, buf, nframes ); | |||
else | |||
celt_decode_float( decoder, packet_bufX, net_period_down, buf, nframes ); | |||
#else | |||
if( !packet_payload ) | |||
celt_decode_float( decoder, NULL, net_period_down, buf ); | |||
else | |||
celt_decode_float( decoder, packet_bufX, net_period_down, buf ); | |||
#endif | |||
CELTDecoder *decoder = src_node->data; | |||
#if HAVE_CELT_API_0_8 | |||
if( !packet_payload ) | |||
celt_decode_float( decoder, NULL, net_period_down, buf, nframes ); | |||
else | |||
celt_decode_float( decoder, packet_bufX, net_period_down, buf, nframes ); | |||
#else | |||
if( !packet_payload ) | |||
celt_decode_float( decoder, NULL, net_period_down, buf ); | |||
else | |||
celt_decode_float( decoder, packet_bufX, net_period_down, buf ); | |||
#endif | |||
src_node = jack_slist_next (src_node); | |||
src_node = jack_slist_next (src_node); | |||
} | |||
else if (jack_port_is_midi (porttype)) | |||
{ | |||
@@ -1390,8 +1389,8 @@ render_payload_to_jack_ports_celt (void *packet_payload, jack_nframes_t net_peri | |||
// convert the data buffer to a standard format (uint32_t based) | |||
unsigned int buffer_size_uint32 = net_period_down / 2; | |||
uint32_t * buffer_uint32 = (uint32_t*) packet_bufX; | |||
if( packet_payload ) | |||
decode_midi_buffer (buffer_uint32, buffer_size_uint32, buf); | |||
if( packet_payload ) | |||
decode_midi_buffer (buffer_uint32, buffer_size_uint32, buf); | |||
} | |||
packet_bufX = (packet_bufX + net_period_down); | |||
node = jack_slist_next (node); | |||
@@ -1422,7 +1421,7 @@ render_jack_ports_to_payload_celt (JSList *playback_ports, JSList *playback_srcs | |||
float *floatbuf = alloca (sizeof(float) * nframes ); | |||
memcpy( floatbuf, buf, nframes*sizeof(float) ); | |||
CELTEncoder *encoder = src_node->data; | |||
#if HAVE_CELT_API_0_8 | |||
#if HAVE_CELT_API_0_8 | HAVE_CELT_API_0_11 | |||
encoded_bytes = celt_encode_float( encoder, floatbuf, nframes, packet_bufX, net_period_up ); | |||
#else | |||
encoded_bytes = celt_encode_float( encoder, floatbuf, NULL, packet_bufX, net_period_up ); | |||
@@ -31,7 +31,7 @@ | |||
jack_port_t *input_port; | |||
jack_port_t *output_port; | |||
int connecting, disconnecting; | |||
int done = 0; | |||
volatile int done = 0; | |||
#define TRUE 1 | |||
#define FALSE 0 | |||
@@ -58,7 +58,6 @@ show_usage (char *my_name) | |||
fprintf (stderr, "For more information see http://jackaudio.org/\n"); | |||
} | |||
int | |||
main (int argc, char *argv[]) | |||
{ | |||
@@ -181,11 +180,11 @@ main (int argc, char *argv[]) | |||
if ((port1 = jack_port_by_name(client, portA)) == 0) { | |||
fprintf (stderr, "ERROR %s not a valid port\n", portA); | |||
goto exit; | |||
} | |||
} | |||
if ((port2 = jack_port_by_name(client, portB)) == 0) { | |||
fprintf (stderr, "ERROR %s not a valid port\n", portB); | |||
goto exit; | |||
} | |||
} | |||
port1_flags = jack_port_flags (port1); | |||
port2_flags = jack_port_flags (port2); | |||
@@ -207,17 +206,25 @@ main (int argc, char *argv[]) | |||
goto exit; | |||
} | |||
/* tell the JACK server that we are ready to roll */ | |||
if (jack_activate (client)) { | |||
fprintf (stderr, "cannot activate client"); | |||
goto exit; | |||
} | |||
/* connect the ports. Note: you can't do this before | |||
the client is activated (this may change in the future). | |||
*/ | |||
if (connecting) { | |||
if (jack_connect(client, jack_port_name(src_port), jack_port_name(dst_port))) { | |||
fprintf (stderr, "cannot connect client, already connected?\n"); | |||
goto exit; | |||
} | |||
} | |||
if (disconnecting) { | |||
if (jack_disconnect(client, jack_port_name(src_port), jack_port_name(dst_port))) { | |||
fprintf (stderr, "cannot disconnect client, already disconnected?\n"); | |||
goto exit; | |||
} | |||
} | |||
@@ -1,4 +1,4 @@ | |||
/** @file simple_client.c | |||
/** @file control.c | |||
* | |||
* @brief This simple client demonstrates the basic features of JACK | |||
* as they would be used by many applications. | |||
@@ -14,14 +14,14 @@ | |||
jack_client_t *client; | |||
static int reorder = 0; | |||
static int Jack_Graph_Order_Callback(void *arg) | |||
{ | |||
const char **ports; | |||
int i; | |||
printf("Jack_Graph_Order_Callback count = %d\n", reorder++); | |||
ports = jack_get_ports(client, NULL, NULL, JackPortIsPhysical|JackPortIsOutput); | |||
if (ports) { | |||
for (i = 0; ports[i]; ++i) { | |||
@@ -29,15 +29,15 @@ static int Jack_Graph_Order_Callback(void *arg) | |||
} | |||
free(ports); | |||
} | |||
ports = jack_get_ports(client, NULL, NULL, JackPortIsPhysical|JackPortIsInput); | |||
if (ports) { | |||
if (ports) { | |||
for (i = 0; ports[i]; ++i) { | |||
printf("name: %s\n", ports[i]); | |||
} | |||
free(ports); | |||
} | |||
return 0; | |||
} | |||
@@ -46,7 +46,7 @@ main (int argc, char *argv[]) | |||
{ | |||
jack_options_t options = JackNullOption; | |||
jack_status_t status; | |||
/* open a client connection to the JACK server */ | |||
client = jack_client_open("control_client", options, &status); | |||
@@ -54,7 +54,7 @@ main (int argc, char *argv[]) | |||
printf("jack_client_open() failed \n"); | |||
exit(1); | |||
} | |||
if (jack_set_graph_order_callback(client, Jack_Graph_Order_Callback, 0) != 0) { | |||
printf("Error when calling jack_set_graph_order_callback() !\n"); | |||
} | |||
@@ -66,10 +66,10 @@ main (int argc, char *argv[]) | |||
printf("cannot activate client"); | |||
exit(1); | |||
} | |||
printf("Type 'q' to quit\n"); | |||
printf("Type 'q' to quit\n"); | |||
while ((getchar() != 'q')) {} | |||
jack_client_close(client); | |||
exit (0); | |||
} |
@@ -130,22 +130,22 @@ def build(bld): | |||
prog.uselib_local = 'clientlib' | |||
prog.target = 'jack_netsource' | |||
#if bld.env['IS_LINUX'] and bld.env['BUILD_EXAMPLE_ALSA_IO']: | |||
# prog = bld.new_task_gen('cc', 'program') | |||
# prog.includes = os_incdir + ['../common/jack', '../common'] | |||
# prog.source = ['alsa_in.c', '../common/memops.c'] | |||
# prog.env.append_value("CCFLAGS", "-DNO_JACK_ERROR") | |||
# prog.uselib = 'ALSA SAMPLERATE' | |||
# prog.uselib_local = 'clientlib' | |||
# prog.target = 'alsa_in' | |||
# prog = bld.new_task_gen('cc', 'program') | |||
# prog.includes = os_incdir + ['../common/jack', '../common'] | |||
# prog.source = ['alsa_out.c', '../common/memops.c'] | |||
# prog.env.append_value("CCFLAGS", "-DNO_JACK_ERROR") | |||
# prog.uselib = 'ALSA SAMPLERATE' | |||
# prog.uselib_local = 'clientlib' | |||
# prog.target = 'alsa_out' | |||
if bld.env['IS_LINUX'] and bld.env['BUILD_EXAMPLE_ALSA_IO']: | |||
prog = bld.new_task_gen('cc', 'program') | |||
prog.includes = os_incdir + ['../common/jack', '../common'] | |||
prog.source = ['alsa_in.c', '../common/memops.c'] | |||
prog.env.append_value("CCFLAGS", "-DNO_JACK_ERROR") | |||
prog.uselib = 'ALSA SAMPLERATE' | |||
prog.uselib_local = 'clientlib' | |||
prog.target = 'alsa_in' | |||
prog = bld.new_task_gen('cc', 'program') | |||
prog.includes = os_incdir + ['../common/jack', '../common'] | |||
prog.source = ['alsa_out.c', '../common/memops.c'] | |||
prog.env.append_value("CCFLAGS", "-DNO_JACK_ERROR") | |||
prog.uselib = 'ALSA SAMPLERATE' | |||
prog.uselib_local = 'clientlib' | |||
prog.target = 'alsa_out' | |||
for example_lib, example_lib_source in example_libs.items(): | |||
lib = bld.new_task_gen('cc', 'shlib') | |||
@@ -129,23 +129,33 @@ def configure(conf): | |||
conf.fatal('jackdbus was explicitly requested but cannot be built') | |||
conf.sub_config('example-clients') | |||
if conf.check_cfg(package='celt', atleast_version='0.8.0', args='--cflags --libs'): | |||
if conf.check_cfg(package='celt', atleast_version='0.11.0', args='--cflags --libs'): | |||
conf.define('HAVE_CELT', 1) | |||
conf.define('HAVE_CELT_API_0_11', 1) | |||
conf.define('HAVE_CELT_API_0_8', 0) | |||
conf.define('HAVE_CELT_API_0_7', 0) | |||
conf.define('HAVE_CELT_API_0_5', 0) | |||
elif conf.check_cfg(package='celt', atleast_version='0.8.0', args='--cflags --libs'): | |||
conf.define('HAVE_CELT', 1) | |||
conf.define('HAVE_CELT_API_0_11', 0) | |||
conf.define('HAVE_CELT_API_0_8', 1) | |||
conf.define('HAVE_CELT_API_0_7', 0) | |||
conf.define('HAVE_CELT_API_0_5', 0) | |||
elif conf.check_cfg(package='celt', atleast_version='0.7.0', args='--cflags --libs'): | |||
conf.define('HAVE_CELT', 1) | |||
conf.define('HAVE_CELT_API_0_11', 0) | |||
conf.define('HAVE_CELT_API_0_8', 0) | |||
conf.define('HAVE_CELT_API_0_7', 1) | |||
conf.define('HAVE_CELT_API_0_5', 0) | |||
elif conf.check_cfg(package='celt', atleast_version='0.5.0', args='--cflags --libs', required=True): | |||
conf.define('HAVE_CELT', 1) | |||
conf.define('HAVE_CELT_API_0_11', 0) | |||
conf.define('HAVE_CELT_API_0_8', 0) | |||
conf.define('HAVE_CELT_API_0_7', 0) | |||
conf.define('HAVE_CELT_API_0_5', 1) | |||
else: | |||
conf.define('HAVE_CELT', 0) | |||
conf.define('HAVE_CELT_API_0_11', 0) | |||
conf.define('HAVE_CELT_API_0_8', 0) | |||
conf.define('HAVE_CELT_API_0_7', 0) | |||
conf.define('HAVE_CELT_API_0_5', 0) | |||