10 #define LOC QString("AOWin: ")
12 #ifndef WAVE_FORMAT_IEEE_FLOAT
13 #define WAVE_FORMAT_IEEE_FLOAT 0x0003
16 #ifndef WAVE_FORMAT_DOLBY_AC3_SPDIF
17 #define WAVE_FORMAT_DOLBY_AC3_SPDIF 0x0092
20 #ifndef WAVE_FORMAT_EXTENSIBLE
21 #define WAVE_FORMAT_EXTENSIBLE 0xFFFE
24 #ifndef _WAVEFORMATEXTENSIBLE_
41 0x0000, 0x0010, 0x80, 0x00, 0x00, 0xaa, 0x00, 0x38, 0x9b, 0x71);
42 DEFINE_GUID(_KSDATAFORMAT_SUBTYPE_PCM, WAVE_FORMAT_PCM,
43 0x0000, 0x0010, 0x80, 0x00, 0x00, 0xaa, 0x00, 0x38, 0x9b, 0x71);
45 0x0000, 0x0010, 0x80, 0x00, 0x00, 0xaa, 0x00, 0x38, 0x9b, 0x71);
54 m_hEvent = CreateEvent(
nullptr, FALSE, TRUE,
nullptr);
81 static void CALLBACK
waveOutProc(HWAVEOUT hwo, UINT uMsg, DWORD dwInstance,
82 DWORD dwParam1, DWORD dwParam2);
96 DWORD dwParam1, DWORD dwParam2)
102 if (uMsg != WOM_DONE)
106 InterlockedDecrement(&instance->
m_nPkts);
116 m_UseSPDIF(settings.m_usePassthru)
151 while (DWORD rate = (DWORD)settings->
GetNextRate())
157 #if 0 // 24-bit integer is not supported
160 #if 0 // 32-bit integer (OGG) is not supported on all platforms.
163 #if 0 // 32-bit floating point (AC3) is not supported on all platforms.
168 for (
uint i = 2; i < 7; i++)
184 VBAUDIO(QString(
"Buffering %1 fragments of %2 bytes each, total: %3 bytes")
201 wf.
SubFormat = _KSDATAFORMAT_SUBTYPE_DOLBY_AC3_SPDIF;
206 wf.
SubFormat = _KSDATAFORMAT_SUBTYPE_IEEE_FLOAT;
210 wf.
Format.wFormatTag = WAVE_FORMAT_PCM;
211 wf.
SubFormat = _KSDATAFORMAT_SUBTYPE_PCM;
214 VBAUDIO(QString(
"New format: %1bits %2ch %3Hz %4")
231 (intptr_t)
this, CALLBACK_FUNCTION);
233 if (mmr == WAVERR_BADFORMAT)
235 Error(QString(
"Unable to set audio output parameters %1")
236 .arg(wf.Format.nSamplesPerSec));
263 if (wh->dwFlags & WHDR_PREPARED)
271 memset(wh, 0,
sizeof(WAVEHDR));
273 wh->dwBufferLength = size;
277 VBERROR(
"WriteAudio: failed to prepare header");
280 VBERROR(
"WriteAudio: failed to write packet");
292 DWORD dwVolume = 0xffffffff;
294 if (MMSYSERR_NOERROR == waveOutGetVolume((HWAVEOUT)WAVE_MAPPER, &dwVolume))
296 Volume = (channel == 0) ?
297 (LOWORD(dwVolume) / (0xffff / 100)) :
298 (HIWORD(dwVolume) / (0xffff / 100));
301 LOG(VB_AUDIO, LOG_INFO, QString(
"GetVolume(%1) %2 (%3)")
302 .arg(channel).arg(Volume).arg(dwVolume));
310 VBERROR(
"Windows volume only supports stereo!");
312 DWORD dwVolume = 0xffffffff;
313 if (MMSYSERR_NOERROR == waveOutGetVolume((HWAVEOUT)WAVE_MAPPER, &dwVolume))
316 dwVolume = (dwVolume & 0xffff0000) | (volume * (0xffff / 100));
318 dwVolume = (dwVolume & 0xffff) | ((volume * (0xffff / 100)) << 16);
322 dwVolume = volume * (0xffff / 100);
323 dwVolume |= (dwVolume << 16);
326 VBAUDIO(QString(
"SetVolume(%1) %2(%3)")
327 .arg(channel).arg(volume).arg(dwVolume));
329 waveOutSetVolume((HWAVEOUT)WAVE_MAPPER, dwVolume);