1 /* ScummVM - Graphic Adventure Engine
2  *
3  * ScummVM is the legal property of its developers, whose names
4  * are too numerous to list here. Please refer to the COPYRIGHT
5  * file distributed with this source distribution.
6  *
7  * This program is free software; you can redistribute it and/or
8  * modify it under the terms of the GNU General Public License
9  * as published by the Free Software Foundation; either version 2
10  * of the License, or (at your option) any later version.
11  *
12  * This program is distributed in the hope that it will be useful,
13  * but WITHOUT ANY WARRANTY; without even the implied warranty of
14  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
15  * GNU General Public License for more details.
16  *
17  * You should have received a copy of the GNU General Public License
18  * along with this program; if not, write to the Free Software
19  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
20  *
21  */
22 
23 #ifndef NUVIE_SOUND_ADPLUG_ADPLUG_PLAYER
24 #define NUVIE_SOUND_ADPLUG_ADPLUG_PLAYER
25 
26 #include "ultima/shared/std/string.h"
27 #include "ultima/nuvie/sound/adplug/opl.h"
28 
29 namespace Ultima {
30 namespace Nuvie {
31 
32 class CPlayer {
33 public:
34 	CPlayer(Copl *newopl);
35 	virtual ~CPlayer();
36 
37 	/***** Operational methods *****/
38 	void seek(unsigned long ms);
39 
40 	virtual bool load(const Std::string &filename) = 0; // loads file
41 	virtual bool update() = 0;          // executes replay code for 1 tick
42 	virtual void rewind(int subsong = -1) = 0;  // rewinds to specified subsong
43 	virtual float getrefresh() = 0;         // returns needed timer refresh rate
44 
45 	/***** Informational methods *****/
46 	unsigned long songlength(int subsong = -1);
47 
48 	virtual Std::string gettype() = 0;  // returns file type
gettitle()49 	virtual Std::string gettitle() {    // returns song title
50 		return Std::string();
51 	}
getauthor()52 	virtual Std::string getauthor() {   // returns song author name
53 		return Std::string();
54 	}
getdesc()55 	virtual Std::string getdesc() {     // returns song description
56 		return Std::string();
57 	}
getpatterns()58 	virtual unsigned int getpatterns() { // returns number of patterns
59 		return 0;
60 	}
getpattern()61 	virtual unsigned int getpattern() { // returns currently playing pattern
62 		return 0;
63 	}
getorders()64 	virtual unsigned int getorders() {  // returns size of orderlist
65 		return 0;
66 	}
getorder()67 	virtual unsigned int getorder() {   // returns currently playing song position
68 		return 0;
69 	}
getrow()70 	virtual unsigned int getrow() {     // returns currently playing row
71 		return 0;
72 	}
getspeed()73 	virtual unsigned int getspeed() {   // returns current song speed
74 		return 0;
75 	}
getsubsongs()76 	virtual unsigned int getsubsongs() { // returns number of subsongs
77 		return 1;
78 	}
getinstruments()79 	virtual unsigned int getinstruments() { // returns number of instruments
80 		return 0;
81 	}
getinstrument(unsigned int n)82 	virtual Std::string getinstrument(unsigned int n) { // returns n-th instrument name
83 		return Std::string();
84 	}
85 
86 protected:
87 	Copl        *opl;   // our OPL chip
88 
89 	static const unsigned short note_table[12]; // standard adlib note table
90 	static const unsigned char op_table[9];     // the 9 operators as expected by the OPL2
91 };
92 
93 } // End of namespace Nuvie
94 } // End of namespace Ultima
95 
96 #endif
97