Browse Source

Merge branch 'master' into newer-midi-with-coremidi-driver

tags/1.9.8
Stephane Letz 14 years ago
parent
commit
e27bce129f
8 changed files with 1732 additions and 1690 deletions
  1. +1631
    -1626
      ChangeLog
  2. +27
    -11
      common/JackNetOneDriver.cpp
  3. +8
    -3
      common/netjack.c
  4. +16
    -17
      common/netjack_packet.c
  5. +11
    -4
      example-clients/connect.c
  6. +12
    -12
      example-clients/control.c
  7. +16
    -16
      example-clients/wscript
  8. +11
    -1
      wscript

+ 1631
- 1626
ChangeLog
File diff suppressed because it is too large
View File


+ 27
- 11
common/JackNetOneDriver.cpp View File

@@ -36,7 +36,7 @@ Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
#endif #endif


#if HAVE_CELT #if HAVE_CELT
#include "celt/celt.h"
#include <celt/celt.h>
#endif #endif


#define MIN(x,y) ((x)<(y) ? (x) : (y)) #define MIN(x,y) ((x)<(y) ? (x) : (y))
@@ -153,12 +153,15 @@ namespace Jack
} }
//port = fGraphManager->GetPort ( port_id ); //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( netj.bitdepth == CELT_MODE ) {
#if HAVE_CELT #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; celt_int32 lookahead;
CELTMode *celt_mode = celt_mode_create( netj.sample_rate, netj.period_size, NULL ); 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 ) ); 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 ); //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( netj.bitdepth == CELT_MODE ) {
#if HAVE_CELT #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 ); 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 ) ); netj.playback_srcs = jack_slist_append(netj.playback_srcs, celt_encoder_create( celt_mode, 1, NULL ) );
#else #else
@@ -697,10 +701,18 @@ namespace Jack
{ {
// audio port, decode celt data. // audio port, decode celt data.
CELTDecoder *decoder = (CELTDecoder *)src_node->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 ) if( !packet_payload )
celt_decode_float( decoder, NULL, net_period_down, buf );
celt_decode_float( decoder, NULL, net_period_down, buf );
else 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); 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 ); 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) ); memcpy( floatbuf, buf, nframes * sizeof(jack_default_audio_sample_t) );
CELTEncoder *encoder = (CELTEncoder *)src_node->data; 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 ); 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." ); jack_error( "something in celt changed. netjack needs to be changed to handle this." );
src_node = jack_slist_next( src_node ); src_node = jack_slist_next( src_node );
} }


+ 8
- 3
common/netjack.c View File

