]> git.sesse.net Git - vlc/blob - modules/audio_output/windows_audio_common.h
DirectSound: correct include order
[vlc] / modules / audio_output / windows_audio_common.h
1 /*****************************************************************************
2  * windows_common.h: Windows Audio common code
3  *****************************************************************************
4  * Copyright (C) 2001-2009 VideoLAN
5  * $Id$
6  *
7  * Authors: Gildas Bazin <gbazin@videolan.org>
8  *          Jean-Baptiste Kempf <jb@videolan.org>
9  *
10  * This program is free software; you can redistribute it and/or modify
11  * it under the terms of the GNU General Public License as published by
12  * the Free Software Foundation; either version 2 of the License, or
13  * (at your option) any later version.
14  *
15  * This program is distributed in the hope that it will be useful,
16  * but WITHOUT ANY WARRANTY; without even the implied warranty of
17  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
18  * GNU General Public License for more details.
19  *
20  * You should have received a copy of the GNU General Public License
21  * along with this program; if not, write to the Free Software
22  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301, USA.
23  *****************************************************************************/
24
25 #include <windows.h>
26 #include <mmsystem.h>
27
28 /*****************************************************************************
29  * DirectSound GUIDs.
30  * Defining them here allows us to get rid of the dxguid library during
31  * the linking stage.
32  *****************************************************************************/
33
34 #define INITGUID /* Doesn't define the DEFINE_GUID as extern */
35 #include <initguid.h>
36
37 #ifndef WAVE_FORMAT_IEEE_FLOAT
38 #   define WAVE_FORMAT_IEEE_FLOAT 0x0003
39 #endif
40
41 #ifndef WAVE_FORMAT_DOLBY_AC3_SPDIF
42 #   define WAVE_FORMAT_DOLBY_AC3_SPDIF 0x0092
43 #endif
44
45 #ifndef WAVE_FORMAT_EXTENSIBLE
46 #define  WAVE_FORMAT_EXTENSIBLE   0xFFFE
47 #endif
48
49 DEFINE_GUID( _KSDATAFORMAT_SUBTYPE_IEEE_FLOAT, WAVE_FORMAT_IEEE_FLOAT, 0x0000, 0x0010, 0x80, 0x00, 0x00, 0xaa, 0x00, 0x38, 0x9b, 0x71 );
50 DEFINE_GUID( _KSDATAFORMAT_SUBTYPE_PCM, WAVE_FORMAT_PCM, 0x0000, 0x0010, 0x80, 0x00, 0x00, 0xaa, 0x00, 0x38, 0x9b, 0x71 );
51 DEFINE_GUID( _KSDATAFORMAT_SUBTYPE_DOLBY_AC3_SPDIF, WAVE_FORMAT_DOLBY_AC3_SPDIF, 0x0000, 0x0010, 0x80, 0x00, 0x00, 0xaa, 0x00, 0x38, 0x9b, 0x71 );
52
53 static const GUID __KSDATAFORMAT_SUBTYPE_IEEE_FLOAT = {WAVE_FORMAT_IEEE_FLOAT, 0x0000, 0x0010, {0x80, 0x00, 0x00, 0xaa, 0x00, 0x38, 0x9b, 0x71}};
54 static const GUID __KSDATAFORMAT_SUBTYPE_PCM = {WAVE_FORMAT_PCM, 0x0000, 0x0010, {0x80, 0x00, 0x00, 0xaa, 0x00, 0x38, 0x9b, 0x71}};
55 static const GUID __KSDATAFORMAT_SUBTYPE_DOLBY_AC3_SPDIF = {WAVE_FORMAT_DOLBY_AC3_SPDIF, 0x0000, 0x0010, {0x80, 0x00, 0x00, 0xaa, 0x00, 0x38, 0x9b, 0x71}};
56
57
58 #define FRAMES_NUM 8                                      /* Needs to be > 3 */
59
60 #ifndef _WAVEFORMATEXTENSIBLE_
61 typedef struct {
62     WAVEFORMATEX    Format;
63     union {
64         WORD wValidBitsPerSample;       /* bits of precision  */
65         WORD wSamplesPerBlock;          /* valid if wBitsPerSample==0 */
66         WORD wReserved;                 /* If neither applies, set to zero. */
67     } Samples;
68     DWORD           dwChannelMask;      /* which channels are */
69                                         /* present in stream  */
70     GUID            SubFormat;
71 } WAVEFORMATEXTENSIBLE, *PWAVEFORMATEXTENSIBLE;
72 #endif
73
74
75 #include <dsound.h>
76
77 #ifndef SPEAKER_FRONT_LEFT
78 #   define SPEAKER_FRONT_LEFT             0x1
79 #   define SPEAKER_FRONT_RIGHT            0x2
80 #   define SPEAKER_FRONT_CENTER           0x4
81 #   define SPEAKER_LOW_FREQUENCY          0x8
82 #   define SPEAKER_BACK_LEFT              0x10
83 #   define SPEAKER_BACK_RIGHT             0x20
84 #   define SPEAKER_FRONT_LEFT_OF_CENTER   0x40
85 #   define SPEAKER_FRONT_RIGHT_OF_CENTER  0x80
86 #   define SPEAKER_BACK_CENTER            0x100
87 #   define SPEAKER_SIDE_LEFT              0x200
88 #   define SPEAKER_SIDE_RIGHT             0x400
89 #   define SPEAKER_TOP_CENTER             0x800
90 #   define SPEAKER_TOP_FRONT_LEFT         0x1000
91 #   define SPEAKER_TOP_FRONT_CENTER       0x2000
92 #   define SPEAKER_TOP_FRONT_RIGHT        0x4000
93 #   define SPEAKER_TOP_BACK_LEFT          0x8000
94 #   define SPEAKER_TOP_BACK_CENTER        0x10000
95 #   define SPEAKER_TOP_BACK_RIGHT         0x20000
96 #   define SPEAKER_RESERVED               0x80000000
97 #endif
98
99 #ifndef DSSPEAKER_DSSPEAKER_DIRECTOUT
100 #   define DSSPEAKER_DSSPEAKER_DIRECTOUT         0x00000000
101 #endif
102 #ifndef DSSPEAKER_HEADPHONE
103 #   define DSSPEAKER_HEADPHONE         0x00000001
104 #endif
105 #ifndef DSSPEAKER_MONO
106 #   define DSSPEAKER_MONO              0x00000002
107 #endif
108 #ifndef DSSPEAKER_QUAD
109 #   define DSSPEAKER_QUAD              0x00000003
110 #endif
111 #ifndef DSSPEAKER_STEREO
112 #   define DSSPEAKER_STEREO            0x00000004
113 #endif
114 #ifndef DSSPEAKER_SURROUND
115 #   define DSSPEAKER_SURROUND          0x00000005
116 #endif
117 #ifndef DSSPEAKER_5POINT1
118 #   define DSSPEAKER_5POINT1           0x00000006
119 #endif
120 #ifndef DSSPEAKER_7POINT1
121 #   define DSSPEAKER_7POINT1           0x00000007
122 #endif
123 #ifndef DSSPEAKER_7POINT1_SURROUND
124 #   define DSSPEAKER_7POINT1_SURROUND           0x00000008
125 #endif
126 #ifndef DSSPEAKER_7POINT1_WIDE
127 #   define DSSPEAKER_7POINT1_WIDE           DSSPEAKER_7POINT1
128 #endif
129
130 static const uint32_t pi_channels_src[] =
131     { AOUT_CHAN_LEFT, AOUT_CHAN_RIGHT,
132       AOUT_CHAN_MIDDLELEFT, AOUT_CHAN_MIDDLERIGHT,
133       AOUT_CHAN_REARLEFT, AOUT_CHAN_REARRIGHT, AOUT_CHAN_REARCENTER,
134       AOUT_CHAN_CENTER, AOUT_CHAN_LFE, 0 };
135 static const uint32_t pi_channels_in[] =
136     { SPEAKER_FRONT_LEFT, SPEAKER_FRONT_RIGHT,
137       SPEAKER_SIDE_LEFT, SPEAKER_SIDE_RIGHT,
138       SPEAKER_BACK_LEFT, SPEAKER_BACK_RIGHT, SPEAKER_BACK_CENTER,
139       SPEAKER_FRONT_CENTER, SPEAKER_LOW_FREQUENCY, 0 };
140 static const uint32_t pi_channels_out[] =
141     { SPEAKER_FRONT_LEFT, SPEAKER_FRONT_RIGHT,
142       SPEAKER_FRONT_CENTER, SPEAKER_LOW_FREQUENCY,
143       SPEAKER_BACK_LEFT, SPEAKER_BACK_RIGHT,
144       SPEAKER_BACK_CENTER,
145       SPEAKER_SIDE_LEFT, SPEAKER_SIDE_RIGHT, 0 };
146
147 #define FLOAT_TEXT N_("Use float32 output")
148 #define FLOAT_LONGTEXT N_( \
149     "The option allows you to enable or disable the high-quality float32 " \
150     "audio output mode (which is not well supported by some soundcards)." )
151