comparison src/adplug/core/mid.h @ 12:3da1b8942b8b trunk

[svn] - remove src/Input src/Output src/Effect src/General src/Visualization src/Container
author nenolod
date Mon, 18 Sep 2006 03:14:20 -0700
parents src/Input/adplug/core/mid.h@13389e613d67
children cae46214b8bf
comparison
equal deleted inserted replaced
11:cff1d04026ae 12:3da1b8942b8b
1 /*
2 * Adplug - Replayer for many OPL2/OPL3 audio file formats.
3 * Copyright (C) 1999 - 2005 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., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
18 *
19 * mid.h - LAA, SCI, MID & CMF Player by Philip Hassey <philhassey@hotmail.com>
20 */
21
22 #include "player.h"
23
24 class CmidPlayer: public CPlayer
25 {
26 public:
27 static CPlayer *factory(Copl *newopl);
28
29 CmidPlayer(Copl *newopl);
30 ~CmidPlayer()
31 { if(data) delete [] data; }
32
33 bool load(const std::string &filename, const CFileProvider &fp);
34 bool update();
35 void rewind(int subsong);
36 float getrefresh();
37
38 std::string gettype();
39 std::string gettitle()
40 { return std::string(title); }
41 std::string getauthor()
42 { return std::string(author); }
43 std::string getdesc()
44 { return std::string(remarks); }
45 unsigned int getinstruments()
46 { return tins; }
47 unsigned int getsubsongs()
48 { return subsongs; }
49
50 protected:
51 static const unsigned char adlib_opadd[];
52 static const int ops[], map_chan[], fnums[], percussion_map[];
53
54 struct midi_channel {
55 int inum;
56 unsigned char ins[11];
57 int vol;
58 int nshift;
59 int on;
60 };
61
62 struct midi_track {
63 unsigned long tend;
64 unsigned long spos;
65 unsigned long pos;
66 unsigned long iwait;
67 int on;
68 unsigned char pv;
69 };
70
71 char *author,*title,*remarks,emptystr;
72 long flen;
73 unsigned long pos;
74 unsigned long sierra_pos; //sierras gotta be special.. :>
75 int subsongs;
76 unsigned char *data;
77
78 unsigned char adlib_data[256];
79 int adlib_style;
80 int adlib_mode;
81 unsigned char myinsbank[128][16], smyinsbank[128][16];
82 midi_channel ch[16];
83 int chp[18][3];
84
85 long deltas;
86 long msqtr;
87
88 midi_track track[16];
89 unsigned int curtrack;
90
91 float fwait;
92 unsigned long iwait;
93 int doing;
94
95 int type,tins,stins;
96
97 private:
98 bool load_sierra_ins(const std::string &fname, const CFileProvider &fp);
99 void midiprintf(char *format, ...);
100 unsigned char datalook(long pos);
101 unsigned long getnexti(unsigned long num);
102 unsigned long getnext(unsigned long num);
103 unsigned long getval();
104 void sierra_next_section();
105 void midi_write_adlib(unsigned int r, unsigned char v);
106 void midi_fm_instrument(int voice, unsigned char *inst);
107 void midi_fm_percussion(int ch, unsigned char *inst);
108 void midi_fm_volume(int voice, int volume);
109 void midi_fm_playnote(int voice, int note, int volume);
110 void midi_fm_endnote(int voice);
111 void midi_fm_reset();
112 };