locked
How to change sample rate when playback a audio file?? RRS feed

  • Question

  • Hi guys,
    I use windows media sdk to playback a audio file, and it is like this:

    format                       : Windows Media
    File size                    : 472 KiB
    PlayTime                     : 3mn 53s
    Bit rate mode                : CBR
    Bit rate                     : 16.5 Kbps
    Maximum bit rate             : 17.8 Kbps
    Encoded date                 : UTC 2008-06-06 08:58:35.287
    Audio #0
    Codec                        : WMA2
    Codec/Info                   : Windows Media Audio 2
    Codec description            : Windows Media Audio 9.2 -  16 kbps, 16 kHz, mono 1-pass CBR
    PlayTime                     : 3mn 53s
    Bit rate mode                : CBR
    Bit rate                     : 17.0 Kbps
    Channel(s)                   : 1 channel
    Sampling rate                : 16.0 KHz
    Language                     : en-us
    DeviceConformanceTemplate    : L2

    Now I want an pcm output from
    IWMSyncReader, and change its sample rate when playback.
    But I got a error when change sample rate and call
    Code Snippet

    IWMSyncReader::SetOutputProps().



    NS_E_INVALID_OUTPUT_FORMAT 0xC00D0BBBL
    The output media format is invalid.

    Anybody can help? Thanks a lot!!


    Wednesday, June 11, 2008 3:32 AM

Answers

  • I'm guessing that there's a subtle mismatch between the WMA format and the PCM format you're asking for that the WMFSDK can't resolve.

     

    One thing you can try is a GetOutputProps() on the WMSyncReader to get its "native" uncompressed format.  You can then try modifying just the sample rate (and no other fields) and see if your SetOutputProps works.

    Monday, June 16, 2008 11:31 PM