annotate Plugins/Input/adplug/core/d00.h @ 359:8df427a314a8 trunk

[svn] Adlib synthesizer (AdPlug) support.
author chainsaw
date Fri, 30 Dec 2005 16:31:39 -0800
parents
children 6ad7eb96dd26
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
359
8df427a314a8 [svn] Adlib synthesizer (AdPlug) support.
chainsaw
parents:
diff changeset
1 /*
8df427a314a8 [svn] Adlib synthesizer (AdPlug) support.
chainsaw
parents:
diff changeset
2 * AdPlug - Replayer for many OPL2/OPL3 audio file formats.
8df427a314a8 [svn] Adlib synthesizer (AdPlug) support.
chainsaw
parents:
diff changeset
3 * Copyright (C) 1999 - 2003 Simon Peter, <dn.tlp@gmx.net>, et al.
8df427a314a8 [svn] Adlib synthesizer (AdPlug) support.
chainsaw
parents:
diff changeset
4 *
8df427a314a8 [svn] Adlib synthesizer (AdPlug) support.
chainsaw
parents:
diff changeset
5 * This library is free software; you can redistribute it and/or
8df427a314a8 [svn] Adlib synthesizer (AdPlug) support.
chainsaw
parents:
diff changeset
6 * modify it under the terms of the GNU Lesser General Public
8df427a314a8 [svn] Adlib synthesizer (AdPlug) support.
chainsaw
parents:
diff changeset
7 * License as published by the Free Software Foundation; either
8df427a314a8 [svn] Adlib synthesizer (AdPlug) support.
chainsaw
parents:
diff changeset
8 * version 2.1 of the License, or (at your option) any later version.
8df427a314a8 [svn] Adlib synthesizer (AdPlug) support.
chainsaw
parents:
diff changeset
9 *
8df427a314a8 [svn] Adlib synthesizer (AdPlug) support.
chainsaw
parents:
diff changeset
10 * This library is distributed in the hope that it will be useful,
8df427a314a8 [svn] Adlib synthesizer (AdPlug) support.
chainsaw
parents:
diff changeset
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
8df427a314a8 [svn] Adlib synthesizer (AdPlug) support.
chainsaw
parents:
diff changeset
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
8df427a314a8 [svn] Adlib synthesizer (AdPlug) support.
chainsaw
parents:
diff changeset
13 * Lesser General Public License for more details.
8df427a314a8 [svn] Adlib synthesizer (AdPlug) support.
chainsaw
parents:
diff changeset
14 *
8df427a314a8 [svn] Adlib synthesizer (AdPlug) support.
chainsaw
parents:
diff changeset
15 * You should have received a copy of the GNU Lesser General Public
8df427a314a8 [svn] Adlib synthesizer (AdPlug) support.
chainsaw
parents:
diff changeset
16 * License along with this library; if not, write to the Free Software
8df427a314a8 [svn] Adlib synthesizer (AdPlug) support.
chainsaw
parents:
diff changeset
17 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
8df427a314a8 [svn] Adlib synthesizer (AdPlug) support.
chainsaw
parents:
diff changeset
18 *
8df427a314a8 [svn] Adlib synthesizer (AdPlug) support.
chainsaw
parents:
diff changeset
19 * d00.h - D00 Player by Simon Peter <dn.tlp@gmx.net>
8df427a314a8 [svn] Adlib synthesizer (AdPlug) support.
chainsaw
parents:
diff changeset
20 */
8df427a314a8 [svn] Adlib synthesizer (AdPlug) support.
chainsaw
parents:
diff changeset
21
8df427a314a8 [svn] Adlib synthesizer (AdPlug) support.
chainsaw
parents:
diff changeset
22 #ifndef H_D00
8df427a314a8 [svn] Adlib synthesizer (AdPlug) support.
chainsaw
parents:
diff changeset
23 #define H_D00
8df427a314a8 [svn] Adlib synthesizer (AdPlug) support.
chainsaw
parents:
diff changeset
24
8df427a314a8 [svn] Adlib synthesizer (AdPlug) support.
chainsaw
parents:
diff changeset
25 #include "player.h"
8df427a314a8 [svn] Adlib synthesizer (AdPlug) support.
chainsaw
parents:
diff changeset
26
8df427a314a8 [svn] Adlib synthesizer (AdPlug) support.
chainsaw
parents:
diff changeset
27 class Cd00Player: public CPlayer
8df427a314a8 [svn] Adlib synthesizer (AdPlug) support.
chainsaw
parents:
diff changeset
28 {
8df427a314a8 [svn] Adlib synthesizer (AdPlug) support.
chainsaw
parents:
diff changeset
29 public:
8df427a314a8 [svn] Adlib synthesizer (AdPlug) support.
chainsaw
parents:
diff changeset
30 static CPlayer *factory(Copl *newopl);
8df427a314a8 [svn] Adlib synthesizer (AdPlug) support.
chainsaw
parents:
diff changeset
31
8df427a314a8 [svn] Adlib synthesizer (AdPlug) support.
chainsaw
parents:
diff changeset
32 Cd00Player(Copl *newopl)
8df427a314a8 [svn] Adlib synthesizer (AdPlug) support.
chainsaw
parents:
diff changeset
33 : CPlayer(newopl), filedata(0)
8df427a314a8 [svn] Adlib synthesizer (AdPlug) support.
chainsaw
parents:
diff changeset
34 { };
8df427a314a8 [svn] Adlib synthesizer (AdPlug) support.
chainsaw
parents:
diff changeset
35 ~Cd00Player()
8df427a314a8 [svn] Adlib synthesizer (AdPlug) support.
chainsaw
parents:
diff changeset
36 { if(filedata) delete [] filedata; };
8df427a314a8 [svn] Adlib synthesizer (AdPlug) support.
chainsaw
parents:
diff changeset
37
8df427a314a8 [svn] Adlib synthesizer (AdPlug) support.
chainsaw
parents:
diff changeset
38 bool load(const std::string &filename, const CFileProvider &fp);
8df427a314a8 [svn] Adlib synthesizer (AdPlug) support.
chainsaw
parents:
diff changeset
39 bool update();
8df427a314a8 [svn] Adlib synthesizer (AdPlug) support.
chainsaw
parents:
diff changeset
40 void rewind(int subsong);
8df427a314a8 [svn] Adlib synthesizer (AdPlug) support.
chainsaw
parents:
diff changeset
41 float getrefresh();
8df427a314a8 [svn] Adlib synthesizer (AdPlug) support.
chainsaw
parents:
diff changeset
42
8df427a314a8 [svn] Adlib synthesizer (AdPlug) support.
chainsaw
parents:
diff changeset
43 std::string gettype();
8df427a314a8 [svn] Adlib synthesizer (AdPlug) support.
chainsaw
parents:
diff changeset
44 std::string gettitle()
8df427a314a8 [svn] Adlib synthesizer (AdPlug) support.
chainsaw
parents:
diff changeset
45 { if(version > 1) return std::string(header->songname); else return std::string(); };
8df427a314a8 [svn] Adlib synthesizer (AdPlug) support.
chainsaw
parents:
diff changeset
46 std::string getauthor()
8df427a314a8 [svn] Adlib synthesizer (AdPlug) support.
chainsaw
parents:
diff changeset
47 { if(version > 1) return std::string(header->author); else return std::string(); };
8df427a314a8 [svn] Adlib synthesizer (AdPlug) support.
chainsaw
parents:
diff changeset
48 std::string getdesc()
8df427a314a8 [svn] Adlib synthesizer (AdPlug) support.
chainsaw
parents:
diff changeset
49 { if(*datainfo) return std::string(datainfo); else return std::string(); };
8df427a314a8 [svn] Adlib synthesizer (AdPlug) support.
chainsaw
parents:
diff changeset
50 unsigned int getsubsongs();
8df427a314a8 [svn] Adlib synthesizer (AdPlug) support.
chainsaw
parents:
diff changeset
51
8df427a314a8 [svn] Adlib synthesizer (AdPlug) support.
chainsaw
parents:
diff changeset
52 protected:
8df427a314a8 [svn] Adlib synthesizer (AdPlug) support.
chainsaw
parents:
diff changeset
53 #pragma pack(1)
8df427a314a8 [svn] Adlib synthesizer (AdPlug) support.
chainsaw
parents:
diff changeset
54 struct d00header {
8df427a314a8 [svn] Adlib synthesizer (AdPlug) support.
chainsaw
parents:
diff changeset
55 char id[6];
8df427a314a8 [svn] Adlib synthesizer (AdPlug) support.
chainsaw
parents:
diff changeset
56 unsigned char type,version,speed,subsongs,soundcard;
8df427a314a8 [svn] Adlib synthesizer (AdPlug) support.
chainsaw
parents:
diff changeset
57 char songname[32],author[32],dummy[32];
8df427a314a8 [svn] Adlib synthesizer (AdPlug) support.
chainsaw
parents:
diff changeset
58 unsigned short tpoin,seqptr,instptr,infoptr,spfxptr,endmark;
8df427a314a8 [svn] Adlib synthesizer (AdPlug) support.
chainsaw
parents:
diff changeset
59 };
8df427a314a8 [svn] Adlib synthesizer (AdPlug) support.
chainsaw
parents:
diff changeset
60
8df427a314a8 [svn] Adlib synthesizer (AdPlug) support.
chainsaw
parents:
diff changeset
61 struct d00header1 {
8df427a314a8 [svn] Adlib synthesizer (AdPlug) support.
chainsaw
parents:
diff changeset
62 unsigned char version,speed,subsongs;
8df427a314a8 [svn] Adlib synthesizer (AdPlug) support.
chainsaw
parents:
diff changeset
63 unsigned short tpoin,seqptr,instptr,infoptr,lpulptr,endmark;
8df427a314a8 [svn] Adlib synthesizer (AdPlug) support.
chainsaw
parents:
diff changeset
64 };
8df427a314a8 [svn] Adlib synthesizer (AdPlug) support.
chainsaw
parents:
diff changeset
65 #pragma pack()
8df427a314a8 [svn] Adlib synthesizer (AdPlug) support.
chainsaw
parents:
diff changeset
66
8df427a314a8 [svn] Adlib synthesizer (AdPlug) support.
chainsaw
parents:
diff changeset
67 struct {
8df427a314a8 [svn] Adlib synthesizer (AdPlug) support.
chainsaw
parents:
diff changeset
68 unsigned short *order,ordpos,pattpos,del,speed,rhcnt,key,freq,inst,spfx,ispfx,irhcnt;
8df427a314a8 [svn] Adlib synthesizer (AdPlug) support.
chainsaw
parents:
diff changeset
69 signed short transpose,slide,slideval,vibspeed;
8df427a314a8 [svn] Adlib synthesizer (AdPlug) support.
chainsaw
parents:
diff changeset
70 unsigned char seqend,vol,vibdepth,fxdel,modvol,cvol,levpuls,frameskip,nextnote,note,ilevpuls,trigger;
8df427a314a8 [svn] Adlib synthesizer (AdPlug) support.
chainsaw
parents:
diff changeset
71 } channel[9];
8df427a314a8 [svn] Adlib synthesizer (AdPlug) support.
chainsaw
parents:
diff changeset
72
8df427a314a8 [svn] Adlib synthesizer (AdPlug) support.
chainsaw
parents:
diff changeset
73 struct Sinsts {
8df427a314a8 [svn] Adlib synthesizer (AdPlug) support.
chainsaw
parents:
diff changeset
74 unsigned char data[11],tunelev,timer,sr,dummy[2];
8df427a314a8 [svn] Adlib synthesizer (AdPlug) support.
chainsaw
parents:
diff changeset
75 } *inst;
8df427a314a8 [svn] Adlib synthesizer (AdPlug) support.
chainsaw
parents:
diff changeset
76
8df427a314a8 [svn] Adlib synthesizer (AdPlug) support.
chainsaw
parents:
diff changeset
77 struct Sspfx {
8df427a314a8 [svn] Adlib synthesizer (AdPlug) support.
chainsaw
parents:
diff changeset
78 unsigned short instnr;
8df427a314a8 [svn] Adlib synthesizer (AdPlug) support.
chainsaw
parents:
diff changeset
79 signed char halfnote;
8df427a314a8 [svn] Adlib synthesizer (AdPlug) support.
chainsaw
parents:
diff changeset
80 unsigned char modlev;
8df427a314a8 [svn] Adlib synthesizer (AdPlug) support.
chainsaw
parents:
diff changeset
81 signed char modlevadd;
8df427a314a8 [svn] Adlib synthesizer (AdPlug) support.
chainsaw
parents:
diff changeset
82 unsigned char duration;
8df427a314a8 [svn] Adlib synthesizer (AdPlug) support.
chainsaw
parents:
diff changeset
83 unsigned short ptr;
8df427a314a8 [svn] Adlib synthesizer (AdPlug) support.
chainsaw
parents:
diff changeset
84 } *spfx;
8df427a314a8 [svn] Adlib synthesizer (AdPlug) support.
chainsaw
parents:
diff changeset
85
8df427a314a8 [svn] Adlib synthesizer (AdPlug) support.
chainsaw
parents:
diff changeset
86 struct Slevpuls {
8df427a314a8 [svn] Adlib synthesizer (AdPlug) support.
chainsaw
parents:
diff changeset
87 unsigned char level;
8df427a314a8 [svn] Adlib synthesizer (AdPlug) support.
chainsaw
parents:
diff changeset
88 signed char voladd;
8df427a314a8 [svn] Adlib synthesizer (AdPlug) support.
chainsaw
parents:
diff changeset
89 unsigned char duration,ptr;
8df427a314a8 [svn] Adlib synthesizer (AdPlug) support.
chainsaw
parents:
diff changeset
90 } *levpuls;
8df427a314a8 [svn] Adlib synthesizer (AdPlug) support.
chainsaw
parents:
diff changeset
91
8df427a314a8 [svn] Adlib synthesizer (AdPlug) support.
chainsaw
parents:
diff changeset
92 unsigned char songend,version;
8df427a314a8 [svn] Adlib synthesizer (AdPlug) support.
chainsaw
parents:
diff changeset
93 char *datainfo;
8df427a314a8 [svn] Adlib synthesizer (AdPlug) support.
chainsaw
parents:
diff changeset
94 unsigned short *seqptr;
8df427a314a8 [svn] Adlib synthesizer (AdPlug) support.
chainsaw
parents:
diff changeset
95 d00header *header;
8df427a314a8 [svn] Adlib synthesizer (AdPlug) support.
chainsaw
parents:
diff changeset
96 d00header1 *header1;
8df427a314a8 [svn] Adlib synthesizer (AdPlug) support.
chainsaw
parents:
diff changeset
97 char *filedata;
8df427a314a8 [svn] Adlib synthesizer (AdPlug) support.
chainsaw
parents:
diff changeset
98
8df427a314a8 [svn] Adlib synthesizer (AdPlug) support.
chainsaw
parents:
diff changeset
99 private:
8df427a314a8 [svn] Adlib synthesizer (AdPlug) support.
chainsaw
parents:
diff changeset
100 void setvolume(unsigned char chan);
8df427a314a8 [svn] Adlib synthesizer (AdPlug) support.
chainsaw
parents:
diff changeset
101 void setfreq(unsigned char chan);
8df427a314a8 [svn] Adlib synthesizer (AdPlug) support.
chainsaw
parents:
diff changeset
102 void setinst(unsigned char chan);
8df427a314a8 [svn] Adlib synthesizer (AdPlug) support.
chainsaw
parents:
diff changeset
103 void playnote(unsigned char chan);
8df427a314a8 [svn] Adlib synthesizer (AdPlug) support.
chainsaw
parents:
diff changeset
104 void vibrato(unsigned char chan);
8df427a314a8 [svn] Adlib synthesizer (AdPlug) support.
chainsaw
parents:
diff changeset
105 };
8df427a314a8 [svn] Adlib synthesizer (AdPlug) support.
chainsaw
parents:
diff changeset
106
8df427a314a8 [svn] Adlib synthesizer (AdPlug) support.
chainsaw
parents:
diff changeset
107 #endif