Tweaking audio params.

This commit is contained in:
Ben Vanik 2014-01-13 00:45:09 -08:00
parent 133cbedad8
commit dccdc00735
1 changed files with 4 additions and 3 deletions

View File

@ -84,7 +84,7 @@ void XAudio2AudioSystem::Initialize() {
waveformat.Format.wFormatTag = WAVE_FORMAT_EXTENSIBLE; waveformat.Format.wFormatTag = WAVE_FORMAT_EXTENSIBLE;
waveformat.SubFormat = KSDATAFORMAT_SUBTYPE_IEEE_FLOAT; waveformat.SubFormat = KSDATAFORMAT_SUBTYPE_IEEE_FLOAT;
waveformat.Format.nChannels = 6; waveformat.Format.nChannels = 6;
waveformat.Format.nSamplesPerSec = 44100; waveformat.Format.nSamplesPerSec = 48000;
waveformat.Format.wBitsPerSample = 32; waveformat.Format.wBitsPerSample = 32;
waveformat.Format.nBlockAlign = (waveformat.Format.nChannels * waveformat.Format.wBitsPerSample) / 8; // 4 waveformat.Format.nBlockAlign = (waveformat.Format.nChannels * waveformat.Format.wBitsPerSample) / 8; // 4
waveformat.Format.nAvgBytesPerSec = waveformat.Format.nSamplesPerSec * waveformat.Format.nBlockAlign; // 44100 * 4 waveformat.Format.nAvgBytesPerSec = waveformat.Format.nSamplesPerSec * waveformat.Format.nBlockAlign; // 44100 * 4
@ -95,7 +95,8 @@ void XAudio2AudioSystem::Initialize() {
SPEAKER_LOW_FREQUENCY | SPEAKER_LOW_FREQUENCY |
SPEAKER_BACK_LEFT | SPEAKER_BACK_RIGHT; SPEAKER_BACK_LEFT | SPEAKER_BACK_RIGHT;
hr = audio_->CreateSourceVoice( hr = audio_->CreateSourceVoice(
&pcm_voice_, (WAVEFORMATEX*)&waveformat, 0, XAUDIO2_DEFAULT_FREQ_RATIO, &pcm_voice_, (WAVEFORMATEX*)&waveformat,
XAUDIO2_VOICE_NOPITCH | XAUDIO2_VOICE_NOSRC, XAUDIO2_DEFAULT_FREQ_RATIO,
voice_callback_); voice_callback_);
if (FAILED(hr)) { if (FAILED(hr)) {
XELOGE("CreateSourceVoice failed with %.8X", hr); XELOGE("CreateSourceVoice failed with %.8X", hr);
@ -112,7 +113,7 @@ void XAudio2AudioSystem::Pump() {
XAUDIO2_VOICE_STATE state; XAUDIO2_VOICE_STATE state;
pcm_voice_->GetState(&state); pcm_voice_->GetState(&state);
auto n = state.BuffersQueued; auto n = state.BuffersQueued;
if (n > 30) { if (n > 60) {
// A lot of buffers are queued up, and until we use them block. // A lot of buffers are queued up, and until we use them block.
ResetEvent(wait_handle_); ResetEvent(wait_handle_);
} }