//-----------------------------------------------------------------------------
// File: WavRead.h
//
// Desc: Support for loading and playing Wave files using DirectSound sound
//       buffers.
//
// Copyright (c) 1999 Microsoft Corp. All rights reserved.
//-----------------------------------------------------------------------------

#ifdef ASURA_USE_PRAGMA_ONCE
    #pragma once
#endif

#ifndef WAVE_READ_H
#define WAVE_READ_H


// (MH - 16.04.2003) use this header for std windows headers - it fixes a 
// problem with PlaySound being defined in mmsystem.h, and possibly others.
#include "Core/Asura_PlatformBasics.h"
//#include <mmreg.h>
//#include <mmsystem.h>


//-----------------------------------------------------------------------------
// Name: class CWaveSoundRead
// Desc: A class to read in sound data from a Wave file
//-----------------------------------------------------------------------------
class CWaveSoundRead
{
public:
    WAVEFORMATEX* m_pwfx;        // Pointer to WAVEFORMATEX structure
    HMMIO         m_hmmioIn;     // MM I/O handle for the WAVE
    MMCKINFO      m_ckIn;        // Multimedia RIFF chunk
    MMCKINFO      m_ckInRiff;    // Use in opening a WAVE file

    // (MH - 13.06.2002) addition for memory-mapped files
    MMIOINFO      m_mmioInfo;

public:
    CWaveSoundRead();
    ~CWaveSoundRead();

    HRESULT Open( const CHAR* strFilename );
    // (MH - 13.06.2002) added support for memory-mapped files, 
    // i.e. a block of memory which is treated as a file.
    HRESULT OpenFromMemory( BYTE* pbData, UINT uNumBytes );
    HRESULT Reset();
    HRESULT Read( UINT nSizeToRead, BYTE* pbData, UINT* pnSizeRead );
    HRESULT Close();

};


#endif WAVE_READ_H



