Archived

This topic is now archived and is closed to further replies.

smidge_tech

Quickie: Decoding an MP3 into DirectSound using ACM

Recommended Posts

Quick question about decoding an mp3 file into a DirectSound buffer using the windows ACM... What should my input wave format look like? I've defined an MPEGLAYER3WAVEFORMAT structure, and have filled it in as follows:
      
/* From MMREG.H header file:
//
// MPEG Layer3 WAVEFORMATEX structure
// for WAVE_FORMAT_MPEGLAYER3 (0x0055)
//
#define MPEGLAYER3_WFX_EXTRA_BYTES   12

// WAVE_FORMAT_MPEGLAYER3 format sructure
//
typedef struct mpeglayer3waveformat_tag {
  WAVEFORMATEX  wfx;
  WORD          wID;
  DWORD         fdwFlags;
  WORD          nBlockSize;
  WORD          nFramesPerBlock;
  WORD          nCodecDelay;
} MPEGLAYER3WAVEFORMAT;


typedef MPEGLAYER3WAVEFORMAT          *PMPEGLAYER3WAVEFORMAT;
typedef MPEGLAYER3WAVEFORMAT NEAR    *NPMPEGLAYER3WAVEFORMAT;
typedef MPEGLAYER3WAVEFORMAT FAR     *LPMPEGLAYER3WAVEFORMAT;


#define MPEGLAYER3_ID_UNKNOWN            0
#define MPEGLAYER3_ID_MPEG               1
#define MPEGLAYER3_ID_CONSTANTFRAMESIZE  2

#define MPEGLAYER3_FLAG_PADDING_ISO      0x00000000
#define MPEGLAYER3_FLAG_PADDING_ON       0x00000001
#define MPEGLAYER3_FLAG_PADDING_OFF      0x00000002
*/


	// Fill in information for the input wave format...

	this->m_InputWaveFormat.wfx.wFormatTag		= WAVE_FORMAT_MPEGLAYER3;
	this->m_InputWaveFormat.wfx.nChannels		= this->m_iChannels;
	this->m_InputWaveFormat.wfx.nSamplesPerSec	= this->m_iFrequency;
//	this->m_InputWaveFormat.wfx.wBitsPerSample	=

	this->m_InputWaveFormat.wfx.nBlockAlign		= (this->m_InputWaveFormat.wfx.wBitsPerSample * this->m_InputWaveFormat.wfx.nChannels) / 8;
	this->m_InputWaveFormat.wfx.nAvgBytesPerSec	= this->m_InputWaveFormat.wfx.nSamplesPerSec * this->m_InputWaveFormat.wfx.nBlockAlign;
	this->m_InputWaveFormat.wfx.cbSize			= MPEGLAYER3_WFX_EXTRA_BYTES;
	this->m_InputWaveFormat.wID					= MPEGLAYER3_ID_MPEG;
//	this->m_InputWaveFormat.fdwFlags			= MPEGLAYER3_FLAG_PADDING_ISO;

//	this->m_InputWaveFormat.nBlockSize			=

//	this->m_InputWaveFormat.nFramesPerBlock		=

	this->m_InputWaveFormat.nCodecDelay			= 0;

      
What goes in the missing fields?!? Thanks so much in advance, ======== Smidge ======== Edited by - smidge_tech on November 18, 2001 5:38:47 PM

Share this post


Link to post
Share on other sites