zenilib  0.5.3.0
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
mmdevapi.c File Reference
#include "config.h"
#include <stdlib.h>
#include <stdio.h>
#include <memory.h>
#include <mmdeviceapi.h>
#include <audioclient.h>
#include <cguid.h>
#include <devpropdef.h>
#include <mmreg.h>
#include <propsys.h>
#include <propkey.h>
#include <devpkey.h>
#include "alMain.h"
#include "alu.h"

Go to the source code of this file.

Macros

#define COBJMACROS
 
#define MONO   SPEAKER_FRONT_CENTER
 
#define QUAD   (SPEAKER_FRONT_LEFT|SPEAKER_FRONT_RIGHT|SPEAKER_BACK_LEFT|SPEAKER_BACK_RIGHT)
 
#define STEREO   (SPEAKER_FRONT_LEFT|SPEAKER_FRONT_RIGHT)
 
#define WM_USER_CloseDevice   (WM_USER+4)
 
#define WM_USER_Enumerate   (WM_USER+5)
 
#define WM_USER_OpenDevice   (WM_USER+0)
 
#define WM_USER_ResetDevice   (WM_USER+1)
 
#define WM_USER_StartDevice   (WM_USER+2)
 
#define WM_USER_StopDevice   (WM_USER+3)
 
#define X5DOT1   (SPEAKER_FRONT_LEFT|SPEAKER_FRONT_RIGHT|SPEAKER_FRONT_CENTER|SPEAKER_LOW_FREQUENCY|SPEAKER_BACK_LEFT|SPEAKER_BACK_RIGHT)
 
#define X5DOT1SIDE   (SPEAKER_FRONT_LEFT|SPEAKER_FRONT_RIGHT|SPEAKER_FRONT_CENTER|SPEAKER_LOW_FREQUENCY|SPEAKER_SIDE_LEFT|SPEAKER_SIDE_RIGHT)
 
#define X6DOT1   (SPEAKER_FRONT_LEFT|SPEAKER_FRONT_RIGHT|SPEAKER_FRONT_CENTER|SPEAKER_LOW_FREQUENCY|SPEAKER_BACK_CENTER|SPEAKER_SIDE_LEFT|SPEAKER_SIDE_RIGHT)
 
#define X7DOT1   (SPEAKER_FRONT_LEFT|SPEAKER_FRONT_RIGHT|SPEAKER_FRONT_CENTER|SPEAKER_LOW_FREQUENCY|SPEAKER_BACK_LEFT|SPEAKER_BACK_RIGHT|SPEAKER_SIDE_LEFT|SPEAKER_SIDE_RIGHT)
 

Functions

static void add_device (IMMDevice *device, DevMap *devmap)
 
void alcMMDevApiDeinit (void)
 
ALCboolean alcMMDevApiInit (BackendFuncs *FuncList)
 
void alcMMDevApiProbe (enum DevProbe type)
 
 DEFINE_DEVPROPKEY (DEVPKEY_Device_FriendlyName, 0xa45c254e, 0xdf1c, 0x4efd, 0x80, 0x20, 0x67, 0xd1, 0x46, 0xa8, 0x50, 0xe0, 14)
 
 DEFINE_GUID (KSDATAFORMAT_SUBTYPE_PCM, 0x00000001, 0x0000, 0x0010, 0x80, 0x00, 0x00, 0xaa, 0x00, 0x38, 0x9b, 0x71)
 
 DEFINE_GUID (KSDATAFORMAT_SUBTYPE_IEEE_FLOAT, 0x00000003, 0x0000, 0x0010, 0x80, 0x00, 0x00, 0xaa, 0x00, 0x38, 0x9b, 0x71)
 
static HRESULT DoReset (ALCdevice *device)
 
static ALCcharget_device_name (IMMDevice *device)
 
static ALCboolean MakeExtensible (WAVEFORMATEXTENSIBLE *out, const WAVEFORMATEX *in)
 
static void MMDevApiClosePlayback (ALCdevice *device)
 
