ScummVM API documentation
adplug_player.h
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 modify
8  * it under the terms of the GNU General Public License as published by
9  * the Free Software Foundation, either version 3 of the License, or
10  * (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, see <http://www.gnu.org/licenses/>.
19  *
20  */
21 
22 #ifndef NUVIE_SOUND_ADPLUG_ADPLUG_PLAYER
23 #define NUVIE_SOUND_ADPLUG_ADPLUG_PLAYER
24 
25 #include "ultima/shared/std/string.h"
26 #include "ultima/nuvie/sound/adplug/opl.h"
27 
28 namespace Common {
29 class Path;
30 }
31 
32 namespace Ultima {
33 namespace Nuvie {
34 
35 class CPlayer {
36 public:
37  CPlayer(Copl *newopl);
38  virtual ~CPlayer();
39 
40  /***** Operational methods *****/
41  void seek(unsigned long ms);
42 
43  virtual bool load(const Common::Path &filename) = 0; // loads file
44  virtual bool update() = 0; // executes replay code for 1 tick
45  virtual void rewind(int subsong = -1) = 0; // rewinds to specified subsong
46  virtual float getrefresh() = 0; // returns needed timer refresh rate
47 
48  /***** Informational methods *****/
49  unsigned long songlength(int subsong = -1);
50 
51  virtual Std::string gettype() = 0; // returns file type
52  virtual Std::string gettitle() { // returns song title
53  return Std::string();
54  }
55  virtual Std::string getauthor() { // returns song author name
56  return Std::string();
57  }
58  virtual Std::string getdesc() { // returns song description
59  return Std::string();
60  }
61  virtual unsigned int getpatterns() { // returns number of patterns
62  return 0;
63  }
64  virtual unsigned int getpattern() { // returns currently playing pattern
65  return 0;
66  }
67  virtual unsigned int getorders() { // returns size of orderlist
68  return 0;
69  }
70  virtual unsigned int getorder() { // returns currently playing song position
71  return 0;
72  }
73  virtual unsigned int getrow() { // returns currently playing row
74  return 0;
75  }
76  virtual unsigned int getspeed() { // returns current song speed
77  return 0;
78  }
79  virtual unsigned int getsubsongs() { // returns number of subsongs
80  return 1;
81  }
82  virtual unsigned int getinstruments() { // returns number of instruments
83  return 0;
84  }
85  virtual Std::string getinstrument(unsigned int n) { // returns n-th instrument name
86  return Std::string();
87  }
88 
89 protected:
90  Copl *opl; // our OPL chip
91 
92  static const unsigned short note_table[12]; // standard adlib note table
93  static const unsigned char op_table[9]; // the 9 operators as expected by the OPL2
94 };
95 
96 } // End of namespace Nuvie
97 } // End of namespace Ultima
98 
99 #endif
Definition: path.h:52
Definition: opl.h:30
Definition: detection.h:27
Path
Definition: game.h:75
Definition: string.h:30
Definition: algorithm.h:29
Definition: adplug_player.h:35