diff --git a/common/netjack.c b/common/netjack.c index ccca8b38..16ae7f4f 100644 --- a/common/netjack.c +++ b/common/netjack.c @@ -364,7 +364,7 @@ void netjack_attach( netjack_driver_state_t *netj ) netj->capture_ports = jack_slist_append (netj->capture_ports, port); - if( netj->bitdepth == 1000 ) { + if( netj->bitdepth == CELT_MODE ) { #if HAVE_CELT celt_int32_t lookahead; // XXX: memory leak @@ -411,7 +411,7 @@ void netjack_attach( netjack_driver_state_t *netj ) netj->playback_ports = jack_slist_append (netj->playback_ports, port); - if( netj->bitdepth == 1000 ) { + if( netj->bitdepth == CELT_MODE ) { #if HAVE_CELT // XXX: memory leak CELTMode *celt_mode = celt_mode_create( netj->sample_rate, 1, netj->period_size, NULL ); @@ -517,7 +517,7 @@ netjack_driver_state_t *netjack_init (netjack_driver_state_t *netj, netj->client = client; - if ((bitdepth != 0) && (bitdepth != 8) && (bitdepth != 16) && (bitdepth != 1000)) + if ((bitdepth != 0) && (bitdepth != 8) && (bitdepth != 16) && (bitdepth != CELT_MODE)) { jack_info ("Invalid bitdepth: %d (8, 16 or 0 for float) !!!", bitdepth); return NULL; @@ -655,7 +655,7 @@ netjack_startup( netjack_driver_state_t *netj ) (jack_time_t) floor ((((float) netj->period_size) / (float)netj->sample_rate) * 1000000.0f); - if( netj->bitdepth == 1000 ) { + if( netj->bitdepth == CELT_MODE ) { // celt mode. // TODO: this is a hack. But i dont want to change the packet header. netj->net_period_down = netj->resample_factor; diff --git a/common/netjack_packet.c b/common/netjack_packet.c index cd51dca9..66adfe28 100644 --- a/common/netjack_packet.c +++ b/common/netjack_packet.c @@ -132,7 +132,9 @@ int get_sample_size (int bitdepth) return sizeof (int8_t); if (bitdepth == 16) return sizeof (int16_t); - if( bitdepth == 1000 ) + //JN: why? is this for buffer sizes before or after encoding? + //JN: if the former, why not int16_t, if the latter, shouldn't it depend on -c N? + if( bitdepth == CELT_MODE ) return sizeof( unsigned char ); return sizeof (int32_t); } @@ -1504,7 +1506,7 @@ render_payload_to_jack_ports (int bitdepth, void *packet_payload, jack_nframes_t else if (bitdepth == 16) render_payload_to_jack_ports_16bit (packet_payload, net_period_down, capture_ports, capture_srcs, nframes); #if HAVE_CELT - else if (bitdepth == 1000) + else if (bitdepth == CELT_MODE) render_payload_to_jack_ports_celt (packet_payload, net_period_down, capture_ports, capture_srcs, nframes); #endif else @@ -1519,7 +1521,7 @@ render_jack_ports_to_payload (int bitdepth, JSList *playback_ports, JSList *play else if (bitdepth == 16) render_jack_ports_to_payload_16bit (playback_ports, playback_srcs, nframes, packet_payload, net_period_up); #if HAVE_CELT - else if (bitdepth == 1000) + else if (bitdepth == CELT_MODE) render_jack_ports_to_payload_celt (playback_ports, playback_srcs, nframes, packet_payload, net_period_up); #endif else diff --git a/common/netjack_packet.h b/common/netjack_packet.h index 7b21b0ee..ad752b26 100644 --- a/common/netjack_packet.h +++ b/common/netjack_packet.h @@ -42,6 +42,8 @@ //#include // The Packet Header. +#define CELT_MODE 1000 // Magic bitdepth value that indicates CELT compression + typedef struct _jacknet_packet_header jacknet_packet_header; struct _jacknet_packet_header