static ALint64 MMDevApiGetLatency (ALCdevice *device)
 
static BOOL MMDevApiLoad (void)
 
static DWORD CALLBACK MMDevApiMsgProc (void *ptr)
 
static ALCenum MMDevApiOpenPlayback (ALCdevice *device, const ALCchar *deviceName)
 
static ALuint MMDevApiProc (ALvoid *ptr)
 
static ALCboolean MMDevApiResetPlayback (ALCdevice *device)
 
static ALCboolean MMDevApiStartPlayback (ALCdevice *device)
 
static void MMDevApiStopPlayback (ALCdevice *device)
 
static DevMap * ProbeDevices (IMMDeviceEnumerator *devenum, EDataFlow flowdir, ALuint *numdevs)
 
static HRESULT WaitForResponse (ThreadRequest *req)
 

Variables

static DevMap * CaptureDeviceList
 
static const BackendFuncs MMDevApiFuncs
 
static ALuint NumCaptureDevices
 
static ALuint NumPlaybackDevices
 
static DevMap * PlaybackDeviceList
 
static HANDLE ThreadHdl
 
static DWORD ThreadID
 

Macro Definition Documentation

#define COBJMACROS

OpenAL cross platform audio library Copyright (C) 2011 by authors. This library is free software; you can redistribute it and/or modify it under the terms of the GNU Library General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version.

This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Library General Public License for more details.

You should have received a copy of the GNU Library General Public License along with this library; if not, write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. Or go to http://www.gnu.org/copyleft/lgpl.html

Definition at line 23 of file mmdevapi.c.

#define MONO   SPEAKER_FRONT_CENTER

Definition at line 50 of file mmdevapi.c.

Referenced by DoReset(), and MakeExtensible().

Definition at line 52 of file mmdevapi.c.

Referenced by DoReset().

#define STEREO   (SPEAKER_FRONT_LEFT|SPEAKER_FRONT_RIGHT)

Definition at line 51 of file mmdevapi.c.

Referenced by DoReset(), and MakeExtensible().

#define WM_USER_CloseDevice   (WM_USER+4)

Definition at line 99 of file mmdevapi.c.

Referenced by MMDevApiClosePlayback(), and MMDevApiMsgProc().

#define WM_USER_Enumerate   (WM_USER+5)

Definition at line 100 of file mmdevapi.c.

Referenced by alcMMDevApiProbe(), MMDevApiMsgProc(), and MMDevApiOpenPlayback().

#define WM_USER_OpenDevice   (WM_USER+0)

Definition at line 95 of file mmdevapi.c.

Referenced by MMDevApiMsgProc(), and MMDevApiOpenPlayback().

#define WM_USER_ResetDevice   (WM_USER+1)

Definition at line 96 of file mmdevapi.c.

Referenced by MMDevApiMsgProc(), and MMDevApiResetPlayback().

#define WM_USER_StartDevice   (WM_USER+2)

Definition at line 97 of file mmdevapi.c.

Referenced by MMDevApiMsgProc(), and MMDevApiStartPlayback().

#define WM_USER_StopDevice   (WM_USER+3)

Definition at line 98 of file mmdevapi.c.

Referenced by MMDevApiMsgProc(), and MMDevApiStopPlayback().

Function Documentation

static void add_device ( IMMDevice *  device,
DevMap *  devmap 
)
static

Definition at line 149 of file mmdevapi.c.

References get_device_name(), HRESULT(), and TRACE.

Referenced by ProbeDevices().

void alcMMDevApiDeinit ( void  )
ALCboolean alcMMDevApiInit ( BackendFuncs FuncList)

Definition at line 970 of file mmdevapi.c.

References ALC_FALSE, ALC_TRUE, MMDevApiFuncs, and MMDevApiLoad().

