Linux: Patch for audio system not getting initalized properly when device name is set
This commit is contained in:
parent
bdbf830dd7
commit
8a268bbd2d
1 changed files with 6 additions and 2 deletions
|
@ -1,13 +1,13 @@
|
||||||
#include "SdlSoundManager.h"
|
#include "SdlSoundManager.h"
|
||||||
#include "../Core/EmulationSettings.h"
|
#include "../Core/EmulationSettings.h"
|
||||||
|
#include "../Core/MessageManager.h"
|
||||||
#include "../Core/SoundMixer.h"
|
#include "../Core/SoundMixer.h"
|
||||||
|
|
||||||
SdlSoundManager::SdlSoundManager()
|
SdlSoundManager::SdlSoundManager()
|
||||||
{
|
{
|
||||||
if(InitializeAudio(44100, false)) {
|
if(InitializeAudio(44100, false)) {
|
||||||
|
_buffer = new uint8_t[0xFFFF];
|
||||||
SoundMixer::RegisterAudioDevice(this);
|
SoundMixer::RegisterAudioDevice(this);
|
||||||
|
|
||||||
_buffer = new uint8_t[0xFFFF];
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -48,6 +48,10 @@ bool SdlSoundManager::InitializeAudio(uint32_t sampleRate, bool isStereo)
|
||||||
SDL_AudioSpec obtainedSpec;
|
SDL_AudioSpec obtainedSpec;
|
||||||
|
|
||||||
_audioDeviceID = SDL_OpenAudioDevice(_deviceName.empty() ? nullptr : _deviceName.c_str(), isCapture, &audioSpec, &obtainedSpec, 0);
|
_audioDeviceID = SDL_OpenAudioDevice(_deviceName.empty() ? nullptr : _deviceName.c_str(), isCapture, &audioSpec, &obtainedSpec, 0);
|
||||||
|
if(_audioDeviceID == 0 && !_deviceName.empty()) {
|
||||||
|
MessageManager::Log("[Audio] Failed opening audio device '" + _deviceName + "', will retry with default device.");
|
||||||
|
_audioDeviceID = SDL_OpenAudioDevice(nullptr, isCapture, &audioSpec, &obtainedSpec, 0);
|
||||||
|
}
|
||||||
|
|
||||||
_writePosition = 0;
|
_writePosition = 0;
|
||||||
_readPosition = 0;
|
_readPosition = 0;
|
||||||
|
|
Loading…
Add table
Reference in a new issue