SDL  2.0
SDL_wasapi.h
Go to the documentation of this file.
1 /*
2  Simple DirectMedia Layer
3  Copyright (C) 1997-2018 Sam Lantinga <slouken@libsdl.org>
4 
5  This software is provided 'as-is', without any express or implied
6  warranty. In no event will the authors be held liable for any damages
7  arising from the use of this software.
8 
9  Permission is granted to anyone to use this software for any purpose,
10  including commercial applications, and to alter it and redistribute it
11  freely, subject to the following restrictions:
12 
13  1. The origin of this software must not be misrepresented; you must not
14  claim that you wrote the original software. If you use this software
15  in a product, an acknowledgment in the product documentation would be
16  appreciated but is not required.
17  2. Altered source versions must be plainly marked as such, and must not be
18  misrepresented as being the original software.
19  3. This notice may not be removed or altered from any source distribution.
20 */
21 #include "../../SDL_internal.h"
22 
23 #ifndef SDL_wasapi_h_
24 #define SDL_wasapi_h_
25 
26 #ifdef __cplusplus
27 extern "C" {
28 #endif
29 
30 #include "../SDL_sysaudio.h"
31 
32 /* Hidden "this" pointer for the audio functions */
33 #ifdef __cplusplus
34 #define _THIS SDL_AudioDevice *_this
35 #else
36 #define _THIS SDL_AudioDevice *this
37 #endif
38 
40 {
42  WCHAR *devid;
43  WAVEFORMATEX *waveformat;
44  IAudioClient *client;
45  IAudioRenderClient *render;
46  IAudioCaptureClient *capture;
47  SDL_AudioStream *capturestream;
48  HANDLE event;
49  HANDLE task;
51  int framesize;
56 };
57 
58 /* these increment as default devices change. Opened default devices pick up changes in their threads. */
61 
62 /* win32 and winrt implementations call into these. */
63 int WASAPI_PrepDevice(_THIS, const SDL_bool updatestream);
66 void WASAPI_AddDevice(const SDL_bool iscapture, const char *devname, LPCWSTR devid);
67 void WASAPI_RemoveDevice(const SDL_bool iscapture, LPCWSTR devid);
68 
69 /* These are functions that are implemented differently for Windows vs WinRT. */
70 int WASAPI_PlatformInit(void);
71 void WASAPI_PlatformDeinit(void);
72 void WASAPI_EnumerateEndpoints(void);
73 int WASAPI_ActivateDevice(_THIS, const SDL_bool isrecovery);
76 void WASAPI_PlatformDeleteActivationHandler(void *handler);
78 
79 #ifdef __cplusplus
80 }
81 #endif
82 
83 #endif /* SDL_wasapi_h_ */
84 
85 /* vi: set ts=4 sw=4 expandtab: */
SDL_AudioStream * capturestream
Definition: SDL_wasapi.h:47
void WASAPI_AddDevice(const SDL_bool iscapture, const char *devname, LPCWSTR devid)
void WASAPI_UnrefDevice(_THIS)
A type representing an atomic integer value. It is a struct so people don&#39;t accidentally use numeric ...
Definition: SDL_atomic.h:198
void WASAPI_BeginLoopIteration(_THIS)
IAudioClient * client
Definition: SDL_wasapi.h:44
int WASAPI_ActivateDevice(_THIS, const SDL_bool isrecovery)
void WASAPI_PlatformThreadDeinit(_THIS)
void WASAPI_PlatformDeinit(void)
WAVEFORMATEX * waveformat
Definition: SDL_wasapi.h:43
IAudioCaptureClient * capture
Definition: SDL_wasapi.h:46
int WASAPI_PrepDevice(_THIS, const SDL_bool updatestream)
void WASAPI_RefDevice(_THIS)
void WASAPI_EnumerateEndpoints(void)
#define _THIS
Definition: SDL_wasapi.h:36
IAudioRenderClient * render
Definition: SDL_wasapi.h:45
SDL_bool coinitialized
Definition: SDL_wasapi.h:50
void WASAPI_RemoveDevice(const SDL_bool iscapture, LPCWSTR devid)
int WASAPI_PlatformInit(void)
SDL_atomic_t refcount
Definition: SDL_wasapi.h:41
SDL_atomic_t WASAPI_DefaultPlaybackGeneration
SDL_bool
Definition: SDL_stdinc.h:139
SDL_bool device_lost
Definition: SDL_wasapi.h:53
SDL_atomic_t WASAPI_DefaultCaptureGeneration
void WASAPI_PlatformDeleteActivationHandler(void *handler)
void WASAPI_PlatformThreadInit(_THIS)
SDL_atomic_t just_activated
Definition: SDL_wasapi.h:55
void * activation_handler
Definition: SDL_wasapi.h:54