Mercurial > audlegacy
annotate Plugins/Input/adplug/core/rix.h @ 428:15ca2ea93a30 trunk
[svn] Sync with upstream CVS. This implements RIX playback.
author | chainsaw |
---|---|
date | Sat, 14 Jan 2006 07:27:13 -0800 |
parents | |
children | 2b06eb5e472d |
rev | line source |
---|---|
428
15ca2ea93a30
[svn] Sync with upstream CVS. This implements RIX playback.
chainsaw
parents:
diff
changeset
|
1 /* |
15ca2ea93a30
[svn] Sync with upstream CVS. This implements RIX playback.
chainsaw
parents:
diff
changeset
|
2 * Adplug - Replayer for many OPL2/OPL3 audio file formats. |
15ca2ea93a30
[svn] Sync with upstream CVS. This implements RIX playback.
chainsaw
parents:
diff
changeset
|
3 * Copyright (C) 1999 - 2005 Simon Peter, <dn.tlp@gmx.net>, et al. |
15ca2ea93a30
[svn] Sync with upstream CVS. This implements RIX playback.
chainsaw
parents:
diff
changeset
|
4 * |
15ca2ea93a30
[svn] Sync with upstream CVS. This implements RIX playback.
chainsaw
parents:
diff
changeset
|
5 * This library is free software; you can redistribute it and/or |
15ca2ea93a30
[svn] Sync with upstream CVS. This implements RIX playback.
chainsaw
parents:
diff
changeset
|
6 * modify it under the terms of the GNU Lesser General Public |
15ca2ea93a30
[svn] Sync with upstream CVS. This implements RIX playback.
chainsaw
parents:
diff
changeset
|
7 * License as published by the Free Software Foundation; either |
15ca2ea93a30
[svn] Sync with upstream CVS. This implements RIX playback.
chainsaw
parents:
diff
changeset
|
8 * version 2.1 of the License, or (at your option) any later version. |
15ca2ea93a30
[svn] Sync with upstream CVS. This implements RIX playback.
chainsaw
parents:
diff
changeset
|
9 * |
15ca2ea93a30
[svn] Sync with upstream CVS. This implements RIX playback.
chainsaw
parents:
diff
changeset
|
10 * This library is distributed in the hope that it will be useful, |
15ca2ea93a30
[svn] Sync with upstream CVS. This implements RIX playback.
chainsaw
parents:
diff
changeset
|
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of |
15ca2ea93a30
[svn] Sync with upstream CVS. This implements RIX playback.
chainsaw
parents:
diff
changeset
|
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
15ca2ea93a30
[svn] Sync with upstream CVS. This implements RIX playback.
chainsaw
parents:
diff
changeset
|
13 * Lesser General Public License for more details. |
15ca2ea93a30
[svn] Sync with upstream CVS. This implements RIX playback.
chainsaw
parents:
diff
changeset
|
14 * |
15ca2ea93a30
[svn] Sync with upstream CVS. This implements RIX playback.
chainsaw
parents:
diff
changeset
|
15 * You should have received a copy of the GNU Lesser General Public |
15ca2ea93a30
[svn] Sync with upstream CVS. This implements RIX playback.
chainsaw
parents:
diff
changeset
|
16 * License along with this library; if not, write to the Free Software |
15ca2ea93a30
[svn] Sync with upstream CVS. This implements RIX playback.
chainsaw
parents:
diff
changeset
|
17 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA |
15ca2ea93a30
[svn] Sync with upstream CVS. This implements RIX playback.
chainsaw
parents:
diff
changeset
|
18 * |
15ca2ea93a30
[svn] Sync with upstream CVS. This implements RIX playback.
chainsaw
parents:
diff
changeset
|
19 * rix.h - Dayu OPL Format Player by palxex <palxex@163.com/palxex.ys168.com> |
15ca2ea93a30
[svn] Sync with upstream CVS. This implements RIX playback.
chainsaw
parents:
diff
changeset
|
20 */ |
15ca2ea93a30
[svn] Sync with upstream CVS. This implements RIX playback.
chainsaw
parents:
diff
changeset
|
21 |
15ca2ea93a30
[svn] Sync with upstream CVS. This implements RIX playback.
chainsaw
parents:
diff
changeset
|
22 #include "player.h" |
15ca2ea93a30
[svn] Sync with upstream CVS. This implements RIX playback.
chainsaw
parents:
diff
changeset
|
23 |
15ca2ea93a30
[svn] Sync with upstream CVS. This implements RIX playback.
chainsaw
parents:
diff
changeset
|
24 class CrixPlayer: public CPlayer |
15ca2ea93a30
[svn] Sync with upstream CVS. This implements RIX playback.
chainsaw
parents:
diff
changeset
|
25 { |
15ca2ea93a30
[svn] Sync with upstream CVS. This implements RIX playback.
chainsaw
parents:
diff
changeset
|
26 public: |
15ca2ea93a30
[svn] Sync with upstream CVS. This implements RIX playback.
chainsaw
parents:
diff
changeset
|
27 static CPlayer *factory(Copl *newopl); |
15ca2ea93a30
[svn] Sync with upstream CVS. This implements RIX playback.
chainsaw
parents:
diff
changeset
|
28 |
15ca2ea93a30
[svn] Sync with upstream CVS. This implements RIX playback.
chainsaw
parents:
diff
changeset
|
29 CrixPlayer(Copl *newopl) |
15ca2ea93a30
[svn] Sync with upstream CVS. This implements RIX playback.
chainsaw
parents:
diff
changeset
|
30 : CPlayer(newopl),I(0),T(0),mus_block(0),ins_block(0),rhythm(0),mutex(0),music_on(0), |
15ca2ea93a30
[svn] Sync with upstream CVS. This implements RIX playback.
chainsaw
parents:
diff
changeset
|
31 pause_flag(0),band(0),band_low(0),e0_reg_flag(0),bd_modify(0),sustain(0),dro_end(0) |
15ca2ea93a30
[svn] Sync with upstream CVS. This implements RIX playback.
chainsaw
parents:
diff
changeset
|
32 { |
15ca2ea93a30
[svn] Sync with upstream CVS. This implements RIX playback.
chainsaw
parents:
diff
changeset
|
33 // memset(buffer,0,97948); |
15ca2ea93a30
[svn] Sync with upstream CVS. This implements RIX playback.
chainsaw
parents:
diff
changeset
|
34 int i=0,j=i*3; |
15ca2ea93a30
[svn] Sync with upstream CVS. This implements RIX playback.
chainsaw
parents:
diff
changeset
|
35 unsigned long t=9; |
15ca2ea93a30
[svn] Sync with upstream CVS. This implements RIX playback.
chainsaw
parents:
diff
changeset
|
36 |
15ca2ea93a30
[svn] Sync with upstream CVS. This implements RIX playback.
chainsaw
parents:
diff
changeset
|
37 if(opl->gettype() == Copl::TYPE_OPL2) |
15ca2ea93a30
[svn] Sync with upstream CVS. This implements RIX playback.
chainsaw
parents:
diff
changeset
|
38 opl3_mode = 0; |
15ca2ea93a30
[svn] Sync with upstream CVS. This implements RIX playback.
chainsaw
parents:
diff
changeset
|
39 else |
15ca2ea93a30
[svn] Sync with upstream CVS. This implements RIX playback.
chainsaw
parents:
diff
changeset
|
40 opl3_mode = 1; |
15ca2ea93a30
[svn] Sync with upstream CVS. This implements RIX playback.
chainsaw
parents:
diff
changeset
|
41 }; |
15ca2ea93a30
[svn] Sync with upstream CVS. This implements RIX playback.
chainsaw
parents:
diff
changeset
|
42 ~CrixPlayer() |
15ca2ea93a30
[svn] Sync with upstream CVS. This implements RIX playback.
chainsaw
parents:
diff
changeset
|
43 {}; |
15ca2ea93a30
[svn] Sync with upstream CVS. This implements RIX playback.
chainsaw
parents:
diff
changeset
|
44 |
15ca2ea93a30
[svn] Sync with upstream CVS. This implements RIX playback.
chainsaw
parents:
diff
changeset
|
45 bool load(const std::string &filename, const CFileProvider &fp); |
15ca2ea93a30
[svn] Sync with upstream CVS. This implements RIX playback.
chainsaw
parents:
diff
changeset
|
46 bool update(); |
15ca2ea93a30
[svn] Sync with upstream CVS. This implements RIX playback.
chainsaw
parents:
diff
changeset
|
47 void rewind(int subsong); |
15ca2ea93a30
[svn] Sync with upstream CVS. This implements RIX playback.
chainsaw
parents:
diff
changeset
|
48 float getrefresh(); |
15ca2ea93a30
[svn] Sync with upstream CVS. This implements RIX playback.
chainsaw
parents:
diff
changeset
|
49 |
15ca2ea93a30
[svn] Sync with upstream CVS. This implements RIX playback.
chainsaw
parents:
diff
changeset
|
50 std::string gettype() |
15ca2ea93a30
[svn] Sync with upstream CVS. This implements RIX playback.
chainsaw
parents:
diff
changeset
|
51 { return std::string("Softstar RIX OPL Music Format"); }; |
15ca2ea93a30
[svn] Sync with upstream CVS. This implements RIX playback.
chainsaw
parents:
diff
changeset
|
52 |
15ca2ea93a30
[svn] Sync with upstream CVS. This implements RIX playback.
chainsaw
parents:
diff
changeset
|
53 typedef struct {unsigned char v[14];}ADDT; |
15ca2ea93a30
[svn] Sync with upstream CVS. This implements RIX playback.
chainsaw
parents:
diff
changeset
|
54 |
15ca2ea93a30
[svn] Sync with upstream CVS. This implements RIX playback.
chainsaw
parents:
diff
changeset
|
55 protected: |
15ca2ea93a30
[svn] Sync with upstream CVS. This implements RIX playback.
chainsaw
parents:
diff
changeset
|
56 unsigned char dro[64000]; |
15ca2ea93a30
[svn] Sync with upstream CVS. This implements RIX playback.
chainsaw
parents:
diff
changeset
|
57 unsigned char buf_addr[655360]; /* rix files' buffer */ |
15ca2ea93a30
[svn] Sync with upstream CVS. This implements RIX playback.
chainsaw
parents:
diff
changeset
|
58 unsigned short buffer[300]; |
15ca2ea93a30
[svn] Sync with upstream CVS. This implements RIX playback.
chainsaw
parents:
diff
changeset
|
59 unsigned short a0b0_data2[11]; |
15ca2ea93a30
[svn] Sync with upstream CVS. This implements RIX playback.
chainsaw
parents:
diff
changeset
|
60 unsigned char a0b0_data3[18]; |
15ca2ea93a30
[svn] Sync with upstream CVS. This implements RIX playback.
chainsaw
parents:
diff
changeset
|
61 unsigned char a0b0_data4[18]; |
15ca2ea93a30
[svn] Sync with upstream CVS. This implements RIX playback.
chainsaw
parents:
diff
changeset
|
62 unsigned char a0b0_data5[96]; |
15ca2ea93a30
[svn] Sync with upstream CVS. This implements RIX playback.
chainsaw
parents:
diff
changeset
|
63 unsigned char addrs_head[96]; |
15ca2ea93a30
[svn] Sync with upstream CVS. This implements RIX playback.
chainsaw
parents:
diff
changeset
|
64 unsigned short insbuf[28]; |
15ca2ea93a30
[svn] Sync with upstream CVS. This implements RIX playback.
chainsaw
parents:
diff
changeset
|
65 unsigned short displace[11]; |
15ca2ea93a30
[svn] Sync with upstream CVS. This implements RIX playback.
chainsaw
parents:
diff
changeset
|
66 ADDT reg_bufs[18]; |
15ca2ea93a30
[svn] Sync with upstream CVS. This implements RIX playback.
chainsaw
parents:
diff
changeset
|
67 unsigned long pos,length; |
15ca2ea93a30
[svn] Sync with upstream CVS. This implements RIX playback.
chainsaw
parents:
diff
changeset
|
68 unsigned long msdone,mstotal; |
15ca2ea93a30
[svn] Sync with upstream CVS. This implements RIX playback.
chainsaw
parents:
diff
changeset
|
69 unsigned short delay; |
15ca2ea93a30
[svn] Sync with upstream CVS. This implements RIX playback.
chainsaw
parents:
diff
changeset
|
70 unsigned char index, opl3_mode; |
15ca2ea93a30
[svn] Sync with upstream CVS. This implements RIX playback.
chainsaw
parents:
diff
changeset
|
71 enum OplMode { |
15ca2ea93a30
[svn] Sync with upstream CVS. This implements RIX playback.
chainsaw
parents:
diff
changeset
|
72 ModeOPL2,ModeOPL3,ModeDUALOPL2 |
15ca2ea93a30
[svn] Sync with upstream CVS. This implements RIX playback.
chainsaw
parents:
diff
changeset
|
73 } mode; |
15ca2ea93a30
[svn] Sync with upstream CVS. This implements RIX playback.
chainsaw
parents:
diff
changeset
|
74 |
15ca2ea93a30
[svn] Sync with upstream CVS. This implements RIX playback.
chainsaw
parents:
diff
changeset
|
75 static const unsigned char adflag[18]; |
15ca2ea93a30
[svn] Sync with upstream CVS. This implements RIX playback.
chainsaw
parents:
diff
changeset
|
76 static const unsigned char reg_data[18]; |
15ca2ea93a30
[svn] Sync with upstream CVS. This implements RIX playback.
chainsaw
parents:
diff
changeset
|
77 static const unsigned char ad_C0_offs[18]; |
15ca2ea93a30
[svn] Sync with upstream CVS. This implements RIX playback.
chainsaw
parents:
diff
changeset
|
78 static const unsigned char modify[28]; |
15ca2ea93a30
[svn] Sync with upstream CVS. This implements RIX playback.
chainsaw
parents:
diff
changeset
|
79 static const unsigned char bd_reg_data[124]; |
15ca2ea93a30
[svn] Sync with upstream CVS. This implements RIX playback.
chainsaw
parents:
diff
changeset
|
80 static unsigned char for40reg[18]; |
15ca2ea93a30
[svn] Sync with upstream CVS. This implements RIX playback.
chainsaw
parents:
diff
changeset
|
81 static unsigned short mus_time; |
15ca2ea93a30
[svn] Sync with upstream CVS. This implements RIX playback.
chainsaw
parents:
diff
changeset
|
82 unsigned int I,T; |
15ca2ea93a30
[svn] Sync with upstream CVS. This implements RIX playback.
chainsaw
parents:
diff
changeset
|
83 unsigned short mus_block; |
15ca2ea93a30
[svn] Sync with upstream CVS. This implements RIX playback.
chainsaw
parents:
diff
changeset
|
84 unsigned short ins_block; |
15ca2ea93a30
[svn] Sync with upstream CVS. This implements RIX playback.
chainsaw
parents:
diff
changeset
|
85 unsigned char rhythm; |
15ca2ea93a30
[svn] Sync with upstream CVS. This implements RIX playback.
chainsaw
parents:
diff
changeset
|
86 unsigned char mutex; |
15ca2ea93a30
[svn] Sync with upstream CVS. This implements RIX playback.
chainsaw
parents:
diff
changeset
|
87 unsigned char music_on; |
15ca2ea93a30
[svn] Sync with upstream CVS. This implements RIX playback.
chainsaw
parents:
diff
changeset
|
88 unsigned char pause_flag; |
15ca2ea93a30
[svn] Sync with upstream CVS. This implements RIX playback.
chainsaw
parents:
diff
changeset
|
89 unsigned short band; |
15ca2ea93a30
[svn] Sync with upstream CVS. This implements RIX playback.
chainsaw
parents:
diff
changeset
|
90 unsigned char band_low; |
15ca2ea93a30
[svn] Sync with upstream CVS. This implements RIX playback.
chainsaw
parents:
diff
changeset
|
91 unsigned short e0_reg_flag; |
15ca2ea93a30
[svn] Sync with upstream CVS. This implements RIX playback.
chainsaw
parents:
diff
changeset
|
92 unsigned char bd_modify; |
15ca2ea93a30
[svn] Sync with upstream CVS. This implements RIX playback.
chainsaw
parents:
diff
changeset
|
93 int sustain; |
15ca2ea93a30
[svn] Sync with upstream CVS. This implements RIX playback.
chainsaw
parents:
diff
changeset
|
94 int dro_end; |
15ca2ea93a30
[svn] Sync with upstream CVS. This implements RIX playback.
chainsaw
parents:
diff
changeset
|
95 |
15ca2ea93a30
[svn] Sync with upstream CVS. This implements RIX playback.
chainsaw
parents:
diff
changeset
|
96 #define ad_08_reg() ad_bop(8,0) /**/ |
15ca2ea93a30
[svn] Sync with upstream CVS. This implements RIX playback.
chainsaw
parents:
diff
changeset
|
97 inline void ad_20_reg(unsigned short); /**/ |
15ca2ea93a30
[svn] Sync with upstream CVS. This implements RIX playback.
chainsaw
parents:
diff
changeset
|
98 inline void ad_40_reg(unsigned short); /**/ |
15ca2ea93a30
[svn] Sync with upstream CVS. This implements RIX playback.
chainsaw
parents:
diff
changeset
|
99 inline void ad_60_reg(unsigned short); /**/ |
15ca2ea93a30
[svn] Sync with upstream CVS. This implements RIX playback.
chainsaw
parents:
diff
changeset
|
100 inline void ad_80_reg(unsigned short); /**/ |
15ca2ea93a30
[svn] Sync with upstream CVS. This implements RIX playback.
chainsaw
parents:
diff
changeset
|
101 inline void ad_a0b0_reg(unsigned short); /**/ |
15ca2ea93a30
[svn] Sync with upstream CVS. This implements RIX playback.
chainsaw
parents:
diff
changeset
|
102 inline void ad_a0b0l_reg(unsigned short,unsigned short,unsigned short); /**/ |
15ca2ea93a30
[svn] Sync with upstream CVS. This implements RIX playback.
chainsaw
parents:
diff
changeset
|
103 inline void ad_a0b0l_reg_(unsigned short,unsigned short,unsigned short); /**/ |
15ca2ea93a30
[svn] Sync with upstream CVS. This implements RIX playback.
chainsaw
parents:
diff
changeset
|
104 inline void ad_bd_reg(); /**/ |
15ca2ea93a30
[svn] Sync with upstream CVS. This implements RIX playback.
chainsaw
parents:
diff
changeset
|
105 inline void ad_bop(unsigned short,unsigned short); /**/ |
15ca2ea93a30
[svn] Sync with upstream CVS. This implements RIX playback.
chainsaw
parents:
diff
changeset
|
106 inline void ad_C0_reg(unsigned short); /**/ |
15ca2ea93a30
[svn] Sync with upstream CVS. This implements RIX playback.
chainsaw
parents:
diff
changeset
|
107 inline void ad_E0_reg(unsigned short); /**/ |
15ca2ea93a30
[svn] Sync with upstream CVS. This implements RIX playback.
chainsaw
parents:
diff
changeset
|
108 inline unsigned short ad_initial(); /**/ |
15ca2ea93a30
[svn] Sync with upstream CVS. This implements RIX playback.
chainsaw
parents:
diff
changeset
|
109 inline unsigned short ad_test(); /**/ |
15ca2ea93a30
[svn] Sync with upstream CVS. This implements RIX playback.
chainsaw
parents:
diff
changeset
|
110 inline void crc_trans(unsigned short,unsigned short); /**/ |
15ca2ea93a30
[svn] Sync with upstream CVS. This implements RIX playback.
chainsaw
parents:
diff
changeset
|
111 inline void data_initial(); /* done */ |
15ca2ea93a30
[svn] Sync with upstream CVS. This implements RIX playback.
chainsaw
parents:
diff
changeset
|
112 inline void init(); /**/ |
15ca2ea93a30
[svn] Sync with upstream CVS. This implements RIX playback.
chainsaw
parents:
diff
changeset
|
113 inline void ins_to_reg(unsigned short,unsigned short*,unsigned short); /**/ |
15ca2ea93a30
[svn] Sync with upstream CVS. This implements RIX playback.
chainsaw
parents:
diff
changeset
|
114 inline void int_08h_entry(); /**/ |
15ca2ea93a30
[svn] Sync with upstream CVS. This implements RIX playback.
chainsaw
parents:
diff
changeset
|
115 inline void music_ctrl(); /**/ |
15ca2ea93a30
[svn] Sync with upstream CVS. This implements RIX playback.
chainsaw
parents:
diff
changeset
|
116 inline void Pause(); /**/ |
15ca2ea93a30
[svn] Sync with upstream CVS. This implements RIX playback.
chainsaw
parents:
diff
changeset
|
117 inline void prep_int(); /**/ |
15ca2ea93a30
[svn] Sync with upstream CVS. This implements RIX playback.
chainsaw
parents:
diff
changeset
|
118 inline void prepare_a0b0(unsigned short,unsigned short); /**/ |
15ca2ea93a30
[svn] Sync with upstream CVS. This implements RIX playback.
chainsaw
parents:
diff
changeset
|
119 inline void rix_90_pro(unsigned short); /**/ |
15ca2ea93a30
[svn] Sync with upstream CVS. This implements RIX playback.
chainsaw
parents:
diff
changeset
|
120 inline void rix_A0_pro(unsigned short,unsigned short); /**/ |
15ca2ea93a30
[svn] Sync with upstream CVS. This implements RIX playback.
chainsaw
parents:
diff
changeset
|
121 inline void rix_B0_pro(unsigned short,unsigned short); /**/ |
15ca2ea93a30
[svn] Sync with upstream CVS. This implements RIX playback.
chainsaw
parents:
diff
changeset
|
122 inline void rix_C0_pro(unsigned short,unsigned short); /**/ |
15ca2ea93a30
[svn] Sync with upstream CVS. This implements RIX playback.
chainsaw
parents:
diff
changeset
|
123 inline void rix_get_ins(); /**/ |
15ca2ea93a30
[svn] Sync with upstream CVS. This implements RIX playback.
chainsaw
parents:
diff
changeset
|
124 inline unsigned short rix_proc(); /**/ |
15ca2ea93a30
[svn] Sync with upstream CVS. This implements RIX playback.
chainsaw
parents:
diff
changeset
|
125 inline void set_new_int(); |
15ca2ea93a30
[svn] Sync with upstream CVS. This implements RIX playback.
chainsaw
parents:
diff
changeset
|
126 inline void set_speed(unsigned short); /**/ |
15ca2ea93a30
[svn] Sync with upstream CVS. This implements RIX playback.
chainsaw
parents:
diff
changeset
|
127 inline void set_time(unsigned short); /**/ |
15ca2ea93a30
[svn] Sync with upstream CVS. This implements RIX playback.
chainsaw
parents:
diff
changeset
|
128 inline void switch_ad_bd(unsigned short); /**/ |
15ca2ea93a30
[svn] Sync with upstream CVS. This implements RIX playback.
chainsaw
parents:
diff
changeset
|
129 inline unsigned int strm_and_fr(unsigned short); /* done */ |
15ca2ea93a30
[svn] Sync with upstream CVS. This implements RIX playback.
chainsaw
parents:
diff
changeset
|
130 }; |