mirror of https://github.com/snes9xgit/snes9x.git
Fix WASAPI preference.
This commit is contained in:
parent
1b1325066b
commit
16da4c2d26
|
@ -9,6 +9,7 @@
|
||||||
#include <cstdio>
|
#include <cstdio>
|
||||||
#include <cstdint>
|
#include <cstdint>
|
||||||
#include <vector>
|
#include <vector>
|
||||||
|
#include <string>
|
||||||
|
|
||||||
S9xPortAudioSoundDriver::S9xPortAudioSoundDriver()
|
S9xPortAudioSoundDriver::S9xPortAudioSoundDriver()
|
||||||
{
|
{
|
||||||
|
@ -146,13 +147,26 @@ bool S9xPortAudioSoundDriver::open_device(int playback_rate, int buffer_size_ms)
|
||||||
|
|
||||||
printf("PortAudio sound driver initializing...\n");
|
printf("PortAudio sound driver initializing...\n");
|
||||||
|
|
||||||
int host = 2; //Pa_GetDefaultHostApi();
|
int host = Pa_GetDefaultHostApi();
|
||||||
|
#ifdef _WIN32
|
||||||
|
// Look for WASAPI
|
||||||
|
for (int i = 0; i < Pa_GetHostApiCount(); i++)
|
||||||
|
{
|
||||||
|
auto hostapi_info = Pa_GetHostApiInfo(i);
|
||||||
|
std::string str(hostapi_info->name);
|
||||||
|
if (str == "Windows WASAPI")
|
||||||
|
{
|
||||||
|
host = i;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
#endif
|
||||||
if (tryHostAPI(host))
|
if (tryHostAPI(host))
|
||||||
return true;
|
return true;
|
||||||
|
|
||||||
for (int i = 0; i < Pa_GetHostApiCount(); i++)
|
for (int i = 0; i < Pa_GetHostApiCount(); i++)
|
||||||
{
|
{
|
||||||
if (Pa_GetDefaultHostApi() != i)
|
if (host != i)
|
||||||
if (tryHostAPI(i))
|
if (tryHostAPI(i))
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue