From d07b14f65ef68368d6434f7d0d33892863db84c7 Mon Sep 17 00:00:00 2001 From: Miller Puckette Date: Sun, 6 Nov 2005 01:49:43 +0000 Subject: fixed memory leak in pa_mac_core.c and the bug sending "bang" to "t s" object svn path=/trunk/; revision=3842 --- pd/portaudio/pa_mac_core/pa_mac_core.c | 10 +++++----- pd/src/makefile | 2 +- pd/src/x_connective.c | 3 ++- 3 files changed, 8 insertions(+), 7 deletions(-) diff --git a/pd/portaudio/pa_mac_core/pa_mac_core.c b/pd/portaudio/pa_mac_core/pa_mac_core.c index e2b4fa8c..77451a5d 100644 --- a/pd/portaudio/pa_mac_core/pa_mac_core.c +++ b/pd/portaudio/pa_mac_core/pa_mac_core.c @@ -465,6 +465,7 @@ static OSStatus AudioIOProc( AudioDeviceID inDevice, CopyOutputData(outOutputData, clientData, frameCount); } + PaUtil_FreeMemory(timeInfo); PaUtil_EndCpuLoadMeasurement( &clientData->stream->cpuLoadMeasurer, frameCount ); if (result == paComplete || result == paAbort) { @@ -493,6 +494,7 @@ static OSStatus AudioInputProc( AudioDeviceID inDevice, CopyInputData(clientData, inInputData, frameCount); clientData->callback(clientData->inputBuffer, NULL, frameCount, timeInfo, paNoFlag, clientData->userData); + PaUtil_FreeMemory(timeInfo); PaUtil_EndCpuLoadMeasurement( &clientData->stream->cpuLoadMeasurer, frameCount ); } @@ -516,7 +518,7 @@ static OSStatus AudioOutputProc( AudioDeviceID inDevice, clientData->callback(NULL, clientData->outputBuffer, frameCount, timeInfo, paNoFlag, clientData->userData); CopyOutputData(outOutputData, clientData, frameCount); - + PaUtil_FreeMemory(timeInfo); PaUtil_EndCpuLoadMeasurement( &clientData->stream->cpuLoadMeasurer, frameCount ); } @@ -665,8 +667,8 @@ static PaError OpenStream( struct PaUtilHostApiRepresentation *hostApi, clientData->inputChannelCount = inputParameters->channelCount; clientData->inputSampleFormat = inputParameters->sampleFormat; err = SetUpUnidirectionalStream(stream->inputDevice, sampleRate, framesPerBuffer, 1); - fprintf(stderr, "error %d (%d)\n", err, paNoError); } + if (err == paNoError && outputParameters != NULL) { stream->outputDevice = macCoreHostApi->macCoreDeviceIds[outputParameters->device]; clientData->outputConverter = PaUtil_SelectConverter(outputParameters->sampleFormat, paFloat32, streamFlags); @@ -679,9 +681,7 @@ static PaError OpenStream( struct PaUtilHostApiRepresentation *hostApi, if (inputParameters == NULL || outputParameters == NULL || stream->inputDevice == stream->outputDevice) { AudioDeviceID device = (inputParameters == NULL) ? stream->outputDevice : stream->inputDevice; - int e2 = AudioDeviceAddIOProc(device, AudioIOProc, clientData); - fprintf(stderr, "AudioDeviceAddIOProc %d\n", e2); - + AudioDeviceAddIOProc(device, AudioIOProc, clientData); } else { // using different devices for input and output diff --git a/pd/src/makefile b/pd/src/makefile index 433bbb6c..2ad50698 100644 --- a/pd/src/makefile +++ b/pd/src/makefile @@ -19,7 +19,7 @@ GLIB = -ltk8.4 -ltcl8.4 LDFLAGS = -Wl,-export-dynamic -lasound LIB = -ldl -lpthread -lasound -OPT_CFLAGS = -O6 -funroll-loops -fomit-frame-pointer +OPT_CFLAGS = -g WARN_CFLAGS = -Wall -W -Wstrict-prototypes \ -Wno-unused -Wno-parentheses -Wno-switch ARCH_CFLAGS = -DPD diff --git a/pd/src/x_connective.c b/pd/src/x_connective.c index 3d62b319..c50e27c8 100644 --- a/pd/src/x_connective.c +++ b/pd/src/x_connective.c @@ -978,7 +978,8 @@ static void trigger_list(t_trigger *x, t_symbol *s, int argc, t_atom *argv) else if (u->u_type == TR_BANG) outlet_bang(u->u_outlet); else if (u->u_type == TR_SYMBOL) - outlet_symbol(u->u_outlet, (argc ? atom_getsymbol(argv) : 0)); + outlet_symbol(u->u_outlet, + (argc ? atom_getsymbol(argv) : &s_symbol)); else if (u->u_type == TR_POINTER) { if (!argc || argv->a_type != TR_POINTER) -- cgit v1.2.1