mirror of
https://github.com/libsdl-org/SDL.git
synced 2026-09-01 14:46:59 +08:00
directsound: First shot at updating for SDL3 audio API.
This does an enormous amount of work in SDL_immdevice.c to simplify and clean up that interface, while moving some of its responsibilities to the higher level SDL_audio.c. I hope I saw the whole picture here, and this wasn't foolhardy of me. WASAPI has not been updated for these changes, or for SDL3 at all, yet. As such, it continues to be broken for now. It will be updated soon. This code compiles with my cross compiler, but hasn't been built with Visual Studio, or tested in any form, so there might be obvious fixes following along shortly.
This commit is contained in:
@@ -120,7 +120,7 @@ typedef struct SDL_AudioDriverImpl
|
||||
int (*CaptureFromDevice)(SDL_AudioDevice *device, void *buffer, int buflen);
|
||||
void (*FlushCapture)(SDL_AudioDevice *device);
|
||||
void (*CloseDevice)(SDL_AudioDevice *device);
|
||||
void (*FreeDeviceHandle)(SDL_AudioDevice *handle); // SDL is done with this device; free the handle from SDL_AddAudioDevice()
|
||||
void (*FreeDeviceHandle)(SDL_AudioDevice *device); // SDL is done with this device; free the handle from SDL_AddAudioDevice()
|
||||
void (*Deinitialize)(void);
|
||||
|
||||
// Some flags to push duplicate code into the core and reduce #ifdefs.
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@@ -27,9 +27,10 @@
|
||||
|
||||
#include "../SDL_sysaudio.h"
|
||||
|
||||
/* The DirectSound objects */
|
||||
// The DirectSound objects
|
||||
struct SDL_PrivateAudioData
|
||||
{
|
||||
// !!! FIXME: make this a union with capture/playback sections?
|
||||
LPDIRECTSOUND sound;
|
||||
LPDIRECTSOUNDBUFFER mixbuf;
|
||||
LPDIRECTSOUNDCAPTURE capture;
|
||||
@@ -39,4 +40,4 @@ struct SDL_PrivateAudioData
|
||||
Uint8 *locked_buf;
|
||||
};
|
||||
|
||||
#endif /* SDL_directsound_h_ */
|
||||
#endif // SDL_directsound_h_
|
||||
|
||||
+141
-264
File diff suppressed because it is too large
Load Diff
@@ -26,16 +26,15 @@
|
||||
#include <mmdeviceapi.h>
|
||||
#include <mmreg.h>
|
||||
|
||||
typedef struct SDL_AudioDevice SDL_AudioDevice; // this is defined in src/audio/SDL_sysaudio.h
|
||||
|
||||
int SDL_IMMDevice_Init(void);
|
||||
void SDL_IMMDevice_Quit(void);
|
||||
int SDL_IMMDevice_Get(LPCWSTR devid, IMMDevice **device, SDL_bool iscapture);
|
||||
void SDL_IMMDevice_EnumerateEndpoints(SDL_bool useguid);
|
||||
int SDL_IMMDevice_GetDefaultAudioInfo(char **name, SDL_AudioSpec *spec, int iscapture);
|
||||
|
||||
int SDL_IMMDevice_Get(SDL_AudioDevice *device, IMMDevice **immdevice, SDL_bool iscapture);
|
||||
void SDL_IMMDevice_EnumerateEndpoints(SDL_AudioDevice **default_output, SDL_AudioDevice **default_capture);
|
||||
LPGUID SDL_IMMDevice_GetDirectSoundGUID(SDL_AudioDevice *device);
|
||||
LPCWSTR SDL_IMMDevice_GetDevID(SDL_AudioDevice *device);
|
||||
void SDL_IMMDevice_FreeDeviceHandle(SDL_AudioDevice *device);
|
||||
SDL_AudioFormat WaveFormatToSDLFormat(WAVEFORMATEX *waveformat);
|
||||
|
||||
/* these increment as default devices change. Opened default devices pick up changes in their threads. */
|
||||
extern SDL_AtomicInt SDL_IMMDevice_DefaultPlaybackGeneration;
|
||||
extern SDL_AtomicInt SDL_IMMDevice_DefaultCaptureGeneration;
|
||||
|
||||
#endif /* SDL_IMMDEVICE_H */
|
||||
|
||||
Reference in New Issue
Block a user