本文整理汇总了C++中LPDIRECTSOUND8::GetSpeakerConfig方法的典型用法代码示例。如果您正苦于以下问题:C++ LPDIRECTSOUND8::GetSpeakerConfig方法的具体用法?C++ LPDIRECTSOUND8::GetSpeakerConfig怎么用?C++ LPDIRECTSOUND8::GetSpeakerConfig使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类LPDIRECTSOUND8
的用法示例。
在下文中一共展示了LPDIRECTSOUND8::GetSpeakerConfig方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: run
void DXAudioOutput::run() {
HRESULT hr;
DSBUFFERDESC dsbdesc;
WAVEFORMATEXTENSIBLE wfx;
WAVEFORMATEXTENSIBLE wfxSet;
int ns = 0;
unsigned int chanmasks[32];
LPDIRECTSOUND8 pDS = NULL;
LPDIRECTSOUNDBUFFER pDSBPrimary = NULL;
LPDIRECTSOUNDBUFFER pDSBOutput = NULL;
LPDIRECTSOUNDNOTIFY8 pDSNotify = NULL;
DWORD dwBufferSize;
DWORD dwLastWritePos;
DWORD dwLastPlayPos;
DWORD dwTotalPlayPos;
int iLastwriteblock;
LPVOID aptr1, aptr2;
DWORD nbytes1, nbytes2;
int playblock;
int nowriteblock;
DWORD dwPlayPosition, dwWritePosition;
unsigned int iByteSize;
bool bOk;
DWORD dwSpeakerConfig;
bool failed = false;
bOk = false;
DWORD dwMask = 0;
bool bHead = false;
ZeroMemory(&dsbdesc, sizeof(DSBUFFERDESC));
dsbdesc.dwSize = sizeof(DSBUFFERDESC);
dsbdesc.dwFlags = DSBCAPS_PRIMARYBUFFER;
if (! g.s.qbaDXOutput.isEmpty()) {
LPGUID lpguid = reinterpret_cast<LPGUID>(g.s.qbaDXOutput.data());
if (FAILED(hr = DirectSoundCreate8(lpguid, &pDS, NULL))) {
failed = true;
}
}
if (! pDS && FAILED(hr = DirectSoundCreate8(&DSDEVID_DefaultVoicePlayback, &pDS, NULL))) {
qWarning("DXAudioOutput: DirectSoundCreate failed: hr=0x%08lx", hr);
goto cleanup;
} else if (FAILED(hr = pDS->SetCooperativeLevel(g.mw->winId(), DSSCL_PRIORITY))) {
qWarning("DXAudioOutput: SetCooperativeLevel failed: hr=0x%08lx", hr);
goto cleanup;
} else if (FAILED(hr = pDS->CreateSoundBuffer(&dsbdesc, &pDSBPrimary, NULL))) {
qWarning("DXAudioOutput: CreateSoundBuffer (Primary) failed: hr=0x%08lx", hr);
goto cleanup;
}
pDS->GetSpeakerConfig(&dwSpeakerConfig);
switch (DSSPEAKER_CONFIG(dwSpeakerConfig)) {
case DSSPEAKER_HEADPHONE:
dwMask = KSAUDIO_SPEAKER_STEREO;
bHead = true;
break;
case DSSPEAKER_MONO:
dwMask = KSAUDIO_SPEAKER_MONO;
break;
case DSSPEAKER_QUAD:
dwMask = KSAUDIO_SPEAKER_QUAD;
break;
case DSSPEAKER_STEREO:
dwMask = KSAUDIO_SPEAKER_STEREO;
break;
case DSSPEAKER_SURROUND:
dwMask = KSAUDIO_SPEAKER_SURROUND;
break;
case DSSPEAKER_5POINT1:
dwMask = KSAUDIO_SPEAKER_5POINT1;
break;
case DSSPEAKER_7POINT1:
dwMask = KSAUDIO_SPEAKER_7POINT1;
break;
case DSSPEAKER_7POINT1_SURROUND:
dwMask = KSAUDIO_SPEAKER_7POINT1_SURROUND;
break;
case DSSPEAKER_5POINT1_SURROUND:
dwMask = KSAUDIO_SPEAKER_5POINT1_SURROUND;
break;
default:
dwMask = 0;
break;
}
if (! g.s.doPositionalAudio())
dwMask = KSAUDIO_SPEAKER_MONO;
for (int i=0;i<32;i++) {
if (dwMask & (1 << i)) {
//.........这里部分代码省略.........