@@ -365,7 +365,7 @@ void netjack_attach( netjack_driver_state_t *netj )
if( netj->bitdepth == CELT_MODE ) if( netj->bitdepth == CELT_MODE )
{ {
#if HAVE_CELT #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; celt_int32 lookahead;
netj->celt_mode = celt_mode_create( netj->sample_rate, netj->period_size, NULL ); netj->celt_mode = celt_mode_create( netj->sample_rate, netj->period_size, NULL );
#else #else
@@ -398,7 +398,9 @@ void netjack_attach( netjack_driver_state_t *netj )


if( netj->bitdepth == CELT_MODE ) { if( netj->bitdepth == CELT_MODE ) {
#if HAVE_CELT #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 ) ); netj->capture_srcs = jack_slist_append(netj->capture_srcs, celt_decoder_create( netj->celt_mode, 1, NULL ) );
#else #else
netj->capture_srcs = jack_slist_append(netj->capture_srcs, celt_decoder_create( netj->celt_mode ) ); 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); jack_slist_append (netj->playback_ports, port);
if( netj->bitdepth == CELT_MODE ) { if( netj->bitdepth == CELT_MODE ) {
#if HAVE_CELT #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 ); 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 ) ); netj->playback_srcs = jack_slist_append(netj->playback_srcs, celt_encoder_create( celt_mode, 1, NULL ) );
#else #else


+ 16
- 17
common/netjack_packet.c View File

@@ -1368,21 +1368,20 @@ render_payload_to_jack_ports_celt (void *packet_payload, jack_nframes_t net_peri
if (jack_port_is_audio (porttype)) if (jack_port_is_audio (porttype))
{ {
// audio port, decode celt data. // 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)) 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) // convert the data buffer to a standard format (uint32_t based)
unsigned int buffer_size_uint32 = net_period_down / 2; unsigned int buffer_size_uint32 = net_period_down / 2;
uint32_t * buffer_uint32 = (uint32_t*) packet_bufX; 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); packet_bufX = (packet_bufX + net_period_down);
node = jack_slist_next (node); 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 ); float *floatbuf = alloca (sizeof(float) * nframes );
memcpy( floatbuf, buf, nframes*sizeof(float) ); memcpy( floatbuf, buf, nframes*sizeof(float) );
CELTEncoder *encoder = src_node->data; 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 ); encoded_bytes = celt_encode_float( encoder, floatbuf, nframes, packet_bufX, net_period_up );
#else #else
encoded_bytes = celt_encode_float( encoder, floatbuf, NULL, packet_bufX, net_period_up ); encoded_bytes = celt_encode_float( encoder, floatbuf, NULL, packet_bufX, net_period_up );


+ 11
- 4
example-clients/connect.c View File

@@ -31,7 +31,7 @@
jack_port_t *input_port; jack_port_t *input_port;
jack_port_t *output_port; jack_port_t *output_port;
int connecting, disconnecting; int connecting, disconnecting;
int done = 0;
volatile int done = 0;
#define TRUE 1 #define TRUE 1
#define FALSE 0 #define FALSE 0


@@ -58,7 +58,6 @@ show_usage (char *my_name)
fprintf (stderr, "For more information see http://jackaudio.org/\n"); fprintf (stderr, "For more information see http://jackaudio.org/\n");
} }



int int
main (int argc, char *argv[]) main (int argc, char *argv[])
{ {
@@ -181,11 +180,11 @@ main (int argc, char *argv[])
if ((port1 = jack_port_by_name(client, portA)) == 0) { if ((port1 = jack_port_by_name(client, portA)) == 0) {
fprintf (stderr, "ERROR %s not a valid port\n", portA); fprintf (stderr, "ERROR %s not a valid port\n", portA);
goto exit; goto exit;
}
}
if ((port2 = jack_port_by_name(client, portB)) == 0) { if ((port2 = jack_port_by_name(client, portB)) == 0) {
fprintf (stderr, "ERROR %s not a valid port\n", portB); fprintf (stderr, "ERROR %s not a valid port\n", portB);
goto exit; goto exit;
}
}


port1_flags = jack_port_flags (port1); port1_flags = jack_port_flags (port1);
port2_flags = jack_port_flags (port2); port2_flags = jack_port_flags (port2);
@@ -207,17 +206,25 @@ main (int argc, char *argv[])
goto exit; 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 /* connect the ports. Note: you can't do this before
the client is activated (this may change in the future). the client is activated (this may change in the future).
*/ */


if (connecting) { if (connecting) {
if (jack_connect(client, jack_port_name(src_port), jack_port_name(dst_port))) { if (jack_connect(client, jack_port_name(src_port), jack_port_name(dst_port))) {
fprintf (stderr, "cannot connect client, already connected?\n");
goto exit; goto exit;
} }
} }
if (disconnecting) { if (disconnecting) {
if (jack_disconnect(client, jack_port_name(src_port), jack_port_name(dst_port))) { if (jack_disconnect(client, jack_port_name(src_port), jack_port_name(dst_port))) {
fprintf (stderr, "cannot disconnect client, already disconnected?\n");
goto exit; goto exit;
} }
} }


+ 12
- 12
example-clients/control.c View File

@@ -1,4 +1,4 @@
/** @file simple_client.c
/** @file control.c
* *
* @brief This simple client demonstrates the basic features of JACK * @brief This simple client demonstrates the basic features of JACK
* as they would be used by many applications. * as they would be used by many applications.
@@ -14,14 +14,14 @@


jack_client_t *client; jack_client_t *client;
static int reorder = 0; static int reorder = 0;
static int Jack_Graph_Order_Callback(void *arg) static int Jack_Graph_Order_Callback(void *arg)
{ {
const char **ports; const char **ports;
int i; int i;
printf("Jack_Graph_Order_Callback count = %d\n", reorder++); printf("Jack_Graph_Order_Callback count = %d\n", reorder++);
ports = jack_get_ports(client, NULL, NULL, JackPortIsPhysical|JackPortIsOutput); ports = jack_get_ports(client, NULL, NULL, JackPortIsPhysical|JackPortIsOutput);
if (ports) { if (ports) {
for (i = 0; ports[i]; ++i) { for (i = 0; ports[i]; ++i) {
@@ -29,15 +29,15 @@ static int Jack_Graph_Order_Callback(void *arg)
} }
free(ports); free(ports);
} }
ports = jack_get_ports(client, NULL, NULL, JackPortIsPhysical|JackPortIsInput); ports = jack_get_ports(client, NULL, NULL, JackPortIsPhysical|JackPortIsInput);
if (ports) {
if (ports) {
for (i = 0; ports[i]; ++i) { for (i = 0; ports[i]; ++i) {
printf("name: %s\n", ports[i]); printf("name: %s\n", ports[i]);
} }
free(ports); free(ports);
} }
return 0; return 0;
} }


@@ -46,7 +46,7 @@ main (int argc, char *argv[])
{ {
jack_options_t options = JackNullOption; jack_options_t options = JackNullOption;
jack_status_t status; jack_status_t status;
/* open a client connection to the JACK server */ /* open a client connection to the JACK server */


client = jack_client_open("control_client", options, &status); client = jack_client_open("control_client", options, &status);
@@ -54,7 +54,7 @@ main (int argc, char *argv[])
printf("jack_client_open() failed \n"); printf("jack_client_open() failed \n");
exit(1); exit(1);
} }
if (jack_set_graph_order_callback(client, Jack_Graph_Order_Callback, 0) != 0) { if (jack_set_graph_order_callback(client, Jack_Graph_Order_Callback, 0) != 0) {
printf("Error when calling jack_set_graph_order_callback() !\n"); printf("Error when calling jack_set_graph_order_callback() !\n");
} }
@@ -66,10 +66,10 @@ main (int argc, char *argv[])
printf("cannot activate client"); printf("cannot activate client");
exit(1); exit(1);
} }
printf("Type 'q' to quit\n");
printf("Type 'q' to quit\n");
while ((getchar() != 'q')) {} while ((getchar() != 'q')) {}
jack_client_close(client); jack_client_close(client);
exit (0); exit (0);
} }

