]> 4ch.mooo.com Git - 16.git/blob - 16/adplug/adplug/src/d00.h
renamed: 16/adplug/adplug-2.2.1/.DS_Store -> 16/adplug/adplug/.DS_Store
[16.git] / 16 / adplug / adplug / src / d00.h
1 /*
2  * AdPlug - Replayer for many OPL2/OPL3 audio file formats.
3  * Copyright (C) 1999 - 2007 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,
69       spfx,ispfx,irhcnt;
70     signed short        transpose,slide,slideval,vibspeed;
71     unsigned char       seqend,vol,vibdepth,fxdel,modvol,cvol,levpuls,
72       frameskip,nextnote,note,ilevpuls,trigger,fxflag;
73   } channel[9];
74
75   struct Sinsts {
76     unsigned char data[11],tunelev,timer,sr,dummy[2];
77   } *inst;
78
79   struct Sspfx {
80     unsigned short instnr;
81     signed char halfnote;
82     unsigned char modlev;
83     signed char modlevadd;
84     unsigned char duration;
85     unsigned short ptr;
86   } *spfx;
87
88   struct Slevpuls {
89     unsigned char level;
90     signed char voladd;
91     unsigned char duration,ptr;
92   } *levpuls;
93
94   unsigned char songend,version,cursubsong;
95   char *datainfo;
96   unsigned short *seqptr;
97   d00header *header;
98   d00header1 *header1;
99   char *filedata;
100
101  private:
102   void setvolume(unsigned char chan);
103   void setfreq(unsigned char chan);
104   void setinst(unsigned char chan);
105   void playnote(unsigned char chan);
106   void vibrato(unsigned char chan);
107 };
108
109 #endif