74 lines
1.4 KiB
C++
74 lines
1.4 KiB
C++
#include <common/windows.hpp>
|
|
#include <midiseq/mididata.hpp>
|
|
#include <midiseq/midiseq.hpp>
|
|
|
|
MidiData *lpMidiData=0;
|
|
|
|
#if defined(__FLAT__)
|
|
#if defined(_MSC_VER)
|
|
BOOL _stdcall DllMain(HINSTANCE /*hInstance*/,DWORD reasonCode,LPVOID /*lpvReserved*/)
|
|
#else
|
|
BOOL WINAPI DllEntryPoint(HINSTANCE /*hInstance*/,DWORD reasonCode,LPVOID /*lpvReserved*/)
|
|
#endif
|
|
{
|
|
switch(reasonCode)
|
|
{
|
|
case DLL_PROCESS_ATTACH :
|
|
lpMidiData=0;
|
|
break;
|
|
case DLL_PROCESS_DETACH :
|
|
stop();
|
|
break;
|
|
}
|
|
return TRUE;
|
|
}
|
|
#else
|
|
int CALLBACK _export LibMain(HINSTANCE /*hInstance*/,WORD /*wDataSeg*/,WORD /*wHeapSize*/,LPSTR /*lpszCmdLine*/)
|
|
{
|
|
lpMidiData=0;
|
|
return TRUE;
|
|
}
|
|
|
|
int CALLBACK _export WEP(int /*nExitType*/)
|
|
{
|
|
return stop();
|
|
}
|
|
#endif
|
|
|
|
#if defined(_MSC_VER)
|
|
short _stdcall play(String midiPathFileName)
|
|
#else
|
|
short CALLBACK _export play(String midiPathFileName)
|
|
#endif
|
|
{
|
|
if(lpMidiData)stop();
|
|
lpMidiData=new MidiData(midiPathFileName);
|
|
if(!lpMidiData)return FALSE;
|
|
lpMidiData->play();
|
|
return TRUE;
|
|
}
|
|
|
|
#if defined(_MSC_VER)
|
|
short _stdcall stop(void)
|
|
#else
|
|
short CALLBACK _export stop(void)
|
|
#endif
|
|
{
|
|
if(!lpMidiData)return FALSE;
|
|
lpMidiData->stop();
|
|
delete lpMidiData;
|
|
lpMidiData=0;
|
|
return TRUE;
|
|
}
|
|
|
|
#if defined(_MSC_VER)
|
|
short _stdcall isInPlay(void)
|
|
#else
|
|
short CALLBACK _export isInPlay(void)
|
|
#endif
|
|
{
|
|
if(!lpMidiData)return FALSE;
|
|
return lpMidiData->isInPlay();
|
|
}
|
|
|