#ifndef IN_YM_H_ALREADY_INCLUDED
#define	IN_YM_H_ALREADY_INCLUDED

#include "ym2612.h"
#include "sn76496.h"
#include "ym2151.h"
#include "resource.h"

#define DUP_INIT 0x20000000

#if 0

typedef struct {
    int version;
	char *description;
	int outid;
	HWND hMainWindow;
	HINSTANCE hDllInstance;
	void (*Config)(HWND hwndParent);
	void (*About)(HWND hwndParent);
	void (*Init)(void);
	void (*Quit)(void);
	int (*Open)(int samplerate, int numchannels, int bitspersamp, int bufferlenms, int prebufferms);
	void (*Close)(void);
	int (*Write)(void *buf, int len);
	int (*CanWrite)(void);
	int (*IsPlaying)(void);
	int (*Pause)(int pause);
	void (*SetVolume)(int volume);
	void (*SetPan)(int pan);
	void (*Flush)(int t);
	int (*GetOutputTime)(void);
	int (*GetWrittenTime)(void);
} Out_Module;

typedef struct {
	int version;
	char *description;
	HWND hMainWindow;
	HINSTANCE hDllInstance;
	char *FileExtensions;
	int is_seekable;
	int UsesOutputPlug;
	void (*Config)(HWND hwndParent);
	void (*About)(HWND hwndParent);
	void (*Init)(void);
	void (*Quit)(void);
	void (*GetFileInfo)(char *file, char *title, int *length_in_ms);
	int (*InfoBox)(char *file, HWND hwndParent);
	int (*IsOurFile)(char *fn);
	int (*Play)(char *fn);
	void (*Pause)(void);
	void (*UnPause)(void);
	int (*IsPaused)(void);
	void (*Stop)(void);
	int (*GetLength)(void);
	int (*GetOutputTime)(void);
	void (*SetOutputTime)(int time_in_ms);
	void (*SetVolume)(int volume);
	void (*SetPan)(int pan);
	void (*SAVSAInit)(int srate, int maxlatency_in_ms);
	void (*SAVSADeInit)(void);
	void (*SAAddPCMData)(void *PCMData, int nch, int bps, int timestamp);
	int (*SAGetMode)(void);
	void (*SAAdd)(void *data, int timestamp, int csa);
	void (*VSAAddPCMData)(void *PCMData, int nch, int bps, int timestamp);
	int (*VSAGetMode)(int *specNch, int *waveNch);
	void (*VSAAdd)(void *data, int timestamp);
	void (*VSASetInfo)(int nch, int srate);
	int (*dsp_isactive)(void);
	int (*dsp_dosamples)(short int *samples, int numsamples, int bps, int nch, int srate);
	void (*EQSet)(int on, char data[10], int preamp);
	void (*SetInfo)(int bitrate, int srate, int stereo, int synched);
	Out_Module *outMod;
} In_Module;

#endif

typedef struct {
    int id;
    char songtitle[32];
    char gametitle[32];
    char gamepub[32];
    char dumpemu[32];
    char dumper[32];
    char comments[256];
    unsigned int loop;
    unsigned int compressed;
} GYMTAG;

//In_Module mod;
GYMTAG gymtag;
//char lastfn[MAX_PATH];
unsigned char *ym_data;
int paused = 1, time_length = -1000, seek_needed = -1,
    time_pos = 0, killDecodeThread = 0,
    ym2612_clock, ym2151_clock, sn76496_clock, /* percentage */
    samplerate, prio, channels; /* channels is bitmapped: 0-7 ym2151 ch1-8, 8-13 ym2612 ch1-6, 14-17 sn76496 ch1-4 */
unsigned long file_size = 0;
//HANDLE thread_handle = NULL, rar_file = NULL;
//HINSTANCE unrardll = NULL;

//DWORD WINAPI PlayCYMThread(void *);
//DWORD WINAPI PlayGYMThread(void *);

#endif /* IN_YM_H_ALREADY_INCLUDED */
