359
|
1 /*
|
|
2 * AdPlug - Replayer for many OPL2/OPL3 audio file formats.
|
|
3 * Copyright (C) 1999 - 2003 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., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
|
18 *
|
|
19 * d00.h - D00 Player by Simon Peter <dn.tlp@gmx.net>
|
|
20 */
|
|
21
|
|
22 #ifndef H_D00
|
|
23 #define H_D00
|
|
24
|
|
25 #include "player.h"
|
|
26
|
|
27 class Cd00Player: public CPlayer
|
|
28 {
|
|
29 public:
|
|
30 static CPlayer *factory(Copl *newopl);
|
|
31
|
|
32 Cd00Player(Copl *newopl)
|
|
33 : CPlayer(newopl), filedata(0)
|
|
34 { };
|
|
35 ~Cd00Player()
|
|
36 { if(filedata) delete [] filedata; };
|
|
37
|
|
38 bool load(const std::string &filename, const CFileProvider &fp);
|
|
39 bool update();
|
|
40 void rewind(int subsong);
|
|
41 float getrefresh();
|
|
42
|
|
43 std::string gettype();
|
|
44 std::string gettitle()
|
|
45 { if(version > 1) return std::string(header->songname); else return std::string(); };
|
|
46 std::string getauthor()
|
|
47 { if(version > 1) return std::string(header->author); else return std::string(); };
|
|
48 std::string getdesc()
|
|
49 { if(*datainfo) return std::string(datainfo); else return std::string(); };
|
|
50 unsigned int getsubsongs();
|
|
51
|
|
52 protected:
|
|
53 #pragma pack(1)
|
|
54 struct d00header {
|
|
55 char id[6];
|
|
56 unsigned char type,version,speed,subsongs,soundcard;
|
|
57 char songname[32],author[32],dummy[32];
|
|
58 unsigned short tpoin,seqptr,instptr,infoptr,spfxptr,endmark;
|
|
59 };
|
|
60
|
|
61 struct d00header1 {
|
|
62 unsigned char version,speed,subsongs;
|
|
63 unsigned short tpoin,seqptr,instptr,infoptr,lpulptr,endmark;
|
|
64 };
|
|
65 #pragma pack()
|
|
66
|
|
67 struct {
|
|
68 unsigned short *order,ordpos,pattpos,del,speed,rhcnt,key,freq,inst,spfx,ispfx,irhcnt;
|
|
69 signed short transpose,slide,slideval,vibspeed;
|
|
70 unsigned char seqend,vol,vibdepth,fxdel,modvol,cvol,levpuls,frameskip,nextnote,note,ilevpuls,trigger;
|
|
71 } channel[9];
|
|
72
|
|
73 struct Sinsts {
|
|
74 unsigned char data[11],tunelev,timer,sr,dummy[2];
|
|
75 } *inst;
|
|
76
|
|
77 struct Sspfx {
|
|
78 unsigned short instnr;
|
|
79 signed char halfnote;
|
|
80 unsigned char modlev;
|
|
81 signed char modlevadd;
|
|
82 unsigned char duration;
|
|
83 unsigned short ptr;
|
|
84 } *spfx;
|
|
85
|
|
86 struct Slevpuls {
|
|
87 unsigned char level;
|
|
88 signed char voladd;
|
|
89 unsigned char duration,ptr;
|
|
90 } *levpuls;
|
|
91
|
|
92 unsigned char songend,version;
|
|
93 char *datainfo;
|
|
94 unsigned short *seqptr;
|
|
95 d00header *header;
|
|
96 d00header1 *header1;
|
|
97 char *filedata;
|
|
98
|
|
99 private:
|
|
100 void setvolume(unsigned char chan);
|
|
101 void setfreq(unsigned char chan);
|
|
102 void setinst(unsigned char chan);
|
|
103 void playnote(unsigned char chan);
|
|
104 void vibrato(unsigned char chan);
|
|
105 };
|
|
106
|
|
107 #endif
|