• Content count

  • Joined

  • Last visited

Community Reputation

102 Neutral

About pknight

  • Rank
  1. Thanks for the reply Ashaman. I think that I have got to the bottom of what the format specific data is for ADPCM files and exactly what type of struct I need to fill. Here are my comments below in case it helps anyone else with the same question:   This is from the Japanese MSDN page, here   typedef struct adpcmwaveformat_tag { WAVEFORMATEX wfx; WORD wSamplesPerBlock; WORD wNumCoef; ADPCMCOEFSET aCoef []; } ADPCMWAVEFORMAT;   (apologies for the formatting)   Now we have in this struct:   WAVEFORMATEX = 18 bytes, as usual 2 x WORD = 2 x 2 bytes   Then a variable size component which will be 7 x sizeof(ADPCMCOEFSET), which is 7 x 4 bytes, or 28 bytes. I got the 7 as per the msdn site's comment:     wNumCoef The number of entries in aCoef. Note (AdpcmEncode) ADPCM command line encoder always, seven entries are included in the array of data compression factor of the ADPCM data that is generated by.   So total size = 18 + 4 + 28 = 50 bytes, which is what my parser is pulling out of the ADPCM file.
  2. Just trying to figure this out myself as I go . . .    From -   Note  Data formats such as ADPCM that require more information than provided by WAVEFORMATEX have aWAVEFORMATEX structure as the first member in their format structures. When you create a source voice with one of those formats, cast the format's structure as a WAVEFORMATEX structure and use it as the value forpSourceFormat.   I assumed I'd be using WAVEFORMATEXTENSIBLE, but it doesn't actually say that here.   From -   In order to use ADPCM encoded data in XAudio2, you need to initialize a ADPCMWAVEFORMAT structure with ADPCM specific values, and pass it as an argument to IXAudio2::CreateSourceVoice when you create a source voice. For an example of loading and playing a sound in XAudio2, see How to: Play a Sound with XAudio2.   Getting closer. There doesn't appear to be an MSDN page for ADPCMWAVEFORMAT, however the Japanese site has:
  3. I'm writing a parser for wave files in C++, designed to work with XAudio2.   I have no problems reading in PCM wave files. My parser extracts the chunk size for the format chunk of a PCM file as 16 bytes. I copy this data into a WAVEFORMATEX or WAVEFORMATEXTENSIBLE struct and it fills struct as I expect.   I used the "AdpcmEncode" utility that comes with the June 2010 DirectX SDK to encode my PCM file to ADPCM.   Now my parser extracts the size of the format chunk as 50 bytes.   I notice that the size of the WAVEFORMATEXTENSIBLE struct is 40 bytes. Is there something wrong with my parser here or is there another type of struct that I should be copying this data to?   The parser seems to be working OK as from the ADPCM file I extract wFormatTag = 2 (i.e. ADPCM encoding) and cbSize = 32 (i.e. 32 extra bytes + 18 bytes for the WAVEFORMATEX struct = 50 bytes total). I'm wondering why this chunk won't fit into a WAVEFORMATEXTENSIBLE struct and what the extra 10 bytes of data might be for.   Any help here will be much appreciated.