DEFINE_DEVPROPKEY ( DEVPKEY_Device_FriendlyName  ,
0xa45c254e  ,
0xdf1c  ,
0x4efd  ,
0x80  ,
0x20  ,
0x67  ,
0xd1  ,
0x46  ,
0xa8  ,
0x50  ,
0xe0  ,
14   
)
DEFINE_GUID ( KSDATAFORMAT_SUBTYPE_PCM  ,
0x00000001  ,
0x0000  ,
0x0010  ,
0x80  ,
0x00  ,
0x00  ,
0xaa  ,
0x00  ,
0x38  ,
0x9b  ,
0x71   
)
DEFINE_GUID ( KSDATAFORMAT_SUBTYPE_IEEE_FLOAT  ,
0x00000003  ,
0x0000  ,
0x0010  ,
0x80  ,
0x00  ,
0x00  ,
0xaa  ,
0x00  ,
0x38  ,
0x9b  ,
0x71   
)
static ALCchar* get_device_name ( IMMDevice *  device)
static

Definition at line 111 of file mmdevapi.c.

References calloc, HRESULT(), NULL, and WARN.

Referenced by add_device(), and MMDevApiMsgProc().

static void MMDevApiClosePlayback ( ALCdevice device)
static
static ALint64 MMDevApiGetLatency ( ALCdevice device)
static

Definition at line 944 of file mmdevapi.c.

References ALCdevice_struct::ExtraData, and ALCdevice_struct::Frequency.

static BOOL MMDevApiLoad ( void  )
static

Definition at line 795 of file mmdevapi.c.

References ERR, FALSE, HRESULT(), MMDevApiMsgProc(), NULL, ThreadHdl, ThreadID, and WaitForResponse().

Referenced by alcMMDevApiInit().

static ALCboolean MMDevApiResetPlayback ( ALCdevice device)
static
static ALCboolean MMDevApiStartPlayback ( ALCdevice device)
static
static void MMDevApiStopPlayback ( ALCdevice device)
static
static DevMap* ProbeDevices ( IMMDeviceEnumerator *  devenum,
EDataFlow  flowdir,
ALuint numdevs 
)
static

Definition at line 164 of file mmdevapi.c.

References add_device(), calloc, ERR, HRESULT(), i, idx, NULL, and UINT().

Referenced by MMDevApiMsgProc().

static HRESULT WaitForResponse ( ThreadRequest *  req)
static

Variable Documentation

DevMap* CaptureDeviceList
static

Definition at line 83 of file mmdevapi.c.

Referenced by alcMMDevApiDeinit(), and MMDevApiMsgProc().

const BackendFuncs MMDevApiFuncs
static
Initial value:
= {
}
#define NULL
Definition: ftobjs.h:61
static void MMDevApiClosePlayback(ALCdevice *device)
Definition: mmdevapi.c:889
static ALCenum MMDevApiOpenPlayback(ALCdevice *device, const ALCchar *deviceName)
Definition: mmdevapi.c:818
static ALCboolean MMDevApiStartPlayback(ALCdevice *device)
Definition: mmdevapi.c:922
static ALint64 MMDevApiGetLatency(ALCdevice *device)
Definition: mmdevapi.c:944
void ALCdevice_LockDefault(ALCdevice *device)
Definition: ALc.c:1277
static void MMDevApiStopPlayback(ALCdevice *device)
Definition: mmdevapi.c:934
static ALCboolean MMDevApiResetPlayback(ALCdevice *device)
Definition: mmdevapi.c:910
void ALCdevice_UnlockDefault(ALCdevice *device)
Definition: ALc.c:1281

Definition at line 952 of file mmdevapi.c.

Referenced by alcMMDevApiInit().

ALuint NumCaptureDevices
static

Definition at line 84 of file mmdevapi.c.

Referenced by alcMMDevApiDeinit(), and MMDevApiMsgProc().

ALuint NumPlaybackDevices
static
DevMap* PlaybackDeviceList
static
HANDLE ThreadHdl
static

Definition at line 87 of file mmdevapi.c.

Referenced by alcMMDevApiDeinit(), and MMDevApiLoad().