Cleanup: avoid comparing double to enum

This is necessary for C++20 compatibility.
This commit is contained in:
Jacques Lucke 2026-01-16 17:02:11 +01:00
parent 8e9726c143
commit 0981cf25cf
3 changed files with 4 additions and 4 deletions

View file

@ -51,7 +51,7 @@ AUD_API AUD_Device* AUD_Device_open(const char* type, AUD_DeviceSpecs specs, int
dspecs.channels = CHANNELS_STEREO;
if(dspecs.format == FORMAT_INVALID)
dspecs.format = FORMAT_FLOAT32;
if(dspecs.rate == RATE_INVALID)
if(dspecs.rate == double(RATE_INVALID))
dspecs.rate = RATE_48000;
if(buffersize < 128)
buffersize = AUD_DEFAULT_BUFFER_SIZE;

View file

@ -174,7 +174,7 @@ AUD_API const char* AUD_Sound_write(AUD_Sound* sound, const char* filename, AUD_
DeviceSpecs specs;
specs.specs = reader->getSpecs();
if((rate != RATE_INVALID) && (specs.rate != rate))
if((rate != double(RATE_INVALID)) && (specs.rate != rate))
{
specs.rate = rate;
reader = std::make_shared<JOSResampleReader>(reader, rate);

View file

@ -931,7 +931,7 @@ void OpenALDevice::updateStreams()
ALCint attribs[] = { ALC_FREQUENCY, (ALCint)specs.rate, 0 };
ALCint* attributes = attribs;
if(specs.rate == RATE_INVALID)
if(specs.rate == double(RATE_INVALID))
attributes = nullptr;
m_context = alcCreateContext(m_device, attributes);
@ -1152,7 +1152,7 @@ OpenALDevice::OpenALDevice(DeviceSpecs specs, int buffersize, const std::string
// at least try to set the frequency
ALCint attribs[] = { ALC_FREQUENCY, (ALCint)specs.rate, 0 };
ALCint* attributes = attribs;
if(specs.rate == RATE_INVALID)
if(specs.rate == double(RATE_INVALID))
attributes = nullptr;
m_context = alcCreateContext(m_device, attributes);