Skip to content
This repository has been archived by the owner on Nov 20, 2024. It is now read-only.

Commit

Permalink
Minor updates for XAudio2Sound3D
Browse files Browse the repository at this point in the history
  • Loading branch information
walbourn committed Aug 20, 2022
1 parent 9eb639b commit 8e66574
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 2 deletions.
8 changes: 7 additions & 1 deletion XAudio2/XAudio2Sound3D/audio.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -314,7 +314,11 @@ HRESULT InitAudio()

g_audioState.emitter.ChannelCount = INPUTCHANNELS;
g_audioState.emitter.ChannelRadius = 1.0f;
g_audioState.emitter.pChannelAzimuths = g_audioState.emitterAzimuths;

static_assert(INPUTCHANNELS == 1 || g_audioState.emitter.pChannelAzimuths != nullptr, "Multi-channel sources require emitter azimuths");
// For examples of how to configure emitter azimuths for multi-channel sources, see DirectX Tool Kit for Audio
// helper method AudioEmitter::EnableDefaultMultiChannel
// http://go.microsoft.com/fwlink/?LinkId=248929

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

assert(pwfx->nChannels == INPUTCHANNELS);

//
// Play the wave using a source voice that sends to both the submix and mastering voices
//
Expand Down
1 change: 0 additions & 1 deletion XAudio2/XAudio2Sound3D/audio.h
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,6 @@ struct AUDIO_STATE
bool fUseInnerRadius;
bool fUseRedirectToLFE;

FLOAT32 emitterAzimuths[INPUTCHANNELS];
FLOAT32 matrixCoefficients[INPUTCHANNELS * OUTPUTCHANNELS];
};

Expand Down

0 comments on commit 8e66574

Please sign in to comment.