Update of /cvsroot/audacity/lib-src/portaudio-v19/src/hostapi/jack
In directory sc8-pr-cvs11.sourceforge.net:/tmp/cvs-serv22516/src/hostapi/jack
Modified Files:
pa_jack.c
Log Message:
Bringing PortAudio up to their latest SVN sources.
Index: pa_jack.c
===================================================================
RCS file: /cvsroot/audacity/lib-src/portaudio-v19/src/hostapi/jack/pa_jack.c,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -d -r1.1 -r1.2
--- pa_jack.c 10 Jun 2006 21:30:56 -0000 1.1
+++ pa_jack.c 23 Sep 2006 18:42:50 -0000 1.2
@@ -22,10 +22,6 @@
* The above copyright notice and this permission notice shall be
* included in all copies or substantial portions of the Software.
*
- * Any person wishing to distribute modifications to the Software is
- * requested to send the modifications to the original developer so that
- * they can be incorporated into the canonical version.
- *
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
@@ -35,6 +31,22 @@
* WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*/
+/*
+ * The text above constitutes the entire PortAudio license; however,
+ * the PortAudio community also makes the following non-binding requests:
+ *
+ * Any person wishing to distribute modifications to the Software is
+ * requested to send the modifications to the original developer so that
+ * they can be incorporated into the canonical version. It is also
+ * requested that these non-binding requests be included along with the
+ * license above.
+ */
+
+/**
+ @file
+ @ingroup hostaip_src
+*/
+
#include <string.h>
#include <regex.h>
#include <stdlib.h>
@@ -454,12 +466,12 @@
const char **jack_ports = NULL;
char **client_names = NULL;
- char *regex_pattern = alloca( jack_client_name_size() + 3 );
+ char *regex_pattern = MALLOC( jack_client_name_size() + 3 );
int port_index, client_index, i;
double globalSampleRate;
regex_t port_regex;
unsigned long numClients = 0, numPorts = 0;
- char *tmp_client_name = alloca( jack_client_name_size() );
+ char *tmp_client_name = MALLOC( jack_client_name_size() );
commonApi->info.defaultInputDevice = paNoDevice;
commonApi->info.defaultOutputDevice = paNoDevice;
@@ -482,7 +494,7 @@
while( jack_ports[numPorts] )
++numPorts;
/* At least there will be one port per client :) */
- UNLESS( client_names = alloca( numPorts * sizeof (char *) ),
paInsufficientMemory );
+ UNLESS( client_names = MALLOC( numPorts * sizeof (char *) ),
paInsufficientMemory );
/* Build a list of clients from the list of ports */
for( numClients = 0, port_index = 0; jack_ports[port_index] != NULL;
port_index++ )
@@ -697,7 +709,7 @@
UNLESS( jackHostApi = (PaJackHostApiRepresentation*)
PaUtil_AllocateMemory( sizeof(PaJackHostApiRepresentation) ),
paInsufficientMemory );
- jackHostApi->deviceInfoMemory = NULL;
+ UNLESS( jackHostApi->deviceInfoMemory = PaUtil_CreateAllocationGroup(),
paInsufficientMemory );
mainThread_ = pthread_self();
ASSERT_CALL( pthread_mutex_init( &jackHostApi->mtx, NULL ), 0 );
@@ -706,7 +718,7 @@
/* Try to become a client of the JACK server. If we cannot do
* this, then this API cannot be used. */
- clientName = alloca( jack_client_name_size() );
+ clientName = PaUtil_GroupAllocateMemory( jackHostApi->deviceInfoMemory,
jack_client_name_size() );
written = snprintf( clientName, jack_client_name_size(), "PortAudio-%d",
getpid() );
assert( written < jack_client_name_size() );
jackHostApi->jack_client = jack_client_new( clientName );
@@ -719,7 +731,6 @@
goto error;
}
- UNLESS( jackHostApi->deviceInfoMemory = PaUtil_CreateAllocationGroup(),
paInsufficientMemory );
jackHostApi->hostApiIndex = hostApiIndex;
*hostApi = &jackHostApi->commonHostApiRep;
@@ -1055,9 +1066,9 @@
PaError result = paNoError;
PaJackHostApiRepresentation *jackHostApi =
(PaJackHostApiRepresentation*)hostApi;
PaJackStream *stream = NULL;
- char *port_string = alloca( jack_port_name_size() );
+ char *port_string = PaUtil_GroupAllocateMemory(
jackHostApi->deviceInfoMemory, jack_port_name_size() );
unsigned long regexSz = jack_client_name_size() + 3;
- char *regex_pattern = alloca( regexSz );
+ char *regex_pattern = PaUtil_GroupAllocateMemory(
jackHostApi->deviceInfoMemory, regexSz );
const char **jack_ports = NULL;
/* int jack_max_buffer_size = jack_get_buffer_size(
jackHostApi->jack_client ); */
int i;
@@ -1653,35 +1664,29 @@
if( !stream->hostApi->jackIsDown ) /* XXX: Well? */
{
- if( stream->num_incoming_connections > 0 )
+ for( i = 0; i < stream->num_incoming_connections; i++ )
{
- int failed = 0;
- for( i = 0; i < stream->num_incoming_connections; i++ )
- {
- if( jack_port_disconnect( stream->jack_client,
stream->local_input_ports[i] ) )
- {
- failed = 1;
- }
- }
- if( failed )
+ UNLESS( !jack_port_lock( stream->jack_client,
stream->local_input_ports[i] ),
+ paUnanticipatedHostError );
+ if( jack_port_connected( stream->local_input_ports[i] ) )
{
- PA_DEBUG(( "%s: Failed to disconnect input, already done
externally?\n", __FUNCTION__ ));
+ UNLESS( !jack_port_disconnect( stream->jack_client,
stream->local_input_ports[i] ),
+ paUnanticipatedHostError );
}
+ UNLESS( !jack_port_unlock( stream->jack_client,
stream->local_input_ports[i] ),
+ paUnanticipatedHostError );
}
- if( stream->num_outgoing_connections > 0 )
+ for( i = 0; i < stream->num_outgoing_connections; i++ )
{
- int failed = 0;
- for( i = 0; i < stream->num_outgoing_connections; i++ )
- {
- if( jack_port_disconnect( stream->jack_client,
stream->local_output_ports[i] ) )
- {
- failed = 1;
- }
- }
- if( failed )
+ UNLESS( !jack_port_lock( stream->jack_client,
stream->local_output_ports[i] ),
+ paUnanticipatedHostError );
+ if( jack_port_connected( stream->local_output_ports[i] ) )
{
- PA_DEBUG(( "%s: Failed to disconnect output, already done
externally?\n", __FUNCTION__ ));
+ UNLESS( !jack_port_disconnect( stream->jack_client,
stream->local_output_ports[i] ),
+ paUnanticipatedHostError );
}
+ UNLESS( !jack_port_unlock( stream->jack_client,
stream->local_output_ports[i] ),
+ paUnanticipatedHostError );
}
}
-------------------------------------------------------------------------
Take Surveys. Earn Cash. Influence the Future of IT
Join SourceForge.net's Techsay panel and you'll get the chance to share your
opinions on IT & business topics through brief surveys -- and earn cash
http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV
_______________________________________________
Audacity-cvs mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/audacity-cvs