summaryrefslogtreecommitdiff
path: root/drivers
diff options
context:
space:
mode:
Diffstat (limited to 'drivers')
-rw-r--r--drivers/netjack/net_driver.c29
-rw-r--r--drivers/netjack/net_driver.h1
-rw-r--r--drivers/netjack/netjack_packet.c50
-rw-r--r--drivers/netjack/netjack_packet.h4
4 files changed, 58 insertions, 26 deletions
diff --git a/drivers/netjack/net_driver.c b/drivers/netjack/net_driver.c
index fc8742a..6ca859d 100644
--- a/drivers/netjack/net_driver.c
+++ b/drivers/netjack/net_driver.c
@@ -393,7 +393,7 @@ net_driver_read (net_driver_t* driver, jack_nframes_t nframes)
unsigned int *packet_buf, *packet_bufX;
if( ! driver->packet_data_valid ) {
- render_payload_to_jack_ports (driver->bitdepth, NULL, driver->net_period_down, driver->capture_ports, driver->capture_srcs, nframes);
+ render_payload_to_jack_ports (driver->bitdepth, NULL, driver->net_period_down, driver->capture_ports, driver->capture_srcs, nframes, driver->dont_htonl_floats );
return 0;
}
packet_buf = driver->rx_buf;
@@ -461,7 +461,7 @@ net_driver_read (net_driver_t* driver, jack_nframes_t nframes)
}
}
- render_payload_to_jack_ports (driver->bitdepth, packet_bufX, driver->net_period_down, driver->capture_ports, driver->capture_srcs, nframes);
+ render_payload_to_jack_ports (driver->bitdepth, packet_bufX, driver->net_period_down, driver->capture_ports, driver->capture_srcs, nframes, driver->dont_htonl_floats );
return 0;
}
@@ -490,7 +490,7 @@ net_driver_write (net_driver_t* driver, jack_nframes_t nframes)
pkthdr->framecnt = driver->expected_framecnt;
- render_jack_ports_to_payload(driver->bitdepth, driver->playback_ports, driver->playback_srcs, nframes, packet_bufX, driver->net_period_up);
+ render_jack_ports_to_payload(driver->bitdepth, driver->playback_ports, driver->playback_srcs, nframes, packet_bufX, driver->net_period_up, driver->dont_htonl_floats );
packet_header_hton(pkthdr);
if (driver->srcaddress_valid)
@@ -674,7 +674,8 @@ net_driver_new (jack_client_t * client,
unsigned int bitdepth,
unsigned int use_autoconfig,
unsigned int latency,
- unsigned int redundancy)
+ unsigned int redundancy,
+ int dont_htonl_floats)
{
net_driver_t * driver;
int first_pack_len;
@@ -702,6 +703,7 @@ net_driver_new (jack_client_t * client,
driver->sample_rate = sample_rate;
driver->period_size = period_size;
+ driver->dont_htonl_floats = dont_htonl_floats;
driver->listen_port = listen_port;
driver->last_wait_ust = 0;
@@ -876,7 +878,7 @@ driver_get_descriptor ()
desc = calloc (1, sizeof (jack_driver_desc_t));
strcpy (desc->name, "net");
- desc->nparams = 15;
+ desc->nparams = 16;
params = calloc (desc->nparams, sizeof (jack_driver_param_desc_t));
@@ -1009,6 +1011,15 @@ driver_get_descriptor ()
"Send packets N times");
strcpy (params[i].long_desc, params[i].short_desc);
+ i++;
+ strcpy (params[i].name, "no-htonl");
+ params[i].character = 'H';
+ params[i].type = JackDriverParamUInt;
+ params[i].value.ui = 0U;
+ strcpy (params[i].short_desc,
+ "Dont convert samples to network byte order.");
+ strcpy (params[i].long_desc, params[i].short_desc);
+
desc->params = params;
return desc;
@@ -1033,6 +1044,7 @@ driver_initialize (jack_client_t *client, const JSList * params)
unsigned int use_autoconfig = 1;
unsigned int latency = 5;
unsigned int redundancy = 1;
+ int dont_htonl_floats = 0;
const JSList * node;
const jack_driver_param_t * param;
@@ -1116,6 +1128,10 @@ driver_initialize (jack_client_t *client, const JSList * params)
case 'R':
redundancy = param->value.ui;
break;
+
+ case 'H':
+ dont_htonl_floats = param->value.ui;
+ break;
}
}
@@ -1124,7 +1140,8 @@ driver_initialize (jack_client_t *client, const JSList * params)
sample_rate, period_size,
listen_port, handle_transport_sync,
resample_factor, resample_factor_up, bitdepth,
- use_autoconfig, latency, redundancy);
+ use_autoconfig, latency, redundancy,
+ dont_htonl_floats);
}
void
diff --git a/drivers/netjack/net_driver.h b/drivers/netjack/net_driver.h
index 5521e6f..63321d0 100644
--- a/drivers/netjack/net_driver.h
+++ b/drivers/netjack/net_driver.h
@@ -41,6 +41,7 @@ struct _net_driver
jack_nframes_t sample_rate;
jack_nframes_t bitdepth;
jack_nframes_t period_size;
+ int dont_htonl_floats;
jack_nframes_t codec_latency;
diff --git a/drivers/netjack/netjack_packet.c b/drivers/netjack/netjack_packet.c
index 4be553f..c551015 100644
--- a/drivers/netjack/netjack_packet.c
+++ b/drivers/netjack/netjack_packet.c
@@ -843,7 +843,7 @@ encode_midi_buffer (uint32_t *buffer_uint32, unsigned int buffer_size_uint32, ja
// render functions for float
void
-render_payload_to_jack_ports_float ( void *packet_payload, jack_nframes_t net_period_down, JSList *capture_ports, JSList *capture_srcs, jack_nframes_t nframes)
+render_payload_to_jack_ports_float ( void *packet_payload, jack_nframes_t net_period_down, JSList *capture_ports, JSList *capture_srcs, jack_nframes_t nframes, int dont_htonl_floats)
{
channel_t chn = 0;
JSList *node = capture_ports;
@@ -895,12 +895,19 @@ render_payload_to_jack_ports_float ( void *packet_payload, jack_nframes_t net_pe
else
#endif
{
- for (i = 0; i < net_period_down; i++)
- {
- val.i = packet_bufX[i];
- val.i = ntohl (val.i);
- buf[i] = val.f;
- }
+ if( dont_htonl_floats )
+ {
+ memcpy( buf, packet_bufX, net_period_down*sizeof(jack_default_audio_sample_t));
+ }
+ else
+ {
+ for (i = 0; i < net_period_down; i++)
+ {
+ val.i = packet_bufX[i];
+ val.i = ntohl (val.i);
+ buf[i] = val.f;
+ }
+ }
}
}
else if (strncmp (porttype, JACK_DEFAULT_MIDI_TYPE, jack_port_type_size()) == 0)
@@ -918,7 +925,7 @@ render_payload_to_jack_ports_float ( void *packet_payload, jack_nframes_t net_pe
}
void
-render_jack_ports_to_payload_float (JSList *playback_ports, JSList *playback_srcs, jack_nframes_t nframes, void *packet_payload, jack_nframes_t net_period_up)
+render_jack_ports_to_payload_float (JSList *playback_ports, JSList *playback_srcs, jack_nframes_t nframes, void *packet_payload, jack_nframes_t net_period_up, int dont_htonl_floats )
{
channel_t chn = 0;
JSList *node = playback_ports;
@@ -966,12 +973,19 @@ render_jack_ports_to_payload_float (JSList *playback_ports, JSList *playback_src
else
#endif
{
- for (i = 0; i < net_period_up; i++)
- {
- val.f = buf[i];
- val.i = htonl (val.i);
- packet_bufX[i] = val.i;
- }
+ if( dont_htonl_floats )
+ {
+ memcpy( packet_bufX, buf, net_period_up*sizeof(jack_default_audio_sample_t) );
+ }
+ else
+ {
+ for (i = 0; i < net_period_up; i++)
+ {
+ val.f = buf[i];
+ val.i = htonl (val.i);
+ packet_bufX[i] = val.i;
+ }
+ }
}
}
else if (strncmp(porttype, JACK_DEFAULT_MIDI_TYPE, jack_port_type_size()) == 0)
@@ -1352,7 +1366,7 @@ render_jack_ports_to_payload_celt (JSList *playback_ports, JSList *playback_srcs
#endif
/* Wrapper functions with bitdepth argument... */
void
-render_payload_to_jack_ports (int bitdepth, void *packet_payload, jack_nframes_t net_period_down, JSList *capture_ports, JSList *capture_srcs, jack_nframes_t nframes)
+render_payload_to_jack_ports (int bitdepth, void *packet_payload, jack_nframes_t net_period_down, JSList *capture_ports, JSList *capture_srcs, jack_nframes_t nframes, int dont_htonl_floats)
{
if (bitdepth == 8)
render_payload_to_jack_ports_8bit (packet_payload, net_period_down, capture_ports, capture_srcs, nframes);
@@ -1363,11 +1377,11 @@ render_payload_to_jack_ports (int bitdepth, void *packet_payload, jack_nframes_t
render_payload_to_jack_ports_celt (packet_payload, net_period_down, capture_ports, capture_srcs, nframes);
#endif
else
- render_payload_to_jack_ports_float (packet_payload, net_period_down, capture_ports, capture_srcs, nframes);
+ render_payload_to_jack_ports_float (packet_payload, net_period_down, capture_ports, capture_srcs, nframes, dont_htonl_floats);
}
void
-render_jack_ports_to_payload (int bitdepth, JSList *playback_ports, JSList *playback_srcs, jack_nframes_t nframes, void *packet_payload, jack_nframes_t net_period_up)
+render_jack_ports_to_payload (int bitdepth, JSList *playback_ports, JSList *playback_srcs, jack_nframes_t nframes, void *packet_payload, jack_nframes_t net_period_up, int dont_htonl_floats)
{
if (bitdepth == 8)
render_jack_ports_to_payload_8bit (playback_ports, playback_srcs, nframes, packet_payload, net_period_up);
@@ -1378,5 +1392,5 @@ render_jack_ports_to_payload (int bitdepth, JSList *playback_ports, JSList *play
render_jack_ports_to_payload_celt (playback_ports, playback_srcs, nframes, packet_payload, net_period_up);
#endif
else
- render_jack_ports_to_payload_float (playback_ports, playback_srcs, nframes, packet_payload, net_period_up);
+ render_jack_ports_to_payload_float (playback_ports, playback_srcs, nframes, packet_payload, net_period_up, dont_htonl_floats);
}
diff --git a/drivers/netjack/netjack_packet.h b/drivers/netjack/netjack_packet.h
index f70b7e9..f91aaf5 100644
--- a/drivers/netjack/netjack_packet.h
+++ b/drivers/netjack/netjack_packet.h
@@ -131,9 +131,9 @@ void packet_header_hton(jacknet_packet_header *pkthdr);
void packet_header_ntoh(jacknet_packet_header *pkthdr);
-void render_payload_to_jack_ports(int bitdepth, void *packet_payload, jack_nframes_t net_period_down, JSList *capture_ports, JSList *capture_srcs, jack_nframes_t nframes);
+void render_payload_to_jack_ports(int bitdepth, void *packet_payload, jack_nframes_t net_period_down, JSList *capture_ports, JSList *capture_srcs, jack_nframes_t nframes, int dont_htonl_floats );
-void render_jack_ports_to_payload(int bitdepth, JSList *playback_ports, JSList *playback_srcs, jack_nframes_t nframes, void *packet_payload, jack_nframes_t net_period_up);
+void render_jack_ports_to_payload(int bitdepth, JSList *playback_ports, JSList *playback_srcs, jack_nframes_t nframes, void *packet_payload, jack_nframes_t net_period_up, int dont_htonl_floats );
// XXX: This is sort of deprecated: