Mercurial > audlegacy
comparison 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 |
comparison
equal
deleted
inserted
replaced
427:f61e69a1a376 | 428:15ca2ea93a30 |
---|---|
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., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA | |
18 * | |
19 * rix.h - Dayu OPL Format Player by palxex <palxex@163.com/palxex.ys168.com> | |
20 */ | |
21 | |
22 #include "player.h" | |
23 | |
24 class CrixPlayer: public CPlayer | |
25 { | |
26 public: | |
27 static CPlayer *factory(Copl *newopl); | |
28 | |
29 CrixPlayer(Copl *newopl) | |
30 : CPlayer(newopl),I(0),T(0),mus_block(0),ins_block(0),rhythm(0),mutex(0),music_on(0), | |
31 pause_flag(0),band(0),band_low(0),e0_reg_flag(0),bd_modify(0),sustain(0),dro_end(0) | |
32 { | |
33 // memset(buffer,0,97948); | |
34 int i=0,j=i*3; | |
35 unsigned long t=9; | |
36 | |
37 if(opl->gettype() == Copl::TYPE_OPL2) | |
38 opl3_mode = 0; | |
39 else | |
40 opl3_mode = 1; | |
41 }; | |
42 ~CrixPlayer() | |
43 {}; | |
44 | |
45 bool load(const std::string &filename, const CFileProvider &fp); | |
46 bool update(); | |
47 void rewind(int subsong); | |
48 float getrefresh(); | |
49 | |
50 std::string gettype() | |
51 { return std::string("Softstar RIX OPL Music Format"); }; | |
52 | |
53 typedef struct {unsigned char v[14];}ADDT; | |
54 | |
55 protected: | |
56 unsigned char dro[64000]; | |
57 unsigned char buf_addr[655360]; /* rix files' buffer */ | |
58 unsigned short buffer[300]; | |
59 unsigned short a0b0_data2[11]; | |
60 unsigned char a0b0_data3[18]; | |
61 unsigned char a0b0_data4[18]; | |
62 unsigned char a0b0_data5[96]; | |
63 unsigned char addrs_head[96]; | |
64 unsigned short insbuf[28]; | |
65 unsigned short displace[11]; | |
66 ADDT reg_bufs[18]; | |
67 unsigned long pos,length; | |
68 unsigned long msdone,mstotal; | |
69 unsigned short delay; | |
70 unsigned char index, opl3_mode; | |
71 enum OplMode { | |
72 ModeOPL2,ModeOPL3,ModeDUALOPL2 | |
73 } mode; | |
74 | |
75 static const unsigned char adflag[18]; | |
76 static const unsigned char reg_data[18]; | |
77 static const unsigned char ad_C0_offs[18]; | |
78 static const unsigned char modify[28]; | |
79 static const unsigned char bd_reg_data[124]; | |
80 static unsigned char for40reg[18]; | |
81 static unsigned short mus_time; | |
82 unsigned int I,T; | |
83 unsigned short mus_block; | |
84 unsigned short ins_block; | |
85 unsigned char rhythm; | |
86 unsigned char mutex; | |
87 unsigned char music_on; | |
88 unsigned char pause_flag; | |
89 unsigned short band; | |
90 unsigned char band_low; | |
91 unsigned short e0_reg_flag; | |
92 unsigned char bd_modify; | |
93 int sustain; | |
94 int dro_end; | |
95 | |
96 #define ad_08_reg() ad_bop(8,0) /**/ | |
97 inline void ad_20_reg(unsigned short); /**/ | |
98 inline void ad_40_reg(unsigned short); /**/ | |
99 inline void ad_60_reg(unsigned short); /**/ | |
100 inline void ad_80_reg(unsigned short); /**/ | |
101 inline void ad_a0b0_reg(unsigned short); /**/ | |
102 inline void ad_a0b0l_reg(unsigned short,unsigned short,unsigned short); /**/ | |
103 inline void ad_a0b0l_reg_(unsigned short,unsigned short,unsigned short); /**/ | |
104 inline void ad_bd_reg(); /**/ | |
105 inline void ad_bop(unsigned short,unsigned short); /**/ | |
106 inline void ad_C0_reg(unsigned short); /**/ | |
107 inline void ad_E0_reg(unsigned short); /**/ | |
108 inline unsigned short ad_initial(); /**/ | |
109 inline unsigned short ad_test(); /**/ | |
110 inline void crc_trans(unsigned short,unsigned short); /**/ | |
111 inline void data_initial(); /* done */ | |
112 inline void init(); /**/ | |
113 inline void ins_to_reg(unsigned short,unsigned short*,unsigned short); /**/ | |
114 inline void int_08h_entry(); /**/ | |
115 inline void music_ctrl(); /**/ | |
116 inline void Pause(); /**/ | |
117 inline void prep_int(); /**/ | |
118 inline void prepare_a0b0(unsigned short,unsigned short); /**/ | |
119 inline void rix_90_pro(unsigned short); /**/ | |
120 inline void rix_A0_pro(unsigned short,unsigned short); /**/ | |
121 inline void rix_B0_pro(unsigned short,unsigned short); /**/ | |
122 inline void rix_C0_pro(unsigned short,unsigned short); /**/ | |
123 inline void rix_get_ins(); /**/ | |
124 inline unsigned short rix_proc(); /**/ | |
125 inline void set_new_int(); | |
126 inline void set_speed(unsigned short); /**/ | |
127 inline void set_time(unsigned short); /**/ | |
128 inline void switch_ad_bd(unsigned short); /**/ | |
129 inline unsigned int strm_and_fr(unsigned short); /* done */ | |
130 }; |