diff options
Diffstat (limited to 'alc/backends/sdl2.cpp')
-rw-r--r-- | alc/backends/sdl2.cpp | 16 |
1 files changed, 9 insertions, 7 deletions
diff --git a/alc/backends/sdl2.cpp b/alc/backends/sdl2.cpp index 4b3b5e63..28d020a1 100644 --- a/alc/backends/sdl2.cpp +++ b/alc/backends/sdl2.cpp @@ -62,7 +62,7 @@ struct Sdl2Backend final : public BackendBase { void unlock() override; SDL_AudioDeviceID mDeviceID{0u}; - ALsizei mFrameSize{0}; + ALuint mFrameSize{0}; ALuint mFrequency{0u}; DevFmtChannels mFmtChans{}; @@ -84,14 +84,16 @@ void Sdl2Backend::audioCallbackC(void *ptr, Uint8 *stream, int len) void Sdl2Backend::audioCallback(Uint8 *stream, int len) { - assert((len % mFrameSize) == 0); - aluMixData(mDevice, stream, len / mFrameSize); + const auto ulen = static_cast<unsigned int>(len); + assert((ulen % mFrameSize) == 0); + aluMixData(mDevice, stream, ulen / mFrameSize); } ALCenum Sdl2Backend::open(const ALCchar *name) { SDL_AudioSpec want{}, have{}; - want.freq = mDevice->Frequency; + + want.freq = static_cast<int>(mDevice->Frequency); switch(mDevice->FmtType) { case DevFmtUByte: want.format = AUDIO_U8; break; @@ -103,7 +105,7 @@ ALCenum Sdl2Backend::open(const ALCchar *name) case DevFmtFloat: want.format = AUDIO_F32; break; } want.channels = (mDevice->FmtChans == DevFmtMono) ? 1 : 2; - want.samples = mDevice->UpdateSize; + want.samples = static_cast<Uint16>(mDevice->UpdateSize); want.callback = &Sdl2Backend::audioCallbackC; want.userdata = this; @@ -126,7 +128,7 @@ ALCenum Sdl2Backend::open(const ALCchar *name) if(mDeviceID == 0) return ALC_INVALID_VALUE; - mDevice->Frequency = have.freq; + mDevice->Frequency = static_cast<ALuint>(have.freq); if(have.channels == 1) mDevice->FmtChans = DevFmtMono; else if(have.channels == 2) @@ -151,7 +153,7 @@ ALCenum Sdl2Backend::open(const ALCchar *name) mDevice->UpdateSize = have.samples; mDevice->BufferSize = have.samples * 2; /* SDL always (tries to) use two periods. */ - mFrameSize = mDevice->frameSizeFromFmt(); + mFrameSize = static_cast<ALuint>(mDevice->frameSizeFromFmt()); mFrequency = mDevice->Frequency; mFmtChans = mDevice->FmtChans; mFmtType = mDevice->FmtType; |