Skip to content
This repository was archived by the owner on May 22, 2025. It is now read-only.

Commit 8e66574

Browse files
committed
Minor updates for XAudio2Sound3D
1 parent 9eb639b commit 8e66574

File tree

2 files changed

+7
-2
lines changed

2 files changed

+7
-2
lines changed

XAudio2/XAudio2Sound3D/audio.cpp

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -314,7 +314,11 @@ HRESULT InitAudio()
314314

315315
g_audioState.emitter.ChannelCount = INPUTCHANNELS;
316316
g_audioState.emitter.ChannelRadius = 1.0f;
317-
g_audioState.emitter.pChannelAzimuths = g_audioState.emitterAzimuths;
317+
318+
static_assert(INPUTCHANNELS == 1 || g_audioState.emitter.pChannelAzimuths != nullptr, "Multi-channel sources require emitter azimuths");
319+
// For examples of how to configure emitter azimuths for multi-channel sources, see DirectX Tool Kit for Audio
320+
// helper method AudioEmitter::EnableDefaultMultiChannel
321+
// http://go.microsoft.com/fwlink/?LinkId=248929
318322

319323
// Use of Inner radius allows for smoother transitions as
320324
// a sound travels directly through, above, or below the listener.
@@ -380,6 +384,8 @@ HRESULT PrepareAudio( _In_z_ const LPCWSTR wavname )
380384
uint32_t waveSize;
381385
V_RETURN( LoadWAVAudioFromFile( strFilePath, g_audioState.waveData, &pwfx, &sampleData, &waveSize ) );
382386

387+
assert(pwfx->nChannels == INPUTCHANNELS);
388+
383389
//
384390
// Play the wave using a source voice that sends to both the submix and mastering voices
385391
//

XAudio2/XAudio2Sound3D/audio.h

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,6 @@ struct AUDIO_STATE
6161
bool fUseInnerRadius;
6262
bool fUseRedirectToLFE;
6363

64-
FLOAT32 emitterAzimuths[INPUTCHANNELS];
6564
FLOAT32 matrixCoefficients[INPUTCHANNELS * OUTPUTCHANNELS];
6665
};
6766

0 commit comments

Comments
 (0)