#ifndef __MODSOURCE_H
#define __MODSOURCE_H

#ifdef __cplusplus
extern "C" {
#endif

#include "soundsource.h"
#include "mikmod_build.h"
#include "dumb.h"

class ModuleSource : public SoundSource
{
	public:
		ModuleSource();
		virtual ~ModuleSource();
		
		virtual OpenStatus openLocation(File *sourceFile);
		virtual int renderChunk(uint8_t *buf, int &renderSamples);
		virtual void seekSeconds(int seconds);
		virtual void close();
		
		virtual void getNowPlaying(const char *fmtString, char *output);
		virtual int supportsFormat(const char *ext);
	private:
		DUH *duh;
		DUMBFILE *d;
		DUH_SIGRENDERER *ds;
		
		MODULE *module;
		VIRTUAL_FILE vf;
		
		int rendered;
};

#ifdef __cplusplus
}
#endif

#endif
