About the WAV to WMA of audio ?
-
I wrote a code of WAV(C:\\InputFile.wav) to WMA(C:\\OutputFile.wma) of the audio,but it was distempered.Please give a help,thank you in advance. The following is my code:
// Include libraries. #include #include #include #include "D:\WMSDK\WMEncSDK9\include\wmencode.h" #include // for kbhit() void main() { // Declare variables. HRESULT hr; IWMEncoder* pEncoder; IWMEncSourceGroupCollection* pSrcGrpColl; IWMEncSourceGroup* pSrcGrp; IWMEncSource* pSrc; IWMEncVideoSource* pSrcVid; IWMEncAudioSource* pSrcAud; IPropertyBag* pPropertyBag; IWMEncProfileCollection* pProColl; IWMEncProfile* pPro; IWMEncFile* pFile; IWMEncAttributes* pAttr; IWMEncDisplayInfo* pDispInfo; CComBSTR bstrName = NULL; long lCount; int i; // Initialize the COM library and retrieve a pointer to an IWMEncoder interface. hr = CoInitialize(NULL); if ( SUCCEEDED( hr ) ) { hr = CoCreateInstance(CLSID_WMEncoder, NULL, CLSCTX_INPROC_SERVER, IID_IWMEncoder, (void**) &pEncoder); } // Retrieve the source group collection. if ( SUCCEEDED( hr ) ) { hr = pEncoder->get_SourceGroupCollection(&pSrcGrpColl); } // Add a source group to the collection. if ( SUCCEEDED( hr ) ) { hr = pSrcGrpColl->Add(CComBSTR("SG_1"), &pSrcGrp); } if ( SUCCEEDED( hr ) ) { hr = pSrcGrp->AddSource(WMENC_AUDIO, &pSrc); } if ( SUCCEEDED( hr ) ) { hr = pSrc->QueryInterface(IID_IWMEncAudioSource, (void**)&pSrcAud); } if ( SUCCEEDED( hr ) ) { hr = pSrcAud->SetInput(CComBSTR("C:\\InputFile.wav")); } // Specify a file object in which to save encoded content. if ( SUCCEEDED( hr ) ) { hr = pEncoder->get_File(&pFile); } if ( SUCCEEDED( hr ) ) { hr = pFile->put_LocalFileName(CComBSTR("C:\\OutputFile.wma")); } // Retrieve a pointer to the property bag. if ( SUCCEEDED( hr ) ) { hr = pSrcAud->QueryInterface(IID_IPropertyBag, (void**)&pPropertyBag); } // Choose a profile from the collection. if ( SUCCEEDED( hr ) ) { hr = pEncoder->get_ProfileCollection(&pProColl); } if ( SUCCEEDED( hr ) ) { hr = pProColl->get_Count(&lCount); } for (i=0; i