⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 wavreader.h

📁 wav文件读取插件
💻 H
字号:
// WAVReader.h: interface for the WAVReader class.
//
//////////////////////////////////////////////////////////////////////

#if !defined(AFX_WAVReader_H__1ACADF42_5A21_11D3_BA37_00105A669BB5__INCLUDED_)
#define AFX_WAVReader_H__1ACADF42_5A21_11D3_BA37_00105A669BB5__INCLUDED_

#if _MSC_VER > 1000
#pragma once
#endif // _MSC_VER > 1000


class WAVReader : public CKSoundReader  
{
public:
	WAVReader();
	virtual ~WAVReader();

	virtual void Release();

	virtual CKPluginInfo* GetReaderInfo();

	// Get Options Count
	virtual int GetOptionsCount() { return 0; }
	// Get Options Description
	virtual CKSTRING GetOptionDescription(int i) {return NULL; }
	
	// Get Flags
	virtual CK_DATAREADER_FLAGS GetFlags() { return (CK_DATAREADER_FLAGS) (CK_DATAREADER_FILELOAD | CK_DATAREADER_MEMORYLOAD); }

public:
	// Opens a file
	virtual CKERROR OpenFile(char *file);

	virtual CKERROR ReadMemory(void* memory, int size);
	
	// Decodes next chunk of data, use get data buffer to get decoded data
	virtual CKERROR Decode();

	// Gets the last decoded buffer
	virtual CKERROR GetDataBuffer(BYTE **buf, int *size);
	
	// Gets the wave format of decoded datas
	virtual CKERROR GetWaveFormat(CKWaveFormat *wfe);

	// Gets whole decoded data size
	virtual int GetDataSize();
	
	// Gets the play time length
	virtual int GetDuration();

	// Seek
	virtual CKERROR Seek(int pos);
	// Play;
	virtual CKERROR Play();
	// Stop
	virtual CKERROR Stop();

	virtual CKERROR Pause(){return CK_OK;}
	virtual CKERROR Resume(){return CK_OK;}

protected :

	CKERROR DoMMio();

	BOOL Cue(void);
	UINT ReadPCM(BYTE * pbDest, UINT cbSize);

	int DataRead(int count, char* buf); 
	int DataRead(long pos, int count, char* buf);
	int DataSeek(long pos);


	WAVEFORMATEX *m_pwfmt;
	WAVEFORMATEX	m_Wfe;

	HACMSTREAM	m_pHas;
	ACMSTREAMHEADER m_Ash;

	HMMIO m_hmmio;
    MMRESULT m_mmr;
    MMCKINFO m_mmckiRiff;
    MMCKINFO m_mmckiFmt;
    MMCKINFO m_mmckiData;

    UINT m_nBlockAlign;         // wave data block alignment spec
    UINT m_nAvgDataRate;        // average wave data rate
    UINT m_nBytesPlayed;        // offset into data chunk
	BOOL m_IsPcm;

	unsigned long m_OutDataSize;	// size of in  data chunk
	unsigned long m_InDataSize;		// size of out data chunk
	
	unsigned long m_InDataCursor;

// PCM Data

	BYTE *m_Buffer;				// Data Buffer;
	int m_BufferSize;
	int m_BufferDataRead;

	
};

#endif // !defined(AFX_WAVReader_H__1ACADF42_5A21_11D3_BA37_00105A669BB5__INCLUDED_)

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -