Add a device request flag for the sample type
This commit is contained in:
parent
2ab0e3521c
commit
fecd679f33
21
Alc/ALc.c
21
Alc/ALc.c
@ -1176,10 +1176,12 @@ static ALCenum UpdateDeviceParams(ALCdevice *device, const ALCint *attrList)
|
|||||||
oldChans = device->FmtChans;
|
oldChans = device->FmtChans;
|
||||||
oldType = device->FmtType;
|
oldType = device->FmtType;
|
||||||
|
|
||||||
TRACE("Format pre-setup: %s%s, %s, %uhz%s, %u update size x%d\n",
|
TRACE("Format pre-setup: %s%s, %s%s, %uhz%s, %u update size x%d\n",
|
||||||
DevFmtChannelsString(device->FmtChans),
|
DevFmtChannelsString(device->FmtChans),
|
||||||
(device->Flags&DEVICE_CHANNELS_REQUEST)?" (requested)":"",
|
(device->Flags&DEVICE_CHANNELS_REQUEST)?" (requested)":"",
|
||||||
DevFmtTypeString(device->FmtType), device->Frequency,
|
DevFmtTypeString(device->FmtType),
|
||||||
|
(device->Flags&DEVICE_SAMPLE_TYPE_REQUEST)?" (requested)":"",
|
||||||
|
device->Frequency,
|
||||||
(device->Flags&DEVICE_FREQUENCY_REQUEST)?" (requested)":"",
|
(device->Flags&DEVICE_FREQUENCY_REQUEST)?" (requested)":"",
|
||||||
device->UpdateSize, device->NumUpdates);
|
device->UpdateSize, device->NumUpdates);
|
||||||
if(ALCdevice_ResetPlayback(device) == ALC_FALSE)
|
if(ALCdevice_ResetPlayback(device) == ALC_FALSE)
|
||||||
@ -1195,6 +1197,12 @@ static ALCenum UpdateDeviceParams(ALCdevice *device, const ALCint *attrList)
|
|||||||
DevFmtChannelsString(device->FmtChans));
|
DevFmtChannelsString(device->FmtChans));
|
||||||
device->Flags &= ~DEVICE_CHANNELS_REQUEST;
|
device->Flags &= ~DEVICE_CHANNELS_REQUEST;
|
||||||
}
|
}
|
||||||
|
if(device->FmtType != oldType && (device->Flags&DEVICE_SAMPLE_TYPE_REQUEST))
|
||||||
|
{
|
||||||
|
ERR("Failed to set %s, got %s instead\n", DevFmtTypeString(oldType),
|
||||||
|
DevFmtTypeString(device->FmtType));
|
||||||
|
device->Flags &= ~DEVICE_SAMPLE_TYPE_REQUEST;
|
||||||
|
}
|
||||||
if(device->Frequency != oldFreq && (device->Flags&DEVICE_FREQUENCY_REQUEST))
|
if(device->Frequency != oldFreq && (device->Flags&DEVICE_FREQUENCY_REQUEST))
|
||||||
{
|
{
|
||||||
ERR("Failed to set %uhz, got %uhz instead\n", oldFreq, device->Frequency);
|
ERR("Failed to set %uhz, got %uhz instead\n", oldFreq, device->Frequency);
|
||||||
@ -1644,7 +1652,7 @@ ALC_API ALCdevice* ALC_APIENTRY alcCaptureOpenDevice(const ALCchar *deviceName,
|
|||||||
device->Flags |= DEVICE_FREQUENCY_REQUEST;
|
device->Flags |= DEVICE_FREQUENCY_REQUEST;
|
||||||
device->Frequency = frequency;
|
device->Frequency = frequency;
|
||||||
|
|
||||||
device->Flags |= DEVICE_CHANNELS_REQUEST;
|
device->Flags |= DEVICE_CHANNELS_REQUEST | DEVICE_SAMPLE_TYPE_REQUEST;
|
||||||
if(DecomposeDevFormat(format, &device->FmtChans, &device->FmtType) == AL_FALSE)
|
if(DecomposeDevFormat(format, &device->FmtChans, &device->FmtType) == AL_FALSE)
|
||||||
{
|
{
|
||||||
DeleteCriticalSection(&device->Mutex);
|
DeleteCriticalSection(&device->Mutex);
|
||||||
@ -2487,8 +2495,10 @@ ALC_API ALCdevice* ALC_APIENTRY alcOpenDevice(const ALCchar *deviceName)
|
|||||||
{
|
{
|
||||||
if(!(device->Flags&DEVICE_CHANNELS_REQUEST))
|
if(!(device->Flags&DEVICE_CHANNELS_REQUEST))
|
||||||
device->FmtChans = formats[i].channels;
|
device->FmtChans = formats[i].channels;
|
||||||
|
if(!(device->Flags&DEVICE_SAMPLE_TYPE_REQUEST))
|
||||||
device->FmtType = formats[i].type;
|
device->FmtType = formats[i].type;
|
||||||
device->Flags |= DEVICE_CHANNELS_REQUEST;
|
device->Flags |= DEVICE_CHANNELS_REQUEST |
|
||||||
|
DEVICE_SAMPLE_TYPE_REQUEST;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -2519,7 +2529,7 @@ ALC_API ALCdevice* ALC_APIENTRY alcOpenDevice(const ALCchar *deviceName)
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if(!(device->Flags&DEVICE_CHANNELS_REQUEST))
|
if(i == sizeof(chanlist)/sizeof(chanlist[0]))
|
||||||
ERR("Unsupported channels: %s\n", fmt);
|
ERR("Unsupported channels: %s\n", fmt);
|
||||||
}
|
}
|
||||||
if(ConfigValueStr(NULL, "sample-type", &fmt))
|
if(ConfigValueStr(NULL, "sample-type", &fmt))
|
||||||
@ -2543,6 +2553,7 @@ ALC_API ALCdevice* ALC_APIENTRY alcOpenDevice(const ALCchar *deviceName)
|
|||||||
if(strcasecmp(chanlist[i].name, fmt) == 0)
|
if(strcasecmp(chanlist[i].name, fmt) == 0)
|
||||||
{
|
{
|
||||||
device->FmtType = chanlist[i].type;
|
device->FmtType = chanlist[i].type;
|
||||||
|
device->Flags |= DEVICE_SAMPLE_TYPE_REQUEST;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -630,6 +630,8 @@ struct ALCdevice_struct
|
|||||||
#define DEVICE_FREQUENCY_REQUEST (1<<1)
|
#define DEVICE_FREQUENCY_REQUEST (1<<1)
|
||||||
// Channel configuration was requested by the config file
|
// Channel configuration was requested by the config file
|
||||||
#define DEVICE_CHANNELS_REQUEST (1<<2)
|
#define DEVICE_CHANNELS_REQUEST (1<<2)
|
||||||
|
// Sample type was requested by the config file
|
||||||
|
#define DEVICE_SAMPLE_TYPE_REQUEST (1<<3)
|
||||||
|
|
||||||
// Specifies if the device is currently running
|
// Specifies if the device is currently running
|
||||||
#define DEVICE_RUNNING (1<<31)
|
#define DEVICE_RUNNING (1<<31)
|
||||||
|
Loading…
Reference in New Issue
Block a user