dummyaudio: SDL3ify style

This commit is contained in:
Ryan C. Gordon
2023-07-06 17:25:07 -04:00
parent 7d65ff86e2
commit c3f5a5fc72
2 changed files with 8 additions and 9 deletions

View File

@@ -20,12 +20,12 @@
*/ */
#include "SDL_internal.h" #include "SDL_internal.h"
/* Output audio to nowhere... */ // Output audio to nowhere...
#include "../SDL_audio_c.h" #include "../SDL_audio_c.h"
#include "SDL_dummyaudio.h" #include "SDL_dummyaudio.h"
/* !!! FIXME: this should be an SDL hint, not an environment variable. */ // !!! FIXME: this should be an SDL hint, not an environment variable.
#define DUMMYENVR_IODELAY "SDL_DUMMYAUDIODELAY" #define DUMMYENVR_IODELAY "SDL_DUMMYAUDIODELAY"
static void DUMMYAUDIO_WaitDevice(SDL_AudioDevice *device) static void DUMMYAUDIO_WaitDevice(SDL_AudioDevice *device)
@@ -49,9 +49,9 @@ static int DUMMYAUDIO_OpenDevice(SDL_AudioDevice *device)
} }
} }
device->hidden->io_delay = envr ? SDL_atoi(envr) : ((device->sample_frames * 1000) / device->spec.freq); device->hidden->io_delay = (Uint32) (envr ? SDL_atoi(envr) : ((device->sample_frames * 1000) / device->spec.freq));
return 0; /* we're good; don't change reported device format. */ return 0; // we're good; don't change reported device format.
} }
static void DUMMYAUDIO_CloseDevice(SDL_AudioDevice *device) static void DUMMYAUDIO_CloseDevice(SDL_AudioDevice *device)
@@ -70,7 +70,7 @@ static Uint8 *DUMMYAUDIO_GetDeviceBuf(SDL_AudioDevice *device, int *buffer_size)
static int DUMMYAUDIO_CaptureFromDevice(SDL_AudioDevice *device, void *buffer, int buflen) static int DUMMYAUDIO_CaptureFromDevice(SDL_AudioDevice *device, void *buffer, int buflen)
{ {
/* always return a full buffer of silence. */ // always return a full buffer of silence.
SDL_memset(buffer, device->silence_value, buflen); SDL_memset(buffer, device->silence_value, buflen);
return buflen; return buflen;
} }

View File

@@ -27,9 +27,8 @@
struct SDL_PrivateAudioData struct SDL_PrivateAudioData
{ {
/* The file descriptor for the audio device */ Uint8 *mixbuf; // The file descriptor for the audio device
Uint8 *mixbuf; Uint32 io_delay; // miliseconds to sleep in WaitDevice.
Uint32 io_delay;
}; };
#endif /* SDL_dummyaudio_h_ */ #endif // SDL_dummyaudio_h_