diff options
Diffstat (limited to 'libjack/port.c')
-rw-r--r-- | libjack/port.c | 343 |
1 files changed, 175 insertions, 168 deletions
diff --git a/libjack/port.c b/libjack/port.c index 5d42b9f..ae67cbb 100644 --- a/libjack/port.c +++ b/libjack/port.c @@ -1,22 +1,22 @@ /* Copyright (C) 2001-2003 Paul Davis Copyright (C) 2005 Jussi Laako - + This program is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation; either version 2.1 of the License, or (at your option) any later version. - + This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. - + You should have received a copy of the GNU Lesser General Public License - along with this program; if not, write to the Free Software + along with this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. -*/ + */ #include <string.h> #include <stdio.h> @@ -41,36 +41,34 @@ #include "local.h" static void jack_generic_buffer_init(void *port_buffer, - size_t buffer_size, - jack_nframes_t nframes); - -static void jack_audio_port_mixdown (jack_port_t *port, + size_t buffer_size, jack_nframes_t nframes); +static void jack_audio_port_mixdown(jack_port_t *port, + jack_nframes_t nframes); + /* These function pointers are local to each address space. For * internal clients they reside within jackd; for external clients in * the application process. */ jack_port_functions_t jack_builtin_audio_functions = { - .buffer_init = jack_generic_buffer_init, - .mixdown = jack_audio_port_mixdown, + .buffer_init = jack_generic_buffer_init, + .mixdown = jack_audio_port_mixdown, }; extern jack_port_functions_t jack_builtin_midi_functions; jack_port_functions_t jack_builtin_NULL_functions = { - .buffer_init = jack_generic_buffer_init, - .mixdown = NULL, + .buffer_init = jack_generic_buffer_init, + .mixdown = NULL, }; /* Only the Audio and MIDI port types are currently built in. */ jack_port_type_info_t jack_builtin_port_types[] = { - { .type_name = JACK_DEFAULT_AUDIO_TYPE, - .buffer_scale_factor = 1, - }, - { .type_name = JACK_DEFAULT_MIDI_TYPE, + { .type_name = JACK_DEFAULT_AUDIO_TYPE, + .buffer_scale_factor = 1, }, + { .type_name = JACK_DEFAULT_MIDI_TYPE, .buffer_scale_factor = -1, - .buffer_size = 2048 - }, + .buffer_size = 2048 }, { .type_name = "", } }; @@ -78,13 +76,13 @@ jack_port_type_info_t jack_builtin_port_types[] = { #ifdef USE_DYNSIMD -static void (*opt_copy) (float *, const float *, int); -static void (*opt_mix) (float *, const float *, int); +static void (*opt_copy)(float *, const float *, int); +static void (*opt_mix)(float *, const float *, int); static void gen_copyf (float *dest, const float *src, int length) { - memcpy(dest, src, length * sizeof(float)); + memcpy (dest, src, length * sizeof(float)); } static void @@ -96,22 +94,20 @@ gen_mixf (float *dest, const float *src, int length) while (n--) *dest++ += *src++; /*for (iSample = 0; iSample < iDataLength; iSample++) - fpDest[iSample] += fpSrc[iSample];*/ + fpDest[iSample] += fpSrc[iSample];*/ } #ifdef ARCH_X86 void jack_port_set_funcs () { - if (ARCH_X86_HAVE_SSE2(cpu_type)) { + if (ARCH_X86_HAVE_SSE2 (cpu_type)) { opt_copy = x86_sse_copyf; opt_mix = x86_sse_add2f; - } - else if (ARCH_X86_HAVE_3DNOW(cpu_type)) { + } else if (ARCH_X86_HAVE_3DNOW (cpu_type)) { opt_copy = x86_3dnow_copyf; opt_mix = x86_3dnow_add2f; - } - else { + } else { opt_copy = gen_copyf; opt_mix = gen_mixf; } @@ -125,34 +121,34 @@ void jack_port_set_funcs () opt_mix = gen_mixf; } -#endif /* ARCH_X86 */ +#endif /* ARCH_X86 */ -#endif /* USE_DYNSIMD */ +#endif /* USE_DYNSIMD */ int jack_port_name_equals (jack_port_shared_t* port, const char* target) { - char buf[JACK_PORT_NAME_SIZE+1]; + char buf[JACK_PORT_NAME_SIZE + 1]; /* this nasty, nasty kludge is here because between 0.109.0 and 0.109.1, the ALSA audio backend had the name "ALSA", whereas as before and after it, it was called "alsa_pcm". this stops breakage for any setups that have saved "alsa_pcm" or "ALSA" in their connection state. - */ + */ if (strncmp (target, "ALSA:capture", 12) == 0 || strncmp (target, "ALSA:playback", 13) == 0) { - snprintf (buf, sizeof (buf), "alsa_pcm%s", target+4); + snprintf (buf, sizeof(buf), "alsa_pcm%s", target + 4); target = buf; } - return (strcmp (port->name, target) == 0 || - strcmp (port->alias1, target) == 0 || - strcmp (port->alias2, target) == 0); + return strcmp (port->name, target) == 0 || + strcmp (port->alias1, target) == 0 || + strcmp (port->alias2, target) == 0; } jack_port_functions_t * -jack_get_port_functions(jack_port_type_id_t ptid) +jack_get_port_functions (jack_port_type_id_t ptid) { switch (ptid) { case JACK_AUDIO_PORT_TYPE: @@ -169,9 +165,9 @@ jack_get_port_functions(jack_port_type_id_t ptid) * Fills buffer with zeroes. For audio ports, engine->silent_buffer relies on it. */ static void -jack_generic_buffer_init(void *buffer, size_t size, jack_nframes_t nframes) -{ - memset(buffer, 0, size); +jack_generic_buffer_init (void *buffer, size_t size, jack_nframes_t nframes) +{ + memset (buffer, 0, size); } @@ -183,10 +179,10 @@ jack_port_new (const jack_client_t *client, jack_port_id_t port_id, jack_port_type_id_t ptid = shared->ptype_id; jack_port_t *port; - if ((port = (jack_port_t *) malloc (sizeof (jack_port_t))) == NULL) { + if ((port = (jack_port_t*)malloc (sizeof(jack_port_t))) == NULL) { return NULL; } - + port->mix_buffer = NULL; port->client_segment_base = NULL; port->shared = shared; @@ -196,14 +192,15 @@ jack_port_new (const jack_client_t *client, jack_port_id_t port_id, port->tied = NULL; if (jack_uuid_compare (client->control->uuid, port->shared->client_id) == 0) { - + /* It's our port, so initialize the pointers to port * functions within this address space. These builtin - * definitions can be overridden by the client. + * definitions can be overridden by the client. */ - jack_port_functions_t *port_functions = jack_get_port_functions(ptid); - if (port_functions == NULL) + jack_port_functions_t *port_functions = jack_get_port_functions (ptid); + if (port_functions == NULL) { port_functions = &jack_builtin_NULL_functions; + } port->fptr = *port_functions; port->shared->has_mixdown = (port->fptr.mixdown ? TRUE : FALSE); } @@ -213,32 +210,33 @@ jack_port_new (const jack_client_t *client, jack_port_id_t port_id, directly, because port->client_segment_base and/or port->offset can change if the buffer size or port counts are changed. - */ + */ port->client_segment_base = - (void **) &client->port_segment[ptid].attached_at; + (void**)&client->port_segment[ptid].attached_at; return port; } -size_t +size_t jack_port_type_get_buffer_size (jack_client_t *client, const char *port_type) { int i; - for (i=0; i<client->engine->n_port_types; i++) { - if (!strcmp(port_type, client->engine->port_types[i].type_name)) + for (i = 0; i < client->engine->n_port_types; i++) + if (!strcmp (port_type, client->engine->port_types[i].type_name)) { break; - } + } - if (i==client->engine->n_port_types) + if (i == client->engine->n_port_types) { return 0; + } return jack_port_type_buffer_size (&(client->engine->port_types[i]), client->engine->buffer_size); } jack_port_t * -jack_port_register (jack_client_t *client, +jack_port_register (jack_client_t *client, const char *port_name, const char *port_type, unsigned long flags, @@ -246,29 +244,29 @@ jack_port_register (jack_client_t *client, { jack_request_t req; jack_port_t *port = 0; - int length ; + int length; - VALGRIND_MEMSET (&req, 0, sizeof (req)); + VALGRIND_MEMSET (&req, 0, sizeof(req)); req.type = RegisterPort; - length = strlen ((const char *) client->control->name) - + 1 + strlen (port_name); - if ( length >= sizeof (req.x.port_info.name) ) { - jack_error ("\"%s:%s\" is too long to be used as a JACK port name.\n" - "Please use %lu characters or less.", - client->control->name , - port_name, - sizeof (req.x.port_info.name) - 1); - return NULL ; + length = strlen ((const char*)client->control->name) + + 1 + strlen (port_name); + if ( length >= sizeof(req.x.port_info.name) ) { + jack_error ("\"%s:%s\" is too long to be used as a JACK port name.\n" + "Please use %lu characters or less.", + client->control->name, + port_name, + sizeof(req.x.port_info.name) - 1); + return NULL; } - strcpy ((char *) req.x.port_info.name, - (const char *) client->control->name); - strcat ((char *) req.x.port_info.name, ":"); - strcat ((char *) req.x.port_info.name, port_name); + strcpy ((char*)req.x.port_info.name, + (const char*)client->control->name); + strcat ((char*)req.x.port_info.name, ":"); + strcat ((char*)req.x.port_info.name, port_name); - snprintf (req.x.port_info.type, sizeof (req.x.port_info.type), + snprintf (req.x.port_info.type, sizeof(req.x.port_info.type), "%s", port_type); req.x.port_info.flags = flags; req.x.port_info.buffer_size = buffer_size; @@ -290,12 +288,12 @@ jack_port_register (jack_client_t *client, return port; } -int +int jack_port_unregister (jack_client_t *client, jack_port_t *port) { jack_request_t req; - - VALGRIND_MEMSET (&req, 0, sizeof (req)); + + VALGRIND_MEMSET (&req, 0, sizeof(req)); req.type = UnRegisterPort; @@ -324,20 +322,20 @@ jack_port_connected_to (const jack_port_t *port, const char *portname) while we are checking for them. that's hard, and has a non-trivial performance impact for jackd. - */ + */ - pthread_mutex_lock (&((jack_port_t *) port)->connection_lock); + pthread_mutex_lock (&((jack_port_t*)port)->connection_lock); for (node = port->connections; node; node = jack_slist_next (node)) { - jack_port_t *other_port = (jack_port_t *) node->data; - + jack_port_t *other_port = (jack_port_t*)node->data; + if (jack_port_name_equals (other_port->shared, portname)) { ret = TRUE; break; } } - pthread_mutex_unlock (&((jack_port_t *) port)->connection_lock); + pthread_mutex_unlock (&((jack_port_t*)port)->connection_lock); return ret; } @@ -353,29 +351,29 @@ jack_port_get_connections (const jack_port_t *port) while we are checking for them. that's hard, and has a non-trivial performance impact for jackd. - */ + */ - pthread_mutex_lock (&((jack_port_t *) port)->connection_lock); + pthread_mutex_lock (&((jack_port_t*)port)->connection_lock); if (port->connections != NULL) { - ret = (const char **) - malloc (sizeof (char *) - * (jack_slist_length (port->connections) + 1)); + ret = (const char**) + malloc (sizeof(char *) + * (jack_slist_length (port->connections) + 1)); if (ret == NULL) { - pthread_mutex_unlock (&((jack_port_t *)port)->connection_lock); + pthread_mutex_unlock (&((jack_port_t*)port)->connection_lock); return NULL; } for (n = 0, node = port->connections; node; node = jack_slist_next (node), ++n) { - jack_port_t* other =(jack_port_t *) node->data; + jack_port_t* other = (jack_port_t*)node->data; ret[n] = other->shared->name; } ret[n] = NULL; } - pthread_mutex_unlock (&((jack_port_t *) port)->connection_lock); + pthread_mutex_unlock (&((jack_port_t*)port)->connection_lock); return ret; } @@ -395,8 +393,8 @@ jack_port_get_all_connections (const jack_client_t *client, return NULL; } - VALGRIND_MEMSET (&req, 0, sizeof (req)); - + VALGRIND_MEMSET (&req, 0, sizeof(req)); + req.type = GetPortConnections; req.x.port_info.name[0] = '\0'; @@ -417,15 +415,15 @@ jack_port_get_all_connections (const jack_client_t *client, return req.x.port_connections.ports; } - if ((ret = (const char **) malloc (sizeof (char *) * (req.x.port_connections.nports + 1))) == NULL) { + if ((ret = (const char**)malloc (sizeof(char *) * (req.x.port_connections.nports + 1))) == NULL) { return NULL; } for (i = 0; i < req.x.port_connections.nports; ++i ) { jack_port_id_t port_id; - - if (read (client->request_fd, &port_id, sizeof (port_id)) - != sizeof (port_id)) { + + if (read (client->request_fd, &port_id, sizeof(port_id)) + != sizeof(port_id)) { jack_error ("cannot read port id from server"); return 0; } @@ -448,14 +446,15 @@ jack_port_by_id_int (const jack_client_t *client, jack_port_id_t id, int* free) JSList *node; for (node = client->ports; node; node = jack_slist_next (node)) { - if (((jack_port_t *) node->data)->shared->id == id) { + if (((jack_port_t*)node->data)->shared->id == id) { *free = FALSE; - return (jack_port_t *) node->data; + return (jack_port_t*)node->data; } } - if (id >= client->engine->port_max) + if (id >= client->engine->port_max) { return NULL; + } if (client->engine->ports[id].in_use) { *free = TRUE; @@ -471,18 +470,20 @@ jack_port_by_id (jack_client_t *client, jack_port_id_t id) JSList *node; jack_port_t* port; int need_free = FALSE; + for (node = client->ports_ext; node; node = jack_slist_next (node)) { port = node->data; if (port->shared->id == id) { // Found port, return the cached structure return port; } } - + // Otherwise possibly allocate a new port structure, keep it in the ports_ext list for later use - port = jack_port_by_id_int (client,id,&need_free); - if (port != NULL && need_free) + port = jack_port_by_id_int (client, id, &need_free); + if (port != NULL && need_free) { client->ports_ext = jack_slist_prepend (client->ports_ext, port); + } return port; } @@ -491,10 +492,10 @@ jack_port_by_name_int (jack_client_t *client, const char *port_name) { unsigned long i, limit; jack_port_shared_t *port; - + limit = client->engine->port_max; port = &client->engine->ports[0]; - + for (i = 0; i < limit; i++) { if (port[i].in_use && jack_port_name_equals (&port[i], port_name)) { return jack_port_new (client, port[i].id, @@ -510,6 +511,7 @@ jack_port_by_name (jack_client_t *client, const char *port_name) { JSList *node; jack_port_t* port; + for (node = client->ports_ext; node; node = jack_slist_next (node)) { port = node->data; if (jack_port_name_equals (port->shared, port_name)) { @@ -517,13 +519,14 @@ jack_port_by_name (jack_client_t *client, const char *port_name) return port; } } - + /* Otherwise allocate a new port structure, keep it in the * ports_ext list for later use. */ port = jack_port_by_name_int (client, port_name); - if (port != NULL) + if (port != NULL) { client->ports_ext = jack_slist_prepend (client->ports_ext, port); + } return port; } @@ -543,7 +546,7 @@ void jack_port_set_latency (jack_port_t *port, jack_nframes_t nframes) { port->shared->latency = nframes; - + /* setup the new latency values here, * so we dont need to change the backend codes. */ @@ -564,15 +567,15 @@ jack_port_get_buffer (jack_port_t *port, jack_nframes_t nframes) /* Output port. The buffer was assigned by the engine when the port was registered. - */ + */ if (port->shared->flags & JackPortIsOutput) { if (port->tied) { return jack_port_get_buffer (port->tied, nframes); } - - if (port->client_segment_base == NULL || *port->client_segment_base == MAP_FAILED) { - return NULL; - } + + if (port->client_segment_base == NULL || *port->client_segment_base == MAP_FAILED) { + return NULL; + } return jack_output_port_buffer (port); } @@ -581,23 +584,23 @@ jack_port_get_buffer (jack_port_t *port, jack_nframes_t nframes) process() callback, and since no connections can be made/broken during this phase (enforced by the jack server), there is no need to take the connection lock here - */ + */ if ((node = port->connections) == NULL) { - - if (port->client_segment_base == NULL || *port->client_segment_base == MAP_FAILED) { - return NULL; - } + + if (port->client_segment_base == NULL || *port->client_segment_base == MAP_FAILED) { + return NULL; + } /* no connections; return a zero-filled buffer */ - return (void *) (*(port->client_segment_base) + port->type_info->zero_buffer_offset); + return (void*)(*(port->client_segment_base) + port->type_info->zero_buffer_offset); } if ((next = jack_slist_next (node)) == NULL) { /* one connection: use zero-copy mode - just pass the buffer of the connected (output) port. - */ - return jack_port_get_buffer (((jack_port_t *) node->data), + */ + return jack_port_get_buffer (((jack_port_t*)node->data), nframes); } @@ -605,25 +608,25 @@ jack_port_get_buffer (jack_port_t *port, jack_nframes_t nframes) incoming data into that buffer. We have already established the existence of a mixdown function during the connection process. - */ + */ if (port->mix_buffer == NULL) { - jack_error( "internal jack error: mix_buffer not allocated" ); + jack_error ( "internal jack error: mix_buffer not allocated" ); return NULL; } port->fptr.mixdown (port, nframes); - return (void *) port->mix_buffer; + return (void*)port->mix_buffer; } size_t jack_port_type_buffer_size (jack_port_type_info_t* port_type_info, jack_nframes_t nframes) { - if( port_type_info->buffer_scale_factor < 0 ) { + if ( port_type_info->buffer_scale_factor < 0 ) { return port_type_info->buffer_size; - } + } return port_type_info->buffer_scale_factor - * sizeof (jack_default_audio_sample_t) - * nframes; + * sizeof(jack_default_audio_sample_t) + * nframes; } int @@ -655,7 +658,7 @@ jack_port_untie (jack_port_t *port) return 0; } -int +int jack_port_request_monitor (jack_port_t *port, int onoff) { @@ -669,21 +672,21 @@ jack_port_request_monitor (jack_port_t *port, int onoff) JSList *node; - /* this port is for input, so recurse over each of the + /* this port is for input, so recurse over each of the connected ports. */ pthread_mutex_lock (&port->connection_lock); for (node = port->connections; node; node = jack_slist_next (node)) { - + /* drop the lock because if there is a feedback loop, we will deadlock. XXX much worse things will happen if there is a feedback loop !!! - */ + */ pthread_mutex_unlock (&port->connection_lock); - jack_port_request_monitor ((jack_port_t *) node->data, + jack_port_request_monitor ((jack_port_t*)node->data, onoff); pthread_mutex_lock (&port->connection_lock); } @@ -692,8 +695,8 @@ jack_port_request_monitor (jack_port_t *port, int onoff) return 0; } - -int + +int jack_port_request_monitor_by_name (jack_client_t *client, const char *port_name, int onoff) @@ -704,7 +707,7 @@ jack_port_request_monitor_by_name (jack_client_t *client, limit = client->engine->port_max; ports = &client->engine->ports[0]; - + for (i = 0; i < limit; i++) { if (ports[i].in_use && strcmp (ports[i].name, port_name) == 0) { @@ -757,14 +760,14 @@ int jack_port_get_aliases (const jack_port_t *port, char* const aliases[2]) { int cnt = 0; - + if (port->shared->alias1[0] != '\0') { - snprintf (aliases[0], JACK_CLIENT_NAME_SIZE+JACK_PORT_NAME_SIZE, "%s", port->shared->alias1); + snprintf (aliases[0], JACK_CLIENT_NAME_SIZE + JACK_PORT_NAME_SIZE, "%s", port->shared->alias1); cnt++; } if (port->shared->alias2[0] != '\0') { - snprintf (aliases[1], JACK_CLIENT_NAME_SIZE+JACK_PORT_NAME_SIZE, "%s", port->shared->alias2); + snprintf (aliases[1], JACK_CLIENT_NAME_SIZE + JACK_PORT_NAME_SIZE, "%s", port->shared->alias2); cnt++; } @@ -776,12 +779,12 @@ jack_port_short_name (const jack_port_t *port) { /* we know there is always a colon, because we put it there ... - */ + */ return strchr (port->shared->name, ':') + 1; } -int +int jack_port_is_mine (const jack_client_t *client, const jack_port_t *port) { return jack_uuid_compare (port->shared->client_id, client->control->uuid) == 0; @@ -813,16 +816,16 @@ jack_port_rename (jack_client_t* client, jack_port_t *port, const char *new_name req.type = PortNameChanged; /* re-purpose an appropriate part of the request union to convey the names */ - snprintf ((char *) req.x.connect.source_port, JACK_PORT_NAME_SIZE-1, "%s", old_name); - snprintf ((char *) req.x.connect.destination_port, JACK_PORT_NAME_SIZE-1, "%s", new_name); - - (void) jack_client_deliver_request (client, &req); + snprintf ((char*)req.x.connect.source_port, JACK_PORT_NAME_SIZE - 1, "%s", old_name); + snprintf ((char*)req.x.connect.destination_port, JACK_PORT_NAME_SIZE - 1, "%s", new_name); + + (void)jack_client_deliver_request (client, &req); } free (old_name); return ret; -} +} int jack_port_set_name (jack_port_t *port, const char *new_name) { @@ -832,13 +835,13 @@ jack_port_set_name (jack_port_t *port, const char *new_name) if (strcmp (new_name, port->shared->name) == 0) { return 0; } - + colon = strchr (port->shared->name, ':'); - len = sizeof (port->shared->name) - - ((int) (colon - port->shared->name)) - 2; - snprintf (colon+1, len, "%s", new_name); + len = sizeof(port->shared->name) - + ((int)(colon - port->shared->name)) - 2; + snprintf (colon + 1, len, "%s", new_name); + - return 0; } @@ -846,9 +849,9 @@ int jack_port_set_alias (jack_port_t *port, const char *alias) { if (port->shared->alias1[0] == '\0') { - snprintf (port->shared->alias1, sizeof (port->shared->alias1), "%s", alias); + snprintf (port->shared->alias1, sizeof(port->shared->alias1), "%s", alias); } else if (port->shared->alias2[0] == '\0') { - snprintf (port->shared->alias2, sizeof (port->shared->alias2), "%s", alias); + snprintf (port->shared->alias2, sizeof(port->shared->alias2), "%s", alias); } else { return -1; } @@ -870,55 +873,59 @@ jack_port_unset_alias (jack_port_t *port, const char *alias) return 0; } -void +void jack_port_set_latency_range (jack_port_t *port, jack_latency_callback_mode_t mode, jack_latency_range_t *range) { if (mode == JackCaptureLatency) { port->shared->capture_latency = *range; - /* hack to set port->shared->latency up for + /* hack to set port->shared->latency up for * backend ports */ - if ((port->shared->flags & JackPortIsOutput) && (port->shared->flags & JackPortIsPhysical)) + if ((port->shared->flags & JackPortIsOutput) && (port->shared->flags & JackPortIsPhysical)) { port->shared->latency = (range->min + range->max) / 2; + } } else { port->shared->playback_latency = *range; - /* hack to set port->shared->latency up for + /* hack to set port->shared->latency up for * backend ports */ - if ((port->shared->flags & JackPortIsInput) && (port->shared->flags & JackPortIsPhysical)) + if ((port->shared->flags & JackPortIsInput) && (port->shared->flags & JackPortIsPhysical)) { port->shared->latency = (range->min + range->max) / 2; + } } } -void +void jack_port_get_latency_range (jack_port_t *port, jack_latency_callback_mode_t mode, jack_latency_range_t *range) { - if (mode == JackCaptureLatency) + if (mode == JackCaptureLatency) { *range = port->shared->capture_latency; - else + } else { *range = port->shared->playback_latency; + } } /* AUDIO PORT SUPPORT */ -static inline float f_max(float x, float a) +static inline float f_max (float x, float a) { x -= a; x += fabs (x); x *= 0.5; x += a; - return (x); + return x; } -static void +static void jack_audio_port_mixdown (jack_port_t *port, jack_nframes_t nframes) { JSList *node; jack_port_t *input; + #ifndef ARCH_X86 jack_nframes_t n; jack_default_audio_sample_t *dst, *src; @@ -928,39 +935,39 @@ jack_audio_port_mixdown (jack_port_t *port, jack_nframes_t nframes) /* by the time we've called this, we've already established the existence of more than one connection to this input port and allocated a mix_buffer. - */ + */ /* no need to take connection lock, since this is called from the process() callback, and the jack server ensures that no changes to connections happen during this time. - */ + */ node = port->connections; - input = (jack_port_t *) node->data; + input = (jack_port_t*)node->data; buffer = port->mix_buffer; #ifndef USE_DYNSIMD memcpy (buffer, jack_output_port_buffer (input), - sizeof (jack_default_audio_sample_t) * nframes); -#else /* USE_DYNSIMD */ + sizeof(jack_default_audio_sample_t) * nframes); +#else /* USE_DYNSIMD */ opt_copy (buffer, jack_output_port_buffer (input), nframes); #endif /* USE_DYNSIMD */ for (node = jack_slist_next (node); node; node = jack_slist_next (node)) { - input = (jack_port_t *) node->data; + input = (jack_port_t*)node->data; #ifndef USE_DYNSIMD n = nframes; dst = buffer; src = jack_output_port_buffer (input); - while (n--) { + while (n--) *dst++ += *src++; - } -#else /* USE_DYNSIMD */ + +#else /* USE_DYNSIMD */ opt_mix (buffer, jack_output_port_buffer (input), nframes); #endif /* USE_DYNSIMD */ } |