[Scummvm-git-logs] scummvm master -> 36b759a61a073e6f274b0bcee7d9e2dc4790203b
lephilousophe
noreply at scummvm.org
Sun Jan 4 10:01:24 UTC 2026
This automated email contains information about 1 new commit which have been
pushed to the 'scummvm' repo located at https://api.github.com/repos/scummvm/scummvm .
Summary:
36b759a61a SDL: Remove useless callback
Commit: 36b759a61a073e6f274b0bcee7d9e2dc4790203b
https://github.com/scummvm/scummvm/commit/36b759a61a073e6f274b0bcee7d9e2dc4790203b
Author: Le Philousophe (lephilousophe at users.noreply.github.com)
Date: 2026-01-04T11:01:05+01:00
Commit Message:
SDL: Remove useless callback
sdl3Callback doesn't need to call sdlCallback: it can directly call
callbackHandler.
Changed paths:
backends/mixer/sdl/sdl-mixer.cpp
backends/mixer/sdl/sdl-mixer.h
diff --git a/backends/mixer/sdl/sdl-mixer.cpp b/backends/mixer/sdl/sdl-mixer.cpp
index 399c40ba41d..3107e1b8e6a 100644
--- a/backends/mixer/sdl/sdl-mixer.cpp
+++ b/backends/mixer/sdl/sdl-mixer.cpp
@@ -225,7 +225,7 @@ SDL_AudioSpec SdlMixerManager::getAudioSpec(uint32 outputRate) {
void SdlMixerManager::startAudio() {
// Start the sound system
#if SDL_VERSION_ATLEAST(3, 0, 0)
- _stream = SDL_OpenAudioDeviceStream(SDL_AUDIO_DEVICE_DEFAULT_PLAYBACK, &_obtained, sdl3Callback, this);
+ _stream = SDL_OpenAudioDeviceStream(SDL_AUDIO_DEVICE_DEFAULT_PLAYBACK, &_obtained, sdlCallback, this);
if (_stream)
SDL_ResumeAudioDevice(SDL_GetAudioStreamDevice(_stream));
#else
@@ -238,25 +238,26 @@ void SdlMixerManager::callbackHandler(byte *samples, int len) {
_mixer->mixCallback(samples, len);
}
-void SdlMixerManager::sdlCallback(void *this_, byte *samples, int len) {
- SdlMixerManager *manager = (SdlMixerManager *)this_;
- assert(manager);
-
- manager->callbackHandler(samples, len);
-}
-
#if SDL_VERSION_ATLEAST(3, 0, 0)
-void SdlMixerManager::sdl3Callback(void *userdata, SDL_AudioStream *stream, int additional_amount, int total_amount) {
+void SdlMixerManager::sdlCallback(void *userdata, SDL_AudioStream *stream, int additional_amount, int total_amount) {
if (additional_amount > 0) {
Uint8 *data = SDL_stack_alloc(Uint8, additional_amount);
if (data) {
SdlMixerManager *manager = (SdlMixerManager *)userdata;
- manager->sdlCallback(userdata, data, additional_amount);
+ assert(manager);
+ manager->callbackHandler(data, additional_amount);
SDL_PutAudioStreamData(stream, data, additional_amount);
SDL_stack_free(data);
}
}
}
+#else
+void SdlMixerManager::sdlCallback(void *this_, byte *samples, int len) {
+ SdlMixerManager *manager = (SdlMixerManager *)this_;
+ assert(manager);
+
+ manager->callbackHandler(samples, len);
+}
#endif
void SdlMixerManager::suspendAudio() {
@@ -273,7 +274,7 @@ int SdlMixerManager::resumeAudio() {
if (!_audioSuspended)
return -2;
#if SDL_VERSION_ATLEAST(3, 0, 0)
- _stream = SDL_OpenAudioDeviceStream(SDL_AUDIO_DEVICE_DEFAULT_PLAYBACK, &_obtained, sdl3Callback, this);
+ _stream = SDL_OpenAudioDeviceStream(SDL_AUDIO_DEVICE_DEFAULT_PLAYBACK, &_obtained, sdlCallback, this);
if(!_stream)
return -1;
if (SDL_ResumeAudioDevice(SDL_GetAudioStreamDevice(_stream)))
diff --git a/backends/mixer/sdl/sdl-mixer.h b/backends/mixer/sdl/sdl-mixer.h
index 3dd0670396f..69b3bf50abd 100644
--- a/backends/mixer/sdl/sdl-mixer.h
+++ b/backends/mixer/sdl/sdl-mixer.h
@@ -79,9 +79,10 @@ protected:
* The mixer callback entry point. Static functions can't be overridden
* by subclasses, so it invokes the non-static function callbackHandler()
*/
- static void sdlCallback(void *this_, byte *samples, int len);
#if SDL_VERSION_ATLEAST(3, 0, 0)
- static void sdl3Callback(void *userdata, SDL_AudioStream *stream, int additional_amount, int total_amount);
+ static void sdlCallback(void *userdata, SDL_AudioStream *stream, int additional_amount, int total_amount);
+#else
+ static void sdlCallback(void *this_, byte *samples, int len);
#endif
bool _isSubsystemInitialized;
More information about the Scummvm-git-logs
mailing list