Open the playback device earlier
So we actually have a device name to get the initial settings for. Be aware that some backends set a format when opening instead of on reset, so such devices will only set the default format (it can't get a desired format without the device name, but the format will already be set once that's known). The affected backends are WinMM, SDL2, and PortAudio (none of which are generally used). This could be fixed by reopening the device during reset, but it would need to be done carefully.
This commit is contained in:
parent
87e279082f
commit
725ceb128e
38
Alc/alc.cpp
38
Alc/alc.cpp
@ -3665,7 +3665,7 @@ START_API_FUNC
|
||||
|
||||
DeviceRef device{new ALCdevice{Playback}};
|
||||
|
||||
//Set output format
|
||||
/* Set output format */
|
||||
device->FmtChans = DevFmtChannelsDefault;
|
||||
device->FmtType = DevFmtTypeDefault;
|
||||
device->Frequency = DEFAULT_OUTPUT_RATE;
|
||||
@ -3677,6 +3677,24 @@ START_API_FUNC
|
||||
device->AuxiliaryEffectSlotMax = 64;
|
||||
device->NumAuxSends = DEFAULT_SENDS;
|
||||
|
||||
/* Create the device backend. */
|
||||
device->Backend = PlaybackBackend.getFactory().createBackend(device.get(),
|
||||
BackendType::Playback);
|
||||
if(!device->Backend)
|
||||
{
|
||||
alcSetError(nullptr, ALC_OUT_OF_MEMORY);
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
/* Find a playback device to open */
|
||||
ALCenum err{device->Backend->open(deviceName)};
|
||||
if(err != ALC_NO_ERROR)
|
||||
{
|
||||
alcSetError(nullptr, err);
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
deviceName = device->DeviceName.c_str();
|
||||
const ALCchar *fmt{};
|
||||
if(ConfigValueStr(deviceName, nullptr, "channels", &fmt))
|
||||
{
|
||||
@ -3774,23 +3792,7 @@ START_API_FUNC
|
||||
device->NumStereoSources = 1;
|
||||
device->NumMonoSources = device->SourcesMax - device->NumStereoSources;
|
||||
|
||||
device->Backend = PlaybackBackend.getFactory().createBackend(device.get(),
|
||||
BackendType::Playback);
|
||||
if(!device->Backend)
|
||||
{
|
||||
alcSetError(nullptr, ALC_OUT_OF_MEMORY);
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
// Find a playback device to open
|
||||
ALCenum err{device->Backend->open(deviceName)};
|
||||
if(err != ALC_NO_ERROR)
|
||||
{
|
||||
alcSetError(nullptr, err);
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
if(ConfigValueStr(device->DeviceName.c_str(), nullptr, "ambi-format", &fmt))
|
||||
if(ConfigValueStr(deviceName, nullptr, "ambi-format", &fmt))
|
||||
{
|
||||
if(strcasecmp(fmt, "fuma") == 0)
|
||||
{
|
||||
|
Loading…
x
Reference in New Issue
Block a user