mirror of
https://github.com/libsdl-org/SDL.git
synced 2026-06-04 06:12:04 +08:00
wasapi: Initial WASAPI support, for Windows Vista and later.
This should remain binary compatible with Windows XP, as we dynamically load anything we need and fall back to DirectSound/WinMM/XAudio2 if not available.
This commit is contained in:
@@ -361,6 +361,7 @@
|
|||||||
<ClInclude Include="..\..\src\video\windows\SDL_windowsshape.h" />
|
<ClInclude Include="..\..\src\video\windows\SDL_windowsshape.h" />
|
||||||
<ClInclude Include="..\..\src\video\windows\SDL_windowsvideo.h" />
|
<ClInclude Include="..\..\src\video\windows\SDL_windowsvideo.h" />
|
||||||
<ClInclude Include="..\..\src\video\windows\SDL_windowswindow.h" />
|
<ClInclude Include="..\..\src\video\windows\SDL_windowswindow.h" />
|
||||||
|
<ClInclude Include="..\..\src\audio\wasapi\SDL_wasapi.h" />
|
||||||
<ClInclude Include="..\..\src\audio\winmm\SDL_winmm.h" />
|
<ClInclude Include="..\..\src\audio\winmm\SDL_winmm.h" />
|
||||||
<ClInclude Include="..\..\src\core\windows\SDL_xinput.h" />
|
<ClInclude Include="..\..\src\core\windows\SDL_xinput.h" />
|
||||||
<ClInclude Include="..\..\src\haptic\windows\SDL_xinputhaptic_c.h" />
|
<ClInclude Include="..\..\src\haptic\windows\SDL_xinputhaptic_c.h" />
|
||||||
@@ -491,6 +492,7 @@
|
|||||||
<ClCompile Include="..\..\src\video\windows\SDL_windowsshape.c" />
|
<ClCompile Include="..\..\src\video\windows\SDL_windowsshape.c" />
|
||||||
<ClCompile Include="..\..\src\video\windows\SDL_windowsvideo.c" />
|
<ClCompile Include="..\..\src\video\windows\SDL_windowsvideo.c" />
|
||||||
<ClCompile Include="..\..\src\video\windows\SDL_windowswindow.c" />
|
<ClCompile Include="..\..\src\video\windows\SDL_windowswindow.c" />
|
||||||
|
<ClCompile Include="..\..\src\audio\wasapi\SDL_wasapi.c" />
|
||||||
<ClCompile Include="..\..\src\audio\winmm\SDL_winmm.c" />
|
<ClCompile Include="..\..\src\audio\winmm\SDL_winmm.c" />
|
||||||
<ClCompile Include="..\..\src\audio\xaudio2\SDL_xaudio2.c" />
|
<ClCompile Include="..\..\src\audio\xaudio2\SDL_xaudio2.c" />
|
||||||
<ClCompile Include="..\..\src\core\windows\SDL_xinput.c" />
|
<ClCompile Include="..\..\src\core\windows\SDL_xinput.c" />
|
||||||
|
|||||||
@@ -1437,6 +1437,14 @@
|
|||||||
RelativePath="..\..\src\video\windows\SDL_windowswindow.h"
|
RelativePath="..\..\src\video\windows\SDL_windowswindow.h"
|
||||||
>
|
>
|
||||||
</File>
|
</File>
|
||||||
|
<File
|
||||||
|
RelativePath="..\..\src\audio\wasapi\SDL_wasapi.c"
|
||||||
|
>
|
||||||
|
</File>
|
||||||
|
<File
|
||||||
|
RelativePath="..\..\src\audio\wasapi\SDL_wasapi.h"
|
||||||
|
>
|
||||||
|
</File>
|
||||||
<File
|
<File
|
||||||
RelativePath="..\..\src\audio\winmm\SDL_winmm.c"
|
RelativePath="..\..\src\audio\winmm\SDL_winmm.c"
|
||||||
>
|
>
|
||||||
|
|||||||
@@ -154,6 +154,7 @@ typedef unsigned int uintptr_t;
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
/* Enable various audio drivers */
|
/* Enable various audio drivers */
|
||||||
|
#define SDL_AUDIO_DRIVER_WASAPI 1
|
||||||
#define SDL_AUDIO_DRIVER_DSOUND 1
|
#define SDL_AUDIO_DRIVER_DSOUND 1
|
||||||
#define SDL_AUDIO_DRIVER_XAUDIO2 1
|
#define SDL_AUDIO_DRIVER_XAUDIO2 1
|
||||||
#define SDL_AUDIO_DRIVER_WINMM 1
|
#define SDL_AUDIO_DRIVER_WINMM 1
|
||||||
|
|||||||
@@ -68,6 +68,9 @@ static const AudioBootStrap *const bootstrap[] = {
|
|||||||
#if SDL_AUDIO_DRIVER_NAS
|
#if SDL_AUDIO_DRIVER_NAS
|
||||||
&NAS_bootstrap,
|
&NAS_bootstrap,
|
||||||
#endif
|
#endif
|
||||||
|
#if SDL_AUDIO_DRIVER_WASAPI
|
||||||
|
&WASAPI_bootstrap,
|
||||||
|
#endif
|
||||||
#if SDL_AUDIO_DRIVER_XAUDIO2
|
#if SDL_AUDIO_DRIVER_XAUDIO2
|
||||||
&XAUDIO2_bootstrap,
|
&XAUDIO2_bootstrap,
|
||||||
#endif
|
#endif
|
||||||
|
|||||||
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,46 @@
|
|||||||
|
/*
|
||||||
|
Simple DirectMedia Layer
|
||||||
|
Copyright (C) 1997-2017 Sam Lantinga <slouken@libsdl.org>
|
||||||
|
|
||||||
|
This software is provided 'as-is', without any express or implied
|
||||||
|
warranty. In no event will the authors be held liable for any damages
|
||||||
|
arising from the use of this software.
|
||||||
|
|
||||||
|
Permission is granted to anyone to use this software for any purpose,
|
||||||
|
including commercial applications, and to alter it and redistribute it
|
||||||
|
freely, subject to the following restrictions:
|
||||||
|
|
||||||
|
1. The origin of this software must not be misrepresented; you must not
|
||||||
|
claim that you wrote the original software. If you use this software
|
||||||
|
in a product, an acknowledgment in the product documentation would be
|
||||||
|
appreciated but is not required.
|
||||||
|
2. Altered source versions must be plainly marked as such, and must not be
|
||||||
|
misrepresented as being the original software.
|
||||||
|
3. This notice may not be removed or altered from any source distribution.
|
||||||
|
*/
|
||||||
|
#include "../../SDL_internal.h"
|
||||||
|
|
||||||
|
#ifndef SDL_wasapi_h_
|
||||||
|
#define SDL_wasapi_h_
|
||||||
|
|
||||||
|
#include "../SDL_sysaudio.h"
|
||||||
|
|
||||||
|
/* Hidden "this" pointer for the audio functions */
|
||||||
|
#define _THIS SDL_AudioDevice *this
|
||||||
|
|
||||||
|
struct SDL_PrivateAudioData
|
||||||
|
{
|
||||||
|
IMMDevice *device;
|
||||||
|
WAVEFORMATEX *waveformat;
|
||||||
|
IAudioClient *client;
|
||||||
|
IAudioRenderClient *render;
|
||||||
|
IAudioCaptureClient *capture;
|
||||||
|
SDL_AudioStream *capturestream;
|
||||||
|
HANDLE task;
|
||||||
|
SDL_bool coinitialized;
|
||||||
|
int framesize;
|
||||||
|
};
|
||||||
|
|
||||||
|
#endif /* SDL_wasapi_h_ */
|
||||||
|
|
||||||
|
/* vi: set ts=4 sw=4 expandtab: */
|
||||||
@@ -142,6 +142,8 @@ Registry, and a unhelpful "Microphone(Yeti Stereo Microph" in winmm. Sigh.
|
|||||||
|
|
||||||
(Also, DirectSound shouldn't be limited to 32 chars, but its device enum
|
(Also, DirectSound shouldn't be limited to 32 chars, but its device enum
|
||||||
has the same problem.)
|
has the same problem.)
|
||||||
|
|
||||||
|
WASAPI doesn't need this. This is just for DirectSound/WinMM.
|
||||||
*/
|
*/
|
||||||
char *
|
char *
|
||||||
WIN_LookupAudioDeviceName(const WCHAR *name, const GUID *guid)
|
WIN_LookupAudioDeviceName(const WCHAR *name, const GUID *guid)
|
||||||
|
|||||||
Reference in New Issue
Block a user