Initial
This commit is contained in:
65
sample/Sample.cpp
Normal file
65
sample/Sample.cpp
Normal file
@@ -0,0 +1,65 @@
|
||||
#include <common/array.hpp>
|
||||
#include <sample/purewave.hpp>
|
||||
#include <sample/wave.hpp>
|
||||
#include <sample/sample.hpp>
|
||||
|
||||
PureWave *lpPureWave=0;
|
||||
PureVector<WaveForm> waveForms;
|
||||
|
||||
#if defined(__FLAT__)
|
||||
BOOL WINAPI DllEntryPoint(HINSTANCE /*hInstance*/,DWORD reasonCode,LPVOID /*lpvReserved*/)
|
||||
{
|
||||
switch(reasonCode)
|
||||
{
|
||||
case DLL_PROCESS_ATTACH :
|
||||
// createInstanceData(hInstance);
|
||||
break;
|
||||
case DLL_PROCESS_DETACH :
|
||||
// destroyInstanceData();
|
||||
break;
|
||||
}
|
||||
return TRUE;
|
||||
}
|
||||
#else
|
||||
int CALLBACK _export LibMain(HINSTANCE hInstance,WORD /*wDataSeg*/,WORD /*wHeapSize*/,LPSTR /*lpszCmdLine*/)
|
||||
{
|
||||
createInstanceData(hInstance);
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
int CALLBACK _export WEP(int /*nExitType*/)
|
||||
{
|
||||
destroyInstanceData();
|
||||
return TRUE;
|
||||
}
|
||||
#endif
|
||||
|
||||
short CALLBACK _export play(WORD waveFormIndex,WORD waitFlag)
|
||||
{
|
||||
if(!lpPureWave)return FALSE;
|
||||
if(waveFormIndex>=waveForms.size())return FALSE;
|
||||
return lpPureWave->play(waveForms[waveFormIndex],waitFlag?DeviceHandler::Wait:DeviceHandler::NoWait);
|
||||
}
|
||||
|
||||
short CALLBACK _export preLoadSamples(Block<String> &pathFileNames)
|
||||
{
|
||||
if(!lpPureWave)return FALSE;
|
||||
|
||||
waveForms.size(pathFileNames.size());
|
||||
for(short index=0;index<waveForms.size();index++)waveForms[index]=pathFileNames[index];
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
void CALLBACK _export createInstanceData(HINSTANCE hInstance)
|
||||
{
|
||||
destroyInstanceData();
|
||||
lpPureWave=new PureWave(hInstance);
|
||||
}
|
||||
|
||||
void CALLBACK _export destroyInstanceData(void)
|
||||
{
|
||||
if(lpPureWave){delete lpPureWave;lpPureWave=0;}
|
||||
waveForms.size(0);
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user