2 * Copyright (c) 2015 Andrew Eikum for CodeWeavers
4 * This library is free software; you can redistribute it and/or
5 * modify it under the terms of the GNU Lesser General Public
6 * License as published by the Free Software Foundation; either
7 * version 2.1 of the License, or (at your option) any later version.
9 * This library is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12 * Lesser General Public License for more details.
14 * You should have received a copy of the GNU Lesser General Public
15 * License along with this library; if not, write to the Free Software
16 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
22 typedef struct X3DAUDIO_VECTOR
{
26 typedef struct X3DAUDIO_CONE
{
37 typedef struct X3DAUDIO_DISTANCE_CURVE_POINT
{
40 } X3DAUDIO_DISTANCE_CURVE_POINT
;
42 typedef struct X3DAUDIO_DISTANCE_CURVE
{
43 X3DAUDIO_DISTANCE_CURVE_POINT
*pPoints
;
45 } X3DAUDIO_DISTANCE_CURVE
;
47 typedef struct X3DAUDIO_LISTENER
{
48 X3DAUDIO_VECTOR OrientFront
;
49 X3DAUDIO_VECTOR OrientTop
;
50 X3DAUDIO_VECTOR Position
;
51 X3DAUDIO_VECTOR Velocity
;
55 typedef struct X3DAUDIO_EMITTER
{
57 X3DAUDIO_VECTOR OrientFront
;
58 X3DAUDIO_VECTOR OrientTop
;
59 X3DAUDIO_VECTOR Position
;
60 X3DAUDIO_VECTOR Velocity
;
62 float InnerRadiusAngle
;
65 float *pChannelAzimuths
;
66 X3DAUDIO_DISTANCE_CURVE
*pVolumeCurve
;
67 X3DAUDIO_DISTANCE_CURVE
*pLFECurve
;
68 X3DAUDIO_DISTANCE_CURVE
*pLPFDirectCurve
;
69 X3DAUDIO_DISTANCE_CURVE
*pLPFReverbCurve
;
70 X3DAUDIO_DISTANCE_CURVE
*pReverbCurve
;
71 float CurveDistanceScalar
;
75 typedef struct X3DAUDIO_DSP_SETTINGS
{
76 float *pMatrixCoefficients
;
78 UINT32 SrcChannelCount
;
79 UINT32 DstChannelCount
;
80 float LPFDirectCoefficient
;
81 float LPFReverbCoefficient
;
84 float EmitterToListenerAngle
;
85 float EmitterToListenerDistance
;
86 float EmitterVelocityComponent
;
87 float ListenerVelocityComponent
;
88 } X3DAUDIO_DSP_SETTINGS
;
90 #define X3DAUDIO_CALCULATE_MATRIX 0x00000001
91 #define X3DAUDIO_CALCULATE_DELAY 0x00000002
92 #define X3DAUDIO_CALCULATE_LPF_DIRECT 0x00000004
93 #define X3DAUDIO_CALCULATE_LPF_REVERB 0x00000008
94 #define X3DAUDIO_CALCULATE_REVERB 0x00000010
95 #define X3DAUDIO_CALCULATE_DOPPLER 0x00000020
96 #define X3DAUDIO_CALCULATE_EMITTER_ANGLE 0x00000040
97 #define X3DAUDIO_CALCULATE_ZEROCENTER 0x00010000
98 #define X3DAUDIO_CALCULATE_REDIRECT_TO_LFE 0x00020000
100 #ifndef _SPEAKER_POSITIONS_
101 #define _SPEAKER_POSITIONS_
102 #define SPEAKER_FRONT_LEFT 0x00000001
103 #define SPEAKER_FRONT_RIGHT 0x00000002
104 #define SPEAKER_FRONT_CENTER 0x00000004
105 #define SPEAKER_LOW_FREQUENCY 0x00000008
106 #define SPEAKER_BACK_LEFT 0x00000010
107 #define SPEAKER_BACK_RIGHT 0x00000020
108 #define SPEAKER_FRONT_LEFT_OF_CENTER 0x00000040
109 #define SPEAKER_FRONT_RIGHT_OF_CENTER 0x00000080
110 #define SPEAKER_BACK_CENTER 0x00000100
111 #define SPEAKER_SIDE_LEFT 0x00000200
112 #define SPEAKER_SIDE_RIGHT 0x00000400
113 #define SPEAKER_TOP_CENTER 0x00000800
114 #define SPEAKER_TOP_FRONT_LEFT 0x00001000
115 #define SPEAKER_TOP_FRONT_CENTER 0x00002000
116 #define SPEAKER_TOP_FRONT_RIGHT 0x00004000
117 #define SPEAKER_TOP_BACK_LEFT 0x00008000
118 #define SPEAKER_TOP_BACK_CENTER 0x00010000
119 #define SPEAKER_TOP_BACK_RIGHT 0x00020000
120 #define SPEAKER_RESERVED 0x7ffc0000
121 #define SPEAKER_ALL 0x80000000
125 #define SPEAKER_MONO SPEAKER_FRONT_CENTER
126 #define SPEAKER_STEREO (SPEAKER_FRONT_LEFT | SPEAKER_FRONT_RIGHT)
127 #define SPEAKER_2POINT1 (SPEAKER_FRONT_LEFT | SPEAKER_FRONT_RIGHT | SPEAKER_LOW_FREQUENCY)
128 #define SPEAKER_SURROUND (SPEAKER_FRONT_LEFT | SPEAKER_FRONT_RIGHT | SPEAKER_FRONT_CENTER | SPEAKER_BACK_CENTER)
129 #define SPEAKER_QUAD (SPEAKER_FRONT_LEFT | SPEAKER_FRONT_RIGHT | SPEAKER_BACK_LEFT | SPEAKER_BACK_RIGHT)
130 #define SPEAKER_4POINT1 (SPEAKER_FRONT_LEFT | SPEAKER_FRONT_RIGHT | SPEAKER_LOW_FREQUENCY | SPEAKER_BACK_LEFT | \
132 #define SPEAKER_5POINT1 (SPEAKER_FRONT_LEFT | SPEAKER_FRONT_RIGHT | SPEAKER_FRONT_CENTER | SPEAKER_LOW_FREQUENCY | \
133 SPEAKER_BACK_LEFT | SPEAKER_BACK_RIGHT)
134 #define SPEAKER_7POINT1 (SPEAKER_FRONT_LEFT | SPEAKER_FRONT_RIGHT | SPEAKER_FRONT_CENTER | SPEAKER_LOW_FREQUENCY | \
135 SPEAKER_BACK_LEFT | SPEAKER_BACK_RIGHT | SPEAKER_FRONT_LEFT_OF_CENTER | \
136 SPEAKER_FRONT_RIGHT_OF_CENTER)
137 #define SPEAKER_5POINT1_SURROUND (SPEAKER_FRONT_LEFT | SPEAKER_FRONT_RIGHT | SPEAKER_FRONT_CENTER | SPEAKER_LOW_FREQUENCY | \
138 SPEAKER_SIDE_LEFT | SPEAKER_SIDE_RIGHT)
139 #define SPEAKER_7POINT1_SURROUND (SPEAKER_FRONT_LEFT | SPEAKER_FRONT_RIGHT | SPEAKER_FRONT_CENTER | SPEAKER_LOW_FREQUENCY | \
140 SPEAKER_BACK_LEFT | SPEAKER_BACK_RIGHT | SPEAKER_SIDE_LEFT | SPEAKER_SIDE_RIGHT)
143 #define X3DAUDIO_SPEED_OF_SOUND 343.5f
145 #define X3DAUDIO_HANDLE_BYTESIZE 20
146 typedef BYTE X3DAUDIO_HANDLE
[X3DAUDIO_HANDLE_BYTESIZE
];
148 HRESULT CDECL
X3DAudioInitialize(UINT32
, float, X3DAUDIO_HANDLE
);
149 void CDECL
X3DAudioCalculate(const X3DAUDIO_HANDLE
, const X3DAUDIO_LISTENER
*,
150 const X3DAUDIO_EMITTER
*, UINT32
, X3DAUDIO_DSP_SETTINGS
*);