63 lines
1.7 KiB
C
63 lines
1.7 KiB
C
////////////////////////////////
|
|
//~ Win32 headers
|
|
|
|
#pragma warning(push, 0)
|
|
# define COBJMACROS
|
|
# define WIN32_LEAN_AND_MEAN
|
|
# define UNICODE
|
|
# include <Windows.h>
|
|
# include <initguid.h>
|
|
# include <objbase.h>
|
|
# include <uuids.h>
|
|
# include <Audioclient.h>
|
|
# include <mmdeviceapi.h>
|
|
#pragma warning(pop)
|
|
|
|
DEFINE_GUID(CLSID_MMDeviceEnumerator, 0xbcde0395, 0xe52f, 0x467c, 0x8e, 0x3d, 0xc4, 0x57, 0x92, 0x91, 0x69, 0x2e);
|
|
DEFINE_GUID(IID_IMMDeviceEnumerator, 0xa95664d2, 0x9614, 0x4f35, 0xa7, 0x46, 0xde, 0x8d, 0xb6, 0x36, 0x17, 0xe6);
|
|
DEFINE_GUID(IID_IAudioClient, 0x1cb9ad4c, 0xdbfa, 0x4c32, 0xb1, 0x78, 0xc2, 0xf5, 0x68, 0xa7, 0x03, 0xb2);
|
|
DEFINE_GUID(IID_IAudioClient3, 0x7ed4ee07, 0x8e67, 0x4cd4, 0x8c, 0x1a, 0x2b, 0x7a, 0x59, 0x87, 0xad, 0x42);
|
|
DEFINE_GUID(IID_IAudioRenderClient, 0xf294acfc, 0x3146, 0x4483, 0xa7, 0xbf, 0xad, 0xdc, 0xa7, 0xc2, 0x60, 0xe2);
|
|
|
|
////////////////////////////////
|
|
//~ Wasapi buffer types
|
|
|
|
Struct(PB_WSP_Buff)
|
|
{
|
|
u32 frames_count;
|
|
u8 *frames;
|
|
};
|
|
|
|
////////////////////////////////
|
|
//~ Shared state
|
|
|
|
Struct(PB_WSP_SharedState)
|
|
{
|
|
Atomic32 shutdown;
|
|
IAudioClient *client;
|
|
HANDLE event;
|
|
IAudioRenderClient *playback;
|
|
WAVEFORMATEX *buffer_format;
|
|
u32 buffer_frames;
|
|
Counter PB_WSP_PlaybackJob_counter;
|
|
};
|
|
|
|
extern PB_WSP_SharedState PB_WSP_shared_state;
|
|
|
|
////////////////////////////////
|
|
//~ Wasapi startup
|
|
|
|
void PB_WSP_InitializeWasapi(void);
|
|
P_ExitFuncDef(PB_WSP_Shutdown);
|
|
|
|
////////////////////////////////
|
|
//~ Playback update
|
|
|
|
PB_WSP_Buff PB_WSP_BeginUpdate(void);
|
|
void PB_WSP_EndUpdate(PB_WSP_Buff *wspbuf, MIX_PcmF32 src);
|
|
|
|
////////////////////////////////
|
|
//~ Playback job
|
|
|
|
JobDecl(PB_WSP_PlaybackJob, EmptySig);
|