author | Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com> |
Wed, 18 Aug 2010 10:37:55 +0300 | |
changeset 33 | 3e2da88830cd |
parent 30 | 5dc02b23752f |
permissions | -rw-r--r-- |
0 | 1 |
/**************************************************************************** |
2 |
** |
|
18
2f34d5167611
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
3
diff
changeset
|
3 |
** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). |
0 | 4 |
** All rights reserved. |
5 |
** Contact: Nokia Corporation (qt-info@nokia.com) |
|
6 |
** |
|
7 |
** This file is part of the QtMultimedia module of the Qt Toolkit. |
|
8 |
** |
|
9 |
** $QT_BEGIN_LICENSE:LGPL$ |
|
10 |
** No Commercial Usage |
|
11 |
** This file contains pre-release code and may not be distributed. |
|
12 |
** You may use this file in accordance with the terms and conditions |
|
13 |
** contained in the Technology Preview License Agreement accompanying |
|
14 |
** this package. |
|
15 |
** |
|
16 |
** GNU Lesser General Public License Usage |
|
17 |
** Alternatively, this file may be used under the terms of the GNU Lesser |
|
18 |
** General Public License version 2.1 as published by the Free Software |
|
19 |
** Foundation and appearing in the file LICENSE.LGPL included in the |
|
20 |
** packaging of this file. Please review the following information to |
|
21 |
** ensure the GNU Lesser General Public License version 2.1 requirements |
|
22 |
** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. |
|
23 |
** |
|
24 |
** In addition, as a special exception, Nokia gives you certain additional |
|
25 |
** rights. These rights are described in the Nokia Qt LGPL Exception |
|
26 |
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. |
|
27 |
** |
|
28 |
** If you have questions regarding the use of this file, please contact |
|
29 |
** Nokia at qt-info@nokia.com. |
|
30 |
** |
|
31 |
** |
|
32 |
** |
|
33 |
** |
|
34 |
** |
|
35 |
** |
|
36 |
** |
|
37 |
** |
|
38 |
** $QT_END_LICENSE$ |
|
39 |
** |
|
40 |
****************************************************************************/ |
|
41 |
||
42 |
// |
|
43 |
// W A R N I N G |
|
44 |
// ------------- |
|
45 |
// |
|
46 |
// This file is not part of the Qt API. It exists for the convenience |
|
47 |
// of other Qt classes. This header file may change from version to |
|
48 |
// version without notice, or even be removed. |
|
49 |
// |
|
50 |
// We mean it. |
|
51 |
// |
|
52 |
||
53 |
||
54 |
#include <windows.h> |
|
55 |
#include <mmsystem.h> |
|
56 |
#include "qaudiodeviceinfo_win32_p.h" |
|
57 |
||
58 |
QT_BEGIN_NAMESPACE |
|
59 |
||
60 |
// For mingw toolchain mmsystem.h only defines half the defines, so add if needed. |
|
61 |
#ifndef WAVE_FORMAT_44M08 |
|
62 |
#define WAVE_FORMAT_44M08 0x00000100 |
|
63 |
#define WAVE_FORMAT_44S08 0x00000200 |
|
64 |
#define WAVE_FORMAT_44M16 0x00000400 |
|
65 |
#define WAVE_FORMAT_44S16 0x00000800 |
|
66 |
#define WAVE_FORMAT_48M08 0x00001000 |
|
67 |
#define WAVE_FORMAT_48S08 0x00002000 |
|
68 |
#define WAVE_FORMAT_48M16 0x00004000 |
|
69 |
#define WAVE_FORMAT_48S16 0x00008000 |
|
70 |
#define WAVE_FORMAT_96M08 0x00010000 |
|
71 |
#define WAVE_FORMAT_96S08 0x00020000 |
|
72 |
#define WAVE_FORMAT_96M16 0x00040000 |
|
73 |
#define WAVE_FORMAT_96S16 0x00080000 |
|
74 |
#endif |
|
75 |
||
76 |
||
77 |
QAudioDeviceInfoInternal::QAudioDeviceInfoInternal(QByteArray dev, QAudio::Mode mode) |
|
78 |
{ |
|
79 |
device = QLatin1String(dev); |
|
80 |
this->mode = mode; |
|
22
79de32ba3296
Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
18
diff
changeset
|
81 |
|
79de32ba3296
Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
18
diff
changeset
|
82 |
updateLists(); |
0 | 83 |
} |
84 |
||
85 |
QAudioDeviceInfoInternal::~QAudioDeviceInfoInternal() |
|
86 |
{ |
|
87 |
close(); |
|
88 |
} |
|
89 |
||
90 |
bool QAudioDeviceInfoInternal::isFormatSupported(const QAudioFormat& format) const |
|
91 |
{ |
|
92 |
return testSettings(format); |
|
93 |
} |
|
94 |
||
95 |
QAudioFormat QAudioDeviceInfoInternal::preferredFormat() const |
|
96 |
{ |
|
97 |
QAudioFormat nearest; |
|
98 |
if(mode == QAudio::AudioOutput) { |
|
99 |
nearest.setFrequency(44100); |
|
30
5dc02b23752f
Revision: 201025
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
22
diff
changeset
|
100 |
nearest.setChannelCount(2); |
0 | 101 |
nearest.setByteOrder(QAudioFormat::LittleEndian); |
102 |
nearest.setSampleType(QAudioFormat::SignedInt); |
|
103 |
nearest.setSampleSize(16); |
|
104 |
nearest.setCodec(QLatin1String("audio/pcm")); |
|
105 |
} else { |
|
106 |
nearest.setFrequency(11025); |
|
30
5dc02b23752f
Revision: 201025
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
22
diff
changeset
|
107 |
nearest.setChannelCount(1); |
3
41300fa6a67c
Revision: 201003
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
108 |
nearest.setByteOrder(QAudioFormat::LittleEndian); |
0 | 109 |
nearest.setSampleType(QAudioFormat::SignedInt); |
110 |
nearest.setSampleSize(8); |
|
111 |
nearest.setCodec(QLatin1String("audio/pcm")); |
|
112 |
} |
|
113 |
return nearest; |
|
114 |
} |
|
115 |
||
116 |
QAudioFormat QAudioDeviceInfoInternal::nearestFormat(const QAudioFormat& format) const |
|
117 |
{ |
|
118 |
if(testSettings(format)) |
|
119 |
return format; |
|
120 |
else |
|
121 |
return preferredFormat(); |
|
122 |
} |
|
123 |
||
124 |
QString QAudioDeviceInfoInternal::deviceName() const |
|
125 |
{ |
|
126 |
return device; |
|
127 |
} |
|
128 |
||
129 |
QStringList QAudioDeviceInfoInternal::codecList() |
|
130 |
{ |
|
131 |
updateLists(); |
|
132 |
return codecz; |
|
133 |
} |
|
134 |
||
135 |
QList<int> QAudioDeviceInfoInternal::frequencyList() |
|
136 |
{ |
|
137 |
updateLists(); |
|
138 |
return freqz; |
|
139 |
} |
|
140 |
||
141 |
QList<int> QAudioDeviceInfoInternal::channelsList() |
|
142 |
{ |
|
143 |
updateLists(); |
|
144 |
return channelz; |
|
145 |
} |
|
146 |
||
147 |
QList<int> QAudioDeviceInfoInternal::sampleSizeList() |
|
148 |
{ |
|
149 |
updateLists(); |
|
150 |
return sizez; |
|
151 |
} |
|
152 |
||
153 |
QList<QAudioFormat::Endian> QAudioDeviceInfoInternal::byteOrderList() |
|
154 |
{ |
|
155 |
updateLists(); |
|
156 |
return byteOrderz; |
|
157 |
} |
|
158 |
||
159 |
QList<QAudioFormat::SampleType> QAudioDeviceInfoInternal::sampleTypeList() |
|
160 |
{ |
|
161 |
updateLists(); |
|
162 |
return typez; |
|
163 |
} |
|
164 |
||
165 |
||
166 |
bool QAudioDeviceInfoInternal::open() |
|
167 |
{ |
|
168 |
return true; |
|
169 |
} |
|
170 |
||
171 |
void QAudioDeviceInfoInternal::close() |
|
172 |
{ |
|
173 |
} |
|
174 |
||
175 |
bool QAudioDeviceInfoInternal::testSettings(const QAudioFormat& format) const |
|
176 |
{ |
|
177 |
// Set nearest to closest settings that do work. |
|
178 |
// See if what is in settings will work (return value). |
|
179 |
||
180 |
bool failed = false; |
|
22
79de32ba3296
Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
18
diff
changeset
|
181 |
bool match = false; |
0 | 182 |
|
22
79de32ba3296
Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
18
diff
changeset
|
183 |
// check codec |
79de32ba3296
Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
18
diff
changeset
|
184 |
for( int i = 0; i < codecz.count(); i++) { |
79de32ba3296
Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
18
diff
changeset
|
185 |
if (format.codec() == codecz.at(i)) |
79de32ba3296
Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
18
diff
changeset
|
186 |
match = true; |
79de32ba3296
Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
18
diff
changeset
|
187 |
} |
79de32ba3296
Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
18
diff
changeset
|
188 |
if (!match) failed = true; |
0 | 189 |
|
22
79de32ba3296
Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
18
diff
changeset
|
190 |
// check channel |
79de32ba3296
Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
18
diff
changeset
|
191 |
match = false; |
79de32ba3296
Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
18
diff
changeset
|
192 |
if (!failed) { |
79de32ba3296
Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
18
diff
changeset
|
193 |
for( int i = 0; i < channelz.count(); i++) { |
79de32ba3296
Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
18
diff
changeset
|
194 |
if (format.channels() == channelz.at(i)) { |
79de32ba3296
Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
18
diff
changeset
|
195 |
match = true; |
79de32ba3296
Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
18
diff
changeset
|
196 |
break; |
79de32ba3296
Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
18
diff
changeset
|
197 |
} |
79de32ba3296
Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
18
diff
changeset
|
198 |
} |
79de32ba3296
Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
18
diff
changeset
|
199 |
} |
79de32ba3296
Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
18
diff
changeset
|
200 |
if (!match) failed = true; |
0 | 201 |
|
22
79de32ba3296
Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
18
diff
changeset
|
202 |
// check frequency |
79de32ba3296
Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
18
diff
changeset
|
203 |
match = false; |
79de32ba3296
Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
18
diff
changeset
|
204 |
if (!failed) { |
79de32ba3296
Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
18
diff
changeset
|
205 |
for( int i = 0; i < freqz.count(); i++) { |
79de32ba3296
Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
18
diff
changeset
|
206 |
if (format.frequency() == freqz.at(i)) { |
79de32ba3296
Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
18
diff
changeset
|
207 |
match = true; |
79de32ba3296
Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
18
diff
changeset
|
208 |
break; |
79de32ba3296
Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
18
diff
changeset
|
209 |
} |
79de32ba3296
Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
18
diff
changeset
|
210 |
} |
0 | 211 |
} |
212 |
||
22
79de32ba3296
Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
18
diff
changeset
|
213 |
// check sample size |
79de32ba3296
Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
18
diff
changeset
|
214 |
match = false; |
79de32ba3296
Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
18
diff
changeset
|
215 |
if (!failed) { |
79de32ba3296
Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
18
diff
changeset
|
216 |
for( int i = 0; i < sizez.count(); i++) { |
79de32ba3296
Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
18
diff
changeset
|
217 |
if (format.sampleSize() == sizez.at(i)) { |
79de32ba3296
Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
18
diff
changeset
|
218 |
match = true; |
79de32ba3296
Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
18
diff
changeset
|
219 |
break; |
79de32ba3296
Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
18
diff
changeset
|
220 |
} |
79de32ba3296
Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
18
diff
changeset
|
221 |
} |
79de32ba3296
Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
18
diff
changeset
|
222 |
} |
79de32ba3296
Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
18
diff
changeset
|
223 |
|
79de32ba3296
Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
18
diff
changeset
|
224 |
// check byte order |
79de32ba3296
Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
18
diff
changeset
|
225 |
match = false; |
79de32ba3296
Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
18
diff
changeset
|
226 |
if (!failed) { |
79de32ba3296
Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
18
diff
changeset
|
227 |
for( int i = 0; i < byteOrderz.count(); i++) { |
79de32ba3296
Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
18
diff
changeset
|
228 |
if (format.byteOrder() == byteOrderz.at(i)) { |
79de32ba3296
Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
18
diff
changeset
|
229 |
match = true; |
79de32ba3296
Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
18
diff
changeset
|
230 |
break; |
79de32ba3296
Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
18
diff
changeset
|
231 |
} |
79de32ba3296
Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
18
diff
changeset
|
232 |
} |
79de32ba3296
Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
18
diff
changeset
|
233 |
} |
79de32ba3296
Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
18
diff
changeset
|
234 |
|
79de32ba3296
Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
18
diff
changeset
|
235 |
// check sample type |
79de32ba3296
Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
18
diff
changeset
|
236 |
match = false; |
79de32ba3296
Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
18
diff
changeset
|
237 |
if (!failed) { |
79de32ba3296
Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
18
diff
changeset
|
238 |
for( int i = 0; i < typez.count(); i++) { |
79de32ba3296
Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
18
diff
changeset
|
239 |
if (format.sampleType() == typez.at(i)) { |
79de32ba3296
Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
18
diff
changeset
|
240 |
match = true; |
79de32ba3296
Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
18
diff
changeset
|
241 |
break; |
79de32ba3296
Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
18
diff
changeset
|
242 |
} |
79de32ba3296
Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
18
diff
changeset
|
243 |
} |
79de32ba3296
Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
18
diff
changeset
|
244 |
} |
0 | 245 |
|
246 |
if(!failed) { |
|
247 |
// settings work |
|
248 |
return true; |
|
249 |
} |
|
250 |
return false; |
|
251 |
} |
|
252 |
||
253 |
void QAudioDeviceInfoInternal::updateLists() |
|
254 |
{ |
|
255 |
// redo all lists based on current settings |
|
256 |
bool base = false; |
|
257 |
bool match = false; |
|
258 |
DWORD fmt = NULL; |
|
259 |
QString tmp; |
|
260 |
||
261 |
if(device.compare(QLatin1String("default")) == 0) |
|
262 |
base = true; |
|
263 |
||
264 |
if(mode == QAudio::AudioOutput) { |
|
265 |
WAVEOUTCAPS woc; |
|
266 |
unsigned long iNumDevs,i; |
|
267 |
iNumDevs = waveOutGetNumDevs(); |
|
268 |
for(i=0;i<iNumDevs;i++) { |
|
269 |
if(waveOutGetDevCaps(i, &woc, sizeof(WAVEOUTCAPS)) |
|
270 |
== MMSYSERR_NOERROR) { |
|
30
5dc02b23752f
Revision: 201025
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
22
diff
changeset
|
271 |
tmp = QString((const QChar *)woc.szPname); |
0 | 272 |
if(tmp.compare(device) == 0) { |
273 |
match = true; |
|
274 |
fmt = woc.dwFormats; |
|
275 |
break; |
|
276 |
} |
|
277 |
if(base) { |
|
278 |
match = true; |
|
279 |
fmt = woc.dwFormats; |
|
280 |
break; |
|
281 |
} |
|
282 |
} |
|
283 |
} |
|
284 |
} else { |
|
285 |
WAVEINCAPS woc; |
|
286 |
unsigned long iNumDevs,i; |
|
287 |
iNumDevs = waveInGetNumDevs(); |
|
288 |
for(i=0;i<iNumDevs;i++) { |
|
289 |
if(waveInGetDevCaps(i, &woc, sizeof(WAVEINCAPS)) |
|
290 |
== MMSYSERR_NOERROR) { |
|
30
5dc02b23752f
Revision: 201025
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
22
diff
changeset
|
291 |
tmp = QString((const QChar *)woc.szPname); |
0 | 292 |
if(tmp.compare(device) == 0) { |
293 |
match = true; |
|
294 |
fmt = woc.dwFormats; |
|
295 |
break; |
|
296 |
} |
|
297 |
if(base) { |
|
298 |
match = true; |
|
299 |
fmt = woc.dwFormats; |
|
300 |
break; |
|
301 |
} |
|
302 |
} |
|
303 |
} |
|
304 |
} |
|
305 |
sizez.clear(); |
|
306 |
freqz.clear(); |
|
307 |
channelz.clear(); |
|
308 |
byteOrderz.clear(); |
|
309 |
typez.clear(); |
|
310 |
codecz.clear(); |
|
311 |
||
312 |
if(match) { |
|
313 |
if((fmt && WAVE_FORMAT_1M08) |
|
314 |
|| (fmt && WAVE_FORMAT_1S08) |
|
315 |
|| (fmt && WAVE_FORMAT_2M08) |
|
316 |
|| (fmt && WAVE_FORMAT_2S08) |
|
317 |
|| (fmt && WAVE_FORMAT_4M08) |
|
318 |
|| (fmt && WAVE_FORMAT_4S08) |
|
319 |
#ifndef Q_OS_WINCE |
|
320 |
|| (fmt && WAVE_FORMAT_48M08) |
|
321 |
|| (fmt && WAVE_FORMAT_48S08) |
|
322 |
|| (fmt && WAVE_FORMAT_96M08) |
|
323 |
|| (fmt && WAVE_FORMAT_96S08) |
|
324 |
#endif |
|
325 |
) { |
|
326 |
sizez.append(8); |
|
327 |
} |
|
328 |
if((fmt && WAVE_FORMAT_1M16) |
|
329 |
|| (fmt && WAVE_FORMAT_1S16) |
|
330 |
|| (fmt && WAVE_FORMAT_2M16) |
|
331 |
|| (fmt && WAVE_FORMAT_2S16) |
|
332 |
|| (fmt && WAVE_FORMAT_4M16) |
|
333 |
|| (fmt && WAVE_FORMAT_4S16) |
|
334 |
#ifndef Q_OS_WINCE |
|
335 |
|| (fmt && WAVE_FORMAT_48M16) |
|
336 |
|| (fmt && WAVE_FORMAT_48S16) |
|
337 |
|| (fmt && WAVE_FORMAT_96M16) |
|
338 |
|| (fmt && WAVE_FORMAT_96S16) |
|
339 |
#endif |
|
340 |
) { |
|
341 |
sizez.append(16); |
|
342 |
} |
|
343 |
if((fmt && WAVE_FORMAT_1M08) |
|
344 |
|| (fmt && WAVE_FORMAT_1S08) |
|
345 |
|| (fmt && WAVE_FORMAT_1M16) |
|
346 |
|| (fmt && WAVE_FORMAT_1S16)) { |
|
347 |
freqz.append(11025); |
|
348 |
} |
|
349 |
if((fmt && WAVE_FORMAT_2M08) |
|
350 |
|| (fmt && WAVE_FORMAT_2S08) |
|
351 |
|| (fmt && WAVE_FORMAT_2M16) |
|
352 |
|| (fmt && WAVE_FORMAT_2S16)) { |
|
353 |
freqz.append(22050); |
|
354 |
} |
|
355 |
if((fmt && WAVE_FORMAT_4M08) |
|
356 |
|| (fmt && WAVE_FORMAT_4S08) |
|
357 |
|| (fmt && WAVE_FORMAT_4M16) |
|
358 |
|| (fmt && WAVE_FORMAT_4S16)) { |
|
359 |
freqz.append(44100); |
|
360 |
} |
|
361 |
#ifndef Q_OS_WINCE |
|
362 |
if((fmt && WAVE_FORMAT_48M08) |
|
363 |
|| (fmt && WAVE_FORMAT_48S08) |
|
364 |
|| (fmt && WAVE_FORMAT_48M16) |
|
365 |
|| (fmt && WAVE_FORMAT_48S16)) { |
|
366 |
freqz.append(48000); |
|
367 |
} |
|
368 |
if((fmt && WAVE_FORMAT_96M08) |
|
369 |
|| (fmt && WAVE_FORMAT_96S08) |
|
370 |
|| (fmt && WAVE_FORMAT_96M16) |
|
371 |
|| (fmt && WAVE_FORMAT_96S16)) { |
|
372 |
freqz.append(96000); |
|
373 |
} |
|
374 |
#endif |
|
375 |
channelz.append(1); |
|
376 |
channelz.append(2); |
|
33
3e2da88830cd
Revision: 201031
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
30
diff
changeset
|
377 |
if (mode == QAudio::AudioOutput) { |
3e2da88830cd
Revision: 201031
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
30
diff
changeset
|
378 |
channelz.append(4); |
3e2da88830cd
Revision: 201031
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
30
diff
changeset
|
379 |
channelz.append(6); |
3e2da88830cd
Revision: 201031
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
30
diff
changeset
|
380 |
channelz.append(8); |
3e2da88830cd
Revision: 201031
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
30
diff
changeset
|
381 |
} |
0 | 382 |
|
383 |
byteOrderz.append(QAudioFormat::LittleEndian); |
|
384 |
||
385 |
typez.append(QAudioFormat::SignedInt); |
|
386 |
typez.append(QAudioFormat::UnSignedInt); |
|
387 |
||
388 |
codecz.append(QLatin1String("audio/pcm")); |
|
389 |
} |
|
22
79de32ba3296
Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
18
diff
changeset
|
390 |
if (freqz.count() > 0) |
79de32ba3296
Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
18
diff
changeset
|
391 |
freqz.prepend(8000); |
0 | 392 |
} |
393 |
||
3
41300fa6a67c
Revision: 201003
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
394 |
QList<QByteArray> QAudioDeviceInfoInternal::availableDevices(QAudio::Mode mode) |
0 | 395 |
{ |
396 |
Q_UNUSED(mode) |
|
397 |
||
398 |
QList<QByteArray> devices; |
|
399 |
||
400 |
if(mode == QAudio::AudioOutput) { |
|
401 |
WAVEOUTCAPS woc; |
|
402 |
unsigned long iNumDevs,i; |
|
403 |
iNumDevs = waveOutGetNumDevs(); |
|
404 |
for(i=0;i<iNumDevs;i++) { |
|
405 |
if(waveOutGetDevCaps(i, &woc, sizeof(WAVEOUTCAPS)) |
|
406 |
== MMSYSERR_NOERROR) { |
|
30
5dc02b23752f
Revision: 201025
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
22
diff
changeset
|
407 |
devices.append(QString((const QChar *)woc.szPname).toLocal8Bit().constData()); |
0 | 408 |
} |
409 |
} |
|
410 |
} else { |
|
411 |
WAVEINCAPS woc; |
|
412 |
unsigned long iNumDevs,i; |
|
413 |
iNumDevs = waveInGetNumDevs(); |
|
414 |
for(i=0;i<iNumDevs;i++) { |
|
415 |
if(waveInGetDevCaps(i, &woc, sizeof(WAVEINCAPS)) |
|
416 |
== MMSYSERR_NOERROR) { |
|
30
5dc02b23752f
Revision: 201025
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
22
diff
changeset
|
417 |
devices.append(QString((const QChar *)woc.szPname).toLocal8Bit().constData()); |
0 | 418 |
} |
419 |
} |
|
420 |
||
421 |
} |
|
422 |
if(devices.count() > 0) |
|
423 |
devices.append("default"); |
|
424 |
||
425 |
return devices; |
|
426 |
} |
|
427 |
||
428 |
QByteArray QAudioDeviceInfoInternal::defaultOutputDevice() |
|
429 |
{ |
|
430 |
return QByteArray("default"); |
|
431 |
} |
|
432 |
||
433 |
QByteArray QAudioDeviceInfoInternal::defaultInputDevice() |
|
434 |
{ |
|
435 |
return QByteArray("default"); |
|
436 |
} |
|
437 |
||
438 |
QT_END_NAMESPACE |