The lockforprocess format in Xapo is influenced by the Ixaudiosubmixvoice bound to it. but seemingly only affect the number of channels and sampling rate, wherein the waveformatex.wbitspersample is the float type, 32bit, temporarily did not find how to modify this value. when creating Ixaudiosubmixvoice, the number of channels and the sampling rate are added, both of which flow to Xapo.associated with Ixaudiosubmixvoice::seteffectchain, here is the procedure (example from Microsoft DirectX SDK (June) \samples\c++\xaudio2\ Xaudio2basicsound):
1. Create Xapo:
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);
2. Create the required parameters for Submixvoice:
Xaudio2_effect_descriptor descriptor; Descriptor. Initialstate = true; Descriptor. Outputchannels = 2; Descriptor.peffect = Submixmyxapo; Xaudio2_effect_chain CHAIN; Chain. Effectcount = 1; Chain.peffectdescriptors = &descriptor;
3. Create a sub-mixer and set the number of channels and sample rate.
if (FAILED (Hr=pxaudio2->createsubmixvoice (&psubmixvoice2,1,44100,0,7)))//Set Number of channels (second parameter) and sample rate (third parameter) { wprintf (L "Failed creating Submix Voice:% #X \ n", hr); Safe_release (PXAudio2); CoUninitialize (); return 0; }
4. Connect:
Hr=psubmixvoice2->seteffectchain (&chain);//associated Xapo and Submixvoice
If you do not crawl the data in the Xapo, and the ixaudiovoice associated with it is already the last Submixvoice (Sourcevoice) associated with Mastervoice in the effect chain, or mastervoice, Then the sound can flow directly to the mastervoice, and sound quality is good. after the data is caught in the process in Xapo, it flows to a. wav file or to another player in its own package (only one ixaudiosourcevoice), then the header format of the file orixaudiosourcevoice format, you need the following:
The const waveformatex* pwfinfo pwfinfo;//is a m_pwfxex.format.wformattag= wave_format_extensible set by the outside;//need Attention M_ pwfxex.format.nchannels= pwfinfo->nchannels; m_pwfxex.format.cbsize= 22; M_pwfxex.format.wbitspersample= 32; Need Attention 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; Attention should be paid to m_pwfxex.subformat= ksdataformat_subtype_ieee_float; M_pwfxEx.Samples.wValidBitsPerSample = M_pwfxEx.Format.wBitsPerSample;
this way, you can ensure that the data in the file or the player plays the audio data without any noise. but save the file, 1 seconds of data is almost 348K, and temporarily do not know how to compress the data.
AC qq:1245178753This address: http://blog.csdn.net/u011417605/article/details/51250130
Xapo lockforprocess audio format settings and data processing