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"
|
|
|
|
|
2008-03-28 03:19:18 +00:00
|
|
|
#define OPL_SAMPLE_RATE 49716.0
|
|
|
|
|
2006-02-24 04:48:15 +00:00
|
|
|
class OPLmusicBlock : public musicBlock
|
|
|
|
{
|
|
|
|
public:
|
2008-03-28 03:19:18 +00:00
|
|
|
OPLmusicBlock();
|
|
|
|
~OPLmusicBlock();
|
|
|
|
|
|
|
|
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:
|
|
|
|
OPLmusicFile(FILE *file, char *musiccache, int len, int maxSamples);
|
|
|
|
~OPLmusicFile();
|
|
|
|
|
|
|
|
bool IsValid() const;
|
|
|
|
void SetLooping(bool loop);
|
|
|
|
void Restart();
|
|
|
|
|
|
|
|
protected:
|
|
|
|
int PlayTick();
|
|
|
|
|
|
|
|
enum { NotRaw, RDosPlay, IMF } RawPlayer;
|
|
|
|
int ScoreLen;
|
|
|
|
};
|