ScummVM API documentation
mid.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 ULTIMA_MID_H
23 #define ULTIMA_MID_H
24 
25 #include "ultima/nuvie/sound/adplug/adplug_player.h"
26 
27 namespace Ultima {
28 namespace Nuvie {
29 
30 class OriginFXAdLibDriver;
31 
32 class CmidPlayer: public CPlayer {
33 public:
34  static CPlayer *factory(Copl *newopl);
35 
36  CmidPlayer(Copl *newopl);
37  ~CmidPlayer() override;
38 
39  bool load(const Common::Path &filename) override;
40  bool load(const Common::Path &filename, int song_index);
41  //bool load(const Common::String &filename, const CFileProvider &fp);
42  bool update() override;
43  void rewind(int subsong) override;
44  float getrefresh() override;
45 
46  Common::String gettype() override;
47  Common::String gettitle() override {
48  return Common::String(title);
49  }
50  Common::String getauthor() override {
51  return Common::String(author);
52  }
53  Common::String getdesc() override {
54  return Common::String(remarks);
55  }
56  unsigned int getinstruments() override {
57  return tins;
58  }
59  unsigned int getsubsongs() override {
60  return subsongs;
61  }
62 
63 protected:
64  static const unsigned char adlib_opadd[];
65  static const int ops[], map_chan[], fnums[], percussion_map[];
66 
67  struct midi_track {
68  unsigned long tend;
69  unsigned long spos;
70  unsigned long pos;
71  unsigned long iwait;
72  int on;
73  unsigned char pv;
74  };
75 
76  char *author, *title, *remarks, emptystr;
77  long flen;
78  unsigned long pos;
79 
80  int subsongs;
81  unsigned char *data;
82 
83 
84  int adlib_style;
85  int adlib_mode;
86 
87  int chp[18][3];
88 
89  long deltas;
90  long msqtr;
91 
92  midi_track track[16];
93  unsigned int curtrack;
94  unsigned int track_count;
95 
96  float fwait;
97  unsigned long iwait;
98  int doing;
99 
100  int type, tins, stins;
101 
102  OriginFXAdLibDriver *origin_fx_driver;
103 
104 private:
105 
106  void load_ultima_midi_tracks();
107  void midiprintf(const char *format, ...);
108  unsigned char datalook(long pos);
109  unsigned long getnexti(unsigned long num);
110  unsigned long getnext(unsigned long num);
111  unsigned long getval();
112 
113 public:
114  void interrupt_vector();
115 };
116 
117 } // End of namespace Nuvie
118 } // End of namespace Ultima
119 
120 #endif // ULTIMA_MID_H
Definition: str.h:59
Definition: origin_fx_adib_driver.h:34
Definition: path.h:52
Definition: opl.h:30
Definition: detection.h:27
Definition: adplug_player.h:35
Definition: mid.h:32