359
|
1 /*
|
|
2 * Adplug - Replayer for many OPL2/OPL3 audio file formats.
|
|
3 * Copyright (C) 1999 - 2003 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 * [xad] HYP player, by Riven the Mage <riven@ok.ru>
|
|
20 */
|
|
21
|
|
22 /*
|
|
23 - discovery -
|
|
24
|
|
25 file(s) : HT-EF2.COM, HT-EF3.COM
|
|
26 type : Eiserne Front BBStro
|
|
27 tune : by Shadowdancer [Hypnosis]
|
|
28 player : by (?)Hetero [LKCC/SAC]
|
|
29 */
|
|
30
|
|
31 #include "hyp.h"
|
|
32 #include "debug.h"
|
|
33
|
|
34 const unsigned char CxadhypPlayer::hyp_adlib_registers[99] =
|
|
35 {
|
|
36 0x20, 0x23, 0x40, 0x43, 0x60, 0x63, 0x80, 0x83, 0xA0, 0xB0, 0xC0,
|
|
37 0x21, 0x24, 0x41, 0x44, 0x61, 0x64, 0x81, 0x84, 0xA1, 0xB1, 0xC1,
|
|
38 0x22, 0x25, 0x42, 0x45, 0x62, 0x65, 0x82, 0x85, 0xA2, 0xB2, 0xC2,
|
|
39 0x28, 0x2B, 0x48, 0x4B, 0x68, 0x6B, 0x88, 0x8B, 0xA3, 0xB3, 0xC3,
|
|
40 0x29, 0x2C, 0x49, 0x4C, 0x69, 0x6C, 0x89, 0x8C, 0xA4, 0xB4, 0xC4,
|
|
41 0x2A, 0x2D, 0x4A, 0x4D, 0x6A, 0x6D, 0x8A, 0x8D, 0xA5, 0xB5, 0xC5,
|
|
42 0x30, 0x33, 0x50, 0x53, 0x70, 0x73, 0x90, 0x93, 0xA6, 0xB6, 0xC6,
|
|
43 0x31, 0x34, 0x51, 0x54, 0x71, 0x74, 0x91, 0x94, 0xA7, 0xB7, 0xC7,
|
|
44 0x32, 0x35, 0x52, 0x55, 0x72, 0x75, 0x92, 0x95, 0xA8, 0xB8, 0xC8
|
|
45 };
|
|
46
|
|
47 const unsigned short CxadhypPlayer::hyp_notes[73] =
|
|
48 {
|
|
49 0x0000, // by riven
|
|
50 0x0956, 0x096B, 0x0980, 0x0998, 0x09B1, 0x09C9, 0x09E5, 0x0A03, 0x0A21,
|
|
51 0x0A41, 0x0A63, 0x0A86, 0x0D56, 0x0D6B, 0x0D80, 0x0D98, 0x0DB1, 0x0DC9,
|
|
52 0x0DE5, 0x0E03, 0x0E21, 0x0E41, 0x0E63, 0x0E86, 0x1156, 0x116B, 0x1180,
|
|
53 0x1198, 0x11B1, 0x11C9, 0x11E5, 0x1203, 0x1221, 0x1241, 0x1263, 0x1286,
|
|
54 0x1556, 0x156B, 0x1580, 0x1598, 0x15B1, 0x15C9, 0x15E5, 0x1603, 0x1621,
|
|
55 0x1641, 0x1663, 0x1686, 0x1956, 0x196B, 0x1980, 0x1998, 0x19B1, 0x19C9,
|
|
56 0x19E5, 0x1A03, 0x1A21, 0x1A41, 0x1A63, 0x1A86, 0x1D56, 0x1D6B, 0x1D80,
|
|
57 0x1D98, 0x1DB1, 0x1DC9, 0x1DE5, 0x1E03, 0x1E21, 0x1E41, 0x1E63, 0x1E86
|
|
58 };
|
|
59
|
|
60 CPlayer *CxadhypPlayer::factory(Copl *newopl)
|
|
61 {
|
|
62 return new CxadhypPlayer(newopl);
|
|
63 }
|
|
64
|
|
65 void CxadhypPlayer::xadplayer_rewind(int subsong)
|
|
66 {
|
|
67 int i;
|
|
68
|
|
69 plr.speed = tune[5];
|
|
70
|
|
71 opl_write(0xBD,0xC0);
|
|
72
|
|
73 for(i=0; i<9; i++)
|
|
74 adlib[0xB0+i] = 0;
|
|
75
|
|
76 // define instruments
|
|
77 for(i=0; i<99; i++)
|
|
78 opl_write(hyp_adlib_registers[i], tune[6+i]);
|
|
79
|
|
80 hyp.pointer = 0x69;
|
|
81 }
|
|
82
|
|
83 void CxadhypPlayer::xadplayer_update()
|
|
84 {
|
|
85 for(int i=0; i<9; i++)
|
|
86 {
|
|
87 unsigned char event = tune[hyp.pointer++];
|
|
88
|
|
89 if (event)
|
|
90 {
|
|
91 unsigned short freq = hyp_notes[event & 0x3F];
|
|
92
|
|
93 unsigned char lofreq = (freq & 0xFF);
|
|
94 unsigned char hifreq = (freq >> 8);
|
|
95
|
|
96 opl_write(0xB0+i, adlib[0xB0+i]);
|
|
97
|
|
98 if (!(event & 0x40))
|
|
99 {
|
|
100 opl_write(0xA0+i, lofreq);
|
|
101 opl_write(0xB0+i, hifreq | 0x20);
|
|
102 }
|
|
103
|
|
104 adlib[0xB0+i] &= 0xDF;
|
|
105 }
|
|
106 }
|
|
107
|
|
108 hyp.pointer += 3;
|
|
109
|
|
110 if (hyp.pointer >= tune_size)
|
|
111 {
|
|
112 hyp.pointer = 0x69;
|
|
113 plr.looping = 1;
|
|
114 }
|
|
115 }
|
|
116
|
|
117 float CxadhypPlayer::xadplayer_getrefresh()
|
|
118 {
|
|
119 return 60.0f;
|
|
120 }
|
|
121
|
|
122 std::string CxadhypPlayer::xadplayer_gettype()
|
|
123 {
|
|
124 return std::string("xad: hypnosis player");
|
|
125 }
|