Mercurial > audlegacy
annotate Plugins/Input/adplug/core/rix.cpp @ 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 | 0a73d1faeb4e |
| 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.c - 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 "rix.h" |
|
15ca2ea93a30
[svn] Sync with upstream CVS. This implements RIX playback.
chainsaw
parents:
diff
changeset
|
23 #include <binfile.h> |
|
15ca2ea93a30
[svn] Sync with upstream CVS. This implements RIX playback.
chainsaw
parents:
diff
changeset
|
24 |
|
15ca2ea93a30
[svn] Sync with upstream CVS. This implements RIX playback.
chainsaw
parents:
diff
changeset
|
25 const unsigned char CrixPlayer::adflag[] = {0,0,0,1,1,1,0,0,0,1,1,1,0,0,0,1,1,1}; |
|
15ca2ea93a30
[svn] Sync with upstream CVS. This implements RIX playback.
chainsaw
parents:
diff
changeset
|
26 const unsigned char CrixPlayer::reg_data[] = {0,1,2,3,4,5,8,9,10,11,12,13,16,17,18,19,20,21}; |
|
15ca2ea93a30
[svn] Sync with upstream CVS. This implements RIX playback.
chainsaw
parents:
diff
changeset
|
27 const unsigned char CrixPlayer::ad_C0_offs[] = {0,1,2,0,1,2,3,4,5,3,4,5,6,7,8,6,7,8}; |
|
15ca2ea93a30
[svn] Sync with upstream CVS. This implements RIX playback.
chainsaw
parents:
diff
changeset
|
28 const unsigned char CrixPlayer::modify[] = {0,3,1,4,2,5,6,9,7,10,8,11,12,15,13,16,14,17,12,\ |
|
15ca2ea93a30
[svn] Sync with upstream CVS. This implements RIX playback.
chainsaw
parents:
diff
changeset
|
29 15,16,0,14,0,17,0,13,0}; |
|
15ca2ea93a30
[svn] Sync with upstream CVS. This implements RIX playback.
chainsaw
parents:
diff
changeset
|
30 const unsigned char CrixPlayer::bd_reg_data[] = {\ |
|
15ca2ea93a30
[svn] Sync with upstream CVS. This implements RIX playback.
chainsaw
parents:
diff
changeset
|
31 0x00,0x00,0x00,0x00,0x00,0x00,0x10,0x08,0x04,0x02,0x01,\ |
|
15ca2ea93a30
[svn] Sync with upstream CVS. This implements RIX playback.
chainsaw
parents:
diff
changeset
|
32 0x00,0x01,0x01,0x03,0x0F,0x05,0x00,0x01,0x03,0x0F,0x00,\ |
|
15ca2ea93a30
[svn] Sync with upstream CVS. This implements RIX playback.
chainsaw
parents:
diff
changeset
|
33 0x00,0x00,0x01,0x00,0x00,0x01,0x01,0x0F,0x07,0x00,0x02,\ |
|
15ca2ea93a30
[svn] Sync with upstream CVS. This implements RIX playback.
chainsaw
parents:
diff
changeset
|
34 0x04,0x00,0x00,0x00,0x01,0x00,0x00,0x00,0x00,0x00,0x0A,\ |
|
15ca2ea93a30
[svn] Sync with upstream CVS. This implements RIX playback.
chainsaw
parents:
diff
changeset
|
35 0x04,0x00,0x08,0x0C,0x0B,0x00,0x00,0x00,0x01,0x00,0x00,\ |
|
15ca2ea93a30
[svn] Sync with upstream CVS. This implements RIX playback.
chainsaw
parents:
diff
changeset
|
36 0x00,0x00,0x0D,0x04,0x00,0x06,0x0F,0x00,0x00,0x00,0x00,\ |
|
15ca2ea93a30
[svn] Sync with upstream CVS. This implements RIX playback.
chainsaw
parents:
diff
changeset
|
37 0x01,0x00,0x00,0x0C,0x00,0x0F,0x0B,0x00,0x08,0x05,0x00,\ |
|
15ca2ea93a30
[svn] Sync with upstream CVS. This implements RIX playback.
chainsaw
parents:
diff
changeset
|
38 0x00,0x00,0x00,0x00,0x00,0x00,0x04,0x00,0x0F,0x0B,0x00,\ |
|
15ca2ea93a30
[svn] Sync with upstream CVS. This implements RIX playback.
chainsaw
parents:
diff
changeset
|
39 0x07,0x05,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x01,0x00,\ |
|
15ca2ea93a30
[svn] Sync with upstream CVS. This implements RIX playback.
chainsaw
parents:
diff
changeset
|
40 0x0F,0x0B,0x00,0x05,0x05,0x00,0x00,0x00,0x00,0x00,0x00,\ |
|
15ca2ea93a30
[svn] Sync with upstream CVS. This implements RIX playback.
chainsaw
parents:
diff
changeset
|
41 0x00,0x01,0x00,0x0F,0x0B,0x00,0x07,0x05,0x00,0x00,0x00,\ |
|
15ca2ea93a30
[svn] Sync with upstream CVS. This implements RIX playback.
chainsaw
parents:
diff
changeset
|
42 0x00,0x00,0x00}; |
|
15ca2ea93a30
[svn] Sync with upstream CVS. This implements RIX playback.
chainsaw
parents:
diff
changeset
|
43 unsigned char CrixPlayer::for40reg[] = {0x7F,0x7F,0x7F,0x7F,0x7F,0x7F,0x7F,0x7F,0x7F,\ |
|
15ca2ea93a30
[svn] Sync with upstream CVS. This implements RIX playback.
chainsaw
parents:
diff
changeset
|
44 0x7F,0x7F,0x7F,0x7F,0x7F,0x7F,0x7F,0x7F,0x7F}; |
|
15ca2ea93a30
[svn] Sync with upstream CVS. This implements RIX playback.
chainsaw
parents:
diff
changeset
|
45 unsigned short CrixPlayer::mus_time = 0x4268; |
|
15ca2ea93a30
[svn] Sync with upstream CVS. This implements RIX playback.
chainsaw
parents:
diff
changeset
|
46 /*** public methods *************************************/ |
|
15ca2ea93a30
[svn] Sync with upstream CVS. This implements RIX playback.
chainsaw
parents:
diff
changeset
|
47 CPlayer *CrixPlayer::factory(Copl *newopl) |
|
15ca2ea93a30
[svn] Sync with upstream CVS. This implements RIX playback.
chainsaw
parents:
diff
changeset
|
48 { |
|
15ca2ea93a30
[svn] Sync with upstream CVS. This implements RIX playback.
chainsaw
parents:
diff
changeset
|
49 return new CrixPlayer(newopl); |
|
15ca2ea93a30
[svn] Sync with upstream CVS. This implements RIX playback.
chainsaw
parents:
diff
changeset
|
50 } |
|
15ca2ea93a30
[svn] Sync with upstream CVS. This implements RIX playback.
chainsaw
parents:
diff
changeset
|
51 |
|
15ca2ea93a30
[svn] Sync with upstream CVS. This implements RIX playback.
chainsaw
parents:
diff
changeset
|
52 bool CrixPlayer::load(const std::string &filename, const CFileProvider &fp) |
|
15ca2ea93a30
[svn] Sync with upstream CVS. This implements RIX playback.
chainsaw
parents:
diff
changeset
|
53 { |
|
15ca2ea93a30
[svn] Sync with upstream CVS. This implements RIX playback.
chainsaw
parents:
diff
changeset
|
54 binistream *f = fp.open(filename); if(!f) return false; |
|
15ca2ea93a30
[svn] Sync with upstream CVS. This implements RIX playback.
chainsaw
parents:
diff
changeset
|
55 unsigned long i=0; |
|
15ca2ea93a30
[svn] Sync with upstream CVS. This implements RIX playback.
chainsaw
parents:
diff
changeset
|
56 |
|
15ca2ea93a30
[svn] Sync with upstream CVS. This implements RIX playback.
chainsaw
parents:
diff
changeset
|
57 if(f->readInt(2)!=0x55aa) {fp.close(f);return false; } |
|
15ca2ea93a30
[svn] Sync with upstream CVS. This implements RIX playback.
chainsaw
parents:
diff
changeset
|
58 buf_addr[i++]=0xaa;buf_addr[i++]=0x55; |
|
15ca2ea93a30
[svn] Sync with upstream CVS. This implements RIX playback.
chainsaw
parents:
diff
changeset
|
59 while(!f->eof()) |
|
15ca2ea93a30
[svn] Sync with upstream CVS. This implements RIX playback.
chainsaw
parents:
diff
changeset
|
60 buf_addr[i++]=f->readInt(1); |
|
15ca2ea93a30
[svn] Sync with upstream CVS. This implements RIX playback.
chainsaw
parents:
diff
changeset
|
61 length=i; |
|
15ca2ea93a30
[svn] Sync with upstream CVS. This implements RIX playback.
chainsaw
parents:
diff
changeset
|
62 fp.close(f); |
|
15ca2ea93a30
[svn] Sync with upstream CVS. This implements RIX playback.
chainsaw
parents:
diff
changeset
|
63 set_new_int(); |
|
15ca2ea93a30
[svn] Sync with upstream CVS. This implements RIX playback.
chainsaw
parents:
diff
changeset
|
64 data_initial(); |
|
15ca2ea93a30
[svn] Sync with upstream CVS. This implements RIX playback.
chainsaw
parents:
diff
changeset
|
65 while(!dro_end) |
|
15ca2ea93a30
[svn] Sync with upstream CVS. This implements RIX playback.
chainsaw
parents:
diff
changeset
|
66 int_08h_entry(); |
|
15ca2ea93a30
[svn] Sync with upstream CVS. This implements RIX playback.
chainsaw
parents:
diff
changeset
|
67 |
|
15ca2ea93a30
[svn] Sync with upstream CVS. This implements RIX playback.
chainsaw
parents:
diff
changeset
|
68 length=T; |
|
15ca2ea93a30
[svn] Sync with upstream CVS. This implements RIX playback.
chainsaw
parents:
diff
changeset
|
69 mode = (OplMode)1; // Type of opl data this can contain |
|
15ca2ea93a30
[svn] Sync with upstream CVS. This implements RIX playback.
chainsaw
parents:
diff
changeset
|
70 |
|
15ca2ea93a30
[svn] Sync with upstream CVS. This implements RIX playback.
chainsaw
parents:
diff
changeset
|
71 // binofstream *g=new binofstream(filename+string(".dro")); |
|
15ca2ea93a30
[svn] Sync with upstream CVS. This implements RIX playback.
chainsaw
parents:
diff
changeset
|
72 // g->writeString("DBRAWOPL",8); |
|
15ca2ea93a30
[svn] Sync with upstream CVS. This implements RIX playback.
chainsaw
parents:
diff
changeset
|
73 // g->writeInt(mstotal,4); |
|
15ca2ea93a30
[svn] Sync with upstream CVS. This implements RIX playback.
chainsaw
parents:
diff
changeset
|
74 // g->writeInt(length+1,4); |
|
15ca2ea93a30
[svn] Sync with upstream CVS. This implements RIX playback.
chainsaw
parents:
diff
changeset
|
75 // g->writeInt(1,1); |
|
15ca2ea93a30
[svn] Sync with upstream CVS. This implements RIX playback.
chainsaw
parents:
diff
changeset
|
76 // for(int t=0;t<length;t++) |
|
15ca2ea93a30
[svn] Sync with upstream CVS. This implements RIX playback.
chainsaw
parents:
diff
changeset
|
77 // g->writeInt(dro[t],1); |
|
15ca2ea93a30
[svn] Sync with upstream CVS. This implements RIX playback.
chainsaw
parents:
diff
changeset
|
78 // g->close(); |
|
15ca2ea93a30
[svn] Sync with upstream CVS. This implements RIX playback.
chainsaw
parents:
diff
changeset
|
79 // delete g; |
|
15ca2ea93a30
[svn] Sync with upstream CVS. This implements RIX playback.
chainsaw
parents:
diff
changeset
|
80 |
|
15ca2ea93a30
[svn] Sync with upstream CVS. This implements RIX playback.
chainsaw
parents:
diff
changeset
|
81 rewind(0); |
|
15ca2ea93a30
[svn] Sync with upstream CVS. This implements RIX playback.
chainsaw
parents:
diff
changeset
|
82 return true; |
|
15ca2ea93a30
[svn] Sync with upstream CVS. This implements RIX playback.
chainsaw
parents:
diff
changeset
|
83 } |
|
15ca2ea93a30
[svn] Sync with upstream CVS. This implements RIX playback.
chainsaw
parents:
diff
changeset
|
84 |
|
15ca2ea93a30
[svn] Sync with upstream CVS. This implements RIX playback.
chainsaw
parents:
diff
changeset
|
85 bool CrixPlayer::update() |
|
15ca2ea93a30
[svn] Sync with upstream CVS. This implements RIX playback.
chainsaw
parents:
diff
changeset
|
86 { |
|
15ca2ea93a30
[svn] Sync with upstream CVS. This implements RIX playback.
chainsaw
parents:
diff
changeset
|
87 if (delay>500) { |
|
15ca2ea93a30
[svn] Sync with upstream CVS. This implements RIX playback.
chainsaw
parents:
diff
changeset
|
88 delay-=500; |
|
15ca2ea93a30
[svn] Sync with upstream CVS. This implements RIX playback.
chainsaw
parents:
diff
changeset
|
89 return true; |
|
15ca2ea93a30
[svn] Sync with upstream CVS. This implements RIX playback.
chainsaw
parents:
diff
changeset
|
90 } else delay=1; |
|
15ca2ea93a30
[svn] Sync with upstream CVS. This implements RIX playback.
chainsaw
parents:
diff
changeset
|
91 while (pos < length) |
|
15ca2ea93a30
[svn] Sync with upstream CVS. This implements RIX playback.
chainsaw
parents:
diff
changeset
|
92 { |
|
15ca2ea93a30
[svn] Sync with upstream CVS. This implements RIX playback.
chainsaw
parents:
diff
changeset
|
93 unsigned char cmd = dro[pos++]; |
|
15ca2ea93a30
[svn] Sync with upstream CVS. This implements RIX playback.
chainsaw
parents:
diff
changeset
|
94 switch(cmd) { |
|
15ca2ea93a30
[svn] Sync with upstream CVS. This implements RIX playback.
chainsaw
parents:
diff
changeset
|
95 case 0: |
|
15ca2ea93a30
[svn] Sync with upstream CVS. This implements RIX playback.
chainsaw
parents:
diff
changeset
|
96 delay = 1 + dro[pos++]; |
|
15ca2ea93a30
[svn] Sync with upstream CVS. This implements RIX playback.
chainsaw
parents:
diff
changeset
|
97 return true; |
|
15ca2ea93a30
[svn] Sync with upstream CVS. This implements RIX playback.
chainsaw
parents:
diff
changeset
|
98 case 1: |
|
15ca2ea93a30
[svn] Sync with upstream CVS. This implements RIX playback.
chainsaw
parents:
diff
changeset
|
99 delay = 1 + dro[pos] + (dro[pos+1]<<8); |
|
15ca2ea93a30
[svn] Sync with upstream CVS. This implements RIX playback.
chainsaw
parents:
diff
changeset
|
100 pos+=2; |
|
15ca2ea93a30
[svn] Sync with upstream CVS. This implements RIX playback.
chainsaw
parents:
diff
changeset
|
101 return true; |
|
15ca2ea93a30
[svn] Sync with upstream CVS. This implements RIX playback.
chainsaw
parents:
diff
changeset
|
102 case 2: |
|
15ca2ea93a30
[svn] Sync with upstream CVS. This implements RIX playback.
chainsaw
parents:
diff
changeset
|
103 index = 0; |
|
15ca2ea93a30
[svn] Sync with upstream CVS. This implements RIX playback.
chainsaw
parents:
diff
changeset
|
104 opl->setchip(0); |
|
15ca2ea93a30
[svn] Sync with upstream CVS. This implements RIX playback.
chainsaw
parents:
diff
changeset
|
105 break; |
|
15ca2ea93a30
[svn] Sync with upstream CVS. This implements RIX playback.
chainsaw
parents:
diff
changeset
|
106 case 3: |
|
15ca2ea93a30
[svn] Sync with upstream CVS. This implements RIX playback.
chainsaw
parents:
diff
changeset
|
107 index = 1; |
|
15ca2ea93a30
[svn] Sync with upstream CVS. This implements RIX playback.
chainsaw
parents:
diff
changeset
|
108 opl->setchip(1); |
|
15ca2ea93a30
[svn] Sync with upstream CVS. This implements RIX playback.
chainsaw
parents:
diff
changeset
|
109 break; |
|
15ca2ea93a30
[svn] Sync with upstream CVS. This implements RIX playback.
chainsaw
parents:
diff
changeset
|
110 default: |
|
15ca2ea93a30
[svn] Sync with upstream CVS. This implements RIX playback.
chainsaw
parents:
diff
changeset
|
111 if(index == 0 || opl3_mode) |
|
15ca2ea93a30
[svn] Sync with upstream CVS. This implements RIX playback.
chainsaw
parents:
diff
changeset
|
112 opl->write(cmd,dro[pos++]); |
|
15ca2ea93a30
[svn] Sync with upstream CVS. This implements RIX playback.
chainsaw
parents:
diff
changeset
|
113 break; |
|
15ca2ea93a30
[svn] Sync with upstream CVS. This implements RIX playback.
chainsaw
parents:
diff
changeset
|
114 } |
|
15ca2ea93a30
[svn] Sync with upstream CVS. This implements RIX playback.
chainsaw
parents:
diff
changeset
|
115 } |
|
15ca2ea93a30
[svn] Sync with upstream CVS. This implements RIX playback.
chainsaw
parents:
diff
changeset
|
116 return pos<length; |
|
15ca2ea93a30
[svn] Sync with upstream CVS. This implements RIX playback.
chainsaw
parents:
diff
changeset
|
117 } |
|
15ca2ea93a30
[svn] Sync with upstream CVS. This implements RIX playback.
chainsaw
parents:
diff
changeset
|
118 |
|
15ca2ea93a30
[svn] Sync with upstream CVS. This implements RIX playback.
chainsaw
parents:
diff
changeset
|
119 void CrixPlayer::rewind(int subsong) |
|
15ca2ea93a30
[svn] Sync with upstream CVS. This implements RIX playback.
chainsaw
parents:
diff
changeset
|
120 { |
|
15ca2ea93a30
[svn] Sync with upstream CVS. This implements RIX playback.
chainsaw
parents:
diff
changeset
|
121 delay=1; |
|
15ca2ea93a30
[svn] Sync with upstream CVS. This implements RIX playback.
chainsaw
parents:
diff
changeset
|
122 pos = index = 0; |
|
15ca2ea93a30
[svn] Sync with upstream CVS. This implements RIX playback.
chainsaw
parents:
diff
changeset
|
123 opl->init(); |
|
15ca2ea93a30
[svn] Sync with upstream CVS. This implements RIX playback.
chainsaw
parents:
diff
changeset
|
124 opl->write(1,32); // go to OPL2 mode |
|
15ca2ea93a30
[svn] Sync with upstream CVS. This implements RIX playback.
chainsaw
parents:
diff
changeset
|
125 } |
|
15ca2ea93a30
[svn] Sync with upstream CVS. This implements RIX playback.
chainsaw
parents:
diff
changeset
|
126 |
|
15ca2ea93a30
[svn] Sync with upstream CVS. This implements RIX playback.
chainsaw
parents:
diff
changeset
|
127 float CrixPlayer::getrefresh() |
|
15ca2ea93a30
[svn] Sync with upstream CVS. This implements RIX playback.
chainsaw
parents:
diff
changeset
|
128 { |
|
15ca2ea93a30
[svn] Sync with upstream CVS. This implements RIX playback.
chainsaw
parents:
diff
changeset
|
129 if (delay > 500) return 1000 / 500; |
|
15ca2ea93a30
[svn] Sync with upstream CVS. This implements RIX playback.
chainsaw
parents:
diff
changeset
|
130 else return 1000 / (double)delay; |
|
15ca2ea93a30
[svn] Sync with upstream CVS. This implements RIX playback.
chainsaw
parents:
diff
changeset
|
131 } |
|
15ca2ea93a30
[svn] Sync with upstream CVS. This implements RIX playback.
chainsaw
parents:
diff
changeset
|
132 |
|
15ca2ea93a30
[svn] Sync with upstream CVS. This implements RIX playback.
chainsaw
parents:
diff
changeset
|
133 /*------------------Implemention----------------------------*/ |
|
15ca2ea93a30
[svn] Sync with upstream CVS. This implements RIX playback.
chainsaw
parents:
diff
changeset
|
134 inline void CrixPlayer::set_new_int() |
|
15ca2ea93a30
[svn] Sync with upstream CVS. This implements RIX playback.
chainsaw
parents:
diff
changeset
|
135 { |
|
15ca2ea93a30
[svn] Sync with upstream CVS. This implements RIX playback.
chainsaw
parents:
diff
changeset
|
136 if(!ad_initial()) exit(1); |
|
15ca2ea93a30
[svn] Sync with upstream CVS. This implements RIX playback.
chainsaw
parents:
diff
changeset
|
137 prep_int(); |
|
15ca2ea93a30
[svn] Sync with upstream CVS. This implements RIX playback.
chainsaw
parents:
diff
changeset
|
138 } |
|
15ca2ea93a30
[svn] Sync with upstream CVS. This implements RIX playback.
chainsaw
parents:
diff
changeset
|
139 /*----------------------------------------------------------*/ |
|
15ca2ea93a30
[svn] Sync with upstream CVS. This implements RIX playback.
chainsaw
parents:
diff
changeset
|
140 inline void CrixPlayer::Pause() |
|
15ca2ea93a30
[svn] Sync with upstream CVS. This implements RIX playback.
chainsaw
parents:
diff
changeset
|
141 { |
|
15ca2ea93a30
[svn] Sync with upstream CVS. This implements RIX playback.
chainsaw
parents:
diff
changeset
|
142 register unsigned short i; |
|
15ca2ea93a30
[svn] Sync with upstream CVS. This implements RIX playback.
chainsaw
parents:
diff
changeset
|
143 pause_flag = 1; |
|
15ca2ea93a30
[svn] Sync with upstream CVS. This implements RIX playback.
chainsaw
parents:
diff
changeset
|
144 for(i=0;i<11;i++) |
|
15ca2ea93a30
[svn] Sync with upstream CVS. This implements RIX playback.
chainsaw
parents:
diff
changeset
|
145 switch_ad_bd(i); |
|
15ca2ea93a30
[svn] Sync with upstream CVS. This implements RIX playback.
chainsaw
parents:
diff
changeset
|
146 } |
|
15ca2ea93a30
[svn] Sync with upstream CVS. This implements RIX playback.
chainsaw
parents:
diff
changeset
|
147 /*----------------------------------------------------------*/ |
|
15ca2ea93a30
[svn] Sync with upstream CVS. This implements RIX playback.
chainsaw
parents:
diff
changeset
|
148 inline void CrixPlayer::ad_a0b0l_reg_(unsigned short index,unsigned short p2,unsigned short p3) |
|
15ca2ea93a30
[svn] Sync with upstream CVS. This implements RIX playback.
chainsaw
parents:
diff
changeset
|
149 { |
|
15ca2ea93a30
[svn] Sync with upstream CVS. This implements RIX playback.
chainsaw
parents:
diff
changeset
|
150 unsigned short i = p2+a0b0_data2[index]; |
|
15ca2ea93a30
[svn] Sync with upstream CVS. This implements RIX playback.
chainsaw
parents:
diff
changeset
|
151 a0b0_data4[index] = p3; |
|
15ca2ea93a30
[svn] Sync with upstream CVS. This implements RIX playback.
chainsaw
parents:
diff
changeset
|
152 a0b0_data3[index] = p2; |
|
15ca2ea93a30
[svn] Sync with upstream CVS. This implements RIX playback.
chainsaw
parents:
diff
changeset
|
153 } |
|
15ca2ea93a30
[svn] Sync with upstream CVS. This implements RIX playback.
chainsaw
parents:
diff
changeset
|
154 inline void CrixPlayer::data_initial() |
|
15ca2ea93a30
[svn] Sync with upstream CVS. This implements RIX playback.
chainsaw
parents:
diff
changeset
|
155 { |
|
15ca2ea93a30
[svn] Sync with upstream CVS. This implements RIX playback.
chainsaw
parents:
diff
changeset
|
156 rhythm = buf_addr[2]; |
|
15ca2ea93a30
[svn] Sync with upstream CVS. This implements RIX playback.
chainsaw
parents:
diff
changeset
|
157 mus_block = (buf_addr[0x0D]<<8)+buf_addr[0x0C]; |
|
15ca2ea93a30
[svn] Sync with upstream CVS. This implements RIX playback.
chainsaw
parents:
diff
changeset
|
158 ins_block = (buf_addr[0x09]<<8)+buf_addr[0x08]; |
|
15ca2ea93a30
[svn] Sync with upstream CVS. This implements RIX playback.
chainsaw
parents:
diff
changeset
|
159 I = mus_block+1; |
|
15ca2ea93a30
[svn] Sync with upstream CVS. This implements RIX playback.
chainsaw
parents:
diff
changeset
|
160 if(rhythm != 0) |
|
15ca2ea93a30
[svn] Sync with upstream CVS. This implements RIX playback.
chainsaw
parents:
diff
changeset
|
161 { |
|
15ca2ea93a30
[svn] Sync with upstream CVS. This implements RIX playback.
chainsaw
parents:
diff
changeset
|
162 // ad_a0b0_reg(6); |
|
15ca2ea93a30
[svn] Sync with upstream CVS. This implements RIX playback.
chainsaw
parents:
diff
changeset
|
163 // ad_a0b0_reg(7); |
|
15ca2ea93a30
[svn] Sync with upstream CVS. This implements RIX playback.
chainsaw
parents:
diff
changeset
|
164 // ad_a0b0_reg(8); |
|
15ca2ea93a30
[svn] Sync with upstream CVS. This implements RIX playback.
chainsaw
parents:
diff
changeset
|
165 ad_a0b0l_reg_(8,0x18,0); |
|
15ca2ea93a30
[svn] Sync with upstream CVS. This implements RIX playback.
chainsaw
parents:
diff
changeset
|
166 ad_a0b0l_reg_(7,0x1F,0); |
|
15ca2ea93a30
[svn] Sync with upstream CVS. This implements RIX playback.
chainsaw
parents:
diff
changeset
|
167 } |
|
15ca2ea93a30
[svn] Sync with upstream CVS. This implements RIX playback.
chainsaw
parents:
diff
changeset
|
168 bd_modify = 0; |
|
15ca2ea93a30
[svn] Sync with upstream CVS. This implements RIX playback.
chainsaw
parents:
diff
changeset
|
169 // ad_bd_reg(); |
|
15ca2ea93a30
[svn] Sync with upstream CVS. This implements RIX playback.
chainsaw
parents:
diff
changeset
|
170 band = 0; music_on = 1; |
|
15ca2ea93a30
[svn] Sync with upstream CVS. This implements RIX playback.
chainsaw
parents:
diff
changeset
|
171 } |
|
15ca2ea93a30
[svn] Sync with upstream CVS. This implements RIX playback.
chainsaw
parents:
diff
changeset
|
172 /*----------------------------------------------------------*/ |
|
15ca2ea93a30
[svn] Sync with upstream CVS. This implements RIX playback.
chainsaw
parents:
diff
changeset
|
173 inline unsigned short CrixPlayer::ad_initial() |
|
15ca2ea93a30
[svn] Sync with upstream CVS. This implements RIX playback.
chainsaw
parents:
diff
changeset
|
174 { |
|
15ca2ea93a30
[svn] Sync with upstream CVS. This implements RIX playback.
chainsaw
parents:
diff
changeset
|
175 register unsigned short i,j,k = 0; |
|
15ca2ea93a30
[svn] Sync with upstream CVS. This implements RIX playback.
chainsaw
parents:
diff
changeset
|
176 for(i=0;i<25;i++) crc_trans(i,i*4); |
|
15ca2ea93a30
[svn] Sync with upstream CVS. This implements RIX playback.
chainsaw
parents:
diff
changeset
|
177 for(i=0;i<8;i++) |
|
15ca2ea93a30
[svn] Sync with upstream CVS. This implements RIX playback.
chainsaw
parents:
diff
changeset
|
178 for(j=0;j<12;j++) |
|
15ca2ea93a30
[svn] Sync with upstream CVS. This implements RIX playback.
chainsaw
parents:
diff
changeset
|
179 { |
|
15ca2ea93a30
[svn] Sync with upstream CVS. This implements RIX playback.
chainsaw
parents:
diff
changeset
|
180 a0b0_data5[k] = i; |
|
15ca2ea93a30
[svn] Sync with upstream CVS. This implements RIX playback.
chainsaw
parents:
diff
changeset
|
181 addrs_head[k] = j; |
|
15ca2ea93a30
[svn] Sync with upstream CVS. This implements RIX playback.
chainsaw
parents:
diff
changeset
|
182 k++; |
|
15ca2ea93a30
[svn] Sync with upstream CVS. This implements RIX playback.
chainsaw
parents:
diff
changeset
|
183 } |
|
15ca2ea93a30
[svn] Sync with upstream CVS. This implements RIX playback.
chainsaw
parents:
diff
changeset
|
184 //ad_bd_reg(); |
|
15ca2ea93a30
[svn] Sync with upstream CVS. This implements RIX playback.
chainsaw
parents:
diff
changeset
|
185 //ad_08_reg(); |
|
15ca2ea93a30
[svn] Sync with upstream CVS. This implements RIX playback.
chainsaw
parents:
diff
changeset
|
186 //for(i=0;i<9;i++) ad_a0b0_reg(i); |
|
15ca2ea93a30
[svn] Sync with upstream CVS. This implements RIX playback.
chainsaw
parents:
diff
changeset
|
187 e0_reg_flag = 0x20; |
|
15ca2ea93a30
[svn] Sync with upstream CVS. This implements RIX playback.
chainsaw
parents:
diff
changeset
|
188 //for(i=0;i<18;i++) ad_bop(0xE0+reg_data[i],0); |
|
15ca2ea93a30
[svn] Sync with upstream CVS. This implements RIX playback.
chainsaw
parents:
diff
changeset
|
189 //ad_bop(1,e0_reg_flag); |
|
15ca2ea93a30
[svn] Sync with upstream CVS. This implements RIX playback.
chainsaw
parents:
diff
changeset
|
190 return 1;//ad_test(); |
|
15ca2ea93a30
[svn] Sync with upstream CVS. This implements RIX playback.
chainsaw
parents:
diff
changeset
|
191 } |
|
15ca2ea93a30
[svn] Sync with upstream CVS. This implements RIX playback.
chainsaw
parents:
diff
changeset
|
192 /*----------------------------------------------------------*/ |
|
15ca2ea93a30
[svn] Sync with upstream CVS. This implements RIX playback.
chainsaw
parents:
diff
changeset
|
193 inline void CrixPlayer::crc_trans(unsigned short index,unsigned short v) |
|
15ca2ea93a30
[svn] Sync with upstream CVS. This implements RIX playback.
chainsaw
parents:
diff
changeset
|
194 { |
|
15ca2ea93a30
[svn] Sync with upstream CVS. This implements RIX playback.
chainsaw
parents:
diff
changeset
|
195 register unsigned short i; |
|
15ca2ea93a30
[svn] Sync with upstream CVS. This implements RIX playback.
chainsaw
parents:
diff
changeset
|
196 unsigned int res; unsigned short low; |
|
15ca2ea93a30
[svn] Sync with upstream CVS. This implements RIX playback.
chainsaw
parents:
diff
changeset
|
197 res = strm_and_fr(v); |
|
15ca2ea93a30
[svn] Sync with upstream CVS. This implements RIX playback.
chainsaw
parents:
diff
changeset
|
198 low = res; |
|
15ca2ea93a30
[svn] Sync with upstream CVS. This implements RIX playback.
chainsaw
parents:
diff
changeset
|
199 buffer[index*12] = (low+4)>>3; |
|
15ca2ea93a30
[svn] Sync with upstream CVS. This implements RIX playback.
chainsaw
parents:
diff
changeset
|
200 for(i=1;i<=11;i++) |
|
15ca2ea93a30
[svn] Sync with upstream CVS. This implements RIX playback.
chainsaw
parents:
diff
changeset
|
201 { |
|
15ca2ea93a30
[svn] Sync with upstream CVS. This implements RIX playback.
chainsaw
parents:
diff
changeset
|
202 res *= 1.06; |
|
15ca2ea93a30
[svn] Sync with upstream CVS. This implements RIX playback.
chainsaw
parents:
diff
changeset
|
203 buffer[index*12+i] = res>>3; |
|
15ca2ea93a30
[svn] Sync with upstream CVS. This implements RIX playback.
chainsaw
parents:
diff
changeset
|
204 } |
|
15ca2ea93a30
[svn] Sync with upstream CVS. This implements RIX playback.
chainsaw
parents:
diff
changeset
|
205 } |
|
15ca2ea93a30
[svn] Sync with upstream CVS. This implements RIX playback.
chainsaw
parents:
diff
changeset
|
206 |
|
15ca2ea93a30
[svn] Sync with upstream CVS. This implements RIX playback.
chainsaw
parents:
diff
changeset
|
207 /*----------------------------------------------------------*/ |
|
15ca2ea93a30
[svn] Sync with upstream CVS. This implements RIX playback.
chainsaw
parents:
diff
changeset
|
208 inline void CrixPlayer::prep_int() |
|
15ca2ea93a30
[svn] Sync with upstream CVS. This implements RIX playback.
chainsaw
parents:
diff
changeset
|
209 { |
|
15ca2ea93a30
[svn] Sync with upstream CVS. This implements RIX playback.
chainsaw
parents:
diff
changeset
|
210 mutex = 0; |
|
15ca2ea93a30
[svn] Sync with upstream CVS. This implements RIX playback.
chainsaw
parents:
diff
changeset
|
211 } |
|
15ca2ea93a30
[svn] Sync with upstream CVS. This implements RIX playback.
chainsaw
parents:
diff
changeset
|
212 /*----------------------------------------------------------*/ |
|
15ca2ea93a30
[svn] Sync with upstream CVS. This implements RIX playback.
chainsaw
parents:
diff
changeset
|
213 inline void CrixPlayer::ad_bop(unsigned short reg,unsigned short value) |
|
15ca2ea93a30
[svn] Sync with upstream CVS. This implements RIX playback.
chainsaw
parents:
diff
changeset
|
214 { |
|
15ca2ea93a30
[svn] Sync with upstream CVS. This implements RIX playback.
chainsaw
parents:
diff
changeset
|
215 dro[T++]=reg;dro[T++]=value; |
|
15ca2ea93a30
[svn] Sync with upstream CVS. This implements RIX playback.
chainsaw
parents:
diff
changeset
|
216 } |
|
15ca2ea93a30
[svn] Sync with upstream CVS. This implements RIX playback.
chainsaw
parents:
diff
changeset
|
217 /*------------------------------------------------------*/ |
|
15ca2ea93a30
[svn] Sync with upstream CVS. This implements RIX playback.
chainsaw
parents:
diff
changeset
|
218 inline unsigned short CrixPlayer::ad_test() /* Test the SoundCard */ |
|
15ca2ea93a30
[svn] Sync with upstream CVS. This implements RIX playback.
chainsaw
parents:
diff
changeset
|
219 { |
|
15ca2ea93a30
[svn] Sync with upstream CVS. This implements RIX playback.
chainsaw
parents:
diff
changeset
|
220 ad_bop(0x04,0x60); |
|
15ca2ea93a30
[svn] Sync with upstream CVS. This implements RIX playback.
chainsaw
parents:
diff
changeset
|
221 ad_bop(0x04,0x80); |
|
15ca2ea93a30
[svn] Sync with upstream CVS. This implements RIX playback.
chainsaw
parents:
diff
changeset
|
222 ad_bop(0x02,0xFF); |
|
15ca2ea93a30
[svn] Sync with upstream CVS. This implements RIX playback.
chainsaw
parents:
diff
changeset
|
223 ad_bop(0x04,0x21); |
|
15ca2ea93a30
[svn] Sync with upstream CVS. This implements RIX playback.
chainsaw
parents:
diff
changeset
|
224 ad_bop(0x04,0x60); |
|
15ca2ea93a30
[svn] Sync with upstream CVS. This implements RIX playback.
chainsaw
parents:
diff
changeset
|
225 ad_bop(0x04,0x80); |
|
15ca2ea93a30
[svn] Sync with upstream CVS. This implements RIX playback.
chainsaw
parents:
diff
changeset
|
226 return 1; |
|
15ca2ea93a30
[svn] Sync with upstream CVS. This implements RIX playback.
chainsaw
parents:
diff
changeset
|
227 } |
|
15ca2ea93a30
[svn] Sync with upstream CVS. This implements RIX playback.
chainsaw
parents:
diff
changeset
|
228 /*--------------------------------------------------------------*/ |
|
15ca2ea93a30
[svn] Sync with upstream CVS. This implements RIX playback.
chainsaw
parents:
diff
changeset
|
229 inline void CrixPlayer::int_08h_entry() |
|
15ca2ea93a30
[svn] Sync with upstream CVS. This implements RIX playback.
chainsaw
parents:
diff
changeset
|
230 { |
|
15ca2ea93a30
[svn] Sync with upstream CVS. This implements RIX playback.
chainsaw
parents:
diff
changeset
|
231 unsigned short band_sus = 1; |
|
15ca2ea93a30
[svn] Sync with upstream CVS. This implements RIX playback.
chainsaw
parents:
diff
changeset
|
232 while(band_sus) |
|
15ca2ea93a30
[svn] Sync with upstream CVS. This implements RIX playback.
chainsaw
parents:
diff
changeset
|
233 { |
|
15ca2ea93a30
[svn] Sync with upstream CVS. This implements RIX playback.
chainsaw
parents:
diff
changeset
|
234 if(sustain <= 0 && mutex == 0) |
|
15ca2ea93a30
[svn] Sync with upstream CVS. This implements RIX playback.
chainsaw
parents:
diff
changeset
|
235 { |
|
15ca2ea93a30
[svn] Sync with upstream CVS. This implements RIX playback.
chainsaw
parents:
diff
changeset
|
236 mutex++; |
|
15ca2ea93a30
[svn] Sync with upstream CVS. This implements RIX playback.
chainsaw
parents:
diff
changeset
|
237 band_sus = rix_proc(); |
|
15ca2ea93a30
[svn] Sync with upstream CVS. This implements RIX playback.
chainsaw
parents:
diff
changeset
|
238 if(band_sus) sustain += band_sus * 1.06; |
|
15ca2ea93a30
[svn] Sync with upstream CVS. This implements RIX playback.
chainsaw
parents:
diff
changeset
|
239 mstotal+=sustain; |
|
15ca2ea93a30
[svn] Sync with upstream CVS. This implements RIX playback.
chainsaw
parents:
diff
changeset
|
240 dro[T++]=(sustain>=0x100?1:0); |
|
15ca2ea93a30
[svn] Sync with upstream CVS. This implements RIX playback.
chainsaw
parents:
diff
changeset
|
241 dro[T++]=sustain&0xff; |
|
15ca2ea93a30
[svn] Sync with upstream CVS. This implements RIX playback.
chainsaw
parents:
diff
changeset
|
242 if(sustain>=0x100) |
|
15ca2ea93a30
[svn] Sync with upstream CVS. This implements RIX playback.
chainsaw
parents:
diff
changeset
|
243 dro[T++]=(sustain>>8)&0xff; |
|
15ca2ea93a30
[svn] Sync with upstream CVS. This implements RIX playback.
chainsaw
parents:
diff
changeset
|
244 mutex--; |
|
15ca2ea93a30
[svn] Sync with upstream CVS. This implements RIX playback.
chainsaw
parents:
diff
changeset
|
245 if(band_sus == 0) |
|
15ca2ea93a30
[svn] Sync with upstream CVS. This implements RIX playback.
chainsaw
parents:
diff
changeset
|
246 { |
|
15ca2ea93a30
[svn] Sync with upstream CVS. This implements RIX playback.
chainsaw
parents:
diff
changeset
|
247 dro_end=1; |
|
15ca2ea93a30
[svn] Sync with upstream CVS. This implements RIX playback.
chainsaw
parents:
diff
changeset
|
248 break; |
|
15ca2ea93a30
[svn] Sync with upstream CVS. This implements RIX playback.
chainsaw
parents:
diff
changeset
|
249 } |
|
15ca2ea93a30
[svn] Sync with upstream CVS. This implements RIX playback.
chainsaw
parents:
diff
changeset
|
250 } |
|
15ca2ea93a30
[svn] Sync with upstream CVS. This implements RIX playback.
chainsaw
parents:
diff
changeset
|
251 else |
|
15ca2ea93a30
[svn] Sync with upstream CVS. This implements RIX playback.
chainsaw
parents:
diff
changeset
|
252 { |
|
15ca2ea93a30
[svn] Sync with upstream CVS. This implements RIX playback.
chainsaw
parents:
diff
changeset
|
253 if(band_sus) sustain -= 14; /* aging */ |
|
15ca2ea93a30
[svn] Sync with upstream CVS. This implements RIX playback.
chainsaw
parents:
diff
changeset
|
254 break; |
|
15ca2ea93a30
[svn] Sync with upstream CVS. This implements RIX playback.
chainsaw
parents:
diff
changeset
|
255 } |
|
15ca2ea93a30
[svn] Sync with upstream CVS. This implements RIX playback.
chainsaw
parents:
diff
changeset
|
256 } |
|
15ca2ea93a30
[svn] Sync with upstream CVS. This implements RIX playback.
chainsaw
parents:
diff
changeset
|
257 } |
|
15ca2ea93a30
[svn] Sync with upstream CVS. This implements RIX playback.
chainsaw
parents:
diff
changeset
|
258 /*--------------------------------------------------------------*/ |
|
15ca2ea93a30
[svn] Sync with upstream CVS. This implements RIX playback.
chainsaw
parents:
diff
changeset
|
259 inline unsigned short CrixPlayer::rix_proc() |
|
15ca2ea93a30
[svn] Sync with upstream CVS. This implements RIX playback.
chainsaw
parents:
diff
changeset
|
260 { |
|
15ca2ea93a30
[svn] Sync with upstream CVS. This implements RIX playback.
chainsaw
parents:
diff
changeset
|
261 unsigned char ctrl = 0; |
|
15ca2ea93a30
[svn] Sync with upstream CVS. This implements RIX playback.
chainsaw
parents:
diff
changeset
|
262 if(music_on == 0||pause_flag == 1) return 0; |
|
15ca2ea93a30
[svn] Sync with upstream CVS. This implements RIX playback.
chainsaw
parents:
diff
changeset
|
263 band = 0; |
|
15ca2ea93a30
[svn] Sync with upstream CVS. This implements RIX playback.
chainsaw
parents:
diff
changeset
|
264 while(buf_addr[I] != 0x80 && I<length-1) |
|
15ca2ea93a30
[svn] Sync with upstream CVS. This implements RIX playback.
chainsaw
parents:
diff
changeset
|
265 { |
|
15ca2ea93a30
[svn] Sync with upstream CVS. This implements RIX playback.
chainsaw
parents:
diff
changeset
|
266 band_low = buf_addr[I-1]; |
|
15ca2ea93a30
[svn] Sync with upstream CVS. This implements RIX playback.
chainsaw
parents:
diff
changeset
|
267 ctrl = buf_addr[I]; I+=2; |
|
15ca2ea93a30
[svn] Sync with upstream CVS. This implements RIX playback.
chainsaw
parents:
diff
changeset
|
268 switch(ctrl&0xF0) |
|
15ca2ea93a30
[svn] Sync with upstream CVS. This implements RIX playback.
chainsaw
parents:
diff
changeset
|
269 { |
|
15ca2ea93a30
[svn] Sync with upstream CVS. This implements RIX playback.
chainsaw
parents:
diff
changeset
|
270 case 0x90: rix_get_ins(); rix_90_pro(ctrl&0x0F); break; |
|
15ca2ea93a30
[svn] Sync with upstream CVS. This implements RIX playback.
chainsaw
parents:
diff
changeset
|
271 case 0xA0: rix_A0_pro(ctrl&0x0F,((unsigned short)band_low)<<6); break; |
|
15ca2ea93a30
[svn] Sync with upstream CVS. This implements RIX playback.
chainsaw
parents:
diff
changeset
|
272 case 0xB0: rix_B0_pro(ctrl&0x0F,band_low); break; |
|
15ca2ea93a30
[svn] Sync with upstream CVS. This implements RIX playback.
chainsaw
parents:
diff
changeset
|
273 case 0xC0: switch_ad_bd(ctrl&0x0F); |
|
15ca2ea93a30
[svn] Sync with upstream CVS. This implements RIX playback.
chainsaw
parents:
diff
changeset
|
274 if(band_low != 0) rix_C0_pro(ctrl&0x0F,band_low); |
|
15ca2ea93a30
[svn] Sync with upstream CVS. This implements RIX playback.
chainsaw
parents:
diff
changeset
|
275 break; |
|
15ca2ea93a30
[svn] Sync with upstream CVS. This implements RIX playback.
chainsaw
parents:
diff
changeset
|
276 default: band = (ctrl<<8)+band_low; break; |
|
15ca2ea93a30
[svn] Sync with upstream CVS. This implements RIX playback.
chainsaw
parents:
diff
changeset
|
277 } |
|
15ca2ea93a30
[svn] Sync with upstream CVS. This implements RIX playback.
chainsaw
parents:
diff
changeset
|
278 if(band != 0) return band; |
|
15ca2ea93a30
[svn] Sync with upstream CVS. This implements RIX playback.
chainsaw
parents:
diff
changeset
|
279 } |
|
15ca2ea93a30
[svn] Sync with upstream CVS. This implements RIX playback.
chainsaw
parents:
diff
changeset
|
280 music_ctrl(); |
|
15ca2ea93a30
[svn] Sync with upstream CVS. This implements RIX playback.
chainsaw
parents:
diff
changeset
|
281 I = mus_block+1; |
|
15ca2ea93a30
[svn] Sync with upstream CVS. This implements RIX playback.
chainsaw
parents:
diff
changeset
|
282 band = 0; music_on = 1; |
|
15ca2ea93a30
[svn] Sync with upstream CVS. This implements RIX playback.
chainsaw
parents:
diff
changeset
|
283 return 0; |
|
15ca2ea93a30
[svn] Sync with upstream CVS. This implements RIX playback.
chainsaw
parents:
diff
changeset
|
284 } |
|
15ca2ea93a30
[svn] Sync with upstream CVS. This implements RIX playback.
chainsaw
parents:
diff
changeset
|
285 /*--------------------------------------------------------------*/ |
|
15ca2ea93a30
[svn] Sync with upstream CVS. This implements RIX playback.
chainsaw
parents:
diff
changeset
|
286 inline void CrixPlayer::rix_get_ins() |
|
15ca2ea93a30
[svn] Sync with upstream CVS. This implements RIX playback.
chainsaw
parents:
diff
changeset
|
287 { |
|
15ca2ea93a30
[svn] Sync with upstream CVS. This implements RIX playback.
chainsaw
parents:
diff
changeset
|
288 memcpy(insbuf,(&buf_addr[ins_block])+(band_low<<6),56); |
|
15ca2ea93a30
[svn] Sync with upstream CVS. This implements RIX playback.
chainsaw
parents:
diff
changeset
|
289 } |
|
15ca2ea93a30
[svn] Sync with upstream CVS. This implements RIX playback.
chainsaw
parents:
diff
changeset
|
290 /*--------------------------------------------------------------*/ |
|
15ca2ea93a30
[svn] Sync with upstream CVS. This implements RIX playback.
chainsaw
parents:
diff
changeset
|
291 inline void CrixPlayer::rix_90_pro(unsigned short ctrl_l) |
|
15ca2ea93a30
[svn] Sync with upstream CVS. This implements RIX playback.
chainsaw
parents:
diff
changeset
|
292 { |
|
15ca2ea93a30
[svn] Sync with upstream CVS. This implements RIX playback.
chainsaw
parents:
diff
changeset
|
293 if(rhythm == 0 || ctrl_l < 6) |
|
15ca2ea93a30
[svn] Sync with upstream CVS. This implements RIX playback.
chainsaw
parents:
diff
changeset
|
294 { |
|
15ca2ea93a30
[svn] Sync with upstream CVS. This implements RIX playback.
chainsaw
parents:
diff
changeset
|
295 ins_to_reg(modify[ctrl_l*2],insbuf,insbuf[26]); |
|
15ca2ea93a30
[svn] Sync with upstream CVS. This implements RIX playback.
chainsaw
parents:
diff
changeset
|
296 ins_to_reg(modify[ctrl_l*2+1],insbuf+13,insbuf[27]); |
|
15ca2ea93a30
[svn] Sync with upstream CVS. This implements RIX playback.
chainsaw
parents:
diff
changeset
|
297 return; |
|
15ca2ea93a30
[svn] Sync with upstream CVS. This implements RIX playback.
chainsaw
parents:
diff
changeset
|
298 } |
|
15ca2ea93a30
[svn] Sync with upstream CVS. This implements RIX playback.
chainsaw
parents:
diff
changeset
|
299 else |
|
15ca2ea93a30
[svn] Sync with upstream CVS. This implements RIX playback.
chainsaw
parents:
diff
changeset
|
300 { |
|
15ca2ea93a30
[svn] Sync with upstream CVS. This implements RIX playback.
chainsaw
parents:
diff
changeset
|
301 if(ctrl_l > 6) |
|
15ca2ea93a30
[svn] Sync with upstream CVS. This implements RIX playback.
chainsaw
parents:
diff
changeset
|
302 { |
|
15ca2ea93a30
[svn] Sync with upstream CVS. This implements RIX playback.
chainsaw
parents:
diff
changeset
|
303 ins_to_reg(modify[ctrl_l*2+6],insbuf,insbuf[26]); |
|
15ca2ea93a30
[svn] Sync with upstream CVS. This implements RIX playback.
chainsaw
parents:
diff
changeset
|
304 return; |
|
15ca2ea93a30
[svn] Sync with upstream CVS. This implements RIX playback.
chainsaw
parents:
diff
changeset
|
305 } |
|
15ca2ea93a30
[svn] Sync with upstream CVS. This implements RIX playback.
chainsaw
parents:
diff
changeset
|
306 else |
|
15ca2ea93a30
[svn] Sync with upstream CVS. This implements RIX playback.
chainsaw
parents:
diff
changeset
|
307 { |
|
15ca2ea93a30
[svn] Sync with upstream CVS. This implements RIX playback.
chainsaw
parents:
diff
changeset
|
308 ins_to_reg(12,insbuf,insbuf[26]); |
|
15ca2ea93a30
[svn] Sync with upstream CVS. This implements RIX playback.
chainsaw
parents:
diff
changeset
|
309 ins_to_reg(15,insbuf+13,insbuf[27]); |
|
15ca2ea93a30
[svn] Sync with upstream CVS. This implements RIX playback.
chainsaw
parents:
diff
changeset
|
310 return; |
|
15ca2ea93a30
[svn] Sync with upstream CVS. This implements RIX playback.
chainsaw
parents:
diff
changeset
|
311 } |
|
15ca2ea93a30
[svn] Sync with upstream CVS. This implements RIX playback.
chainsaw
parents:
diff
changeset
|
312 } |
|
15ca2ea93a30
[svn] Sync with upstream CVS. This implements RIX playback.
chainsaw
parents:
diff
changeset
|
313 } |
|
15ca2ea93a30
[svn] Sync with upstream CVS. This implements RIX playback.
chainsaw
parents:
diff
changeset
|
314 /*--------------------------------------------------------------*/ |
|
15ca2ea93a30
[svn] Sync with upstream CVS. This implements RIX playback.
chainsaw
parents:
diff
changeset
|
315 inline void CrixPlayer::rix_A0_pro(unsigned short ctrl_l,unsigned short index) |
|
15ca2ea93a30
[svn] Sync with upstream CVS. This implements RIX playback.
chainsaw
parents:
diff
changeset
|
316 { |
|
15ca2ea93a30
[svn] Sync with upstream CVS. This implements RIX playback.
chainsaw
parents:
diff
changeset
|
317 if(rhythm == 0 || ctrl_l <= 6) |
|
15ca2ea93a30
[svn] Sync with upstream CVS. This implements RIX playback.
chainsaw
parents:
diff
changeset
|
318 { |
|
15ca2ea93a30
[svn] Sync with upstream CVS. This implements RIX playback.
chainsaw
parents:
diff
changeset
|
319 prepare_a0b0(ctrl_l,index>0x3FFF?0x3FFF:index); |
|
15ca2ea93a30
[svn] Sync with upstream CVS. This implements RIX playback.
chainsaw
parents:
diff
changeset
|
320 ad_a0b0l_reg(ctrl_l,a0b0_data3[ctrl_l],a0b0_data4[ctrl_l]); |
|
15ca2ea93a30
[svn] Sync with upstream CVS. This implements RIX playback.
chainsaw
parents:
diff
changeset
|
321 } |
|
15ca2ea93a30
[svn] Sync with upstream CVS. This implements RIX playback.
chainsaw
parents:
diff
changeset
|
322 else return; |
|
15ca2ea93a30
[svn] Sync with upstream CVS. This implements RIX playback.
chainsaw
parents:
diff
changeset
|
323 } |
|
15ca2ea93a30
[svn] Sync with upstream CVS. This implements RIX playback.
chainsaw
parents:
diff
changeset
|
324 /*--------------------------------------------------------------*/ |
|
15ca2ea93a30
[svn] Sync with upstream CVS. This implements RIX playback.
chainsaw
parents:
diff
changeset
|
325 inline void CrixPlayer::prepare_a0b0(unsigned short index,unsigned short v) /* important !*/ |
|
15ca2ea93a30
[svn] Sync with upstream CVS. This implements RIX playback.
chainsaw
parents:
diff
changeset
|
326 { |
|
15ca2ea93a30
[svn] Sync with upstream CVS. This implements RIX playback.
chainsaw
parents:
diff
changeset
|
327 short high = 0,low = 0; unsigned int res; |
|
15ca2ea93a30
[svn] Sync with upstream CVS. This implements RIX playback.
chainsaw
parents:
diff
changeset
|
328 low = ((unsigned short)(v-0x2000))*0x19; |
|
15ca2ea93a30
[svn] Sync with upstream CVS. This implements RIX playback.
chainsaw
parents:
diff
changeset
|
329 high = ((short)v)<0x2000?0xFFFF:0; |
|
15ca2ea93a30
[svn] Sync with upstream CVS. This implements RIX playback.
chainsaw
parents:
diff
changeset
|
330 if(low == 0xFF && high == 0) return; |
|
15ca2ea93a30
[svn] Sync with upstream CVS. This implements RIX playback.
chainsaw
parents:
diff
changeset
|
331 res = ((((unsigned int)high)<<16)|low)/0x2000; |
|
15ca2ea93a30
[svn] Sync with upstream CVS. This implements RIX playback.
chainsaw
parents:
diff
changeset
|
332 low = res&0xFFFF; |
|
15ca2ea93a30
[svn] Sync with upstream CVS. This implements RIX playback.
chainsaw
parents:
diff
changeset
|
333 if(low < 0) |
|
15ca2ea93a30
[svn] Sync with upstream CVS. This implements RIX playback.
chainsaw
parents:
diff
changeset
|
334 { |
|
15ca2ea93a30
[svn] Sync with upstream CVS. This implements RIX playback.
chainsaw
parents:
diff
changeset
|
335 low = 0x18-low; high = (signed short)low<0?0xFFFF:0; |
|
15ca2ea93a30
[svn] Sync with upstream CVS. This implements RIX playback.
chainsaw
parents:
diff
changeset
|
336 res = high; res<<=16; res+=low; |
|
15ca2ea93a30
[svn] Sync with upstream CVS. This implements RIX playback.
chainsaw
parents:
diff
changeset
|
337 low = ((signed short)res)/(signed short)0xFFE7; |
|
15ca2ea93a30
[svn] Sync with upstream CVS. This implements RIX playback.
chainsaw
parents:
diff
changeset
|
338 a0b0_data2[index] = low; |
|
15ca2ea93a30
[svn] Sync with upstream CVS. This implements RIX playback.
chainsaw
parents:
diff
changeset
|
339 low = res; |
|
15ca2ea93a30
[svn] Sync with upstream CVS. This implements RIX playback.
chainsaw
parents:
diff
changeset
|
340 res = low - 0x18; |
|
15ca2ea93a30
[svn] Sync with upstream CVS. This implements RIX playback.
chainsaw
parents:
diff
changeset
|
341 high = (signed short)res%0x19; |
|
15ca2ea93a30
[svn] Sync with upstream CVS. This implements RIX playback.
chainsaw
parents:
diff
changeset
|
342 low = (signed short)res/0x19; |
|
15ca2ea93a30
[svn] Sync with upstream CVS. This implements RIX playback.
chainsaw
parents:
diff
changeset
|
343 if(high != 0) {low = 0x19; low = low-high;} |
|
15ca2ea93a30
[svn] Sync with upstream CVS. This implements RIX playback.
chainsaw
parents:
diff
changeset
|
344 } |
|
15ca2ea93a30
[svn] Sync with upstream CVS. This implements RIX playback.
chainsaw
parents:
diff
changeset
|
345 else |
|
15ca2ea93a30
[svn] Sync with upstream CVS. This implements RIX playback.
chainsaw
parents:
diff
changeset
|
346 { |
|
15ca2ea93a30
[svn] Sync with upstream CVS. This implements RIX playback.
chainsaw
parents:
diff
changeset
|
347 res = high = low; |
|
15ca2ea93a30
[svn] Sync with upstream CVS. This implements RIX playback.
chainsaw
parents:
diff
changeset
|
348 low = (signed short)res/(signed short)0x19; |
|
15ca2ea93a30
[svn] Sync with upstream CVS. This implements RIX playback.
chainsaw
parents:
diff
changeset
|
349 a0b0_data2[index] = low; |
|
15ca2ea93a30
[svn] Sync with upstream CVS. This implements RIX playback.
chainsaw
parents:
diff
changeset
|
350 res = high; |
|
15ca2ea93a30
[svn] Sync with upstream CVS. This implements RIX playback.
chainsaw
parents:
diff
changeset
|
351 low = (signed short)res%(signed short)0x19; |
|
15ca2ea93a30
[svn] Sync with upstream CVS. This implements RIX playback.
chainsaw
parents:
diff
changeset
|
352 } |
|
15ca2ea93a30
[svn] Sync with upstream CVS. This implements RIX playback.
chainsaw
parents:
diff
changeset
|
353 low = (signed short)low*(signed short)0x18; |
|
15ca2ea93a30
[svn] Sync with upstream CVS. This implements RIX playback.
chainsaw
parents:
diff
changeset
|
354 displace[index] = low; |
|
15ca2ea93a30
[svn] Sync with upstream CVS. This implements RIX playback.
chainsaw
parents:
diff
changeset
|
355 } |
|
15ca2ea93a30
[svn] Sync with upstream CVS. This implements RIX playback.
chainsaw
parents:
diff
changeset
|
356 /*--------------------------------------------------------------*/ |
|
15ca2ea93a30
[svn] Sync with upstream CVS. This implements RIX playback.
chainsaw
parents:
diff
changeset
|
357 inline void CrixPlayer::ad_a0b0l_reg(unsigned short index,unsigned short p2,unsigned short p3) |
|
15ca2ea93a30
[svn] Sync with upstream CVS. This implements RIX playback.
chainsaw
parents:
diff
changeset
|
358 { |
|
15ca2ea93a30
[svn] Sync with upstream CVS. This implements RIX playback.
chainsaw
parents:
diff
changeset
|
359 unsigned short data; unsigned short i = p2+a0b0_data2[index]; |
|
15ca2ea93a30
[svn] Sync with upstream CVS. This implements RIX playback.
chainsaw
parents:
diff
changeset
|
360 a0b0_data4[index] = p3; |
|
15ca2ea93a30
[svn] Sync with upstream CVS. This implements RIX playback.
chainsaw
parents:
diff
changeset
|
361 a0b0_data3[index] = p2; |
|
15ca2ea93a30
[svn] Sync with upstream CVS. This implements RIX playback.
chainsaw
parents:
diff
changeset
|
362 i = ((signed short)i<=0x5F?i:0x5F); |
|
15ca2ea93a30
[svn] Sync with upstream CVS. This implements RIX playback.
chainsaw
parents:
diff
changeset
|
363 i = ((signed short)i>=0?i:0); |
|
15ca2ea93a30
[svn] Sync with upstream CVS. This implements RIX playback.
chainsaw
parents:
diff
changeset
|
364 data = buffer[addrs_head[i]+displace[index]/2]; |
|
15ca2ea93a30
[svn] Sync with upstream CVS. This implements RIX playback.
chainsaw
parents:
diff
changeset
|
365 ad_bop(0xA0+index,data); |
|
15ca2ea93a30
[svn] Sync with upstream CVS. This implements RIX playback.
chainsaw
parents:
diff
changeset
|
366 data = a0b0_data5[i]*4+(p3<1?0:0x20)+((data>>8)&3); |
|
15ca2ea93a30
[svn] Sync with upstream CVS. This implements RIX playback.
chainsaw
parents:
diff
changeset
|
367 ad_bop(0xB0+index,data); |
|
15ca2ea93a30
[svn] Sync with upstream CVS. This implements RIX playback.
chainsaw
parents:
diff
changeset
|
368 } |
|
15ca2ea93a30
[svn] Sync with upstream CVS. This implements RIX playback.
chainsaw
parents:
diff
changeset
|
369 /*--------------------------------------------------------------*/ |
|
15ca2ea93a30
[svn] Sync with upstream CVS. This implements RIX playback.
chainsaw
parents:
diff
changeset
|
370 inline void CrixPlayer::rix_B0_pro(unsigned short ctrl_l,unsigned short index) |
|
15ca2ea93a30
[svn] Sync with upstream CVS. This implements RIX playback.
chainsaw
parents:
diff
changeset
|
371 { |
|
15ca2ea93a30
[svn] Sync with upstream CVS. This implements RIX playback.
chainsaw
parents:
diff
changeset
|
372 register int temp = 0; |
|
15ca2ea93a30
[svn] Sync with upstream CVS. This implements RIX playback.
chainsaw
parents:
diff
changeset
|
373 if(rhythm == 0 || ctrl_l < 6) temp = modify[ctrl_l*2+1]; |
|
15ca2ea93a30
[svn] Sync with upstream CVS. This implements RIX playback.
chainsaw
parents:
diff
changeset
|
374 else |
|
15ca2ea93a30
[svn] Sync with upstream CVS. This implements RIX playback.
chainsaw
parents:
diff
changeset
|
375 { |
|
15ca2ea93a30
[svn] Sync with upstream CVS. This implements RIX playback.
chainsaw
parents:
diff
changeset
|
376 temp = ctrl_l > 6?ctrl_l*2:ctrl_l*2+1; |
|
15ca2ea93a30
[svn] Sync with upstream CVS. This implements RIX playback.
chainsaw
parents:
diff
changeset
|
377 temp = modify[temp+6]; |
|
15ca2ea93a30
[svn] Sync with upstream CVS. This implements RIX playback.
chainsaw
parents:
diff
changeset
|
378 } |
|
15ca2ea93a30
[svn] Sync with upstream CVS. This implements RIX playback.
chainsaw
parents:
diff
changeset
|
379 for40reg[temp] = index>0x7F?0x7F:index; |
|
15ca2ea93a30
[svn] Sync with upstream CVS. This implements RIX playback.
chainsaw
parents:
diff
changeset
|
380 ad_40_reg(temp); |
|
15ca2ea93a30
[svn] Sync with upstream CVS. This implements RIX playback.
chainsaw
parents:
diff
changeset
|
381 } |
|
15ca2ea93a30
[svn] Sync with upstream CVS. This implements RIX playback.
chainsaw
parents:
diff
changeset
|
382 /*--------------------------------------------------------------*/ |
|
15ca2ea93a30
[svn] Sync with upstream CVS. This implements RIX playback.
chainsaw
parents:
diff
changeset
|
383 inline void CrixPlayer::rix_C0_pro(unsigned short ctrl_l,unsigned short index) |
|
15ca2ea93a30
[svn] Sync with upstream CVS. This implements RIX playback.
chainsaw
parents:
diff
changeset
|
384 { |
|
15ca2ea93a30
[svn] Sync with upstream CVS. This implements RIX playback.
chainsaw
parents:
diff
changeset
|
385 register unsigned short i = index>=12?index-12:0; |
|
15ca2ea93a30
[svn] Sync with upstream CVS. This implements RIX playback.
chainsaw
parents:
diff
changeset
|
386 if(ctrl_l < 6 || rhythm == 0) |
|
15ca2ea93a30
[svn] Sync with upstream CVS. This implements RIX playback.
chainsaw
parents:
diff
changeset
|
387 { |
|
15ca2ea93a30
[svn] Sync with upstream CVS. This implements RIX playback.
chainsaw
parents:
diff
changeset
|
388 ad_a0b0l_reg(ctrl_l,i,1); |
|
15ca2ea93a30
[svn] Sync with upstream CVS. This implements RIX playback.
chainsaw
parents:
diff
changeset
|
389 return; |
|
15ca2ea93a30
[svn] Sync with upstream CVS. This implements RIX playback.
chainsaw
parents:
diff
changeset
|
390 } |
|
15ca2ea93a30
[svn] Sync with upstream CVS. This implements RIX playback.
chainsaw
parents:
diff
changeset
|
391 else |
|
15ca2ea93a30
[svn] Sync with upstream CVS. This implements RIX playback.
chainsaw
parents:
diff
changeset
|
392 { |
|
15ca2ea93a30
[svn] Sync with upstream CVS. This implements RIX playback.
chainsaw
parents:
diff
changeset
|
393 if(ctrl_l != 6) |
|
15ca2ea93a30
[svn] Sync with upstream CVS. This implements RIX playback.
chainsaw
parents:
diff
changeset
|
394 { |
|
15ca2ea93a30
[svn] Sync with upstream CVS. This implements RIX playback.
chainsaw
parents:
diff
changeset
|
395 if(ctrl_l == 8) |
|
15ca2ea93a30
[svn] Sync with upstream CVS. This implements RIX playback.
chainsaw
parents:
diff
changeset
|
396 { |
|
15ca2ea93a30
[svn] Sync with upstream CVS. This implements RIX playback.
chainsaw
parents:
diff
changeset
|
397 ad_a0b0l_reg(ctrl_l,i,0); |
|
15ca2ea93a30
[svn] Sync with upstream CVS. This implements RIX playback.
chainsaw
parents:
diff
changeset
|
398 ad_a0b0l_reg(7,i+7,0); |
|
15ca2ea93a30
[svn] Sync with upstream CVS. This implements RIX playback.
chainsaw
parents:
diff
changeset
|
399 } |
|
15ca2ea93a30
[svn] Sync with upstream CVS. This implements RIX playback.
chainsaw
parents:
diff
changeset
|
400 } |
|
15ca2ea93a30
[svn] Sync with upstream CVS. This implements RIX playback.
chainsaw
parents:
diff
changeset
|
401 else ad_a0b0l_reg(ctrl_l,i,0); |
|
15ca2ea93a30
[svn] Sync with upstream CVS. This implements RIX playback.
chainsaw
parents:
diff
changeset
|
402 bd_modify |= bd_reg_data[ctrl_l]; |
|
15ca2ea93a30
[svn] Sync with upstream CVS. This implements RIX playback.
chainsaw
parents:
diff
changeset
|
403 ad_bd_reg(); |
|
15ca2ea93a30
[svn] Sync with upstream CVS. This implements RIX playback.
chainsaw
parents:
diff
changeset
|
404 return; |
|
15ca2ea93a30
[svn] Sync with upstream CVS. This implements RIX playback.
chainsaw
parents:
diff
changeset
|
405 } |
|
15ca2ea93a30
[svn] Sync with upstream CVS. This implements RIX playback.
chainsaw
parents:
diff
changeset
|
406 } |
|
15ca2ea93a30
[svn] Sync with upstream CVS. This implements RIX playback.
chainsaw
parents:
diff
changeset
|
407 /*--------------------------------------------------------------*/ |
|
15ca2ea93a30
[svn] Sync with upstream CVS. This implements RIX playback.
chainsaw
parents:
diff
changeset
|
408 inline void CrixPlayer::switch_ad_bd(unsigned short index) |
|
15ca2ea93a30
[svn] Sync with upstream CVS. This implements RIX playback.
chainsaw
parents:
diff
changeset
|
409 { |
|
15ca2ea93a30
[svn] Sync with upstream CVS. This implements RIX playback.
chainsaw
parents:
diff
changeset
|
410 |
|
15ca2ea93a30
[svn] Sync with upstream CVS. This implements RIX playback.
chainsaw
parents:
diff
changeset
|
411 if(rhythm == 0 || index < 6) ad_a0b0l_reg(index,a0b0_data3[index],0); |
|
15ca2ea93a30
[svn] Sync with upstream CVS. This implements RIX playback.
chainsaw
parents:
diff
changeset
|
412 else |
|
15ca2ea93a30
[svn] Sync with upstream CVS. This implements RIX playback.
chainsaw
parents:
diff
changeset
|
413 { |
|
15ca2ea93a30
[svn] Sync with upstream CVS. This implements RIX playback.
chainsaw
parents:
diff
changeset
|
414 bd_modify &= (~bd_reg_data[index]), |
|
15ca2ea93a30
[svn] Sync with upstream CVS. This implements RIX playback.
chainsaw
parents:
diff
changeset
|
415 ad_bd_reg(); |
|
15ca2ea93a30
[svn] Sync with upstream CVS. This implements RIX playback.
chainsaw
parents:
diff
changeset
|
416 } |
|
15ca2ea93a30
[svn] Sync with upstream CVS. This implements RIX playback.
chainsaw
parents:
diff
changeset
|
417 } |
|
15ca2ea93a30
[svn] Sync with upstream CVS. This implements RIX playback.
chainsaw
parents:
diff
changeset
|
418 /*--------------------------------------------------------------*/ |
|
15ca2ea93a30
[svn] Sync with upstream CVS. This implements RIX playback.
chainsaw
parents:
diff
changeset
|
419 inline void CrixPlayer::ins_to_reg(unsigned short index,unsigned short* insb,unsigned short value) |
|
15ca2ea93a30
[svn] Sync with upstream CVS. This implements RIX playback.
chainsaw
parents:
diff
changeset
|
420 { |
|
15ca2ea93a30
[svn] Sync with upstream CVS. This implements RIX playback.
chainsaw
parents:
diff
changeset
|
421 register unsigned short i; |
|
15ca2ea93a30
[svn] Sync with upstream CVS. This implements RIX playback.
chainsaw
parents:
diff
changeset
|
422 for(i=0;i<13;i++) reg_bufs[index].v[i] = insb[i]; |
|
15ca2ea93a30
[svn] Sync with upstream CVS. This implements RIX playback.
chainsaw
parents:
diff
changeset
|
423 reg_bufs[index].v[13] = value&3; |
|
15ca2ea93a30
[svn] Sync with upstream CVS. This implements RIX playback.
chainsaw
parents:
diff
changeset
|
424 ad_bd_reg(),ad_08_reg(), |
|
15ca2ea93a30
[svn] Sync with upstream CVS. This implements RIX playback.
chainsaw
parents:
diff
changeset
|
425 ad_40_reg(index),ad_C0_reg(index),ad_60_reg(index), |
|
15ca2ea93a30
[svn] Sync with upstream CVS. This implements RIX playback.
chainsaw
parents:
diff
changeset
|
426 ad_80_reg(index),ad_20_reg(index),ad_E0_reg(index); |
|
15ca2ea93a30
[svn] Sync with upstream CVS. This implements RIX playback.
chainsaw
parents:
diff
changeset
|
427 } |
|
15ca2ea93a30
[svn] Sync with upstream CVS. This implements RIX playback.
chainsaw
parents:
diff
changeset
|
428 /*--------------------------------------------------------------*/ |
|
15ca2ea93a30
[svn] Sync with upstream CVS. This implements RIX playback.
chainsaw
parents:
diff
changeset
|
429 inline void CrixPlayer::ad_E0_reg(unsigned short index) |
|
15ca2ea93a30
[svn] Sync with upstream CVS. This implements RIX playback.
chainsaw
parents:
diff
changeset
|
430 { |
|
15ca2ea93a30
[svn] Sync with upstream CVS. This implements RIX playback.
chainsaw
parents:
diff
changeset
|
431 unsigned short data = e0_reg_flag == 0?0:(reg_bufs[index].v[13]&3); |
|
15ca2ea93a30
[svn] Sync with upstream CVS. This implements RIX playback.
chainsaw
parents:
diff
changeset
|
432 ad_bop(0xE0+reg_data[index],data); |
|
15ca2ea93a30
[svn] Sync with upstream CVS. This implements RIX playback.
chainsaw
parents:
diff
changeset
|
433 } |
|
15ca2ea93a30
[svn] Sync with upstream CVS. This implements RIX playback.
chainsaw
parents:
diff
changeset
|
434 /*--------------------------------------------------------------*/ |
|
15ca2ea93a30
[svn] Sync with upstream CVS. This implements RIX playback.
chainsaw
parents:
diff
changeset
|
435 inline void CrixPlayer::ad_20_reg(unsigned short index) |
|
15ca2ea93a30
[svn] Sync with upstream CVS. This implements RIX playback.
chainsaw
parents:
diff
changeset
|
436 { |
|
15ca2ea93a30
[svn] Sync with upstream CVS. This implements RIX playback.
chainsaw
parents:
diff
changeset
|
437 unsigned short data = (reg_bufs[index].v[9] < 1?0:0x80); |
|
15ca2ea93a30
[svn] Sync with upstream CVS. This implements RIX playback.
chainsaw
parents:
diff
changeset
|
438 data += (reg_bufs[index].v[10] < 1?0:0x40); |
|
15ca2ea93a30
[svn] Sync with upstream CVS. This implements RIX playback.
chainsaw
parents:
diff
changeset
|
439 data += (reg_bufs[index].v[5] < 1?0:0x20); |
|
15ca2ea93a30
[svn] Sync with upstream CVS. This implements RIX playback.
chainsaw
parents:
diff
changeset
|
440 data += (reg_bufs[index].v[11] < 1?0:0x10); |
|
15ca2ea93a30
[svn] Sync with upstream CVS. This implements RIX playback.
chainsaw
parents:
diff
changeset
|
441 data += (reg_bufs[index].v[1]&0x0F); |
|
15ca2ea93a30
[svn] Sync with upstream CVS. This implements RIX playback.
chainsaw
parents:
diff
changeset
|
442 ad_bop(0x20+reg_data[index],data); |
|
15ca2ea93a30
[svn] Sync with upstream CVS. This implements RIX playback.
chainsaw
parents:
diff
changeset
|
443 } |
|
15ca2ea93a30
[svn] Sync with upstream CVS. This implements RIX playback.
chainsaw
parents:
diff
changeset
|
444 /*--------------------------------------------------------------*/ |
|
15ca2ea93a30
[svn] Sync with upstream CVS. This implements RIX playback.
chainsaw
parents:
diff
changeset
|
445 inline void CrixPlayer::ad_80_reg(unsigned short index) |
|
15ca2ea93a30
[svn] Sync with upstream CVS. This implements RIX playback.
chainsaw
parents:
diff
changeset
|
446 { |
|
15ca2ea93a30
[svn] Sync with upstream CVS. This implements RIX playback.
chainsaw
parents:
diff
changeset
|
447 unsigned short data = (reg_bufs[index].v[7]&0x0F),temp = reg_bufs[index].v[4]; |
|
15ca2ea93a30
[svn] Sync with upstream CVS. This implements RIX playback.
chainsaw
parents:
diff
changeset
|
448 data |= (temp << 4); |
|
15ca2ea93a30
[svn] Sync with upstream CVS. This implements RIX playback.
chainsaw
parents:
diff
changeset
|
449 ad_bop(0x80+reg_data[index],data); |
|
15ca2ea93a30
[svn] Sync with upstream CVS. This implements RIX playback.
chainsaw
parents:
diff
changeset
|
450 } |
|
15ca2ea93a30
[svn] Sync with upstream CVS. This implements RIX playback.
chainsaw
parents:
diff
changeset
|
451 /*--------------------------------------------------------------*/ |
|
15ca2ea93a30
[svn] Sync with upstream CVS. This implements RIX playback.
chainsaw
parents:
diff
changeset
|
452 inline void CrixPlayer::ad_60_reg(unsigned short index) |
|
15ca2ea93a30
[svn] Sync with upstream CVS. This implements RIX playback.
chainsaw
parents:
diff
changeset
|
453 { |
|
15ca2ea93a30
[svn] Sync with upstream CVS. This implements RIX playback.
chainsaw
parents:
diff
changeset
|
454 unsigned short data = reg_bufs[index].v[6]&0x0F,temp = reg_bufs[index].v[3]; |
|
15ca2ea93a30
[svn] Sync with upstream CVS. This implements RIX playback.
chainsaw
parents:
diff
changeset
|
455 data |= (temp << 4); |
|
15ca2ea93a30
[svn] Sync with upstream CVS. This implements RIX playback.
chainsaw
parents:
diff
changeset
|
456 ad_bop(0x60+reg_data[index],data); |
|
15ca2ea93a30
[svn] Sync with upstream CVS. This implements RIX playback.
chainsaw
parents:
diff
changeset
|
457 } |
|
15ca2ea93a30
[svn] Sync with upstream CVS. This implements RIX playback.
chainsaw
parents:
diff
changeset
|
458 /*--------------------------------------------------------------*/ |
|
15ca2ea93a30
[svn] Sync with upstream CVS. This implements RIX playback.
chainsaw
parents:
diff
changeset
|
459 inline void CrixPlayer::ad_C0_reg(unsigned short index) |
|
15ca2ea93a30
[svn] Sync with upstream CVS. This implements RIX playback.
chainsaw
parents:
diff
changeset
|
460 { |
|
15ca2ea93a30
[svn] Sync with upstream CVS. This implements RIX playback.
chainsaw
parents:
diff
changeset
|
461 unsigned short data = reg_bufs[index].v[2]; |
|
15ca2ea93a30
[svn] Sync with upstream CVS. This implements RIX playback.
chainsaw
parents:
diff
changeset
|
462 if(adflag[index] == 1) return; |
|
15ca2ea93a30
[svn] Sync with upstream CVS. This implements RIX playback.
chainsaw
parents:
diff
changeset
|
463 data *= 2, |
|
15ca2ea93a30
[svn] Sync with upstream CVS. This implements RIX playback.
chainsaw
parents:
diff
changeset
|
464 data |= (reg_bufs[index].v[12] < 1?1:0); |
|
15ca2ea93a30
[svn] Sync with upstream CVS. This implements RIX playback.
chainsaw
parents:
diff
changeset
|
465 ad_bop(0xC0+ad_C0_offs[index],data); |
|
15ca2ea93a30
[svn] Sync with upstream CVS. This implements RIX playback.
chainsaw
parents:
diff
changeset
|
466 } |
|
15ca2ea93a30
[svn] Sync with upstream CVS. This implements RIX playback.
chainsaw
parents:
diff
changeset
|
467 /*--------------------------------------------------------------*/ |
|
15ca2ea93a30
[svn] Sync with upstream CVS. This implements RIX playback.
chainsaw
parents:
diff
changeset
|
468 inline void CrixPlayer::ad_40_reg(unsigned short index) |
|
15ca2ea93a30
[svn] Sync with upstream CVS. This implements RIX playback.
chainsaw
parents:
diff
changeset
|
469 { |
|
15ca2ea93a30
[svn] Sync with upstream CVS. This implements RIX playback.
chainsaw
parents:
diff
changeset
|
470 unsigned int res = 0; |
|
15ca2ea93a30
[svn] Sync with upstream CVS. This implements RIX playback.
chainsaw
parents:
diff
changeset
|
471 unsigned short data = 0,temp = reg_bufs[index].v[0]; |
|
15ca2ea93a30
[svn] Sync with upstream CVS. This implements RIX playback.
chainsaw
parents:
diff
changeset
|
472 data = 0x3F - (0x3F & reg_bufs[index].v[8]), |
|
15ca2ea93a30
[svn] Sync with upstream CVS. This implements RIX playback.
chainsaw
parents:
diff
changeset
|
473 data *= for40reg[index], |
|
15ca2ea93a30
[svn] Sync with upstream CVS. This implements RIX playback.
chainsaw
parents:
diff
changeset
|
474 data *= 2, |
|
15ca2ea93a30
[svn] Sync with upstream CVS. This implements RIX playback.
chainsaw
parents:
diff
changeset
|
475 data += 0x7F, |
|
15ca2ea93a30
[svn] Sync with upstream CVS. This implements RIX playback.
chainsaw
parents:
diff
changeset
|
476 res = data; |
|
15ca2ea93a30
[svn] Sync with upstream CVS. This implements RIX playback.
chainsaw
parents:
diff
changeset
|
477 data = res/0xFE, |
|
15ca2ea93a30
[svn] Sync with upstream CVS. This implements RIX playback.
chainsaw
parents:
diff
changeset
|
478 data -= 0x3F, |
|
15ca2ea93a30
[svn] Sync with upstream CVS. This implements RIX playback.
chainsaw
parents:
diff
changeset
|
479 data = -data, |
|
15ca2ea93a30
[svn] Sync with upstream CVS. This implements RIX playback.
chainsaw
parents:
diff
changeset
|
480 data |= temp<<6; |
|
15ca2ea93a30
[svn] Sync with upstream CVS. This implements RIX playback.
chainsaw
parents:
diff
changeset
|
481 ad_bop(0x40+reg_data[index],data); |
|
15ca2ea93a30
[svn] Sync with upstream CVS. This implements RIX playback.
chainsaw
parents:
diff
changeset
|
482 } |
|
15ca2ea93a30
[svn] Sync with upstream CVS. This implements RIX playback.
chainsaw
parents:
diff
changeset
|
483 /*--------------------------------------------------------------*/ |
|
15ca2ea93a30
[svn] Sync with upstream CVS. This implements RIX playback.
chainsaw
parents:
diff
changeset
|
484 inline void CrixPlayer::ad_bd_reg() |
|
15ca2ea93a30
[svn] Sync with upstream CVS. This implements RIX playback.
chainsaw
parents:
diff
changeset
|
485 { |
|
15ca2ea93a30
[svn] Sync with upstream CVS. This implements RIX playback.
chainsaw
parents:
diff
changeset
|
486 unsigned short data = rhythm < 1? 0:0x20; |
|
15ca2ea93a30
[svn] Sync with upstream CVS. This implements RIX playback.
chainsaw
parents:
diff
changeset
|
487 data |= bd_modify; |
|
15ca2ea93a30
[svn] Sync with upstream CVS. This implements RIX playback.
chainsaw
parents:
diff
changeset
|
488 ad_bop(0xBD,data); |
|
15ca2ea93a30
[svn] Sync with upstream CVS. This implements RIX playback.
chainsaw
parents:
diff
changeset
|
489 } |
|
15ca2ea93a30
[svn] Sync with upstream CVS. This implements RIX playback.
chainsaw
parents:
diff
changeset
|
490 /*--------------------------------------------------------------*/ |
|
15ca2ea93a30
[svn] Sync with upstream CVS. This implements RIX playback.
chainsaw
parents:
diff
changeset
|
491 inline void CrixPlayer::ad_a0b0_reg(unsigned short index) |
|
15ca2ea93a30
[svn] Sync with upstream CVS. This implements RIX playback.
chainsaw
parents:
diff
changeset
|
492 { |
|
15ca2ea93a30
[svn] Sync with upstream CVS. This implements RIX playback.
chainsaw
parents:
diff
changeset
|
493 ad_bop(0xA0+index,0); |
|
15ca2ea93a30
[svn] Sync with upstream CVS. This implements RIX playback.
chainsaw
parents:
diff
changeset
|
494 ad_bop(0xB0+index,0); |
|
15ca2ea93a30
[svn] Sync with upstream CVS. This implements RIX playback.
chainsaw
parents:
diff
changeset
|
495 } |
|
15ca2ea93a30
[svn] Sync with upstream CVS. This implements RIX playback.
chainsaw
parents:
diff
changeset
|
496 /*--------------------------------------------------------------*/ |
|
15ca2ea93a30
[svn] Sync with upstream CVS. This implements RIX playback.
chainsaw
parents:
diff
changeset
|
497 inline void CrixPlayer::music_ctrl() |
|
15ca2ea93a30
[svn] Sync with upstream CVS. This implements RIX playback.
chainsaw
parents:
diff
changeset
|
498 { |
|
15ca2ea93a30
[svn] Sync with upstream CVS. This implements RIX playback.
chainsaw
parents:
diff
changeset
|
499 register int i; |
|
15ca2ea93a30
[svn] Sync with upstream CVS. This implements RIX playback.
chainsaw
parents:
diff
changeset
|
500 music_on = 0; |
|
15ca2ea93a30
[svn] Sync with upstream CVS. This implements RIX playback.
chainsaw
parents:
diff
changeset
|
501 for(i=0;i<11;i++) |
|
15ca2ea93a30
[svn] Sync with upstream CVS. This implements RIX playback.
chainsaw
parents:
diff
changeset
|
502 switch_ad_bd(i); |
|
15ca2ea93a30
[svn] Sync with upstream CVS. This implements RIX playback.
chainsaw
parents:
diff
changeset
|
503 } |
|
15ca2ea93a30
[svn] Sync with upstream CVS. This implements RIX playback.
chainsaw
parents:
diff
changeset
|
504 /*----------------------------------------------------------------------*/ |
|
15ca2ea93a30
[svn] Sync with upstream CVS. This implements RIX playback.
chainsaw
parents:
diff
changeset
|
505 inline unsigned int CrixPlayer::strm_and_fr(unsigned short parm) |
|
15ca2ea93a30
[svn] Sync with upstream CVS. This implements RIX playback.
chainsaw
parents:
diff
changeset
|
506 { |
|
15ca2ea93a30
[svn] Sync with upstream CVS. This implements RIX playback.
chainsaw
parents:
diff
changeset
|
507 return ((unsigned int)parm*6+10000)*0.27461678223; |
|
15ca2ea93a30
[svn] Sync with upstream CVS. This implements RIX playback.
chainsaw
parents:
diff
changeset
|
508 } |
|
15ca2ea93a30
[svn] Sync with upstream CVS. This implements RIX playback.
chainsaw
parents:
diff
changeset
|
509 |
