Re: ACM Convert - acmStreamOpen return 512



There are other easy ways of having the struct populated for you such as
using acmFormatSuggest(). Pass in the PCM struct and it will give you a
GSM struct out (with the appropriate flags and parameters of course).

The problem in this case however is probably your source PCM format. The
sample rate and BitsPerSample is likely invalid for conversion. I use
BitsPerSample = 16 and nSamplePerSec of 8000 and it works ok. The source
sample rate usually has to match the output sample rate, otherwise you can
do sample rate conversion first using the PCM ACM codec.

--http://www.chrisnet.net/code.htm
[MS MVP for DirectShow / MediaFoundation]




Thanks for your help.
I modified the code and just add acmMetrics(to calculate the size of
the new format no?) and acmFormatSuggest functions and change the PCM
struct.

'init dest for acmFormatSuggest
Dim gslDst As gsm610waveformat_tag
gslDst = New gsm610waveformat_tag
gslDst.wfx = New WAVEFORMATEX2
gslDst.wfx.wFormatTag = Wave.WAVEHDR.WAVE_FORMAT_GSM610

Dim retourMetrics As Integer

Dim ret As Integer = acmMetrics(0,
ACM_METRIC_MAX_SIZE_FORMAT, retourMetrics)

ret = acmFormatSuggest(hwnd, m_wfmt, gslDst.wfx,
retourMetrics, ACM_FORMATSUGGESTF_WFORMATTAG)

ret = acmStreamOpen(0, IntPtr.Zero, m_wfmt, gsm610.wfx,
IntPtr.Zero, IntPtr.Zero, IntPtr.Zero, ACM_STREAMOPENF_QUERY) ...
....
<DllImport("coredll.dll")> _
Protected Shared Function acmFormatSuggest(ByRef has As
IntPtr, ByVal pwfxSrc As Wave.WAVEFORMATEX, ByVal pwfxDst As
WAVEFORMATEX, ByVal cbwfxDst As Integer, ByVal fdwSuggest As Integer)
As MMSYSERR
End Function
<DllImport("coredll.dll")> _
Protected Shared Function acmMetrics(ByRef hao As IntPtr,
ByVal uMetric As Integer, ByRef pMetric As Integer) As MMSYSERR
End Function
....

Is there something wrong? the function "acmMetrics" turns over a value
of 5. I think it's not normal... This value doesn't change after. I
saw that it's a INVALHANDLE error. But for "acmMetrics" I don't use
any handle.No?
I am lost...

.



Relevant Pages

  • Re: ACM ADPCM to PCM Conversion
    ... >> wav but every time i call acmFormatSuggest or acmStreamOpen they just return ... >> and that does allow me to convert from ADPCM to PCM, ... Plz tell me about that. ...
    (microsoft.public.win32.programmer.mmedia)
  • Re: ACM Convert - acmStreamOpen return 512
    ... convert PCM to GSM610 but I don't understand how I must do. ... I think that the GSM struct is ok. ... sample rate and BitsPerSample is likely invalid for conversion. ... do sample rate conversion first using the PCM ACM codec. ...
    (microsoft.public.win32.programmer.mmedia)
  • Re: ACM Convert - acmStreamOpen return 512
    ... I have a question about acmFormatSuggest. ... It is correct to convert PCM ... the output formatag, I put PCM format, the same as input formatag. ... [MS MVP for DirectShow / MediaFoundation] ...
    (microsoft.public.win32.programmer.mmedia)