This commit is contained in:
2024-08-07 09:16:27 -04:00
parent fdfadd5c7e
commit 5f971cf684
5200 changed files with 731717 additions and 0 deletions

58
sample/PureWave.cpp Normal file
View File

@@ -0,0 +1,58 @@
#include <sample/purewave.hpp>
#include <common/assert.hpp>
#include <sample/wave.hpp>
PureWave::~PureWave()
{
destroy();
}
PureWave::PureWave(void)
: mhProcessInstance(processInstance()), mClassNameString("PLAYBACKSAMPLEDOUTPUT")
{
UINT numOutputDevices;
UINT numInputDevices;
registerClass();
createWindow();
numOutputDevices=::waveOutGetNumDevs();
numInputDevices=::waveInGetNumDevs();
for(short deviceIndex=0;deviceIndex<numOutputDevices;deviceIndex++)
mWaveOutDeviceBlock.insert(&WaveOutDevice(deviceIndex,*this));
for(deviceIndex=0;deviceIndex<numInputDevices;deviceIndex++)
mWaveInDeviceBlock.insert(&WaveInDevice(deviceIndex,*this));
}
void PureWave::registerClass(void)const
{
WNDCLASS wndClass;
if(::GetClassInfo(mhProcessInstance,(LPSTR)mClassNameString,(WNDCLASS FAR*)&wndClass))return;
wndClass.style =CS_HREDRAW|CS_VREDRAW;
wndClass.lpfnWndProc =(WNDPROC)Window::WndProc;
wndClass.cbClsExtra =0;
wndClass.cbWndExtra =sizeof(PureWave*);
wndClass.hInstance =mhProcessInstance;
wndClass.hIcon =::LoadIcon(NULL,IDI_APPLICATION);
wndClass.hCursor =::LoadCursor(NULL,IDC_ARROW);
wndClass.hbrBackground =(HBRUSH)::GetStockObject(WHITE_BRUSH);
wndClass.lpszMenuName =0;
wndClass.lpszClassName =(LPSTR)mClassNameString;
::RegisterClass(&wndClass);
assert(0!=::GetClassInfo(mhProcessInstance,(LPSTR)mClassNameString,(WNDCLASS FAR*)&wndClass));
}
void PureWave::createWindow(void)
{
assert(0!=::CreateWindow((LPSTR)mClassNameString,(LPSTR)mClassNameString,
WS_OVERLAPPEDWINDOW,CW_USEDEFAULT,CW_USEDEFAULT,CW_USEDEFAULT,CW_USEDEFAULT,
NULL,NULL,mhProcessInstance,(LPSTR)this));
show(SW_HIDE);
update();
}
WORD PureWave::play(WaveForm &someWaveForm,DeviceHandler::PlayMode playMode)
{
if(!mWaveOutDeviceBlock.size())return FALSE;
return (mWaveOutDeviceBlock[0]).play(someWaveForm,playMode);
}