rix.cpp 16 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570
  1. /*
  2. * Adplug - Replayer for many OPL2/OPL3 audio file formats.
  3. * Copyright (C) 1999 - 2007 Simon Peter, <dn.tlp@gmx.net>, et al.
  4. *
  5. * This library is free software; you can redistribute it and/or
  6. * modify it under the terms of the GNU Lesser General Public
  7. * License as published by the Free Software Foundation; either
  8. * version 2.1 of the License, or (at your option) any later version.
  9. *
  10. * This library is distributed in the hope that it will be useful,
  11. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  12. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
  13. * Lesser General Public License for more details.
  14. *
  15. * You should have received a copy of the GNU Lesser General Public
  16. * License along with this library; if not, write to the Free Software
  17. * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
  18. *
  19. * rix.cpp - Softstar RIX OPL Format Player by palxex <palxex.ys168.com>
  20. * BSPAL <BSPAL.ys168.com>
  21. */
  22. #include <cstring>
  23. #include <cstdlib>
  24. #include "rix.h"
  25. using namespace std;
  26. #if !defined(_WIN32) || defined(__SYMBIAN32__)
  27. #define stricmp strcasecmp
  28. #endif
  29. #if defined(__hppa__) || \
  30. defined(__m68k__) || defined(mc68000) || defined(_M_M68K) || \
  31. (defined(__MIPS__) && defined(__MISPEB__)) || \
  32. defined(__ppc__) || defined(__POWERPC__) || defined(_M_PPC) || \
  33. defined(__sparc__)
  34. // big endian
  35. #define RIX_SWAP32(a) (((a) << 24) | (((a) << 8) & 0x00FF0000) | (((a) >> 8) & 0x0000FF00) | ((a) >> 24))
  36. #else
  37. // little endian
  38. #define RIX_SWAP32(a) (a)
  39. #endif
  40. const uint8_t CrixPlayer::adflag[] = {0,0,0,1,1,1,0,0,0,1,1,1,0,0,0,1,1,1};
  41. const uint8_t CrixPlayer::reg_data[] = {0,1,2,3,4,5,8,9,10,11,12,13,16,17,18,19,20,21};
  42. const uint8_t CrixPlayer::ad_C0_offs[] = {0,1,2,0,1,2,3,4,5,3,4,5,6,7,8,6,7,8};
  43. const uint8_t CrixPlayer::modify[] = {0,3,1,4,2,5,6,9,7,10,8,11,12,15,13,16,14,17,12,\
  44. 15,16,0,14,0,17,0,13,0};
  45. const uint8_t CrixPlayer::bd_reg_data[] = {
  46. 0x00,0x00,0x00,0x00,0x00,0x00,0x10,0x08,0x04,0x02,0x01,
  47. 0x00,0x01,0x01,0x03,0x0F,0x05,0x00,0x01,0x03,0x0F,0x00,
  48. 0x00,0x00,0x01,0x00,0x00,0x01,0x01,0x0F,0x07,0x00,0x02,
  49. 0x04,0x00,0x00,0x00,0x01,0x00,0x00,0x00,0x00,0x00,0x0A,
  50. 0x04,0x00,0x08,0x0C,0x0B,0x00,0x00,0x00,0x01,0x00,0x00,
  51. 0x00,0x00,0x0D,0x04,0x00,0x06,0x0F,0x00,0x00,0x00,0x00,
  52. 0x01,0x00,0x00,0x0C,0x00,0x0F,0x0B,0x00,0x08,0x05,0x00,
  53. 0x00,0x00,0x00,0x00,0x00,0x00,0x04,0x00,0x0F,0x0B,0x00,
  54. 0x07,0x05,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x01,0x00,
  55. 0x0F,0x0B,0x00,0x05,0x05,0x00,0x00,0x00,0x00,0x00,0x00,
  56. 0x00,0x01,0x00,0x0F,0x0B,0x00,0x07,0x05,0x00,0x00,0x00,
  57. 0x00,0x00,0x00};
  58. uint8_t CrixPlayer::for40reg[] = {0x7F,0x7F,0x7F,0x7F,0x7F,0x7F,0x7F,0x7F,0x7F,
  59. 0x7F,0x7F,0x7F,0x7F,0x7F,0x7F,0x7F,0x7F,0x7F};
  60. const uint16_t CrixPlayer::mus_time = 0x4268;
  61. /*** public methods *************************************/
  62. CPlayer *CrixPlayer::factory(Copl *newopl)
  63. {
  64. return new CrixPlayer(newopl);
  65. }
  66. CrixPlayer::CrixPlayer(Copl *newopl)
  67. : CPlayer(newopl), flag_mkf(0), file_buffer(0), rix_buf(0)
  68. #if USE_RIX_EXTRA_INIT
  69. , extra_regs(NULL), extra_vals(NULL), extra_length(0)
  70. #endif
  71. {
  72. }
  73. CrixPlayer::~CrixPlayer()
  74. {
  75. if(file_buffer)
  76. delete [] file_buffer;
  77. #if USE_RIX_EXTRA_INIT
  78. if (extra_regs) delete[] extra_regs;
  79. if (extra_vals) delete[] extra_vals;
  80. #endif
  81. }
  82. #if USE_RIX_EXTRA_INIT
  83. void CrixPlayer::set_extra_init(uint32_t* regs, uint8_t* datas, int n)
  84. {
  85. extra_length = n;
  86. if (extra_regs) delete[] extra_regs;
  87. if (extra_vals) delete[] extra_vals;
  88. if (n > 0)
  89. {
  90. extra_regs = new uint32_t[n];
  91. extra_vals = new uint8_t[n];
  92. if (extra_regs) memcpy(extra_regs, regs, n * sizeof(uint32_t));
  93. if (extra_vals) memcpy(extra_vals, datas, n * sizeof(uint8_t));
  94. }
  95. else
  96. {
  97. extra_regs = NULL;
  98. extra_vals = NULL;
  99. }
  100. }
  101. #endif
  102. bool CrixPlayer::load(const std::string &filename, const CFileProvider &fp)
  103. {
  104. binistream *f = fp.open(filename); if(!f) return false;
  105. uint32_t i=0;
  106. if(stricmp(filename.substr(filename.length()-4,4).c_str(),".mkf")==0)
  107. {
  108. flag_mkf=1;
  109. f->seek(0);
  110. int offset=f->readInt(4);
  111. f->seek(offset);
  112. }
  113. if(f->readInt(2)!=0x55aa){ fp.close(f);return false; }
  114. file_buffer = new uint8_t [fp.filesize(f) + 1];
  115. f->seek(0);
  116. while(!f->eof())
  117. file_buffer[i++]=f->readInt(1);
  118. length=i;
  119. fp.close(f);
  120. if(!flag_mkf)
  121. rix_buf=file_buffer;
  122. rewind(0);
  123. return true;
  124. }
  125. bool CrixPlayer::update()
  126. {
  127. int_08h_entry();
  128. return !play_end;
  129. }
  130. void CrixPlayer::rewind(int subsong, bool reinit)
  131. {
  132. play_end = 0;
  133. pos = 0;
  134. if (reinit)
  135. {
  136. I = 0; T = 0;
  137. mus_block = 0;
  138. ins_block = 0;
  139. rhythm = 0;
  140. music_on = 0;
  141. pause_flag = 0;
  142. band = 0;
  143. band_low = 0;
  144. e0_reg_flag = 0;
  145. bd_modify = 0;
  146. sustain = 0;
  147. memset(f_buffer, 0, sizeof(f_buffer));
  148. memset(a0b0_data2, 0, sizeof(a0b0_data2));
  149. memset(a0b0_data3, 0, sizeof(a0b0_data3));
  150. memset(a0b0_data4, 0, sizeof(a0b0_data4));
  151. memset(a0b0_data5, 0, sizeof(a0b0_data5));
  152. memset(addrs_head, 0, sizeof(addrs_head));
  153. memset(insbuf, 0, sizeof(insbuf));
  154. memset(displace, 0, sizeof(displace));
  155. memset(reg_bufs, 0, sizeof(reg_bufs));
  156. memset(for40reg, 0x7F, sizeof(for40reg));
  157. }
  158. if (flag_mkf)
  159. {
  160. uint32_t *buf_index = (uint32_t *)file_buffer;
  161. int offset1 = RIX_SWAP32(buf_index[subsong]), offset2;
  162. while ((offset2 = RIX_SWAP32(buf_index[++subsong])) == offset1);
  163. length = offset2 - offset1 + 1;
  164. rix_buf = file_buffer + offset1;
  165. }
  166. if (reinit)
  167. {
  168. opl->init();
  169. opl->write(1, 32); // go to OPL2 mode
  170. set_new_int();
  171. data_initial();
  172. }
  173. }
  174. unsigned int CrixPlayer::getsubsongs()
  175. {
  176. if(flag_mkf)
  177. {
  178. uint32_t *buf_index=(uint32_t *)file_buffer;
  179. int songs=RIX_SWAP32(buf_index[0])/4,i=0;
  180. for(i=0;i<songs;i++)
  181. if(buf_index[i+1]==buf_index[i])
  182. songs--;
  183. return songs;
  184. }
  185. else
  186. return 1;
  187. }
  188. float CrixPlayer::getrefresh()
  189. {
  190. return 70.0f;
  191. }
  192. /*------------------Implemention----------------------------*/
  193. inline void CrixPlayer::set_new_int()
  194. {
  195. // if(!ad_initial()) exit(1);
  196. ad_initial();
  197. }
  198. /*----------------------------------------------------------*/
  199. inline void CrixPlayer::Pause()
  200. {
  201. register uint16_t i;
  202. pause_flag = 1;
  203. for(i=0;i<11;i++)
  204. switch_ad_bd(i);
  205. }
  206. /*----------------------------------------------------------*/
  207. inline void CrixPlayer::ad_a0b0l_reg_(uint16_t index,uint16_t p2,uint16_t p3)
  208. {
  209. // uint16_t i = p2+a0b0_data2[index];
  210. a0b0_data4[index] = p3;
  211. a0b0_data3[index] = p2;
  212. }
  213. inline void CrixPlayer::data_initial()
  214. {
  215. rhythm = rix_buf[2];
  216. mus_block = (rix_buf[0x0D]<<8)+rix_buf[0x0C];
  217. ins_block = (rix_buf[0x09]<<8)+rix_buf[0x08];
  218. I = mus_block+1;
  219. if(rhythm != 0)
  220. {
  221. ad_a0b0_reg(6);
  222. ad_a0b0_reg(7);
  223. ad_a0b0_reg(8);
  224. ad_a0b0l_reg_(8,0x18,0);
  225. ad_a0b0l_reg_(7,0x1F,0);
  226. // This is required for correct attack effect, by louyihua
  227. #if USE_RIX_EXTRA_INIT
  228. if (extra_regs && extra_vals && extra_length > 0)
  229. {
  230. for (uint32_t i = 0; i < extra_length; i++)
  231. opl->write(extra_regs[i], extra_vals[i]);
  232. }
  233. #else
  234. opl->write(0xa8, 87);
  235. opl->write(0xb8, 9);
  236. opl->write(0xa7, 3);
  237. opl->write(0xb7, 15/*10*/); // Changed from 10 (original value) to 15 for better quality
  238. #endif
  239. }
  240. bd_modify = 0;
  241. ad_bd_reg();
  242. band = 0; music_on = 1;
  243. }
  244. /*----------------------------------------------------------*/
  245. inline uint16_t CrixPlayer::ad_initial()
  246. {
  247. uint16_t i,j,k = 0;
  248. for(i=0;i<25;i++)
  249. {
  250. uint32_t res = ((uint32_t)i*24+10000)*52088/250000*0x24000/0x1B503;
  251. f_buffer[i*12]=((uint16_t)res+4)>>3;
  252. for(int t=1;t<12;t++)
  253. {
  254. res*=1.06;
  255. f_buffer[i*12+t]=((uint16_t)res+4)>>3;
  256. }
  257. }
  258. for(i=0;i<8;i++)
  259. for(j=0;j<12;j++)
  260. {
  261. a0b0_data5[k] = i;
  262. addrs_head[k] = j;
  263. k++;
  264. }
  265. ad_bd_reg();
  266. ad_08_reg();
  267. for(i=0;i<9;i++) ad_a0b0_reg(i);
  268. e0_reg_flag = 0x20;
  269. for(i=0;i<18;i++) ad_bop(0xE0+reg_data[i],0);
  270. ad_bop(1,e0_reg_flag);
  271. return 1;//ad_test();
  272. }
  273. /*----------------------------------------------------------*/
  274. inline void CrixPlayer::ad_bop(uint16_t reg,uint16_t value)
  275. {
  276. //if(reg == 2 || reg == 3)
  277. // AdPlug_LogWrite("switch OPL2/3 mode!\n");
  278. opl->write(reg & 0xff, value & 0xff);
  279. }
  280. /*--------------------------------------------------------------*/
  281. inline void CrixPlayer::int_08h_entry()
  282. {
  283. uint16_t band_sus = 1;
  284. while(band_sus)
  285. {
  286. if(sustain <= 0)
  287. {
  288. band_sus = rix_proc();
  289. if(band_sus) sustain += band_sus;
  290. else
  291. {
  292. play_end=1;
  293. break;
  294. }
  295. }
  296. else
  297. {
  298. if(band_sus) sustain -= 14; /* aging */
  299. break;
  300. }
  301. }
  302. }
  303. /*--------------------------------------------------------------*/
  304. inline uint16_t CrixPlayer::rix_proc()
  305. {
  306. uint8_t ctrl = 0;
  307. if(music_on == 0||pause_flag == 1) return 0;
  308. band = 0;
  309. while(rix_buf[I] != 0x80 && I<length-1)
  310. {
  311. band_low = rix_buf[I-1];
  312. ctrl = rix_buf[I]; I+=2;
  313. switch(ctrl&0xF0)
  314. {
  315. case 0x90: rix_get_ins(); rix_90_pro(ctrl&0x0F); break;
  316. case 0xA0: rix_A0_pro(ctrl&0x0F,((uint16_t)band_low)<<6); break;
  317. case 0xB0: rix_B0_pro(ctrl&0x0F,band_low); break;
  318. case 0xC0: switch_ad_bd(ctrl&0x0F);
  319. if(band_low != 0) rix_C0_pro(ctrl&0x0F,band_low);
  320. break;
  321. default: band = (ctrl<<8)+band_low; break;
  322. }
  323. if(band != 0) return band;
  324. }
  325. music_ctrl();
  326. I = mus_block+1;
  327. band = 0; music_on = 1;
  328. return 0;
  329. }
  330. /*--------------------------------------------------------------*/
  331. inline void CrixPlayer::rix_get_ins()
  332. {
  333. int i;
  334. uint8_t *baddr = (&rix_buf[ins_block])+(band_low<<6);
  335. for(i = 0; i < 28; i++)
  336. insbuf[i] = (baddr[i * 2 + 1] << 8) + baddr[i * 2];
  337. }
  338. /*--------------------------------------------------------------*/
  339. inline void CrixPlayer::rix_90_pro(uint16_t ctrl_l)
  340. {
  341. if(rhythm == 0 || ctrl_l < 6)
  342. {
  343. ins_to_reg(modify[ctrl_l*2],insbuf,insbuf[26]);
  344. ins_to_reg(modify[ctrl_l*2+1],insbuf+13,insbuf[27]);
  345. return;
  346. }
  347. else if(ctrl_l > 6)
  348. {
  349. ins_to_reg(modify[ctrl_l*2+6],insbuf,insbuf[26]);
  350. return;
  351. }
  352. else
  353. {
  354. ins_to_reg(12,insbuf,insbuf[26]);
  355. ins_to_reg(15,insbuf+13,insbuf[27]);
  356. return;
  357. }
  358. }
  359. /*--------------------------------------------------------------*/
  360. inline void CrixPlayer::rix_A0_pro(uint16_t ctrl_l,uint16_t index)
  361. {
  362. if(rhythm == 0 || ctrl_l <= 6)
  363. {
  364. prepare_a0b0(ctrl_l,index>0x3FFF?0x3FFF:index);
  365. ad_a0b0l_reg(ctrl_l,a0b0_data3[ctrl_l],a0b0_data4[ctrl_l]);
  366. }
  367. else return;
  368. }
  369. /*--------------------------------------------------------------*/
  370. inline void CrixPlayer::prepare_a0b0(uint16_t index,uint16_t v) /* important !*/
  371. {
  372. short high = 0,low = 0; uint32_t res;
  373. int res1 = (v-0x2000)*0x19;
  374. if(res1 == (int)0xff) return;
  375. low = res1/0x2000;
  376. if(low < 0)
  377. {
  378. low = 0x18-low; high = (signed short)low<0?0xFFFF:0;
  379. res = high; res<<=16; res+=low;
  380. low = ((signed short)res)/(signed short)0xFFE7;
  381. a0b0_data2[index] = low;
  382. low = res;
  383. res = low - 0x18;
  384. high = (signed short)res%0x19;
  385. low = (signed short)res/0x19;
  386. if(high != 0) {low = 0x19; low = low-high;}
  387. }
  388. else
  389. {
  390. res = high = low;
  391. low = (signed short)res/(signed short)0x19;
  392. a0b0_data2[index] = low;
  393. res = high;
  394. low = (signed short)res%(signed short)0x19;
  395. }
  396. low = (signed short)low*(signed short)0x18;
  397. displace[index] = low;
  398. }
  399. /*--------------------------------------------------------------*/
  400. inline void CrixPlayer::ad_a0b0l_reg(uint16_t index,uint16_t p2,uint16_t p3)
  401. {
  402. uint16_t data; uint16_t i = p2+a0b0_data2[index];
  403. a0b0_data4[index] = p3;
  404. a0b0_data3[index] = p2;
  405. i = ((signed short)i<=0x5F?i:0x5F);
  406. i = ((signed short)i>=0?i:0);
  407. data = f_buffer[addrs_head[i]+displace[index]/2];
  408. ad_bop(0xA0+index,data);
  409. data = a0b0_data5[i]*4+(p3<1?0:0x20)+((data>>8)&3);
  410. ad_bop(0xB0+index,data);
  411. }
  412. /*--------------------------------------------------------------*/
  413. inline void CrixPlayer::rix_B0_pro(uint16_t ctrl_l,uint16_t index)
  414. {
  415. register int temp = 0;
  416. if(rhythm == 0 || ctrl_l < 6) temp = modify[ctrl_l*2+1];
  417. else
  418. {
  419. temp = ctrl_l > 6?ctrl_l*2:ctrl_l*2+1;
  420. temp = modify[temp+6];
  421. }
  422. for40reg[temp] = index>0x7F?0x7F:index;
  423. ad_40_reg(temp);
  424. }
  425. /*--------------------------------------------------------------*/
  426. inline void CrixPlayer::rix_C0_pro(uint16_t ctrl_l,uint16_t index)
  427. {
  428. register uint16_t i = index>=12?index-12:0;
  429. if(ctrl_l < 6 || rhythm == 0)
  430. {
  431. ad_a0b0l_reg(ctrl_l,i,1);
  432. return;
  433. }
  434. else
  435. {
  436. if(ctrl_l != 6)
  437. {
  438. if(ctrl_l == 8)
  439. {
  440. ad_a0b0l_reg(ctrl_l,i,0);
  441. ad_a0b0l_reg(7,i+7,0);
  442. }
  443. }
  444. else ad_a0b0l_reg(ctrl_l,i,0);
  445. bd_modify |= bd_reg_data[ctrl_l];
  446. ad_bd_reg();
  447. return;
  448. }
  449. }
  450. /*--------------------------------------------------------------*/
  451. inline void CrixPlayer::switch_ad_bd(uint16_t index)
  452. {
  453. if(rhythm == 0 || index < 6) ad_a0b0l_reg(index,a0b0_data3[index],0);
  454. else
  455. {
  456. bd_modify &= (~bd_reg_data[index]),
  457. ad_bd_reg();
  458. }
  459. }
  460. /*--------------------------------------------------------------*/
  461. inline void CrixPlayer::ins_to_reg(uint16_t index,uint16_t* insb,uint16_t value)
  462. {
  463. register uint16_t i;
  464. for(i=0;i<13;i++) reg_bufs[index].v[i] = insb[i];
  465. reg_bufs[index].v[13] = value&3;
  466. ad_bd_reg(),ad_08_reg(),
  467. ad_40_reg(index),ad_C0_reg(index),ad_60_reg(index),
  468. ad_80_reg(index),ad_20_reg(index),ad_E0_reg(index);
  469. }
  470. /*--------------------------------------------------------------*/
  471. inline void CrixPlayer::ad_E0_reg(uint16_t index)
  472. {
  473. uint16_t data = e0_reg_flag == 0?0:(reg_bufs[index].v[13]&3);
  474. ad_bop(0xE0+reg_data[index],data);
  475. }
  476. /*--------------------------------------------------------------*/
  477. inline void CrixPlayer::ad_20_reg(uint16_t index)
  478. {
  479. uint16_t data = (reg_bufs[index].v[9] < 1?0:0x80);
  480. data += (reg_bufs[index].v[10] < 1?0:0x40);
  481. data += (reg_bufs[index].v[5] < 1?0:0x20);
  482. data += (reg_bufs[index].v[11] < 1?0:0x10);
  483. data += (reg_bufs[index].v[1]&0x0F);
  484. ad_bop(0x20+reg_data[index],data);
  485. }
  486. /*--------------------------------------------------------------*/
  487. inline void CrixPlayer::ad_80_reg(uint16_t index)
  488. {
  489. uint16_t data = (reg_bufs[index].v[7]&0x0F),temp = reg_bufs[index].v[4];
  490. data |= (temp << 4);
  491. ad_bop(0x80+reg_data[index],data);
  492. }
  493. /*--------------------------------------------------------------*/
  494. inline void CrixPlayer::ad_60_reg(uint16_t index)
  495. {
  496. uint16_t data = reg_bufs[index].v[6]&0x0F,temp = reg_bufs[index].v[3];
  497. data |= (temp << 4);
  498. ad_bop(0x60+reg_data[index],data);
  499. }
  500. /*--------------------------------------------------------------*/
  501. inline void CrixPlayer::ad_C0_reg(uint16_t index)
  502. {
  503. uint16_t data = reg_bufs[index].v[2];
  504. if(adflag[index] == 1) return;
  505. data *= 2,
  506. data |= (reg_bufs[index].v[12] < 1?1:0);
  507. ad_bop(0xC0+ad_C0_offs[index],data);
  508. }
  509. /*--------------------------------------------------------------*/
  510. inline void CrixPlayer::ad_40_reg(uint16_t index)
  511. {
  512. uint32_t res = 0;
  513. uint16_t data = 0,temp = reg_bufs[index].v[0];
  514. data = 0x3F - (0x3F & reg_bufs[index].v[8]),
  515. data *= for40reg[index],
  516. data *= 2,
  517. data += 0x7F,
  518. res = data;
  519. data = res/0xFE,
  520. data -= 0x3F,
  521. data = -data,
  522. data |= temp<<6;
  523. ad_bop(0x40+reg_data[index],data);
  524. }
  525. /*--------------------------------------------------------------*/
  526. inline void CrixPlayer::ad_bd_reg()
  527. {
  528. uint16_t data = rhythm < 1? 0:0x20;
  529. data |= bd_modify;
  530. ad_bop(0xBD,data);
  531. }
  532. /*--------------------------------------------------------------*/
  533. inline void CrixPlayer::ad_a0b0_reg(uint16_t index)
  534. {
  535. ad_bop(0xA0+index,0);
  536. ad_bop(0xB0+index,0);
  537. }
  538. /*--------------------------------------------------------------*/
  539. inline void CrixPlayer::music_ctrl()
  540. {
  541. register int i;
  542. for(i=0;i<11;i++)
  543. switch_ad_bd(i);
  544. }