diff options
author | Chris Robinson <[email protected]> | 2019-09-15 09:50:28 -0700 |
---|---|---|
committer | Chris Robinson <[email protected]> | 2019-09-15 09:50:28 -0700 |
commit | c5a3c52822d0ab8e36c2d3d31936eae1da64049f (patch) | |
tree | 0608df414c53e281459c29de73a6ca272f9fc33a | |
parent | e4cc77ea237c8a2ca67cb0a1cb28e6d652746590 (diff) |
Return and pass more appropriate types for backends
-rw-r--r-- | alc/alc.cpp | 9 | ||||
-rw-r--r-- | alc/backends/alsa.cpp | 38 | ||||
-rw-r--r-- | alc/backends/base.cpp | 6 | ||||
-rw-r--r-- | alc/backends/base.h | 7 | ||||
-rw-r--r-- | alc/backends/coreaudio.cpp | 38 | ||||
-rw-r--r-- | alc/backends/dsound.cpp | 28 | ||||
-rw-r--r-- | alc/backends/jack.cpp | 22 | ||||
-rw-r--r-- | alc/backends/loopback.cpp | 12 | ||||
-rw-r--r-- | alc/backends/null.cpp | 14 | ||||
-rw-r--r-- | alc/backends/opensl.cpp | 36 | ||||
-rw-r--r-- | alc/backends/oss.cpp | 32 | ||||
-rw-r--r-- | alc/backends/portaudio.cpp | 30 | ||||
-rw-r--r-- | alc/backends/pulseaudio.cpp | 24 | ||||
-rw-r--r-- | alc/backends/qsa.cpp | 18 | ||||
-rw-r--r-- | alc/backends/sdl2.cpp | 12 | ||||
-rw-r--r-- | alc/backends/sndio.cpp | 36 | ||||
-rw-r--r-- | alc/backends/solaris.cpp | 20 | ||||
-rw-r--r-- | alc/backends/wasapi.cpp | 22 | ||||
-rw-r--r-- | alc/backends/wave.cpp | 16 | ||||
-rw-r--r-- | alc/backends/winmm.cpp | 34 |
20 files changed, 227 insertions, 227 deletions
diff --git a/alc/alc.cpp b/alc/alc.cpp index fa88cba8..4a4ed677 100644 --- a/alc/alc.cpp +++ b/alc/alc.cpp @@ -1920,7 +1920,7 @@ static ALCenum UpdateDeviceParams(ALCdevice *device, const ALCint *attrList) device->UpdateSize, device->BufferSize); try { - if(device->Backend->reset() == ALC_FALSE) + if(device->Backend->reset() == false) return ALC_INVALID_DEVICE; } catch(std::exception &e) { @@ -2235,7 +2235,7 @@ static ALCenum UpdateDeviceParams(ALCdevice *device, const ALCint *attrList) if(!device->Flags.get<DevicePaused>()) { - if(device->Backend->start() == ALC_FALSE) + if(device->Backend->start() == false) return ALC_INVALID_DEVICE; device->Flags.set<DeviceRunning>(); } @@ -3911,7 +3911,8 @@ START_API_FUNC { std::lock_guard<std::mutex> _{dev->StateLock}; BackendBase *backend{dev->Backend.get()}; if(samples >= 0 && backend->availableSamples() >= static_cast<ALCuint>(samples)) - err = backend->captureSamples(buffer, static_cast<ALuint>(samples)); + err = backend->captureSamples(static_cast<al::byte*>(buffer), + static_cast<ALuint>(samples)); } if(err != ALC_NO_ERROR) alcSetError(dev.get(), err); @@ -4085,7 +4086,7 @@ START_API_FUNC if(dev->mContexts.load()->empty()) return; - if(dev->Backend->start() == ALC_FALSE) + if(dev->Backend->start() == false) { aluHandleDisconnect(dev.get(), "Device start failure"); alcSetError(dev.get(), ALC_INVALID_DEVICE); diff --git a/alc/backends/alsa.cpp b/alc/backends/alsa.cpp index b797c768..da928171 100644 --- a/alc/backends/alsa.cpp +++ b/alc/backends/alsa.cpp @@ -395,8 +395,8 @@ struct AlsaPlayback final : public BackendBase { int mixerNoMMapProc(); ALCenum open(const ALCchar *name) override; - ALCboolean reset() override; - ALCboolean start() override; + bool reset() override; + bool start() override; void stop() override; ClockLatency getClockLatency() override; @@ -630,7 +630,7 @@ ALCenum AlsaPlayback::open(const ALCchar *name) return ALC_NO_ERROR; } -ALCboolean AlsaPlayback::reset() +bool AlsaPlayback::reset() { snd_pcm_format_t format{SND_PCM_FORMAT_UNKNOWN}; switch(mDevice->FmtType) @@ -770,16 +770,16 @@ ALCboolean AlsaPlayback::reset() SetDefaultChannelOrder(mDevice); - return ALC_TRUE; + return true; error: ERR("%s failed: %s\n", funcerr, snd_strerror(err)); if(hp) snd_pcm_hw_params_free(hp); if(sp) snd_pcm_sw_params_free(sp); - return ALC_FALSE; + return false; } -ALCboolean AlsaPlayback::start() +bool AlsaPlayback::start() { snd_pcm_hw_params_t *hp{}; snd_pcm_access_t access; @@ -797,7 +797,7 @@ ALCboolean AlsaPlayback::start() error: ERR("%s failed: %s\n", funcerr, snd_strerror(err)); if(hp) snd_pcm_hw_params_free(hp); - return ALC_FALSE; + return false; } snd_pcm_hw_params_free(hp); hp = nullptr; @@ -815,7 +815,7 @@ ALCboolean AlsaPlayback::start() if(err < 0) { ERR("snd_pcm_prepare(data->mPcmHandle) failed: %s\n", snd_strerror(err)); - return ALC_FALSE; + return false; } thread_func = &AlsaPlayback::mixerProc; } @@ -823,7 +823,7 @@ ALCboolean AlsaPlayback::start() try { mKillNow.store(false, std::memory_order_release); mThread = std::thread{std::mem_fn(thread_func), this}; - return ALC_TRUE; + return true; } catch(std::exception& e) { ERR("Could not create playback thread: %s\n", e.what()); @@ -831,7 +831,7 @@ ALCboolean AlsaPlayback::start() catch(...) { } mBuffer.clear(); - return ALC_FALSE; + return false; } void AlsaPlayback::stop() @@ -869,9 +869,9 @@ struct AlsaCapture final : public BackendBase { ~AlsaCapture() override; ALCenum open(const ALCchar *name) override; - ALCboolean start() override; + bool start() override; void stop() override; - ALCenum captureSamples(ALCvoid *buffer, ALCuint samples) override; + ALCenum captureSamples(al::byte *buffer, ALCuint samples) override; ALCuint availableSamples() override; ClockLatency getClockLatency() override; @@ -1015,7 +1015,7 @@ error2: } -ALCboolean AlsaCapture::start() +bool AlsaCapture::start() { int err{snd_pcm_prepare(mPcmHandle)}; if(err < 0) @@ -1029,11 +1029,11 @@ ALCboolean AlsaCapture::start() if(err < 0) { aluHandleDisconnect(mDevice, "Capture state failure: %s", snd_strerror(err)); - return ALC_FALSE; + return false; } mDoCapture = true; - return ALC_TRUE; + return true; } void AlsaCapture::stop() @@ -1058,7 +1058,7 @@ void AlsaCapture::stop() mDoCapture = false; } -ALCenum AlsaCapture::captureSamples(ALCvoid *buffer, ALCuint samples) +ALCenum AlsaCapture::captureSamples(al::byte *buffer, ALCuint samples) { if(mRing) { @@ -1078,7 +1078,7 @@ ALCenum AlsaCapture::captureSamples(ALCvoid *buffer, ALCuint samples) if(static_cast<snd_pcm_uframes_t>(amt) > samples) amt = samples; amt = snd_pcm_frames_to_bytes(mPcmHandle, amt); - std::copy_n(mBuffer.begin(), amt, static_cast<al::byte*>(buffer)); + std::copy_n(mBuffer.begin(), amt, buffer); mBuffer.erase(mBuffer.begin(), mBuffer.begin()+amt); amt = snd_pcm_bytes_to_frames(mPcmHandle, amt); @@ -1111,11 +1111,11 @@ ALCenum AlsaCapture::captureSamples(ALCvoid *buffer, ALCuint samples) continue; } - buffer = static_cast<al::byte*>(buffer) + amt; + buffer = buffer + amt; samples -= static_cast<ALCuint>(amt); } if(samples > 0) - std::fill_n(static_cast<al::byte*>(buffer), snd_pcm_frames_to_bytes(mPcmHandle, samples), + std::fill_n(buffer, snd_pcm_frames_to_bytes(mPcmHandle, samples), al::byte((mDevice->FmtType == DevFmtUByte) ? 0x80 : 0)); return ALC_NO_ERROR; diff --git a/alc/backends/base.cpp b/alc/backends/base.cpp index c4c6052b..a5f66606 100644 --- a/alc/backends/base.cpp +++ b/alc/backends/base.cpp @@ -28,10 +28,10 @@ BackendBase::BackendBase(ALCdevice *device) noexcept : mDevice{device} BackendBase::~BackendBase() = default; -ALCboolean BackendBase::reset() -{ return ALC_FALSE; } +bool BackendBase::reset() +{ return false; } -ALCenum BackendBase::captureSamples(void*, ALCuint) +ALCenum BackendBase::captureSamples(al::byte*, ALCuint) { return ALC_INVALID_DEVICE; } ALCuint BackendBase::availableSamples() diff --git a/alc/backends/base.h b/alc/backends/base.h index e88734dc..cc33ba50 100644 --- a/alc/backends/base.h +++ b/alc/backends/base.h @@ -9,6 +9,7 @@ #include "AL/alc.h" #include "alcmain.h" +#include "albyte.h" struct ClockLatency { @@ -33,11 +34,11 @@ ClockLatency GetClockLatency(ALCdevice *device); struct BackendBase { virtual ALCenum open(const ALCchar *name) = 0; - virtual ALCboolean reset(); - virtual ALCboolean start() = 0; + virtual bool reset(); + virtual bool start() = 0; virtual void stop() = 0; - virtual ALCenum captureSamples(void *buffer, ALCuint samples); + virtual ALCenum captureSamples(al::byte *buffer, ALCuint samples); virtual ALCuint availableSamples(); virtual ClockLatency getClockLatency(); diff --git a/alc/backends/coreaudio.cpp b/alc/backends/coreaudio.cpp index 3ae9800c..72754718 100644 --- a/alc/backends/coreaudio.cpp +++ b/alc/backends/coreaudio.cpp @@ -54,8 +54,8 @@ struct CoreAudioPlayback final : public BackendBase { AudioBufferList *ioData); ALCenum open(const ALCchar *name) override; - ALCboolean reset() override; - ALCboolean start() override; + bool reset() override; + bool start() override; void stop() override; AudioUnit mAudioUnit; @@ -137,7 +137,7 @@ ALCenum CoreAudioPlayback::open(const ALCchar *name) return ALC_NO_ERROR; } -ALCboolean CoreAudioPlayback::reset() +bool CoreAudioPlayback::reset() { OSStatus err{AudioUnitUninitialize(mAudioUnit)}; if(err != noErr) @@ -151,7 +151,7 @@ ALCboolean CoreAudioPlayback::reset() if(err != noErr || size != sizeof(AudioStreamBasicDescription)) { ERR("AudioUnitGetProperty failed\n"); - return ALC_FALSE; + return false; } #if 0 @@ -170,7 +170,7 @@ ALCboolean CoreAudioPlayback::reset() if(err != noErr) { ERR("AudioUnitSetProperty failed\n"); - return ALC_FALSE; + return false; } if(mDevice->Frequency != streamFormat.mSampleRate) @@ -254,7 +254,7 @@ ALCboolean CoreAudioPlayback::reset() if(err != noErr) { ERR("AudioUnitSetProperty failed\n"); - return ALC_FALSE; + return false; } /* setup callback */ @@ -268,7 +268,7 @@ ALCboolean CoreAudioPlayback::reset() if(err != noErr) { ERR("AudioUnitSetProperty failed\n"); - return ALC_FALSE; + return false; } /* init the default audio unit... */ @@ -276,21 +276,21 @@ ALCboolean CoreAudioPlayback::reset() if(err != noErr) { ERR("AudioUnitInitialize failed\n"); - return ALC_FALSE; + return false; } - return ALC_TRUE; + return true; } -ALCboolean CoreAudioPlayback::start() +bool CoreAudioPlayback::start() { OSStatus err{AudioOutputUnitStart(mAudioUnit)}; if(err != noErr) { ERR("AudioOutputUnitStart failed\n"); - return ALC_FALSE; + return false; } - return ALC_TRUE; + return true; } void CoreAudioPlayback::stop() @@ -313,9 +313,9 @@ struct CoreAudioCapture final : public BackendBase { UInt32 inNumberFrames, AudioBufferList *ioData); ALCenum open(const ALCchar *name) override; - ALCboolean start() override; + bool start() override; void stop() override; - ALCenum captureSamples(void *buffer, ALCuint samples) override; + ALCenum captureSamples(al::byte *buffer, ALCuint samples) override; ALCuint availableSamples() override; AudioUnit mAudioUnit{0}; @@ -628,15 +628,15 @@ ALCenum CoreAudioCapture::open(const ALCchar *name) } -ALCboolean CoreAudioCapture::start() +bool CoreAudioCapture::start() { OSStatus err{AudioOutputUnitStart(mAudioUnit)}; if(err != noErr) { ERR("AudioOutputUnitStart failed\n"); - return ALC_FALSE; + return false; } - return ALC_TRUE; + return true; } void CoreAudioCapture::stop() @@ -646,7 +646,7 @@ void CoreAudioCapture::stop() ERR("AudioOutputUnitStop failed\n"); } -ALCenum CoreAudioCapture::captureSamples(void *buffer, ALCuint samples) +ALCenum CoreAudioCapture::captureSamples(al::byte *buffer, ALCuint samples) { if(!mConverter) { @@ -663,7 +663,7 @@ ALCenum CoreAudioCapture::captureSamples(void *buffer, ALCuint samples) { const void *src1{rec_vec.second.buf}; auto src1len = static_cast<ALuint>(rec_vec.second.len); - got += mConverter->convert(&src1, &src1len, static_cast<char*>(buffer)+got, samples-got); + got += mConverter->convert(&src1, &src1len, buffer+got, samples-got); total_read += rec_vec.second.len - src1len; } diff --git a/alc/backends/dsound.cpp b/alc/backends/dsound.cpp index f9184968..c581fe8f 100644 --- a/alc/backends/dsound.cpp +++ b/alc/backends/dsound.cpp @@ -167,8 +167,8 @@ struct DSoundPlayback final : public BackendBase { int mixerProc(); ALCenum open(const ALCchar *name) override; - ALCboolean reset() override; - ALCboolean start() override; + bool reset() override; + bool start() override; void stop() override; IDirectSound *mDS{nullptr}; @@ -348,7 +348,7 @@ ALCenum DSoundPlayback::open(const ALCchar *name) return ALC_NO_ERROR; } -ALCboolean DSoundPlayback::reset() +bool DSoundPlayback::reset() { if(mNotifies) mNotifies->Release(); @@ -558,28 +558,28 @@ retry_open: if(mPrimaryBuffer) mPrimaryBuffer->Release(); mPrimaryBuffer = nullptr; - return ALC_FALSE; + return false; } ResetEvent(mNotifyEvent); SetDefaultWFXChannelOrder(mDevice); - return ALC_TRUE; + return true; } -ALCboolean DSoundPlayback::start() +bool DSoundPlayback::start() { try { mKillNow.store(false, std::memory_order_release); mThread = std::thread{std::mem_fn(&DSoundPlayback::mixerProc), this}; - return ALC_TRUE; + return true; } catch(std::exception& e) { ERR("Failed to start mixing thread: %s\n", e.what()); } catch(...) { } - return ALC_FALSE; + return false; } void DSoundPlayback::stop() @@ -597,9 +597,9 @@ struct DSoundCapture final : public BackendBase { ~DSoundCapture() override; ALCenum open(const ALCchar *name) override; - ALCboolean start() override; + bool start() override; void stop() override; - ALCenum captureSamples(void *buffer, ALCuint samples) override; + ALCenum captureSamples(al::byte *buffer, ALCuint samples) override; ALCuint availableSamples() override; IDirectSoundCapture *mDSC{nullptr}; @@ -791,16 +791,16 @@ ALCenum DSoundCapture::open(const ALCchar *name) return ALC_NO_ERROR; } -ALCboolean DSoundCapture::start() +bool DSoundCapture::start() { HRESULT hr{mDSCbuffer->Start(DSCBSTART_LOOPING)}; if(FAILED(hr)) { ERR("start failed: 0x%08lx\n", hr); aluHandleDisconnect(mDevice, "Failure starting capture: 0x%lx", hr); - return ALC_FALSE; + return false; } - return ALC_TRUE; + return true; } void DSoundCapture::stop() @@ -813,7 +813,7 @@ void DSoundCapture::stop() } } -ALCenum DSoundCapture::captureSamples(void *buffer, ALCuint samples) +ALCenum DSoundCapture::captureSamples(al::byte *buffer, ALCuint samples) { mRing->read(buffer, samples); return ALC_NO_ERROR; diff --git a/alc/backends/jack.cpp b/alc/backends/jack.cpp index e1ae91f0..660ea933 100644 --- a/alc/backends/jack.cpp +++ b/alc/backends/jack.cpp @@ -162,8 +162,8 @@ struct JackPlayback final : public BackendBase { int mixerProc(); ALCenum open(const ALCchar *name) override; - ALCboolean reset() override; - ALCboolean start() override; + bool reset() override; + bool start() override; void stop() override; ClockLatency getClockLatency() override; @@ -359,7 +359,7 @@ ALCenum JackPlayback::open(const ALCchar *name) return ALC_NO_ERROR; } -ALCboolean JackPlayback::reset() +bool JackPlayback::reset() { std::for_each(std::begin(mPort), std::end(mPort), [this](jack_port_t *port) -> void @@ -395,7 +395,7 @@ ALCboolean JackPlayback::reset() if(bad_port != ports_end) { ERR("Not enough JACK ports available for %s output\n", DevFmtChannelsString(mDevice->FmtChans)); - if(bad_port == std::begin(mPort)) return ALC_FALSE; + if(bad_port == std::begin(mPort)) return false; if(bad_port == std::begin(mPort)+1) mDevice->FmtChans = DevFmtMono; @@ -416,20 +416,20 @@ ALCboolean JackPlayback::reset() if(!mRing) { ERR("Failed to allocate ringbuffer\n"); - return ALC_FALSE; + return false; } SetDefaultChannelOrder(mDevice); - return ALC_TRUE; + return true; } -ALCboolean JackPlayback::start() +bool JackPlayback::start() { if(jack_activate(mClient)) { ERR("Failed to activate client\n"); - return ALC_FALSE; + return false; } const char **ports{jack_get_ports(mClient, nullptr, nullptr, @@ -438,7 +438,7 @@ ALCboolean JackPlayback::start() { ERR("No physical playback ports found\n"); jack_deactivate(mClient); - return ALC_FALSE; + return false; } std::mismatch(std::begin(mPort), std::end(mPort), ports, [this](const jack_port_t *port, const char *pname) -> bool @@ -460,7 +460,7 @@ ALCboolean JackPlayback::start() try { mKillNow.store(false, std::memory_order_release); mThread = std::thread{std::mem_fn(&JackPlayback::mixerProc), this}; - return ALC_TRUE; + return true; } catch(std::exception& e) { ERR("Could not create playback thread: %s\n", e.what()); @@ -468,7 +468,7 @@ ALCboolean JackPlayback::start() catch(...) { } jack_deactivate(mClient); - return ALC_FALSE; + return false; } void JackPlayback::stop() diff --git a/alc/backends/loopback.cpp b/alc/backends/loopback.cpp index 4a1c641a..7edc2d40 100644 --- a/alc/backends/loopback.cpp +++ b/alc/backends/loopback.cpp @@ -32,8 +32,8 @@ struct LoopbackBackend final : public BackendBase { LoopbackBackend(ALCdevice *device) noexcept : BackendBase{device} { } ALCenum open(const ALCchar *name) override; - ALCboolean reset() override; - ALCboolean start() override; + bool reset() override; + bool start() override; void stop() override; DEF_NEWDEL(LoopbackBackend) @@ -46,14 +46,14 @@ ALCenum LoopbackBackend::open(const ALCchar *name) return ALC_NO_ERROR; } -ALCboolean LoopbackBackend::reset() +bool LoopbackBackend::reset() { SetDefaultWFXChannelOrder(mDevice); - return ALC_TRUE; + return true; } -ALCboolean LoopbackBackend::start() -{ return ALC_TRUE; } +bool LoopbackBackend::start() +{ return true; } void LoopbackBackend::stop() { } diff --git a/alc/backends/null.cpp b/alc/backends/null.cpp index ae58cb8b..b6b115f1 100644 --- a/alc/backends/null.cpp +++ b/alc/backends/null.cpp @@ -52,8 +52,8 @@ struct NullBackend final : public BackendBase { int mixerProc(); ALCenum open(const ALCchar *name) override; - ALCboolean reset() override; - ALCboolean start() override; + bool reset() override; + bool start() override; void stop() override; std::atomic<bool> mKillNow{true}; @@ -120,25 +120,25 @@ ALCenum NullBackend::open(const ALCchar *name) return ALC_NO_ERROR; } -ALCboolean NullBackend::reset() +bool NullBackend::reset() { SetDefaultWFXChannelOrder(mDevice); - return ALC_TRUE; + return true; } -ALCboolean NullBackend::start() +bool NullBackend::start() { try { mKillNow.store(false, std::memory_order_release); mThread = std::thread{std::mem_fn(&NullBackend::mixerProc), this}; - return ALC_TRUE; + return true; } catch(std::exception& e) { ERR("Failed to start mixing thread: %s\n", e.what()); } catch(...) { } - return ALC_FALSE; + return false; } void NullBackend::stop() diff --git a/alc/backends/opensl.cpp b/alc/backends/opensl.cpp index 3a2f455e..0f1d8a21 100644 --- a/alc/backends/opensl.cpp +++ b/alc/backends/opensl.cpp @@ -152,8 +152,8 @@ struct OpenSLPlayback final : public BackendBase { int mixerProc(); ALCenum open(const ALCchar *name) override; - ALCboolean reset() override; - ALCboolean start() override; + bool reset() override; + bool start() override; void stop() override; ClockLatency getClockLatency() override; @@ -347,7 +347,7 @@ ALCenum OpenSLPlayback::open(const ALCchar *name) return ALC_NO_ERROR; } -ALCboolean OpenSLPlayback::reset() +bool OpenSLPlayback::reset() { SLDataLocator_AndroidSimpleBufferQueue loc_bufq; SLDataLocator_OutputMix loc_outmix; @@ -518,13 +518,13 @@ ALCboolean OpenSLPlayback::reset() VCALL0(mBufferQueueObj,Destroy)(); mBufferQueueObj = nullptr; - return ALC_FALSE; + return false; } - return ALC_TRUE; + return true; } -ALCboolean OpenSLPlayback::start() +bool OpenSLPlayback::start() { mRing->reset(); @@ -533,23 +533,23 @@ ALCboolean OpenSLPlayback::start() &bufferQueue)}; PRINTERR(result, "bufferQueue->GetInterface"); if(SL_RESULT_SUCCESS != result) - return ALC_FALSE; + return false; result = VCALL(bufferQueue,RegisterCallback)(&OpenSLPlayback::processC, this); PRINTERR(result, "bufferQueue->RegisterCallback"); - if(SL_RESULT_SUCCESS != result) return ALC_FALSE; + if(SL_RESULT_SUCCESS != result) return false; try { mKillNow.store(false, std::memory_order_release); mThread = std::thread(std::mem_fn(&OpenSLPlayback::mixerProc), this); - return ALC_TRUE; + return true; } catch(std::exception& e) { ERR("Could not create playback thread: %s\n", e.what()); } catch(...) { } - return ALC_FALSE; + return false; } void OpenSLPlayback::stop() @@ -615,9 +615,9 @@ struct OpenSLCapture final : public BackendBase { void process(SLAndroidSimpleBufferQueueItf bq); ALCenum open(const ALCchar *name) override; - ALCboolean start() override; + bool start() override; void stop() override; - ALCenum captureSamples(void *buffer, ALCuint samples) override; + ALCenum captureSamples(al::byte *buffer, ALCuint samples) override; ALCuint availableSamples() override; /* engine interfaces */ @@ -815,7 +815,7 @@ ALCenum OpenSLCapture::open(const ALCchar* name) return ALC_NO_ERROR; } -ALCboolean OpenSLCapture::start() +bool OpenSLCapture::start() { SLRecordItf record; SLresult result{VCALL(mRecordObj,GetInterface)(SL_IID_RECORD, &record)}; @@ -830,10 +830,10 @@ ALCboolean OpenSLCapture::start() if(SL_RESULT_SUCCESS != result) { aluHandleDisconnect(mDevice, "Failed to start capture: 0x%08x", result); - return ALC_FALSE; + return false; } - return ALC_TRUE; + return true; } void OpenSLCapture::stop() @@ -849,7 +849,7 @@ void OpenSLCapture::stop() } } -ALCenum OpenSLCapture::captureSamples(void *buffer, ALCuint samples) +ALCenum OpenSLCapture::captureSamples(al::byte *buffer, ALCuint samples) { ALuint chunk_size{mDevice->UpdateSize * mFrameSize}; SLAndroidSimpleBufferQueueItf bufferQueue; @@ -866,9 +866,7 @@ ALCenum OpenSLCapture::captureSamples(void *buffer, ALCuint samples) for(i = 0;i < samples;) { ALCuint rem{minu(samples - i, mDevice->UpdateSize - mSplOffset)}; - memcpy(static_cast<al::byte*>(buffer) + i*mFrameSize, - data.first.buf + mSplOffset*mFrameSize, - rem * mFrameSize); + memcpy(buffer + i*mFrameSize, data.first.buf + mSplOffset*mFrameSize, rem*mFrameSize); mSplOffset += rem; if(mSplOffset == mDevice->UpdateSize) diff --git a/alc/backends/oss.cpp b/alc/backends/oss.cpp index ffdf3c23..c825ce3e 100644 --- a/alc/backends/oss.cpp +++ b/alc/backends/oss.cpp @@ -249,8 +249,8 @@ struct OSSPlayback final : public BackendBase { int mixerProc(); ALCenum open(const ALCchar *name) override; - ALCboolean reset() override; - ALCboolean start() override; + bool reset() override; + bool start() override; void stop() override; int mFd{-1}; @@ -359,7 +359,7 @@ ALCenum OSSPlayback::open(const ALCchar *name) return ALC_NO_ERROR; } -ALCboolean OSSPlayback::reset() +bool OSSPlayback::reset() { int ossFormat{}; switch(mDevice->FmtType) @@ -406,7 +406,7 @@ ALCboolean OSSPlayback::reset() { err: ERR("%s failed: %s\n", err, strerror(errno)); - return ALC_FALSE; + return false; } #undef CHECKERR @@ -414,7 +414,7 @@ ALCboolean OSSPlayback::reset() { ERR("Failed to set %s, got %d channels instead\n", DevFmtChannelsString(mDevice->FmtChans), numChannels); - return ALC_FALSE; + return false; } if(!((ossFormat == AFMT_S8 && mDevice->FmtType == DevFmtByte) || @@ -423,7 +423,7 @@ ALCboolean OSSPlayback::reset() { ERR("Failed to set %s samples, got OSS format %#x\n", DevFmtTypeString(mDevice->FmtType), ossFormat); - return ALC_FALSE; + return false; } mDevice->Frequency = ossSpeed; @@ -434,22 +434,22 @@ ALCboolean OSSPlayback::reset() mMixData.resize(mDevice->UpdateSize * mDevice->frameSizeFromFmt()); - return ALC_TRUE; + return true; } -ALCboolean OSSPlayback::start() +bool OSSPlayback::start() { try { mKillNow.store(false, std::memory_order_release); mThread = std::thread{std::mem_fn(&OSSPlayback::mixerProc), this}; - return ALC_TRUE; + return true; } catch(std::exception& e) { ERR("Could not create playback thread: %s\n", e.what()); } catch(...) { } - return ALC_FALSE; + return false; } void OSSPlayback::stop() @@ -470,9 +470,9 @@ struct OSScapture final : public BackendBase { int recordProc(); ALCenum open(const ALCchar *name) override; - ALCboolean start() override; + bool start() override; void stop() override; - ALCenum captureSamples(ALCvoid *buffer, ALCuint samples) override; + ALCenum captureSamples(al::byte *buffer, ALCuint samples) override; ALCuint availableSamples() override; int mFd{-1}; @@ -646,19 +646,19 @@ ALCenum OSScapture::open(const ALCchar *name) return ALC_NO_ERROR; } -ALCboolean OSScapture::start() +bool OSScapture::start() { try { mKillNow.store(false, std::memory_order_release); mThread = std::thread{std::mem_fn(&OSScapture::recordProc), this}; - return ALC_TRUE; + return true; } catch(std::exception& e) { ERR("Could not create record thread: %s\n", e.what()); } catch(...) { } - return ALC_FALSE; + return false; } void OSScapture::stop() @@ -671,7 +671,7 @@ void OSScapture::stop() ERR("Error resetting device: %s\n", strerror(errno)); } -ALCenum OSScapture::captureSamples(ALCvoid *buffer, ALCuint samples) +ALCenum OSScapture::captureSamples(al::byte *buffer, ALCuint samples) { mRing->read(buffer, samples); return ALC_NO_ERROR; diff --git a/alc/backends/portaudio.cpp b/alc/backends/portaudio.cpp index 4704a806..0b77f622 100644 --- a/alc/backends/portaudio.cpp +++ b/alc/backends/portaudio.cpp @@ -81,8 +81,8 @@ struct PortPlayback final : public BackendBase { const PaStreamCallbackTimeInfo *timeInfo, const PaStreamCallbackFlags statusFlags); ALCenum open(const ALCchar *name) override; - ALCboolean reset() override; - ALCboolean start() override; + bool reset() override; + bool start() override; void stop() override; PaStream *mStream{nullptr}; @@ -179,7 +179,7 @@ retry_open: } -ALCboolean PortPlayback::reset() +bool PortPlayback::reset() { const PaStreamInfo *streamInfo{Pa_GetStreamInfo(mStream)}; mDevice->Frequency = static_cast<ALuint>(streamInfo->sampleRate); @@ -198,7 +198,7 @@ ALCboolean PortPlayback::reset() else { ERR("Unexpected sample format: 0x%lx\n", mParams.sampleFormat); - return ALC_FALSE; + return false; } if(mParams.channelCount == 2) @@ -208,22 +208,22 @@ ALCboolean PortPlayback::reset() else { ERR("Unexpected channel count: %u\n", mParams.channelCount); - return ALC_FALSE; + return false; } SetDefaultChannelOrder(mDevice); - return ALC_TRUE; + return true; } -ALCboolean PortPlayback::start() +bool PortPlayback::start() { PaError err{Pa_StartStream(mStream)}; if(err != paNoError) { ERR("Pa_StartStream() returned an error: %s\n", Pa_GetErrorText(err)); - return ALC_FALSE; + return false; } - return ALC_TRUE; + return true; } void PortPlayback::stop() @@ -245,9 +245,9 @@ struct PortCapture final : public BackendBase { const PaStreamCallbackTimeInfo *timeInfo, const PaStreamCallbackFlags statusFlags); ALCenum open(const ALCchar *name) override; - ALCboolean start() override; + bool start() override; void stop() override; - ALCenum captureSamples(ALCvoid *buffer, ALCuint samples) override; + ALCenum captureSamples(al::byte *buffer, ALCuint samples) override; ALCuint availableSamples() override; PaStream *mStream{nullptr}; @@ -341,15 +341,15 @@ ALCenum PortCapture::open(const ALCchar *name) } -ALCboolean PortCapture::start() +bool PortCapture::start() { PaError err{Pa_StartStream(mStream)}; if(err != paNoError) { ERR("Error starting stream: %s\n", Pa_GetErrorText(err)); - return ALC_FALSE; + return false; } - return ALC_TRUE; + return true; } void PortCapture::stop() @@ -363,7 +363,7 @@ void PortCapture::stop() ALCuint PortCapture::availableSamples() { return static_cast<ALCuint>(mRing->readSpace()); } -ALCenum PortCapture::captureSamples(ALCvoid *buffer, ALCuint samples) +ALCenum PortCapture::captureSamples(al::byte *buffer, ALCuint samples) { mRing->read(buffer, samples); return ALC_NO_ERROR; diff --git a/alc/backends/pulseaudio.cpp b/alc/backends/pulseaudio.cpp index 23d4e71a..e9997013 100644 --- a/alc/backends/pulseaudio.cpp +++ b/alc/backends/pulseaudio.cpp @@ -666,8 +666,8 @@ struct PulsePlayback final : public BackendBase { void streamMovedCallback(pa_stream *stream); ALCenum open(const ALCchar *name) override; - ALCboolean reset() override; - ALCboolean start() override; + bool reset() override; + bool start() override; void stop() override; ClockLatency getClockLatency() override; void lock() override; @@ -879,7 +879,7 @@ ALCenum PulsePlayback::open(const ALCchar *name) return ALC_NO_ERROR; } -ALCboolean PulsePlayback::reset() +bool PulsePlayback::reset() { std::unique_lock<std::mutex> plock{pulse_lock}; @@ -1032,10 +1032,10 @@ ALCboolean PulsePlayback::reset() len, mAttr.prebuf, mDevice->BufferSize); } - return ALC_TRUE; + return true; } -ALCboolean PulsePlayback::start() +bool PulsePlayback::start() { std::unique_lock<std::mutex> plock{pulse_lock}; @@ -1043,7 +1043,7 @@ ALCboolean PulsePlayback::start() pa_operation *op{pa_stream_cork(mStream, 0, stream_success_callback, nullptr)}; wait_for_operation(op, plock); - return ALC_TRUE; + return true; } void PulsePlayback::stop() @@ -1110,9 +1110,9 @@ struct PulseCapture final : public BackendBase { void streamMovedCallback(pa_stream *stream); ALCenum open(const ALCchar *name) override; - ALCboolean start() override; + bool start() override; void stop() override; - ALCenum captureSamples(ALCvoid *buffer, ALCuint samples) override; + ALCenum captureSamples(al::byte *buffer, ALCuint samples) override; ALCuint availableSamples() override; ClockLatency getClockLatency() override; void lock() override; @@ -1303,12 +1303,12 @@ ALCenum PulseCapture::open(const ALCchar *name) return ALC_NO_ERROR; } -ALCboolean PulseCapture::start() +bool PulseCapture::start() { std::unique_lock<std::mutex> plock{pulse_lock}; pa_operation *op{pa_stream_cork(mStream, 0, stream_success_callback, nullptr)}; wait_for_operation(op, plock); - return ALC_TRUE; + return true; } void PulseCapture::stop() @@ -1318,9 +1318,9 @@ void PulseCapture::stop() wait_for_operation(op, plock); } -ALCenum PulseCapture::captureSamples(ALCvoid *buffer, ALCuint samples) +ALCenum PulseCapture::captureSamples(al::byte *buffer, ALCuint samples) { - al::span<al::byte> dstbuf{static_cast<al::byte*>(buffer), samples * pa_frame_size(&mSpec)}; + al::span<al::byte> dstbuf{buffer, samples * pa_frame_size(&mSpec)}; /* Capture is done in fragment-sized chunks, so we loop until we get all * that's available */ diff --git a/alc/backends/qsa.cpp b/alc/backends/qsa.cpp index 64ed53aa..5fee2989 100644 --- a/alc/backends/qsa.cpp +++ b/alc/backends/qsa.cpp @@ -175,8 +175,8 @@ struct PlaybackWrapper final : public BackendBase { ~PlaybackWrapper() override; ALCenum open(const ALCchar *name) override; - ALCboolean reset() override; - ALCboolean start() override; + bool reset() override; + bool start() override; void stop() override; std::unique_ptr<qsa_data> mExtraData; @@ -616,10 +616,10 @@ PlaybackWrapper::~PlaybackWrapper() ALCenum PlaybackWrapper::open(const ALCchar *name) { return qsa_open_playback(this, name); } -ALCboolean PlaybackWrapper::reset() +bool PlaybackWrapper::reset() { return qsa_reset_playback(this); } -ALCboolean PlaybackWrapper::start() +bool PlaybackWrapper::start() { return qsa_start_playback(this); } void PlaybackWrapper::stop() @@ -635,9 +635,9 @@ struct CaptureWrapper final : public BackendBase { ~CaptureWrapper() override; ALCenum open(const ALCchar *name) override; - ALCboolean start() override; + bool start() override; void stop() override; - ALCenum captureSamples(void *buffer, ALCuint samples) override; + ALCenum captureSamples(al::byte *buffer, ALCuint samples) override; ALCuint availableSamples() override; std::unique_ptr<qsa_data> mExtraData; @@ -894,13 +894,13 @@ CaptureWrapper::~CaptureWrapper() ALCenum CaptureWrapper::open(const ALCchar *name) { return qsa_open_capture(this, name); } -ALCboolean CaptureWrapper::start() -{ qsa_start_capture(this); return ALC_TRUE; } +bool CaptureWrapper::start() +{ qsa_start_capture(this); return true; } void CaptureWrapper::stop() { qsa_stop_capture(this); } -ALCenum CaptureWrapper::captureSamples(void *buffer, ALCuint samples) +ALCenum CaptureWrapper::captureSamples(al::byte *buffer, ALCuint samples) { return qsa_capture_samples(this, buffer, samples); } ALCuint CaptureWrapper::availableSamples() diff --git a/alc/backends/sdl2.cpp b/alc/backends/sdl2.cpp index 6af0ac9d..71616906 100644 --- a/alc/backends/sdl2.cpp +++ b/alc/backends/sdl2.cpp @@ -55,8 +55,8 @@ struct Sdl2Backend final : public BackendBase { void audioCallback(Uint8 *stream, int len); ALCenum open(const ALCchar *name) override; - ALCboolean reset() override; - ALCboolean start() override; + bool reset() override; + bool start() override; void stop() override; void lock() override; void unlock() override; @@ -163,7 +163,7 @@ ALCenum Sdl2Backend::open(const ALCchar *name) return ALC_NO_ERROR; } -ALCboolean Sdl2Backend::reset() +bool Sdl2Backend::reset() { mDevice->Frequency = mFrequency; mDevice->FmtChans = mFmtChans; @@ -171,13 +171,13 @@ ALCboolean Sdl2Backend::reset() mDevice->UpdateSize = mUpdateSize; mDevice->BufferSize = mUpdateSize * 2; SetDefaultWFXChannelOrder(mDevice); - return ALC_TRUE; + return true; } -ALCboolean Sdl2Backend::start() +bool Sdl2Backend::start() { SDL_PauseAudioDevice(mDeviceID, 0); - return ALC_TRUE; + return true; } void Sdl2Backend::stop() diff --git a/alc/backends/sndio.cpp b/alc/backends/sndio.cpp index 4a470e82..d2654853 100644 --- a/alc/backends/sndio.cpp +++ b/alc/backends/sndio.cpp @@ -50,8 +50,8 @@ struct SndioPlayback final : public BackendBase { int mixerProc(); ALCenum open(const ALCchar *name) override; - ALCboolean reset() override; - ALCboolean start() override; + bool reset() override; + bool start() override; void stop() override; sio_hdl *mSndHandle{nullptr}; @@ -124,7 +124,7 @@ ALCenum SndioPlayback::open(const ALCchar *name) return ALC_NO_ERROR; } -ALCboolean SndioPlayback::reset() +bool SndioPlayback::reset() { sio_par par; sio_initpar(&par); @@ -169,13 +169,13 @@ ALCboolean SndioPlayback::reset() if(!sio_setpar(mSndHandle, &par) || !sio_getpar(mSndHandle, &par)) { ERR("Failed to set device parameters\n"); - return ALC_FALSE; + return false; } if(par.bits != par.bps*8) { ERR("Padded samples not supported (%u of %u bits)\n", par.bits, par.bps*8); - return ALC_FALSE; + return true; } mDevice->Frequency = par.rate; @@ -196,7 +196,7 @@ ALCboolean SndioPlayback::reset() else { ERR("Unhandled sample format: %s %u-bit\n", (par.sig?"signed":"unsigned"), par.bits); - return ALC_FALSE; + return false; } SetDefaultChannelOrder(mDevice); @@ -207,21 +207,21 @@ ALCboolean SndioPlayback::reset() mBuffer.resize(mDevice->UpdateSize * mDevice->frameSizeFromFmt()); std::fill(mBuffer.begin(), mBuffer.end(), 0); - return ALC_TRUE; + return true; } -ALCboolean SndioPlayback::start() +bool SndioPlayback::start() { if(!sio_start(mSndHandle)) { ERR("Error starting playback\n"); - return ALC_FALSE; + return false; } try { mKillNow.store(false, std::memory_order_release); mThread = std::thread{std::mem_fn(&SndioPlayback::mixerProc), this}; - return ALC_TRUE; + return true; } catch(std::exception& e) { ERR("Could not create playback thread: %s\n", e.what()); @@ -229,7 +229,7 @@ ALCboolean SndioPlayback::start() catch(...) { } sio_stop(mSndHandle); - return ALC_FALSE; + return false; } void SndioPlayback::stop() @@ -250,9 +250,9 @@ struct SndioCapture final : public BackendBase { int recordProc(); ALCenum open(const ALCchar *name) override; - ALCboolean start() override; + bool start() override; void stop() override; - ALCenum captureSamples(void *buffer, ALCuint samples) override; + ALCenum captureSamples(al::byte *buffer, ALCuint samples) override; ALCuint availableSamples() override; sio_hdl *mSndHandle{nullptr}; @@ -417,18 +417,18 @@ ALCenum SndioCapture::open(const ALCchar *name) return ALC_NO_ERROR; } -ALCboolean SndioCapture::start() +bool SndioCapture::start() { if(!sio_start(mSndHandle)) { ERR("Error starting playback\n"); - return ALC_FALSE; + return false; } try { mKillNow.store(false, std::memory_order_release); mThread = std::thread{std::mem_fn(&SndioCapture::recordProc), this}; - return ALC_TRUE; + return true; } catch(std::exception& e) { ERR("Could not create record thread: %s\n", e.what()); @@ -436,7 +436,7 @@ ALCboolean SndioCapture::start() catch(...) { } sio_stop(mSndHandle); - return ALC_FALSE; + return false; } void SndioCapture::stop() @@ -449,7 +449,7 @@ void SndioCapture::stop() ERR("Error stopping device\n"); } -ALCenum SndioCapture::captureSamples(void *buffer, ALCuint samples) +ALCenum SndioCapture::captureSamples(al::byte *buffer, ALCuint samples) { mRing->read(buffer, samples); return ALC_NO_ERROR; diff --git a/alc/backends/solaris.cpp b/alc/backends/solaris.cpp index 2e8fe458..128924bb 100644 --- a/alc/backends/solaris.cpp +++ b/alc/backends/solaris.cpp @@ -62,8 +62,8 @@ struct SolarisBackend final : public BackendBase { int mixerProc(); ALCenum open(const ALCchar *name) override; - ALCboolean reset() override; - ALCboolean start() override; + bool reset() override; + bool start() override; void stop() override; int mFd{-1}; @@ -160,7 +160,7 @@ ALCenum SolarisBackend::open(const ALCchar *name) return ALC_NO_ERROR; } -ALCboolean SolarisBackend::reset() +bool SolarisBackend::reset() { audio_info_t info; AUDIO_INITINFO(&info); @@ -200,14 +200,14 @@ ALCboolean SolarisBackend::reset() if(ioctl(mFd, AUDIO_SETINFO, &info) < 0) { ERR("ioctl failed: %s\n", strerror(errno)); - return ALC_FALSE; + return false; } if(mDevice->channelsFromFmt() != info.play.channels) { ERR("Failed to set %s, got %u channels instead\n", DevFmtChannelsString(mDevice->FmtChans), info.play.channels); - return ALC_FALSE; + return false; } if(!((info.play.precision == 8 && info.play.encoding == AUDIO_ENCODING_LINEAR8 && mDevice->FmtType == DevFmtUByte) || @@ -217,7 +217,7 @@ ALCboolean SolarisBackend::reset() { ERR("Could not set %s samples, got %d (0x%x)\n", DevFmtTypeString(mDevice->FmtType), info.play.precision, info.play.encoding); - return ALC_FALSE; + return false; } mDevice->Frequency = info.play.sample_rate; @@ -229,22 +229,22 @@ ALCboolean SolarisBackend::reset() mBuffer.resize(mDevice->UpdateSize * mDevice->frameSizeFromFmt()); std::fill(mBuffer.begin(), mBuffer.end(), 0); - return ALC_TRUE; + return true; } -ALCboolean SolarisBackend::start() +bool SolarisBackend::start() { try { mKillNow.store(false, std::memory_order_release); mThread = std::thread{std::mem_fn(&SolarisBackend::mixerProc), this}; - return ALC_TRUE; + return true; } catch(std::exception& e) { ERR("Could not create playback thread: %s\n", e.what()); } catch(...) { } - return ALC_FALSE; + return false; } void SolarisBackend::stop() diff --git a/alc/backends/wasapi.cpp b/alc/backends/wasapi.cpp index 0d04d5a7..0dec5cb9 100644 --- a/alc/backends/wasapi.cpp +++ b/alc/backends/wasapi.cpp @@ -614,9 +614,9 @@ struct WasapiPlayback final : public BackendBase, WasapiProxy { HRESULT openProxy() override; void closeProxy() override; - ALCboolean reset() override; + bool reset() override; HRESULT resetProxy() override; - ALCboolean start() override; + bool start() override; HRESULT startProxy() override; void stop() override; void stopProxy() override; @@ -812,10 +812,10 @@ void WasapiPlayback::closeProxy() } -ALCboolean WasapiPlayback::reset() +bool WasapiPlayback::reset() { HRESULT hr{pushMessage(MsgType::ResetDevice).get()}; - return SUCCEEDED(hr) ? ALC_TRUE : ALC_FALSE; + return SUCCEEDED(hr) ? true : false; } HRESULT WasapiPlayback::resetProxy() @@ -1073,10 +1073,10 @@ HRESULT WasapiPlayback::resetProxy() } -ALCboolean WasapiPlayback::start() +bool WasapiPlayback::start() { HRESULT hr{pushMessage(MsgType::StartDevice).get()}; - return SUCCEEDED(hr) ? ALC_TRUE : ALC_FALSE; + return SUCCEEDED(hr) ? true : false; } HRESULT WasapiPlayback::startProxy() @@ -1156,12 +1156,12 @@ struct WasapiCapture final : public BackendBase, WasapiProxy { void closeProxy() override; HRESULT resetProxy() override; - ALCboolean start() override; + bool start() override; HRESULT startProxy() override; void stop() override; void stopProxy() override; - ALCenum captureSamples(void *buffer, ALCuint samples) override; + ALCenum captureSamples(al::byte *buffer, ALCuint samples) override; ALCuint availableSamples() override; std::wstring mDevId; @@ -1622,10 +1622,10 @@ HRESULT WasapiCapture::resetProxy() } -ALCboolean WasapiCapture::start() +bool WasapiCapture::start() { HRESULT hr{pushMessage(MsgType::StartDevice).get()}; - return SUCCEEDED(hr) ? ALC_TRUE : ALC_FALSE; + return SUCCEEDED(hr) ? true : false; } HRESULT WasapiCapture::startProxy() @@ -1687,7 +1687,7 @@ void WasapiCapture::stopProxy() ALCuint WasapiCapture::availableSamples() { return static_cast<ALCuint>(mRing->readSpace()); } -ALCenum WasapiCapture::captureSamples(void *buffer, ALCuint samples) +ALCenum WasapiCapture::captureSamples(al::byte *buffer, ALCuint samples) { mRing->read(buffer, samples); return ALC_NO_ERROR; diff --git a/alc/backends/wave.cpp b/alc/backends/wave.cpp index 41d0a880..797a9fa5 100644 --- a/alc/backends/wave.cpp +++ b/alc/backends/wave.cpp @@ -97,8 +97,8 @@ struct WaveBackend final : public BackendBase { int mixerProc(); ALCenum open(const ALCchar *name) override; - ALCboolean reset() override; - ALCboolean start() override; + bool reset() override; + bool start() override; void stop() override; FILE *mFile{nullptr}; @@ -231,7 +231,7 @@ ALCenum WaveBackend::open(const ALCchar *name) return ALC_NO_ERROR; } -ALCboolean WaveBackend::reset() +bool WaveBackend::reset() { ALuint channels=0, bytes=0, chanmask=0; int isbformat = 0; @@ -324,7 +324,7 @@ ALCboolean WaveBackend::reset() if(ferror(mFile)) { ERR("Error writing header: %s\n", strerror(errno)); - return ALC_FALSE; + return false; } mDataStart = ftell(mFile); @@ -333,22 +333,22 @@ ALCboolean WaveBackend::reset() const ALuint bufsize{mDevice->frameSizeFromFmt() * mDevice->UpdateSize}; mBuffer.resize(bufsize); - return ALC_TRUE; + return true; } -ALCboolean WaveBackend::start() +bool WaveBackend::start() { try { mKillNow.store(false, std::memory_order_release); mThread = std::thread{std::mem_fn(&WaveBackend::mixerProc), this}; - return ALC_TRUE; + return true; } catch(std::exception& e) { ERR("Failed to start mixing thread: %s\n", e.what()); } catch(...) { } - return ALC_FALSE; + return false; } void WaveBackend::stop() diff --git a/alc/backends/winmm.cpp b/alc/backends/winmm.cpp index 30a19e13..41c110d7 100644 --- a/alc/backends/winmm.cpp +++ b/alc/backends/winmm.cpp @@ -132,8 +132,8 @@ struct WinMMPlayback final : public BackendBase { int mixerProc(); ALCenum open(const ALCchar *name) override; - ALCboolean reset() override; - ALCboolean start() override; + bool reset() override; + bool start() override; void stop() override; std::atomic<ALuint> mWritable{0u}; @@ -263,7 +263,7 @@ retry_open: return ALC_NO_ERROR; } -ALCboolean WinMMPlayback::reset() +bool WinMMPlayback::reset() { mDevice->BufferSize = static_cast<ALuint>(uint64_t{mDevice->BufferSize} * mFormat.nSamplesPerSec / mDevice->Frequency); @@ -278,7 +278,7 @@ ALCboolean WinMMPlayback::reset() else { ERR("Unhandled IEEE float sample depth: %d\n", mFormat.wBitsPerSample); - return ALC_FALSE; + return false; } } else if(mFormat.wFormatTag == WAVE_FORMAT_PCM) @@ -290,13 +290,13 @@ ALCboolean WinMMPlayback::reset() else { ERR("Unhandled PCM sample depth: %d\n", mFormat.wBitsPerSample); - return ALC_FALSE; + return false; } } else { ERR("Unhandled format tag: 0x%04x\n", mFormat.wFormatTag); - return ALC_FALSE; + return false; } if(mFormat.nChannels == 2) @@ -306,7 +306,7 @@ ALCboolean WinMMPlayback::reset() else { ERR("Unhandled channel count: %d\n", mFormat.nChannels); - return ALC_FALSE; + return false; } SetDefaultWFXChannelOrder(mDevice); @@ -324,10 +324,10 @@ ALCboolean WinMMPlayback::reset() } mIdx = 0; - return ALC_TRUE; + return true; } -ALCboolean WinMMPlayback::start() +bool WinMMPlayback::start() { try { std::for_each(mWaveBuffer.begin(), mWaveBuffer.end(), @@ -338,14 +338,14 @@ ALCboolean WinMMPlayback::start() mKillNow.store(false, std::memory_order_release); mThread = std::thread{std::mem_fn(&WinMMPlayback::mixerProc), this}; - return ALC_TRUE; + return true; } catch(std::exception& e) { ERR("Failed to start mixing thread: %s\n", e.what()); } catch(...) { } - return ALC_FALSE; + return false; } void WinMMPlayback::stop() @@ -374,9 +374,9 @@ struct WinMMCapture final : public BackendBase { int captureProc(); ALCenum open(const ALCchar *name) override; - ALCboolean start() override; + bool start() override; void stop() override; - ALCenum captureSamples(void *buffer, ALCuint samples) override; + ALCenum captureSamples(al::byte *buffer, ALCuint samples) override; ALCuint availableSamples() override; std::atomic<ALuint> mReadable{0u}; @@ -543,7 +543,7 @@ ALCenum WinMMCapture::open(const ALCchar *name) return ALC_NO_ERROR; } -ALCboolean WinMMCapture::start() +bool WinMMCapture::start() { try { for(size_t i{0};i < mWaveBuffer.size();++i) @@ -556,14 +556,14 @@ ALCboolean WinMMCapture::start() mThread = std::thread{std::mem_fn(&WinMMCapture::captureProc), this}; waveInStart(mInHdl); - return ALC_TRUE; + return true; } catch(std::exception& e) { ERR("Failed to start mixing thread: %s\n", e.what()); } catch(...) { } - return ALC_FALSE; + return false; } void WinMMCapture::stop() @@ -585,7 +585,7 @@ void WinMMCapture::stop() mIdx = 0; } -ALCenum WinMMCapture::captureSamples(void *buffer, ALCuint samples) +ALCenum WinMMCapture::captureSamples(al::byte *buffer, ALCuint samples) { mRing->read(buffer, samples); return ALC_NO_ERROR; |