zenilib: zenilib/jni/external/openal-soft/Alc/backends/mmdevapi.c File Reference

zenilib 0.5.3.0

- Main Page
- Modules
- Namespaces
- Classes
- Files

- File List
- File Members

All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
Macros | Functions | Variables
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 ALCchar * | get_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().

#define QUAD (SPEAKER_FRONT_LEFT|SPEAKER_FRONT_RIGHT|SPEAKER_BACK_LEFT|SPEAKER_BACK_RIGHT)

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().

#define X5DOT1 (SPEAKER_FRONT_LEFT|SPEAKER_FRONT_RIGHT|SPEAKER_FRONT_CENTER|SPEAKER_LOW_FREQUENCY|SPEAKER_BACK_LEFT|SPEAKER_BACK_RIGHT)

Definition at line 53 of file mmdevapi.c.

Referenced by DoReset().

#define X5DOT1SIDE (SPEAKER_FRONT_LEFT|SPEAKER_FRONT_RIGHT|SPEAKER_FRONT_CENTER|SPEAKER_LOW_FREQUENCY|SPEAKER_SIDE_LEFT|SPEAKER_SIDE_RIGHT)

Definition at line 54 of file mmdevapi.c.

Referenced by DoReset().

#define X6DOT1 (SPEAKER_FRONT_LEFT|SPEAKER_FRONT_RIGHT|SPEAKER_FRONT_CENTER|SPEAKER_LOW_FREQUENCY|SPEAKER_BACK_CENTER|SPEAKER_SIDE_LEFT|SPEAKER_SIDE_RIGHT)

Definition at line 55 of file mmdevapi.c.

Referenced by DoReset().

#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)

Definition at line 56 of file mmdevapi.c.

Referenced by DoReset().

## 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 |  | ) |

Definition at line 978 of file mmdevapi.c.

References CaptureDeviceList, free, i, NULL, NumCaptureDevices, NumPlaybackDevices, PlaybackDeviceList, ThreadHdl, ThreadID, and TRACE.

ALCboolean alcMMDevApiInit | ( | BackendFuncs * | FuncList | ) |

Definition at line 970 of file mmdevapi.c.

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

void alcMMDevApiProbe | ( | enum DevProbe | type | ) |

Definition at line 1009 of file mmdevapi.c.

References ALL_DEVICE_PROBE, AppendAllDevicesList(), CAPTURE_DEVICE_PROBE, ERR, FALSE, HRESULT(), i, NULL, NumPlaybackDevices, PlaybackDeviceList, ThreadID, WaitForResponse(), and WM_USER_Enumerate.

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

Definition at line 330 of file mmdevapi.c.

References DevFmtByte, DevFmtFloat, DevFmtInt, DevFmtMono, DevFmtQuad, DevFmtShort, DevFmtStereo, DevFmtUByte, DevFmtUInt, DevFmtUShort, DevFmtX51, DevFmtX51Side, DevFmtX61, DevFmtX71, DEVICE_CHANNELS_REQUEST, DEVICE_FREQUENCY_REQUEST, WAVEFORMATEXTENSIBLE::dwChannelMask, ERR, ALCdevice_struct::ExtraData, ALCdevice_struct::Flags, ALCdevice_struct::FmtChans, ALCdevice_struct::FmtType, WAVEFORMATEXTENSIBLE::Format, ALCdevice_struct::Frequency, HRESULT(), MakeExtensible(), MONO, tWAVEFORMATEX::nAvgBytesPerSec, tWAVEFORMATEX::nBlockAlign, tWAVEFORMATEX::nChannels, tWAVEFORMATEX::nSamplesPerSec, NULL, ALCdevice_struct::NumUpdates, QUAD, WAVEFORMATEXTENSIBLE::Samples, SetDefaultWFXChannelOrder(), STEREO, WAVEFORMATEXTENSIBLE::SubFormat, ALCdevice_struct::UpdateSize, tWAVEFORMATEX::wBitsPerSample, WAVEFORMATEXTENSIBLE::wValidBitsPerSample, X5DOT1, X5DOT1SIDE, X6DOT1, and X7DOT1.

Referenced by MMDevApiMsgProc().

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 ALCboolean MakeExtensible | ( | WAVEFORMATEXTENSIBLE * | out,
|  | const WAVEFORMATEX * | in
| ) |  |

static

Definition at line 291 of file mmdevapi.c.

References ALC_FALSE, ALC_TRUE, tWAVEFORMATEX::cbSize, WAVEFORMATEXTENSIBLE::dwChannelMask, ERR, WAVEFORMATEXTENSIBLE::Format, memset, MONO, tWAVEFORMATEX::nChannels, STEREO, WAVEFORMATEXTENSIBLE::SubFormat, WAVE_FORMAT_EXTENSIBLE, WAVE_FORMAT_IEEE_FLOAT, WAVE_FORMAT_PCM, and tWAVEFORMATEX::wFormatTag.

