summaryrefslogtreecommitdiff
path: root/Source/Core
diff options
context:
space:
mode:
authorShawn Hoffman <godisgovernment@gmail.com>2011-10-16 13:29:10 -0700
committerShawn Hoffman <godisgovernment@gmail.com>2011-10-16 13:29:10 -0700
commit1d6bd3248c951ee4eb2d0069f307ed973085bdc1 (patch)
tree823e26e34a880fb6fd772a26d1dd197a0e8b0f7f /Source/Core
parent46afefb14f364ce917883e9d465a911a79822712 (diff)
It is safe to call Pa_Initialize and Pa_Terminate more than once.
Diffstat (limited to 'Source/Core')
-rw-r--r--Source/Core/Core/Src/HW/EXI_DeviceMic.cpp41
-rw-r--r--Source/Core/Core/Src/HW/EXI_DeviceMic.h1
2 files changed, 8 insertions, 34 deletions
diff --git a/Source/Core/Core/Src/HW/EXI_DeviceMic.cpp b/Source/Core/Core/Src/HW/EXI_DeviceMic.cpp
index 9faff0e7b6..264d6a0539 100644
--- a/Source/Core/Core/Src/HW/EXI_DeviceMic.cpp
+++ b/Source/Core/Core/Src/HW/EXI_DeviceMic.cpp
@@ -29,8 +29,6 @@
#include "GCPad.h"
-static bool pa_init = false;
-
void CEXIMic::StreamLog(const char *msg)
{
DEBUG_LOG(EXPANSIONINTERFACE, "%s: %s",
@@ -40,46 +38,24 @@ void CEXIMic::StreamLog(const char *msg)
void CEXIMic::StreamInit()
{
// Setup the wonderful c-interfaced lib...
- pa_error = paNoError;
- if (!pa_init)
- {
- pa_error = Pa_Initialize();
-
- if (pa_error != paNoError)
- {
- StreamLog("Pa_Initialize");
- }
- else
- pa_init = true;
- }
-
- mic_count++;
+ if ((pa_error = Pa_Initialize()) != paNoError)
+ StreamLog("Pa_Initialize");
}
void CEXIMic::StreamTerminate()
{
- if (--mic_count <= 0 && pa_init)
- pa_error = Pa_Terminate();
-
- if (pa_error != paNoError)
- {
+ if ((pa_error = Pa_Terminate()) != paNoError)
StreamLog("Pa_Terminate");
- }
- else
- pa_init = false;
}
void CEXIMic::StreamStart()
{
// Open stream with current parameters
- if (pa_init)
- {
- pa_error = Pa_OpenDefaultStream(&pa_stream, 1, 0, paInt16,
- sample_rate, buff_size_samples, NULL, NULL);
- StreamLog("Pa_OpenDefaultStream");
- pa_error = Pa_StartStream(pa_stream);
- StreamLog("Pa_StartStream");
- }
+ pa_error = Pa_OpenDefaultStream(&pa_stream, 1, 0, paInt16,
+ sample_rate, buff_size_samples, NULL, NULL);
+ StreamLog("Pa_OpenDefaultStream");
+ pa_error = Pa_StartStream(pa_stream);
+ StreamLog("Pa_StartStream");
}
void CEXIMic::StreamStop()
@@ -122,7 +98,6 @@ void CEXIMic::StreamReadOne()
// us a way to detect if buff_ovrflw should be set.
u8 const CEXIMic::exi_id[] = { 0, 0x0a, 0, 0, 0 };
-int CEXIMic::mic_count = 0;
CEXIMic::CEXIMic(int index)
: slot(index)
diff --git a/Source/Core/Core/Src/HW/EXI_DeviceMic.h b/Source/Core/Core/Src/HW/EXI_DeviceMic.h
index 491a112375..bdae580135 100644
--- a/Source/Core/Core/Src/HW/EXI_DeviceMic.h
+++ b/Source/Core/Core/Src/HW/EXI_DeviceMic.h
@@ -30,7 +30,6 @@ public:
bool IsPresent();
private:
- static int mic_count;
static u8 const exi_id[];
static int const sample_size = sizeof(s16);
static int const rate_base = 11025;