how to configure output sampling rate and number of channels??

Topics: Developer Forum
Jun 15, 2008 at 10:37 PM
since that you guys  have been expert in using DShowNet ..I hope you will put on the right path..., and if your library can solve this probleme plizzzz let me know.
here is it!!
I'm having troubles configuring the ouput format and properties (sampling rate and nbr of channels) in the graph!!
I'm using DirectShowNET with C# and trying to convert a wave (or MP3) file to a CCITT ALAW 8KH mono..
I really thought that I did the hard part when I converted my wave file to CCITT ALaw...but the problem is that the output file is 44Khz stereo..and I can't change it..even, when the input file is PCM MONO 8KH 8Bit...the output is still stereo 44Khz (it change in the within graph)..I tried to act on the output PIN of ACM Wrapper..but no success..
this my graph with Graphedit plus:
FILE SOURCE(Async)-->WAVE PARSER-->ACM Wrapper-->CCITT A-Law-->WAV DEST--->File Writer.

I only want to have a MONO 8KH CCITT a-Law in the output file.
(or keep the sampling at the same as in the input filel).
thanks in advance.
here is the part of my code
//getPin() is explained further
IPin pPCMOut = GetPin((IBaseFilter)pACMWrap, PinDirection.Output, 0);
IAMStreamConfig pPCMStreamConfig;
pPCMStreamConfig = (IAMStreamConfig)pPCMOut;
AMMediaType pMediaType = new AMMediaType();
pMediaType.majorType = MediaType.Audio;
pMediaType.subType = MediaSubType.WAVE;
WaveFormatEx pFormat = new WaveFormatEx();
//my audio setting
pFormat.nSamplesPerSec = 64000;
pFormat.nChannels = 1;
pFormat.wBitsPerSample = 8000;
//and here is the probleme, since I can't do :
//WAVEFORMATEX* pFormat = (WAVEFORMATEX *)MediaType->pbFormat;
//cause there is no pbFormat in DirectShowNet implementation
//of AMMediaType class
Marshal.PtrToStructure(pMediaType.formatPtr, pFormat);
// ERROR: I'm having a null reference on formatPtr???
hr = pPCMStreamConfig.SetFormat(pMediaType);

I'm stucked..can't get this working..
if you have any idea on how to solve this will help a lot..
thanks in advance.