From 1d44de53b59efa61660f5853cd3d21e21636f4a4 Mon Sep 17 00:00:00 2001 From: sktsqrl Date: Wed, 11 Jul 2012 01:03:25 -0700 Subject: [PATCH] reset samples_avail when stopping gc mic sampling. fixes Mario Party 7 --- Source/Core/Core/Src/HW/EXI_DeviceMic.cpp | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/Source/Core/Core/Src/HW/EXI_DeviceMic.cpp b/Source/Core/Core/Src/HW/EXI_DeviceMic.cpp index cba3940cdf..f1266d4c45 100644 --- a/Source/Core/Core/Src/HW/EXI_DeviceMic.cpp +++ b/Source/Core/Core/Src/HW/EXI_DeviceMic.cpp @@ -38,12 +38,12 @@ void CEXIMic::StreamLog(const char *msg) void CEXIMic::StreamInit() { // Setup the wonderful c-interfaced lib... - pa_stream = NULL; + pa_stream = nullptr; if ((pa_error = Pa_Initialize()) != paNoError) StreamLog("Pa_Initialize"); - stream_buffer = NULL; + stream_buffer = nullptr; samples_avail = stream_wpos = stream_rpos = 0; } @@ -75,7 +75,7 @@ static int Pa_Callback(const void *inputBuffer, void *outputBuffer, s16 *buff_in = (s16 *)inputBuffer; s16 *buff_out = &mic->stream_buffer[mic->stream_wpos]; - if (buff_in == NULL) + if (buff_in == nullptr) { for (int i = 0; i < mic->buff_size_samples; i++) { @@ -118,11 +118,13 @@ void CEXIMic::StreamStart() void CEXIMic::StreamStop() { - if (pa_stream != NULL && Pa_IsStreamActive(pa_stream) >= paNoError) + if (pa_stream != nullptr && Pa_IsStreamActive(pa_stream) >= paNoError) Pa_AbortStream(pa_stream); + samples_avail = stream_wpos = stream_rpos = 0; + delete [] stream_buffer; - stream_buffer = NULL; + stream_buffer = nullptr; } void CEXIMic::StreamReadOne()