diff options
author | Chris Robinson <[email protected]> | 2019-10-09 03:29:25 -0700 |
---|---|---|
committer | Chris Robinson <[email protected]> | 2019-10-09 03:29:25 -0700 |
commit | b687e952efa7407e323e8465df41e2e84b277b31 (patch) | |
tree | aa2272b383366a2c37c9663e498ea1bc158a8984 /alc | |
parent | a7c12453600d4e9ae756b933770c6f42977a2663 (diff) |
Make C callbacks noexcept
No telling what would happen if exceptions managed to get back into presumably
C-based callers.
Diffstat (limited to 'alc')
-rw-r--r-- | alc/backends/coreaudio.cpp | 22 | ||||
-rw-r--r-- | alc/backends/dsound.cpp | 9 | ||||
-rw-r--r-- | alc/backends/jack.cpp | 12 | ||||
-rw-r--r-- | alc/backends/opensl.cpp | 12 | ||||
-rw-r--r-- | alc/backends/portaudio.cpp | 22 | ||||
-rw-r--r-- | alc/backends/pulseaudio.cpp | 78 | ||||
-rw-r--r-- | alc/backends/sdl2.cpp | 6 | ||||
-rw-r--r-- | alc/backends/winmm.cpp | 12 |
8 files changed, 85 insertions, 88 deletions
diff --git a/alc/backends/coreaudio.cpp b/alc/backends/coreaudio.cpp index 5a0e4027..7c18287b 100644 --- a/alc/backends/coreaudio.cpp +++ b/alc/backends/coreaudio.cpp @@ -47,16 +47,16 @@ struct CoreAudioPlayback final : public BackendBase { CoreAudioPlayback(ALCdevice *device) noexcept : BackendBase{device} { } ~CoreAudioPlayback() override; + OSStatus MixerProc(AudioUnitRenderActionFlags *ioActionFlags, + const AudioTimeStamp *inTimeStamp, UInt32 inBusNumber, UInt32 inNumberFrames, + AudioBufferList *ioData) noexcept; static OSStatus MixerProcC(void *inRefCon, AudioUnitRenderActionFlags *ioActionFlags, const AudioTimeStamp *inTimeStamp, UInt32 inBusNumber, UInt32 inNumberFrames, - AudioBufferList *ioData) + AudioBufferList *ioData) noexcept { return static_cast<CoreAudioPlayback*>(inRefCon)->MixerProc(ioActionFlags, inTimeStamp, inBusNumber, inNumberFrames, ioData); } - OSStatus MixerProc(AudioUnitRenderActionFlags *ioActionFlags, - const AudioTimeStamp *inTimeStamp, UInt32 inBusNumber, UInt32 inNumberFrames, - AudioBufferList *ioData); void open(const ALCchar *name) override; bool reset() override; @@ -78,8 +78,8 @@ CoreAudioPlayback::~CoreAudioPlayback() } -OSStatus CoreAudioPlayback::MixerProc(AudioUnitRenderActionFlags*, - const AudioTimeStamp*, UInt32, UInt32, AudioBufferList *ioData) +OSStatus CoreAudioPlayback::MixerProc(AudioUnitRenderActionFlags*, const AudioTimeStamp*, UInt32, + UInt32, AudioBufferList *ioData) noexcept { std::lock_guard<CoreAudioPlayback> _{*this}; aluMixData(mDevice, ioData->mBuffers[0].mData, ioData->mBuffers[0].mDataByteSize/mFrameSize); @@ -291,16 +291,16 @@ struct CoreAudioCapture final : public BackendBase { CoreAudioCapture(ALCdevice *device) noexcept : BackendBase{device} { } ~CoreAudioCapture() override; + OSStatus RecordProc(AudioUnitRenderActionFlags *ioActionFlags, + const AudioTimeStamp *inTimeStamp, UInt32 inBusNumber, + UInt32 inNumberFrames, AudioBufferList *ioData) noexcept; static OSStatus RecordProcC(void *inRefCon, AudioUnitRenderActionFlags *ioActionFlags, const AudioTimeStamp *inTimeStamp, UInt32 inBusNumber, UInt32 inNumberFrames, - AudioBufferList *ioData) + AudioBufferList *ioData) noexcept { return static_cast<CoreAudioCapture*>(inRefCon)->RecordProc(ioActionFlags, inTimeStamp, inBusNumber, inNumberFrames, ioData); } - OSStatus RecordProc(AudioUnitRenderActionFlags *ioActionFlags, - const AudioTimeStamp *inTimeStamp, UInt32 inBusNumber, - UInt32 inNumberFrames, AudioBufferList *ioData); void open(const ALCchar *name) override; bool start() override; @@ -330,7 +330,7 @@ CoreAudioCapture::~CoreAudioCapture() OSStatus CoreAudioCapture::RecordProc(AudioUnitRenderActionFlags*, const AudioTimeStamp *inTimeStamp, UInt32, UInt32 inNumberFrames, - AudioBufferList*) + AudioBufferList*) noexcept { AudioUnitRenderActionFlags flags = 0; union { diff --git a/alc/backends/dsound.cpp b/alc/backends/dsound.cpp index b74f2d3e..c04ba9e4 100644 --- a/alc/backends/dsound.cpp +++ b/alc/backends/dsound.cpp @@ -124,13 +124,12 @@ al::vector<DevMap> CaptureDevices; bool checkName(const al::vector<DevMap> &list, const std::string &name) { - return std::find_if(list.cbegin(), list.cend(), - [&name](const DevMap &entry) -> bool - { return entry.name == name; } - ) != list.cend(); + auto match_name = [&name](const DevMap &entry) -> bool + { return entry.name == name; }; + return std::find_if(list.cbegin(), list.cend(), match_name) != list.cend(); } -BOOL CALLBACK DSoundEnumDevices(GUID *guid, const WCHAR *desc, const WCHAR*, void *data) +BOOL CALLBACK DSoundEnumDevices(GUID *guid, const WCHAR *desc, const WCHAR*, void *data) noexcept { if(!guid) return TRUE; diff --git a/alc/backends/jack.cpp b/alc/backends/jack.cpp index 0814ca8d..c7bf8469 100644 --- a/alc/backends/jack.cpp +++ b/alc/backends/jack.cpp @@ -154,13 +154,13 @@ struct JackPlayback final : public BackendBase { JackPlayback(ALCdevice *device) noexcept : BackendBase{device} { } ~JackPlayback() override; - static int bufferSizeNotifyC(jack_nframes_t numframes, void *arg) + int bufferSizeNotify(jack_nframes_t numframes) noexcept; + static int bufferSizeNotifyC(jack_nframes_t numframes, void *arg) noexcept { return static_cast<JackPlayback*>(arg)->bufferSizeNotify(numframes); } - int bufferSizeNotify(jack_nframes_t numframes); - static int processC(jack_nframes_t numframes, void *arg) + int process(jack_nframes_t numframes) noexcept; + static int processC(jack_nframes_t numframes, void *arg) noexcept { return static_cast<JackPlayback*>(arg)->process(numframes); } - int process(jack_nframes_t numframes); int mixerProc(); @@ -197,7 +197,7 @@ JackPlayback::~JackPlayback() } -int JackPlayback::bufferSizeNotify(jack_nframes_t numframes) +int JackPlayback::bufferSizeNotify(jack_nframes_t numframes) noexcept { std::lock_guard<std::mutex> _{mDevice->StateLock}; mDevice->UpdateSize = numframes; @@ -217,7 +217,7 @@ int JackPlayback::bufferSizeNotify(jack_nframes_t numframes) } -int JackPlayback::process(jack_nframes_t numframes) +int JackPlayback::process(jack_nframes_t numframes) noexcept { jack_default_audio_sample_t *out[MAX_OUTPUT_CHANNELS]; ALsizei numchans{0}; diff --git a/alc/backends/opensl.cpp b/alc/backends/opensl.cpp index 258443f2..4bba3455 100644 --- a/alc/backends/opensl.cpp +++ b/alc/backends/opensl.cpp @@ -146,8 +146,8 @@ struct OpenSLPlayback final : public BackendBase { OpenSLPlayback(ALCdevice *device) noexcept : BackendBase{device} { } ~OpenSLPlayback() override; - void process(SLAndroidSimpleBufferQueueItf bq); - static void processC(SLAndroidSimpleBufferQueueItf bq, void *context) + void process(SLAndroidSimpleBufferQueueItf bq) noexcept; + static void processC(SLAndroidSimpleBufferQueueItf bq, void *context) noexcept { static_cast<OpenSLPlayback*>(context)->process(bq); } int mixerProc(); @@ -197,7 +197,7 @@ OpenSLPlayback::~OpenSLPlayback() /* this callback handler is called every time a buffer finishes playing */ -void OpenSLPlayback::process(SLAndroidSimpleBufferQueueItf) +void OpenSLPlayback::process(SLAndroidSimpleBufferQueueItf) noexcept { /* A note on the ringbuffer usage: The buffer queue seems to hold on to the * pointer passed to the Enqueue method, rather than copying the audio. @@ -622,8 +622,8 @@ struct OpenSLCapture final : public BackendBase { OpenSLCapture(ALCdevice *device) noexcept : BackendBase{device} { } ~OpenSLCapture() override; - void process(SLAndroidSimpleBufferQueueItf bq); - static void processC(SLAndroidSimpleBufferQueueItf bq, void *context) + void process(SLAndroidSimpleBufferQueueItf bq) noexcept; + static void processC(SLAndroidSimpleBufferQueueItf bq, void *context) noexcept { static_cast<OpenSLCapture*>(context)->process(bq); } void open(const ALCchar *name) override; @@ -660,7 +660,7 @@ OpenSLCapture::~OpenSLCapture() } -void OpenSLCapture::process(SLAndroidSimpleBufferQueueItf) +void OpenSLCapture::process(SLAndroidSimpleBufferQueueItf) noexcept { /* A new chunk has been written into the ring buffer, advance it. */ mRing->writeAdvance(1); diff --git a/alc/backends/portaudio.cpp b/alc/backends/portaudio.cpp index f50f1f16..1e3d0ce8 100644 --- a/alc/backends/portaudio.cpp +++ b/alc/backends/portaudio.cpp @@ -75,15 +75,15 @@ struct PortPlayback final : public BackendBase { PortPlayback(ALCdevice *device) noexcept : BackendBase{device} { } ~PortPlayback() override; + int writeCallback(const void *inputBuffer, void *outputBuffer, unsigned long framesPerBuffer, + const PaStreamCallbackTimeInfo *timeInfo, const PaStreamCallbackFlags statusFlags) noexcept; static int writeCallbackC(const void *inputBuffer, void *outputBuffer, unsigned long framesPerBuffer, const PaStreamCallbackTimeInfo *timeInfo, - const PaStreamCallbackFlags statusFlags, void *userData) + const PaStreamCallbackFlags statusFlags, void *userData) noexcept { return static_cast<PortPlayback*>(userData)->writeCallback(inputBuffer, outputBuffer, framesPerBuffer, timeInfo, statusFlags); } - int writeCallback(const void *inputBuffer, void *outputBuffer, unsigned long framesPerBuffer, - const PaStreamCallbackTimeInfo *timeInfo, const PaStreamCallbackFlags statusFlags); void open(const ALCchar *name) override; bool reset() override; @@ -106,9 +106,8 @@ PortPlayback::~PortPlayback() } -int PortPlayback::writeCallback(const void*, void *outputBuffer, - unsigned long framesPerBuffer, const PaStreamCallbackTimeInfo*, - const PaStreamCallbackFlags) +int PortPlayback::writeCallback(const void*, void *outputBuffer, unsigned long framesPerBuffer, + const PaStreamCallbackTimeInfo*, const PaStreamCallbackFlags) noexcept { std::lock_guard<PortPlayback> _{*this}; aluMixData(mDevice, outputBuffer, static_cast<ALuint>(framesPerBuffer)); @@ -232,15 +231,15 @@ struct PortCapture final : public BackendBase { PortCapture(ALCdevice *device) noexcept : BackendBase{device} { } ~PortCapture() override; + int readCallback(const void *inputBuffer, void *outputBuffer, unsigned long framesPerBuffer, + const PaStreamCallbackTimeInfo *timeInfo, const PaStreamCallbackFlags statusFlags) noexcept; static int readCallbackC(const void *inputBuffer, void *outputBuffer, unsigned long framesPerBuffer, const PaStreamCallbackTimeInfo *timeInfo, - const PaStreamCallbackFlags statusFlags, void *userData) + const PaStreamCallbackFlags statusFlags, void *userData) noexcept { return static_cast<PortCapture*>(userData)->readCallback(inputBuffer, outputBuffer, framesPerBuffer, timeInfo, statusFlags); } - int readCallback(const void *inputBuffer, void *outputBuffer, unsigned long framesPerBuffer, - const PaStreamCallbackTimeInfo *timeInfo, const PaStreamCallbackFlags statusFlags); void open(const ALCchar *name) override; bool start() override; @@ -265,9 +264,8 @@ PortCapture::~PortCapture() } -int PortCapture::readCallback(const void *inputBuffer, void*, - unsigned long framesPerBuffer, const PaStreamCallbackTimeInfo*, - const PaStreamCallbackFlags) +int PortCapture::readCallback(const void *inputBuffer, void*, unsigned long framesPerBuffer, + const PaStreamCallbackTimeInfo*, const PaStreamCallbackFlags) noexcept { mRing->write(inputBuffer, framesPerBuffer); return 0; diff --git a/alc/backends/pulseaudio.cpp b/alc/backends/pulseaudio.cpp index 2521084d..95807540 100644 --- a/alc/backends/pulseaudio.cpp +++ b/alc/backends/pulseaudio.cpp @@ -313,7 +313,7 @@ pa_mainloop *pulse_mainloop{nullptr}; std::mutex pulse_lock; std::condition_variable pulse_condvar; -int pulse_poll_func(struct pollfd *ufds, unsigned long nfds, int timeout, void *userdata) +int pulse_poll_func(struct pollfd *ufds, unsigned long nfds, int timeout, void *userdata) noexcept { auto plock = static_cast<std::unique_lock<std::mutex>*>(userdata); plock->unlock(); @@ -343,21 +343,21 @@ int pulse_mainloop_thread() /* PulseAudio Event Callbacks */ -void context_state_callback(pa_context *context, void* /*pdata*/) +void context_state_callback(pa_context *context, void* /*pdata*/) noexcept { pa_context_state_t state{pa_context_get_state(context)}; if(state == PA_CONTEXT_READY || !PA_CONTEXT_IS_GOOD(state)) pulse_condvar.notify_all(); } -void stream_state_callback(pa_stream *stream, void* /*pdata*/) +void stream_state_callback(pa_stream *stream, void* /*pdata*/) noexcept { pa_stream_state_t state{pa_stream_get_state(stream)}; if(state == PA_STREAM_READY || !PA_STREAM_IS_GOOD(state)) pulse_condvar.notify_all(); } -void stream_success_callback(pa_stream* /*stream*/, int /*success*/, void* /*pdata*/) +void stream_success_callback(pa_stream* /*stream*/, int /*success*/, void* /*pdata*/) noexcept { pulse_condvar.notify_all(); } @@ -496,7 +496,7 @@ pa_stream *pulse_connect_stream(const char *device_name, std::unique_lock<std::m } -void device_sink_callback(pa_context*, const pa_sink_info *info, int eol, void*) +void device_sink_callback(pa_context*, const pa_sink_info *info, int eol, void*) noexcept { if(eol) { @@ -567,7 +567,7 @@ void probePlaybackDevices() } -void device_source_callback(pa_context*, const pa_source_info *info, int eol, void*) +void device_source_callback(pa_context*, const pa_source_info *info, int eol, void*) noexcept { if(eol) { @@ -642,32 +642,32 @@ struct PulsePlayback final : public BackendBase { PulsePlayback(ALCdevice *device) noexcept : BackendBase{device} { } ~PulsePlayback() override; - void bufferAttrCallback(pa_stream *stream); - static void bufferAttrCallbackC(pa_stream *stream, void *pdata) + void bufferAttrCallback(pa_stream *stream) noexcept; + static void bufferAttrCallbackC(pa_stream *stream, void *pdata) noexcept { static_cast<PulsePlayback*>(pdata)->bufferAttrCallback(stream); } - void contextStateCallback(pa_context *context); - static void contextStateCallbackC(pa_context *context, void *pdata) + void contextStateCallback(pa_context *context) noexcept; + static void contextStateCallbackC(pa_context *context, void *pdata) noexcept { static_cast<PulsePlayback*>(pdata)->contextStateCallback(context); } - void streamStateCallback(pa_stream *stream); - static void streamStateCallbackC(pa_stream *stream, void *pdata) + void streamStateCallback(pa_stream *stream) noexcept; + static void streamStateCallbackC(pa_stream *stream, void *pdata) noexcept { static_cast<PulsePlayback*>(pdata)->streamStateCallback(stream); } - void streamWriteCallback(pa_stream *stream, size_t nbytes); - static void streamWriteCallbackC(pa_stream *stream, size_t nbytes, void *pdata) + void streamWriteCallback(pa_stream *stream, size_t nbytes) noexcept; + static void streamWriteCallbackC(pa_stream *stream, size_t nbytes, void *pdata) noexcept { static_cast<PulsePlayback*>(pdata)->streamWriteCallback(stream, nbytes); } - void sinkInfoCallback(pa_context *context, const pa_sink_info *info, int eol); - static void sinkInfoCallbackC(pa_context *context, const pa_sink_info *info, int eol, void *pdata) + void sinkInfoCallback(pa_context *context, const pa_sink_info *info, int eol) noexcept; + static void sinkInfoCallbackC(pa_context *context, const pa_sink_info *info, int eol, void *pdata) noexcept { static_cast<PulsePlayback*>(pdata)->sinkInfoCallback(context, info, eol); } - void sinkNameCallback(pa_context *context, const pa_sink_info *info, int eol); - static void sinkNameCallbackC(pa_context *context, const pa_sink_info *info, int eol, void *pdata) + void sinkNameCallback(pa_context *context, const pa_sink_info *info, int eol) noexcept; + static void sinkNameCallbackC(pa_context *context, const pa_sink_info *info, int eol, void *pdata) noexcept { static_cast<PulsePlayback*>(pdata)->sinkNameCallback(context, info, eol); } - void streamMovedCallback(pa_stream *stream); - static void streamMovedCallbackC(pa_stream *stream, void *pdata) + void streamMovedCallback(pa_stream *stream) noexcept; + static void streamMovedCallbackC(pa_stream *stream, void *pdata) noexcept { static_cast<PulsePlayback*>(pdata)->streamMovedCallback(stream); } void open(const ALCchar *name) override; @@ -702,7 +702,7 @@ PulsePlayback::~PulsePlayback() } -void PulsePlayback::bufferAttrCallback(pa_stream *stream) +void PulsePlayback::bufferAttrCallback(pa_stream *stream) noexcept { /* FIXME: Update the device's UpdateSize (and/or BufferSize) using the new * buffer attributes? Changing UpdateSize will change the ALC_REFRESH @@ -713,7 +713,7 @@ void PulsePlayback::bufferAttrCallback(pa_stream *stream) TRACE("minreq=%d, tlength=%d, prebuf=%d\n", mAttr.minreq, mAttr.tlength, mAttr.prebuf); } -void PulsePlayback::contextStateCallback(pa_context *context) +void PulsePlayback::contextStateCallback(pa_context *context) noexcept { if(pa_context_get_state(context) == PA_CONTEXT_FAILED) { @@ -723,7 +723,7 @@ void PulsePlayback::contextStateCallback(pa_context *context) pulse_condvar.notify_all(); } -void PulsePlayback::streamStateCallback(pa_stream *stream) +void PulsePlayback::streamStateCallback(pa_stream *stream) noexcept { if(pa_stream_get_state(stream) == PA_STREAM_FAILED) { @@ -733,7 +733,7 @@ void PulsePlayback::streamStateCallback(pa_stream *stream) pulse_condvar.notify_all(); } -void PulsePlayback::streamWriteCallback(pa_stream *stream, size_t nbytes) +void PulsePlayback::streamWriteCallback(pa_stream *stream, size_t nbytes) noexcept { void *buf{pa_xmalloc(nbytes)}; aluMixData(mDevice, buf, static_cast<ALuint>(nbytes/mFrameSize)); @@ -743,7 +743,7 @@ void PulsePlayback::streamWriteCallback(pa_stream *stream, size_t nbytes) ERR("Failed to write to stream: %d, %s\n", ret, pa_strerror(ret)); } -void PulsePlayback::sinkInfoCallback(pa_context*, const pa_sink_info *info, int eol) +void PulsePlayback::sinkInfoCallback(pa_context*, const pa_sink_info *info, int eol) noexcept { struct ChannelMap { DevFmtChannels fmt; @@ -787,7 +787,7 @@ void PulsePlayback::sinkInfoCallback(pa_context*, const pa_sink_info *info, int info->active_port && strcmp(info->active_port->name, "analog-output-headphones") == 0); } -void PulsePlayback::sinkNameCallback(pa_context*, const pa_sink_info *info, int eol) +void PulsePlayback::sinkNameCallback(pa_context*, const pa_sink_info *info, int eol) noexcept { if(eol) { @@ -797,7 +797,7 @@ void PulsePlayback::sinkNameCallback(pa_context*, const pa_sink_info *info, int mDevice->DeviceName = info->description; } -void PulsePlayback::streamMovedCallback(pa_stream *stream) +void PulsePlayback::streamMovedCallback(pa_stream *stream) noexcept { mDeviceName = pa_stream_get_device_name(stream); TRACE("Stream moved to %s\n", mDeviceName.c_str()); @@ -1073,20 +1073,20 @@ struct PulseCapture final : public BackendBase { PulseCapture(ALCdevice *device) noexcept : BackendBase{device} { } ~PulseCapture() override; - void contextStateCallback(pa_context *context); - static void contextStateCallbackC(pa_context *context, void *pdata) + void contextStateCallback(pa_context *context) noexcept; + static void contextStateCallbackC(pa_context *context, void *pdata) noexcept { static_cast<PulseCapture*>(pdata)->contextStateCallback(context); } - void streamStateCallback(pa_stream *stream); - static void streamStateCallbackC(pa_stream *stream, void *pdata) + void streamStateCallback(pa_stream *stream) noexcept; + static void streamStateCallbackC(pa_stream *stream, void *pdata) noexcept { static_cast<PulseCapture*>(pdata)->streamStateCallback(stream); } - void sourceNameCallback(pa_context *context, const pa_source_info *info, int eol); - static void sourceNameCallbackC(pa_context *context, const pa_source_info *info, int eol, void *pdata) + void sourceNameCallback(pa_context *context, const pa_source_info *info, int eol) noexcept; + static void sourceNameCallbackC(pa_context *context, const pa_source_info *info, int eol, void *pdata) noexcept { static_cast<PulseCapture*>(pdata)->sourceNameCallback(context, info, eol); } - void streamMovedCallback(pa_stream *stream); - static void streamMovedCallbackC(pa_stream *stream, void *pdata) + void streamMovedCallback(pa_stream *stream) noexcept; + static void streamMovedCallbackC(pa_stream *stream, void *pdata) noexcept { static_cast<PulseCapture*>(pdata)->streamMovedCallback(stream); } void open(const ALCchar *name) override; @@ -1126,7 +1126,7 @@ PulseCapture::~PulseCapture() } -void PulseCapture::contextStateCallback(pa_context *context) +void PulseCapture::contextStateCallback(pa_context *context) noexcept { if(pa_context_get_state(context) == PA_CONTEXT_FAILED) { @@ -1136,7 +1136,7 @@ void PulseCapture::contextStateCallback(pa_context *context) pulse_condvar.notify_all(); } -void PulseCapture::streamStateCallback(pa_stream *stream) +void PulseCapture::streamStateCallback(pa_stream *stream) noexcept { if(pa_stream_get_state(stream) == PA_STREAM_FAILED) { @@ -1146,7 +1146,7 @@ void PulseCapture::streamStateCallback(pa_stream *stream) pulse_condvar.notify_all(); } -void PulseCapture::sourceNameCallback(pa_context*, const pa_source_info *info, int eol) +void PulseCapture::sourceNameCallback(pa_context*, const pa_source_info *info, int eol) noexcept { if(eol) { @@ -1156,7 +1156,7 @@ void PulseCapture::sourceNameCallback(pa_context*, const pa_source_info *info, i mDevice->DeviceName = info->description; } -void PulseCapture::streamMovedCallback(pa_stream *stream) +void PulseCapture::streamMovedCallback(pa_stream *stream) noexcept { mDeviceName = pa_stream_get_device_name(stream); TRACE("Stream moved to %s\n", mDeviceName.c_str()); diff --git a/alc/backends/sdl2.cpp b/alc/backends/sdl2.cpp index 4cdf05b4..25b5d4d9 100644 --- a/alc/backends/sdl2.cpp +++ b/alc/backends/sdl2.cpp @@ -52,8 +52,8 @@ struct Sdl2Backend final : public BackendBase { Sdl2Backend(ALCdevice *device) noexcept : BackendBase{device} { } ~Sdl2Backend() override; - void audioCallback(Uint8 *stream, int len); - static void audioCallbackC(void *ptr, Uint8 *stream, int len) + void audioCallback(Uint8 *stream, int len) noexcept; + static void audioCallbackC(void *ptr, Uint8 *stream, int len) noexcept { static_cast<Sdl2Backend*>(ptr)->audioCallback(stream, len); } void open(const ALCchar *name) override; @@ -81,7 +81,7 @@ Sdl2Backend::~Sdl2Backend() mDeviceID = 0; } -void Sdl2Backend::audioCallback(Uint8 *stream, int len) +void Sdl2Backend::audioCallback(Uint8 *stream, int len) noexcept { const auto ulen = static_cast<unsigned int>(len); assert((ulen % mFrameSize) == 0); diff --git a/alc/backends/winmm.cpp b/alc/backends/winmm.cpp index c2ccbc05..649bb345 100644 --- a/alc/backends/winmm.cpp +++ b/alc/backends/winmm.cpp @@ -127,8 +127,8 @@ struct WinMMPlayback final : public BackendBase { WinMMPlayback(ALCdevice *device) noexcept : BackendBase{device} { } ~WinMMPlayback() override; - void CALLBACK waveOutProc(HWAVEOUT device, UINT msg, DWORD_PTR param1, DWORD_PTR param2); - static void CALLBACK waveOutProcC(HWAVEOUT device, UINT msg, DWORD_PTR instance, DWORD_PTR param1, DWORD_PTR param2) + void CALLBACK waveOutProc(HWAVEOUT device, UINT msg, DWORD_PTR param1, DWORD_PTR param2) noexcept; + static void CALLBACK waveOutProcC(HWAVEOUT device, UINT msg, DWORD_PTR instance, DWORD_PTR param1, DWORD_PTR param2) noexcept { reinterpret_cast<WinMMPlayback*>(instance)->waveOutProc(device, msg, param1, param2); } int mixerProc(); @@ -168,7 +168,7 @@ WinMMPlayback::~WinMMPlayback() * Posts a message to 'WinMMPlayback::mixerProc' everytime a WaveOut Buffer is * completed and returns to the application (for more data) */ -void CALLBACK WinMMPlayback::waveOutProc(HWAVEOUT, UINT msg, DWORD_PTR, DWORD_PTR) +void CALLBACK WinMMPlayback::waveOutProc(HWAVEOUT, UINT msg, DWORD_PTR, DWORD_PTR) noexcept { if(msg != WOM_DONE) return; mWritable.fetch_add(1, std::memory_order_acq_rel); @@ -364,8 +364,8 @@ struct WinMMCapture final : public BackendBase { WinMMCapture(ALCdevice *device) noexcept : BackendBase{device} { } ~WinMMCapture() override; - void CALLBACK waveInProc(HWAVEIN device, UINT msg, DWORD_PTR param1, DWORD_PTR param2); - static void CALLBACK waveInProcC(HWAVEIN device, UINT msg, DWORD_PTR instance, DWORD_PTR param1, DWORD_PTR param2) + void CALLBACK waveInProc(HWAVEIN device, UINT msg, DWORD_PTR param1, DWORD_PTR param2) noexcept; + static void CALLBACK waveInProcC(HWAVEIN device, UINT msg, DWORD_PTR instance, DWORD_PTR param1, DWORD_PTR param2) noexcept { reinterpret_cast<WinMMCapture*>(instance)->waveInProc(device, msg, param1, param2); } int captureProc(); @@ -409,7 +409,7 @@ WinMMCapture::~WinMMCapture() * Posts a message to 'WinMMCapture::captureProc' everytime a WaveIn Buffer is * completed and returns to the application (with more data). */ -void CALLBACK WinMMCapture::waveInProc(HWAVEIN, UINT msg, DWORD_PTR, DWORD_PTR) +void CALLBACK WinMMCapture::waveInProc(HWAVEIN, UINT msg, DWORD_PTR, DWORD_PTR) noexcept { if(msg != WIM_DATA) return; mReadable.fetch_add(1, std::memory_order_acq_rel); |