Referenced by DoReset().

static void MMDevApiClosePlayback | ( | ALCdevice * | device | ) |

static

Definition at line 889 of file mmdevapi.c.

References ALCdevice_struct::ExtraData, free, NULL, ThreadID, WaitForResponse(), and WM_USER_CloseDevice.

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 DWORD CALLBACK MMDevApiMsgProc | ( | void * | ptr | ) |

static

Definition at line 562 of file mmdevapi.c.

References CAPTURE_DEVICE_PROBE, CaptureDeviceList, ALCdevice_struct::DeviceName, DoReset(), ERR, ALCdevice_struct::ExtraData, free, get_device_name(), HRESULT(), i, MMDevApiProc(), NULL, NumCaptureDevices, NumPlaybackDevices, PlaybackDeviceList, ProbeDevices(), StartThread(), StopThread(), TRACE, WARN, WM_USER_CloseDevice, WM_USER_Enumerate, WM_USER_OpenDevice, WM_USER_ResetDevice, WM_USER_StartDevice, and WM_USER_StopDevice.

Referenced by MMDevApiLoad().

static ALCenum MMDevApiOpenPlayback | ( | ALCdevice * | device,
|  | const ALCchar * | deviceName
| ) |  |

static

Definition at line 818 of file mmdevapi.c.

References ALC_INVALID_VALUE, ALC_NO_ERROR, ALC_OUT_OF_MEMORY, ALL_DEVICE_PROBE, calloc, ERR, ALCdevice_struct::ExtraData, FALSE, free, HRESULT(), i, NULL, NumPlaybackDevices, PlaybackDeviceList, ThreadID, WaitForResponse(), WM_USER_Enumerate, and WM_USER_OpenDevice.

static ALuint MMDevApiProc | ( | ALvoid * | ptr | ) |

static

Definition at line 219 of file mmdevapi.c.

References ALCdevice_Lock, ALCdevice_Unlock, aluHandleDisconnect(), aluMixData(), DWORD(), ERR, ALCdevice_struct::ExtraData, FALSE, HRESULT(), NULL, ALCdevice_struct::NumUpdates, SetRTPriority(), and ALCdevice_struct::UpdateSize.

Referenced by MMDevApiMsgProc().

static ALCboolean MMDevApiResetPlayback | ( | ALCdevice * | device | ) |

static

Definition at line 910 of file mmdevapi.c.

References ALC_FALSE, ALC_TRUE, ALCdevice_struct::ExtraData, HRESULT(), ThreadID, WaitForResponse(), and WM_USER_ResetDevice.

static ALCboolean MMDevApiStartPlayback | ( | ALCdevice * | device | ) |

static

Definition at line 922 of file mmdevapi.c.

References ALC_FALSE, ALC_TRUE, ALCdevice_struct::ExtraData, HRESULT(), ThreadID, WaitForResponse(), and WM_USER_StartDevice.

static void MMDevApiStopPlayback | ( | ALCdevice * | device | ) |

static

Definition at line 934 of file mmdevapi.c.

References ALCdevice_struct::ExtraData, ThreadID, WaitForResponse(), and WM_USER_StopDevice.

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

Definition at line 102 of file mmdevapi.c.

References ERR.

Referenced by alcMMDevApiProbe(), MMDevApiClosePlayback(), MMDevApiLoad(), MMDevApiOpenPlayback(), MMDevApiResetPlayback(), MMDevApiStartPlayback(), and MMDevApiStopPlayback().

## Variable Documentation

DevMap* CaptureDeviceList

static

Definition at line 83 of file mmdevapi.c.

Referenced by alcMMDevApiDeinit(), and MMDevApiMsgProc().

const BackendFuncs MMDevApiFuncs

static

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

Definition at line 82 of file mmdevapi.c.

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

DevMap* PlaybackDeviceList

static

Definition at line 81 of file mmdevapi.c.

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

HANDLE ThreadHdl

static

Definition at line 87 of file mmdevapi.c.

Referenced by alcMMDevApiDeinit(), and MMDevApiLoad().

DWORD ThreadID

static

Definition at line 88 of file mmdevapi.c.

Referenced by alcMMDevApiDeinit(), alcMMDevApiProbe(), MMDevApiClosePlayback(), MMDevApiLoad(), MMDevApiOpenPlayback(), MMDevApiResetPlayback(), MMDevApiStartPlayback(), and MMDevApiStopPlayback().