1 /*
2  * Adplug - Replayer for many OPL2/OPL3 audio file formats.
3  * Copyright (C) 1999 - 2007 Simon Peter, <dn.tlp@gmx.net>, et al.
4  *
5  * This library is free software; you can redistribute it and/or
6  * modify it under the terms of the GNU Lesser General Public
7  * License as published by the Free Software Foundation; either
8  * version 2.1 of the License, or (at your option) any later version.
9  *
10  * This library is distributed in the hope that it will be useful,
11  * but WITHOUT ANY WARRANTY; without even the implied warranty of
12  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
13  * Lesser General Public License for more details.
14  *
15  * You should have received a copy of the GNU Lesser General Public
16  * License along with this library; if not, write to the Free Software
17  * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
18  *
19  * player.h - Replayer base class, by Simon Peter <dn.tlp@gmx.net>
20  */
21 
22 #ifndef H_ADPLUG_PLAYER
23 #define H_ADPLUG_PLAYER
24 
25 #include "fprovide.h"
26 #include "opl.h"
27 //#include "database.h"
28 
29 class CPlayer
30 {
31 public:
32         CPlayer(Copl *newopl);
33 	virtual ~CPlayer();
34 
35 /***** Operational methods *****/
36 	void seek(unsigned long ms);
37 
38 	virtual bool load(const char *filename,	// loads file
39 			  const CFileProvider &fp = CProvider_Filesystem()) = 0;
40 	virtual bool update() = 0;			// executes replay code for 1 tick
41 	virtual void rewind(int subsong = -1) = 0;	// rewinds to specified subsong
42 	virtual float getrefresh() = 0;			// returns needed timer refresh rate
43 
44 /***** Informational methods *****/
45 	unsigned long songlength(int subsong = -1);
46 
47 	virtual const char *gettype() = 0;	// returns file type
gettitle()48 	virtual const char *gettitle()		// returns song title
49 	  { return ""; }
getauthor()50 	virtual const char *getauthor()		// returns song author name
51 	  { return ""; }
getdesc()52 	virtual const char *getdesc()		// returns song description
53 	  { return ""; }
getpatterns()54 	virtual unsigned int getpatterns()	// returns number of patterns
55 	  { return 0; }
getpattern()56 	virtual unsigned int getpattern()	// returns currently playing pattern
57 	  { return 0; }
getorders()58 	virtual unsigned int getorders()	// returns size of orderlist
59 	  { return 0; }
getorder()60 	virtual unsigned int getorder()		// returns currently playing song position
61 	  { return 0; }
getrow()62 	virtual unsigned int getrow()		// returns currently playing row
63 	  { return 0; }
getspeed()64 	virtual unsigned int getspeed()		// returns current song speed
65 	  { return 0; }
getsubsongs()66 	virtual unsigned int getsubsongs()	// returns number of subsongs
67 	  { return 1; }
getsubsong()68 	virtual unsigned int getsubsong()	// returns current subsong
69 	  { return 0; }
getinstruments()70 	virtual unsigned int getinstruments()	// returns number of instruments
71 	  { return 0; }
getinstrument(unsigned int n)72 	virtual const char *getinstrument(unsigned int n)	// returns n-th instrument name
73 	  { return ""; }
74 
75 protected:
76 	Copl		*opl;	// our OPL chip
77 	//CAdPlugDatabase	*db;	// AdPlug Database
78 
79 	static const unsigned short	note_table[12];	// standard adlib note table
80 	static const unsigned char	op_table[9];	// the 9 operators as expected by the OPL
81 };
82 
83 #endif
84