标签:
MyXAPO * SubmixMyXAPO=NULL; XAPO_REGISTRATION_PROPERTIES *ppRegistrationProperties; hr=XAudio2CreateReverb(&pXAPO); pXAPO->QueryInterface(__uuidof(IXAPO),(void**)&SubmixMyXAPO); SubmixMyXAPO->GetRegistrationProperties(&ppRegistrationProperties); SubmixMyXAPO->Release(); SubmixMyXAPO=new MyXAPO(ppRegistrationProperties);
XAUDIO2_EFFECT_DESCRIPTOR descriptor; descriptor.InitialState = true; descriptor.OutputChannels = 2; descriptor.pEffect = SubmixMyXAPO; XAUDIO2_EFFECT_CHAIN chain; chain.EffectCount = 1 ; chain.pEffectDescriptors = &descriptor;
if(FAILED(hr=pXAudio2->CreateSubmixVoice(&pSubMixVoice2,1,44100,0,7))) //设置通道数(第二个参数)和采样率(第三个参数) { wprintf( L"Failed creating submix voice: %#X\n", hr ); SAFE_RELEASE( pXAudio2 ); CoUninitialize(); return 0; }
hr=pSubMixVoice2->SetEffectChain(&chain);//关联XAPO和SubmixVoice
const WAVEFORMATEX* pWFInfo pWFInfo;//是由外部来设置的 m_pwfxEx.Format.wFormatTag = WAVE_FORMAT_EXTENSIBLE; //需要注意 m_pwfxEx.Format.nChannels = pWFInfo->nChannels; m_pwfxEx.Format.cbSize = 22; m_pwfxEx.Format.wBitsPerSample = 32; //需要注意 m_pwfxEx.Format.nBlockAlign = m_pwfxEx.Format.nChannels * (m_pwfxEx.Format.wBitsPerSample/8); m_pwfxEx.Format.nSamplesPerSec = pWFInfo->nSamplesPerSec; m_pwfxEx.Format.nAvgBytesPerSec = m_pwfxEx.Format.nSamplesPerSec * m_pwfxEx.Format.nBlockAlign; m_pwfxEx.dwChannelMask = 0; //需要注意 m_pwfxEx.SubFormat = KSDATAFORMAT_SUBTYPE_IEEE_FLOAT; m_pwfxEx.Samples.wValidBitsPerSample = m_pwfxEx.Format.wBitsPerSample;
XAPO中LockForProcess 音频格式设置以及数据处理后的音频格式
标签:
原文地址:http://blog.csdn.net/u011417605/article/details/51250130