|
// AlexfSnd.h: interface for the CAlexfSnd class.
// Part of "Morse" project. (C) Alexander Fedorov, 2000. lamer2000@hotmail.com
//////////////////////////////////////////////////////////////////////
#if !defined(AFX_ALEXFSND_H__950F8104_A353_11D2_9864_E7C799AF3D43__INCLUDED_)
#define AFX_ALEXFSND_H__950F8104_A353_11D2_9864_E7C799AF3D43__INCLUDED_
#if _MSC_VER > 1000
#pragma once
#endif // _MSC_VER > 1000
#include <mmsystem.h>
#pragma comment(lib,"winmm.lib")
#define ALEXF_PLAY_BUF 10
#define ALEXF_PLAY_SPS 44100
#define PCM_STAGE_FREE 0
#define PCM_STAGE_MARK_TO_FILL 1
#define PCM_STAGE_PLAY_NOW 2
class CAlexfPCM
{
public:
WAVEHDR whdr;
int iStage;
long lFreq;
double dDelay;
long lNext;
char * WaveBuf;
public:
CAlexfPCM();
virtual ~CAlexfPCM();
static void FillSinus08(
char* pBuf, // buffer address
int iBufLen, // buffer size
int iSPS, // frequency (Samples Per Second)
double fFreq); // frequency, Hz
BOOL CreateSinus08Sample();
BOOL ResizeBuf(long lNewSize);
};
class CAlexfAsyncPlay2
{
BOOL bOK;
int SPS; // Samples Per Sec
WAVEFORMATEX wfme;
HWAVEOUT hwout;
MMRESULT mmres;
static void CALLBACK CallbackWaveOutProc(HWAVEOUT hwo,
UINT uMsg, DWORD dwInstance, DWORD dwParam1, DWORD dwParam2);
CAlexfPCM * pcm;
static CAlexfAsyncPlay2 * ziz;
int GetFreeBuf();
int GetBusyBufferNumber();
void ReleaseBuf(WAVEHDR * lpwhdr);
public:
CAlexfAsyncPlay2();
virtual ~CAlexfAsyncPlay2();
BOOL AddSingleSound(long Freq, double Delay);
BOOL IsOK() {return bOK;}
};
class CAlexfAsyncPlay
{
BOOL bOK;
int SPS; // Samples Per Sec
WAVEFORMATEX wfme;
HWAVEOUT hwout;
MMRESULT mmres;
static void CALLBACK CallbackWaveOutProc(HWAVEOUT hwo,
UINT uMsg, DWORD dwInstance, DWORD dwParam1, DWORD dwParam2);
CAlexfPCM * pcm;
long lLastPCM;
int GetFreeBuf();
void ReleaseBuf(WAVEHDR * lpwhdr);
int GetBusyBufferNumber();
static CAlexfAsyncPlay * ziz;
static DWORD WINAPI ThreadFunc(LPVOID lpThreadParameter);
HANDLE hThread;
CRITICAL_SECTION csCriticalSection;
BOOL bStopThreadNow;
BOOL StopThread();
public:
CAlexfAsyncPlay();
virtual ~CAlexfAsyncPlay();
BOOL AddSingleSound(long Freq, double Delay);
BOOL IsOK() {return bOK;}
};
class CAlexfSyncPlay
{
public:
WAVEFORMATEX wfme;
MMRESULT mmres;
HWAVEOUT hwout;
WAVEHDR whdr;
char * WaveBuf;
double dDuration;
double dFreq;
void FillSinus08(
unsigned char* pBuf,
int iBufLen,
int iSPS,
double fFreq);
static void CALLBACK WaveOut_waveOutProc(HWAVEOUT hwo, UINT uMsg, DWORD dwInstance, DWORD dwParam1, DWORD dwParam2);
BOOL Beep();
public:
int SPS; // Samples Per Sec
CAlexfSyncPlay(BOOL bSoundOn = FALSE);
virtual ~CAlexfSyncPlay();
BOOL Beep08(double Freq, double Delay);
};
#endif // !defined(AFX_ALEXFSND_H__950F8104_A353_11D2_9864_E7C799AF3D43__INCLUDED_)
|
By viewing downloads associated with this article you agree to the Terms of Service and the article's licence.
If a file you wish to view isn't highlighted, and is a text file (not binary), please
let us know and we'll add colourisation support for it.