+ 16
- 16
example-clients/wscript View File

@@ -130,22 +130,22 @@ def build(bld):
prog.uselib_local = 'clientlib' prog.uselib_local = 'clientlib'
prog.target = 'jack_netsource' 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(): for example_lib, example_lib_source in example_libs.items():
lib = bld.new_task_gen('cc', 'shlib') lib = bld.new_task_gen('cc', 'shlib')


+ 11
- 1
wscript View File

@@ -129,23 +129,33 @@ def configure(conf):
conf.fatal('jackdbus was explicitly requested but cannot be built') conf.fatal('jackdbus was explicitly requested but cannot be built')
conf.sub_config('example-clients') 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', 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_8', 1)
conf.define('HAVE_CELT_API_0_7', 0) conf.define('HAVE_CELT_API_0_7', 0)
conf.define('HAVE_CELT_API_0_5', 0) conf.define('HAVE_CELT_API_0_5', 0)
elif conf.check_cfg(package='celt', atleast_version='0.7.0', args='--cflags --libs'): elif conf.check_cfg(package='celt', atleast_version='0.7.0', args='--cflags --libs'):
conf.define('HAVE_CELT', 1) 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_8', 0)
conf.define('HAVE_CELT_API_0_7', 1) conf.define('HAVE_CELT_API_0_7', 1)
conf.define('HAVE_CELT_API_0_5', 0) conf.define('HAVE_CELT_API_0_5', 0)
elif conf.check_cfg(package='celt', atleast_version='0.5.0', args='--cflags --libs', required=True): 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', 1)
conf.define('HAVE_CELT_API_0_11', 0)
conf.define('HAVE_CELT_API_0_8', 0) conf.define('HAVE_CELT_API_0_8', 0)
conf.define('HAVE_CELT_API_0_7', 0) conf.define('HAVE_CELT_API_0_7', 0)
conf.define('HAVE_CELT_API_0_5', 1) conf.define('HAVE_CELT_API_0_5', 1)
else: else:
conf.define('HAVE_CELT', 0) 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_8', 0)
conf.define('HAVE_CELT_API_0_7', 0) conf.define('HAVE_CELT_API_0_7', 0)
conf.define('HAVE_CELT_API_0_5', 0) conf.define('HAVE_CELT_API_0_5', 0)


Loading…
Cancel
Save