2006-02-24 04:48:15 +00:00
|
|
|
#ifdef _WIN32
|
|
|
|
#define WIN32_LEAN_AND_MEAN
|
|
|
|
#include <windows.h>
|
2006-09-14 00:02:31 +00:00
|
|
|
#define USE_WINDOWS_DWORD
|
2006-02-24 04:48:15 +00:00
|
|
|
#else
|
|
|
|
#include <SDL.h>
|
|
|
|
#endif
|
|
|
|
|
|
|
|
#include "muslib.h"
|
|
|
|
#include "files.h"
|
|
|
|
|
|
|
|
class OPLmusicBlock : public musicBlock
|
|
|
|
{
|
|
|
|
public:
|
2008-03-28 03:19:18 +00:00
|
|
|
OPLmusicBlock();
|
2008-04-03 22:34:52 +00:00
|
|
|
virtual ~OPLmusicBlock();
|
2008-03-28 03:19:18 +00:00
|
|
|
|
|
|
|
bool ServiceStream(void *buff, int numbytes);
|
|
|
|
void ResetChips();
|
2006-02-24 04:48:15 +00:00
|
|
|
|
2008-03-28 03:19:18 +00:00
|
|
|
virtual void Restart();
|
2006-02-24 04:48:15 +00:00
|
|
|
|
|
|
|
protected:
|
2008-03-28 03:19:18 +00:00
|
|
|
virtual int PlayTick() = 0;
|
|
|
|
|
2008-03-29 05:01:38 +00:00
|
|
|
void Serialize();
|
|
|
|
void Unserialize();
|
|
|
|
|
2008-03-28 03:19:18 +00:00
|
|
|
double NextTickIn;
|
|
|
|
double SamplesPerTick;
|
2006-02-24 04:48:15 +00:00
|
|
|
bool TwoChips;
|
|
|
|
bool Looping;
|
|
|
|
|
|
|
|
#ifdef _WIN32
|
|
|
|
CRITICAL_SECTION ChipAccess;
|
|
|
|
#else
|
|
|
|
SDL_mutex *ChipAccess;
|
|
|
|
#endif
|
|
|
|
};
|
2008-03-28 03:19:18 +00:00
|
|
|
|
|
|
|
class OPLmusicFile : public OPLmusicBlock
|
|
|
|
{
|
|
|
|
public:
|
2008-04-03 02:31:39 +00:00
|
|
|
OPLmusicFile(FILE *file, char *musiccache, int len);
|
|
|
|
OPLmusicFile(const OPLmusicFile *source, const char *filename);
|
2008-04-03 22:34:52 +00:00
|
|
|
virtual ~OPLmusicFile();
|
2008-03-28 03:19:18 +00:00
|
|
|
|
|
|
|
bool IsValid() const;
|
|
|
|
void SetLooping(bool loop);
|
|
|
|
void Restart();
|
2008-04-03 02:31:39 +00:00
|
|
|
void Dump();
|
2008-03-28 03:19:18 +00:00
|
|
|
|
|
|
|
protected:
|
2008-04-03 02:31:39 +00:00
|
|
|
OPLmusicFile() {}
|
2008-03-28 03:19:18 +00:00
|
|
|
int PlayTick();
|
|
|
|
|
2008-04-03 02:31:39 +00:00
|
|
|
enum { RDosPlay, IMF, DosBox } RawPlayer;
|
2008-03-28 03:19:18 +00:00
|
|
|
int ScoreLen;
|
2008-04-03 02:31:39 +00:00
|
|
|
int WhichChip;
|
2008-03-28 03:19:18 +00:00
|
|
|
};
|