mirror of
https://github.com/dolphin-emu/dolphin.git
synced 2025-02-15 08:49:20 +01:00
It is safe to call Pa_Initialize and Pa_Terminate more than once.
This commit is contained in:
parent
46afefb14f
commit
1d6bd3248c
@ -29,8 +29,6 @@
|
|||||||
|
|
||||||
#include "GCPad.h"
|
#include "GCPad.h"
|
||||||
|
|
||||||
static bool pa_init = false;
|
|
||||||
|
|
||||||
void CEXIMic::StreamLog(const char *msg)
|
void CEXIMic::StreamLog(const char *msg)
|
||||||
{
|
{
|
||||||
DEBUG_LOG(EXPANSIONINTERFACE, "%s: %s",
|
DEBUG_LOG(EXPANSIONINTERFACE, "%s: %s",
|
||||||
@ -40,46 +38,24 @@ void CEXIMic::StreamLog(const char *msg)
|
|||||||
void CEXIMic::StreamInit()
|
void CEXIMic::StreamInit()
|
||||||
{
|
{
|
||||||
// Setup the wonderful c-interfaced lib...
|
// Setup the wonderful c-interfaced lib...
|
||||||
pa_error = paNoError;
|
if ((pa_error = Pa_Initialize()) != paNoError)
|
||||||
if (!pa_init)
|
StreamLog("Pa_Initialize");
|
||||||
{
|
|
||||||
pa_error = Pa_Initialize();
|
|
||||||
|
|
||||||
if (pa_error != paNoError)
|
|
||||||
{
|
|
||||||
StreamLog("Pa_Initialize");
|
|
||||||
}
|
|
||||||
else
|
|
||||||
pa_init = true;
|
|
||||||
}
|
|
||||||
|
|
||||||
mic_count++;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void CEXIMic::StreamTerminate()
|
void CEXIMic::StreamTerminate()
|
||||||
{
|
{
|
||||||
if (--mic_count <= 0 && pa_init)
|
if ((pa_error = Pa_Terminate()) != paNoError)
|
||||||
pa_error = Pa_Terminate();
|
|
||||||
|
|
||||||
if (pa_error != paNoError)
|
|
||||||
{
|
|
||||||
StreamLog("Pa_Terminate");
|
StreamLog("Pa_Terminate");
|
||||||
}
|
|
||||||
else
|
|
||||||
pa_init = false;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void CEXIMic::StreamStart()
|
void CEXIMic::StreamStart()
|
||||||
{
|
{
|
||||||
// Open stream with current parameters
|
// Open stream with current parameters
|
||||||
if (pa_init)
|
pa_error = Pa_OpenDefaultStream(&pa_stream, 1, 0, paInt16,
|
||||||
{
|
sample_rate, buff_size_samples, NULL, NULL);
|
||||||
pa_error = Pa_OpenDefaultStream(&pa_stream, 1, 0, paInt16,
|
StreamLog("Pa_OpenDefaultStream");
|
||||||
sample_rate, buff_size_samples, NULL, NULL);
|
pa_error = Pa_StartStream(pa_stream);
|
||||||
StreamLog("Pa_OpenDefaultStream");
|
StreamLog("Pa_StartStream");
|
||||||
pa_error = Pa_StartStream(pa_stream);
|
|
||||||
StreamLog("Pa_StartStream");
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void CEXIMic::StreamStop()
|
void CEXIMic::StreamStop()
|
||||||
@ -122,7 +98,6 @@ void CEXIMic::StreamReadOne()
|
|||||||
// us a way to detect if buff_ovrflw should be set.
|
// us a way to detect if buff_ovrflw should be set.
|
||||||
|
|
||||||
u8 const CEXIMic::exi_id[] = { 0, 0x0a, 0, 0, 0 };
|
u8 const CEXIMic::exi_id[] = { 0, 0x0a, 0, 0, 0 };
|
||||||
int CEXIMic::mic_count = 0;
|
|
||||||
|
|
||||||
CEXIMic::CEXIMic(int index)
|
CEXIMic::CEXIMic(int index)
|
||||||
: slot(index)
|
: slot(index)
|
||||||
|
@ -30,7 +30,6 @@ public:
|
|||||||
bool IsPresent();
|
bool IsPresent();
|
||||||
|
|
||||||
private:
|
private:
|
||||||
static int mic_count;
|
|
||||||
static u8 const exi_id[];
|
static u8 const exi_id[];
|
||||||
static int const sample_size = sizeof(s16);
|
static int const sample_size = sizeof(s16);
|
||||||
static int const rate_base = 11025;
|
static int const rate_base = 11025;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user