Files
Work/sample/WaveOut.hpp
2024-08-07 09:16:27 -04:00

53 lines
1.5 KiB
C++

#ifndef _SAMPLE_WAVEOUTDEVICE_HPP_
#define _SAMPLE_WAVEOUTDEVICE_HPP_
#ifndef _COMMON_WINDOW_HPP_
#include <common/windows.hpp>
#endif
#ifndef _COMMON_GLOBALDATA_HPP_
#include <common/gdata.hpp>
#endif
#ifndef _SAMPLE_DEVICEHANDLER_HPP_
#include <sample/devhndlr.hpp>
#endif
#ifndef _SAMPLE_WAVEOUTCAPS_HPP_
#include <sample/outcaps.hpp>
#endif
#ifndef _SAMPLE_WAVEHEADER_HPP_
#include <sample/wavehdr.hpp>
#endif
#ifndef _SAMPLE_WAVEFORM_HPP_
#include <sample/wave.hpp>
#endif
#ifndef _SAMPLE_WAVEFORMATPCM_HPP_
#include <sample/pcmform.hpp>
#endif
class WaveOutDevice : public DeviceHandler
{
public:
WaveOutDevice(UINT waveDeviceID,Window &windowHander);
WaveOutDevice(const WaveOutDevice &someWaveOutDevice);
virtual ~WaveOutDevice();
WaveOutDevice &operator=(const WaveOutDevice &someWaveOutDevice);
BOOL play(WaveForm &waveForm,DeviceHandler::PlayMode playMode=DeviceHandler::NoWait);
BOOL pause(void);
BOOL restart(void);
protected:
virtual void openHandler(CallbackData &someCallbackData);
virtual void closeHandler(CallbackData &someCallbackData);
virtual void doneHandler(CallbackData &someCallbackData);
virtual void message(const String &strErrorMessage)const;
private:
enum Disposition{InPause,InPlay,InClose,InOpen,InIdle};
BOOL openDevice(WaveFormatPCM &waveFormatPCM);
BOOL closeDevice(void);
void unprepareHeader(void);
WaveOutCaps mWaveOutCaps;
Window &mWindowHandler;
UINT mWaveDeviceID;
GlobalData<WaveHeader> mGlobalWaveHeader;
HWAVEOUT mhWaveOut;
Disposition mDisposition;
};
#endif