annotate src/adplug/core/u6m.cxx @ 3193:93cf4d0a0dde

alsa-ng: Prefer "PCM" volume control over "Wave" on systems that have both, for consistency with OSS plugin and maybe other apps (closes AUD-34 and AUD-36).
author John Lindgren <john.lindgren@tds.net>
date Mon, 29 Jun 2009 23:05:56 -0400
parents f27d73fb0bcd
children
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
0
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
1 /*
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
2 * Adplug - Replayer for many OPL2/OPL3 audio file formats.
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
3 * Copyright (C) 1999 - 2006 Simon Peter, <dn.tlp@gmx.net>, et al.
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
4 *
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
5 * This library is free software; you can redistribute it and/or
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
6 * modify it under the terms of the GNU Lesser General Public
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
7 * License as published by the Free Software Foundation; either
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
8 * version 2.1 of the License, or (at your option) any later version.
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
9 *
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
10 * This library is distributed in the hope that it will be useful,
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
13 * Lesser General Public License for more details.
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
14 *
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
15 * You should have received a copy of the GNU Lesser General Public
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
16 * License along with this library; if not, write to the Free Software
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
17 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
18 *
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
19 * u6m.cpp - Ultima 6 Music Player by Marc Winterrowd.
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
20 * This code extends the Adlib Winamp plug-in by Simon Peter <dn.tlp@gmx.net>
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
21 */
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
22
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
23 #include "u6m.h"
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
24
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
25 // Makes security checks on output buffer before writing
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
26 #define SAVE_OUTPUT_ROOT(c, d, p) \
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
27 if(p < d.size) \
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
28 output_root(c, d.data, p); \
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
29 else \
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
30 return false;
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
31
955
4709ce4e209e [svn] Run indent -ts4 -nut -bli0 -cdw on this messy lot. Upstream is not consistent with whitespace anyway, no loss there.
chainsaw
parents: 869
diff changeset
32 CPlayer *
4709ce4e209e [svn] Run indent -ts4 -nut -bli0 -cdw on this messy lot. Upstream is not consistent with whitespace anyway, no loss there.
chainsaw
parents: 869
diff changeset
33 Cu6mPlayer::factory (Copl * newopl)
0
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
34 {
955
4709ce4e209e [svn] Run indent -ts4 -nut -bli0 -cdw on this messy lot. Upstream is not consistent with whitespace anyway, no loss there.
chainsaw
parents: 869
diff changeset
35 return new Cu6mPlayer (newopl);
0
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
36 }
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
37
955
4709ce4e209e [svn] Run indent -ts4 -nut -bli0 -cdw on this messy lot. Upstream is not consistent with whitespace anyway, no loss there.
chainsaw
parents: 869
diff changeset
38 bool
4709ce4e209e [svn] Run indent -ts4 -nut -bli0 -cdw on this messy lot. Upstream is not consistent with whitespace anyway, no loss there.
chainsaw
parents: 869
diff changeset
39 Cu6mPlayer::load (VFSFile * fd, const CFileProvider & fp)
0
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
40 {
955
4709ce4e209e [svn] Run indent -ts4 -nut -bli0 -cdw on this messy lot. Upstream is not consistent with whitespace anyway, no loss there.
chainsaw
parents: 869
diff changeset
41 // file validation section
4709ce4e209e [svn] Run indent -ts4 -nut -bli0 -cdw on this messy lot. Upstream is not consistent with whitespace anyway, no loss there.
chainsaw
parents: 869
diff changeset
42 // this section only checks a few *necessary* conditions
4709ce4e209e [svn] Run indent -ts4 -nut -bli0 -cdw on this messy lot. Upstream is not consistent with whitespace anyway, no loss there.
chainsaw
parents: 869
diff changeset
43 unsigned long filesize, decompressed_filesize;
4709ce4e209e [svn] Run indent -ts4 -nut -bli0 -cdw on this messy lot. Upstream is not consistent with whitespace anyway, no loss there.
chainsaw
parents: 869
diff changeset
44 binistream *f;
4709ce4e209e [svn] Run indent -ts4 -nut -bli0 -cdw on this messy lot. Upstream is not consistent with whitespace anyway, no loss there.
chainsaw
parents: 869
diff changeset
45
4709ce4e209e [svn] Run indent -ts4 -nut -bli0 -cdw on this messy lot. Upstream is not consistent with whitespace anyway, no loss there.
chainsaw
parents: 869
diff changeset
46 f = fp.open (fd);
4709ce4e209e [svn] Run indent -ts4 -nut -bli0 -cdw on this messy lot. Upstream is not consistent with whitespace anyway, no loss there.
chainsaw
parents: 869
diff changeset
47 if (!f)
4709ce4e209e [svn] Run indent -ts4 -nut -bli0 -cdw on this messy lot. Upstream is not consistent with whitespace anyway, no loss there.
chainsaw
parents: 869
diff changeset
48 return false;
4709ce4e209e [svn] Run indent -ts4 -nut -bli0 -cdw on this messy lot. Upstream is not consistent with whitespace anyway, no loss there.
chainsaw
parents: 869
diff changeset
49 filesize = fp.filesize (f);
0
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
50
955
4709ce4e209e [svn] Run indent -ts4 -nut -bli0 -cdw on this messy lot. Upstream is not consistent with whitespace anyway, no loss there.
chainsaw
parents: 869
diff changeset
51 if (filesize >= 6)
4709ce4e209e [svn] Run indent -ts4 -nut -bli0 -cdw on this messy lot. Upstream is not consistent with whitespace anyway, no loss there.
chainsaw
parents: 869
diff changeset
52 {
4709ce4e209e [svn] Run indent -ts4 -nut -bli0 -cdw on this messy lot. Upstream is not consistent with whitespace anyway, no loss there.
chainsaw
parents: 869
diff changeset
53 // check if the file has a valid pseudo-header
4709ce4e209e [svn] Run indent -ts4 -nut -bli0 -cdw on this messy lot. Upstream is not consistent with whitespace anyway, no loss there.
chainsaw
parents: 869
diff changeset
54 unsigned char pseudo_header[6];
4709ce4e209e [svn] Run indent -ts4 -nut -bli0 -cdw on this messy lot. Upstream is not consistent with whitespace anyway, no loss there.
chainsaw
parents: 869
diff changeset
55 f->readString ((char *) pseudo_header, 6);
4709ce4e209e [svn] Run indent -ts4 -nut -bli0 -cdw on this messy lot. Upstream is not consistent with whitespace anyway, no loss there.
chainsaw
parents: 869
diff changeset
56 decompressed_filesize = pseudo_header[0] + (pseudo_header[1] << 8);
0
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
57
955
4709ce4e209e [svn] Run indent -ts4 -nut -bli0 -cdw on this messy lot. Upstream is not consistent with whitespace anyway, no loss there.
chainsaw
parents: 869
diff changeset
58 if (!((pseudo_header[2] == 0) && (pseudo_header[3] == 0) &&
4709ce4e209e [svn] Run indent -ts4 -nut -bli0 -cdw on this messy lot. Upstream is not consistent with whitespace anyway, no loss there.
chainsaw
parents: 869
diff changeset
59 (pseudo_header[4] + ((pseudo_header[5] & 0x1) << 8) == 0x100) &&
4709ce4e209e [svn] Run indent -ts4 -nut -bli0 -cdw on this messy lot. Upstream is not consistent with whitespace anyway, no loss there.
chainsaw
parents: 869
diff changeset
60 (decompressed_filesize > (filesize - 4))))
0
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
61 {
955
4709ce4e209e [svn] Run indent -ts4 -nut -bli0 -cdw on this messy lot. Upstream is not consistent with whitespace anyway, no loss there.
chainsaw
parents: 869
diff changeset
62 fp.close (f);
4709ce4e209e [svn] Run indent -ts4 -nut -bli0 -cdw on this messy lot. Upstream is not consistent with whitespace anyway, no loss there.
chainsaw
parents: 869
diff changeset
63 return (false);
0
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
64 }
955
4709ce4e209e [svn] Run indent -ts4 -nut -bli0 -cdw on this messy lot. Upstream is not consistent with whitespace anyway, no loss there.
chainsaw
parents: 869
diff changeset
65 }
4709ce4e209e [svn] Run indent -ts4 -nut -bli0 -cdw on this messy lot. Upstream is not consistent with whitespace anyway, no loss there.
chainsaw
parents: 869
diff changeset
66 else
4709ce4e209e [svn] Run indent -ts4 -nut -bli0 -cdw on this messy lot. Upstream is not consistent with whitespace anyway, no loss there.
chainsaw
parents: 869
diff changeset
67 {
4709ce4e209e [svn] Run indent -ts4 -nut -bli0 -cdw on this messy lot. Upstream is not consistent with whitespace anyway, no loss there.
chainsaw
parents: 869
diff changeset
68 fp.close (f);
4709ce4e209e [svn] Run indent -ts4 -nut -bli0 -cdw on this messy lot. Upstream is not consistent with whitespace anyway, no loss there.
chainsaw
parents: 869
diff changeset
69 return (false);
4709ce4e209e [svn] Run indent -ts4 -nut -bli0 -cdw on this messy lot. Upstream is not consistent with whitespace anyway, no loss there.
chainsaw
parents: 869
diff changeset
70 }
0
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
71
955
4709ce4e209e [svn] Run indent -ts4 -nut -bli0 -cdw on this messy lot. Upstream is not consistent with whitespace anyway, no loss there.
chainsaw
parents: 869
diff changeset
72 // load section
4709ce4e209e [svn] Run indent -ts4 -nut -bli0 -cdw on this messy lot. Upstream is not consistent with whitespace anyway, no loss there.
chainsaw
parents: 869
diff changeset
73 song_data = new unsigned char[decompressed_filesize];
4709ce4e209e [svn] Run indent -ts4 -nut -bli0 -cdw on this messy lot. Upstream is not consistent with whitespace anyway, no loss there.
chainsaw
parents: 869
diff changeset
74 unsigned char *compressed_song_data = new unsigned char[filesize - 3];
0
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
75
955
4709ce4e209e [svn] Run indent -ts4 -nut -bli0 -cdw on this messy lot. Upstream is not consistent with whitespace anyway, no loss there.
chainsaw
parents: 869
diff changeset
76 f->seek (4);
4709ce4e209e [svn] Run indent -ts4 -nut -bli0 -cdw on this messy lot. Upstream is not consistent with whitespace anyway, no loss there.
chainsaw
parents: 869
diff changeset
77 f->readString ((char *) compressed_song_data, filesize - 4);
4709ce4e209e [svn] Run indent -ts4 -nut -bli0 -cdw on this messy lot. Upstream is not consistent with whitespace anyway, no loss there.
chainsaw
parents: 869
diff changeset
78 fp.close (f);
0
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
79
955
4709ce4e209e [svn] Run indent -ts4 -nut -bli0 -cdw on this messy lot. Upstream is not consistent with whitespace anyway, no loss there.
chainsaw
parents: 869
diff changeset
80 // attempt to decompress the song data
4709ce4e209e [svn] Run indent -ts4 -nut -bli0 -cdw on this messy lot. Upstream is not consistent with whitespace anyway, no loss there.
chainsaw
parents: 869
diff changeset
81 // if unsuccessful, deallocate song_data[] on the spot, and return(false)
4709ce4e209e [svn] Run indent -ts4 -nut -bli0 -cdw on this messy lot. Upstream is not consistent with whitespace anyway, no loss there.
chainsaw
parents: 869
diff changeset
82 data_block source, destination;
4709ce4e209e [svn] Run indent -ts4 -nut -bli0 -cdw on this messy lot. Upstream is not consistent with whitespace anyway, no loss there.
chainsaw
parents: 869
diff changeset
83 source.size = filesize - 4;
4709ce4e209e [svn] Run indent -ts4 -nut -bli0 -cdw on this messy lot. Upstream is not consistent with whitespace anyway, no loss there.
chainsaw
parents: 869
diff changeset
84 source.data = compressed_song_data;
4709ce4e209e [svn] Run indent -ts4 -nut -bli0 -cdw on this messy lot. Upstream is not consistent with whitespace anyway, no loss there.
chainsaw
parents: 869
diff changeset
85 destination.size = decompressed_filesize;
4709ce4e209e [svn] Run indent -ts4 -nut -bli0 -cdw on this messy lot. Upstream is not consistent with whitespace anyway, no loss there.
chainsaw
parents: 869
diff changeset
86 destination.data = song_data;
0
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
87
955
4709ce4e209e [svn] Run indent -ts4 -nut -bli0 -cdw on this messy lot. Upstream is not consistent with whitespace anyway, no loss there.
chainsaw
parents: 869
diff changeset
88 if (!lzw_decompress (source, destination))
4709ce4e209e [svn] Run indent -ts4 -nut -bli0 -cdw on this messy lot. Upstream is not consistent with whitespace anyway, no loss there.
chainsaw
parents: 869
diff changeset
89 {
4709ce4e209e [svn] Run indent -ts4 -nut -bli0 -cdw on this messy lot. Upstream is not consistent with whitespace anyway, no loss there.
chainsaw
parents: 869
diff changeset
90 delete[]compressed_song_data;
4709ce4e209e [svn] Run indent -ts4 -nut -bli0 -cdw on this messy lot. Upstream is not consistent with whitespace anyway, no loss there.
chainsaw
parents: 869
diff changeset
91 compressed_song_data = 0;
4709ce4e209e [svn] Run indent -ts4 -nut -bli0 -cdw on this messy lot. Upstream is not consistent with whitespace anyway, no loss there.
chainsaw
parents: 869
diff changeset
92 delete[]song_data;
4709ce4e209e [svn] Run indent -ts4 -nut -bli0 -cdw on this messy lot. Upstream is not consistent with whitespace anyway, no loss there.
chainsaw
parents: 869
diff changeset
93 song_data = 0;
4709ce4e209e [svn] Run indent -ts4 -nut -bli0 -cdw on this messy lot. Upstream is not consistent with whitespace anyway, no loss there.
chainsaw
parents: 869
diff changeset
94 return (false);
4709ce4e209e [svn] Run indent -ts4 -nut -bli0 -cdw on this messy lot. Upstream is not consistent with whitespace anyway, no loss there.
chainsaw
parents: 869
diff changeset
95 }
0
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
96
955
4709ce4e209e [svn] Run indent -ts4 -nut -bli0 -cdw on this messy lot. Upstream is not consistent with whitespace anyway, no loss there.
chainsaw
parents: 869
diff changeset
97 // deallocation section
4709ce4e209e [svn] Run indent -ts4 -nut -bli0 -cdw on this messy lot. Upstream is not consistent with whitespace anyway, no loss there.
chainsaw
parents: 869
diff changeset
98 delete[]compressed_song_data;
4709ce4e209e [svn] Run indent -ts4 -nut -bli0 -cdw on this messy lot. Upstream is not consistent with whitespace anyway, no loss there.
chainsaw
parents: 869
diff changeset
99 compressed_song_data = 0;
4709ce4e209e [svn] Run indent -ts4 -nut -bli0 -cdw on this messy lot. Upstream is not consistent with whitespace anyway, no loss there.
chainsaw
parents: 869
diff changeset
100
4709ce4e209e [svn] Run indent -ts4 -nut -bli0 -cdw on this messy lot. Upstream is not consistent with whitespace anyway, no loss there.
chainsaw
parents: 869
diff changeset
101 rewind (0);
4709ce4e209e [svn] Run indent -ts4 -nut -bli0 -cdw on this messy lot. Upstream is not consistent with whitespace anyway, no loss there.
chainsaw
parents: 869
diff changeset
102 return (true);
0
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
103 }
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
104
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
105
955
4709ce4e209e [svn] Run indent -ts4 -nut -bli0 -cdw on this messy lot. Upstream is not consistent with whitespace anyway, no loss there.
chainsaw
parents: 869
diff changeset
106 bool
4709ce4e209e [svn] Run indent -ts4 -nut -bli0 -cdw on this messy lot. Upstream is not consistent with whitespace anyway, no loss there.
chainsaw
parents: 869
diff changeset
107 Cu6mPlayer::update ()
0
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
108 {
955
4709ce4e209e [svn] Run indent -ts4 -nut -bli0 -cdw on this messy lot. Upstream is not consistent with whitespace anyway, no loss there.
chainsaw
parents: 869
diff changeset
109 if (!driver_active)
4709ce4e209e [svn] Run indent -ts4 -nut -bli0 -cdw on this messy lot. Upstream is not consistent with whitespace anyway, no loss there.
chainsaw
parents: 869
diff changeset
110 {
4709ce4e209e [svn] Run indent -ts4 -nut -bli0 -cdw on this messy lot. Upstream is not consistent with whitespace anyway, no loss there.
chainsaw
parents: 869
diff changeset
111 driver_active = true;
4709ce4e209e [svn] Run indent -ts4 -nut -bli0 -cdw on this messy lot. Upstream is not consistent with whitespace anyway, no loss there.
chainsaw
parents: 869
diff changeset
112 dec_clip (read_delay);
4709ce4e209e [svn] Run indent -ts4 -nut -bli0 -cdw on this messy lot. Upstream is not consistent with whitespace anyway, no loss there.
chainsaw
parents: 869
diff changeset
113 if (read_delay == 0)
4709ce4e209e [svn] Run indent -ts4 -nut -bli0 -cdw on this messy lot. Upstream is not consistent with whitespace anyway, no loss there.
chainsaw
parents: 869
diff changeset
114 {
4709ce4e209e [svn] Run indent -ts4 -nut -bli0 -cdw on this messy lot. Upstream is not consistent with whitespace anyway, no loss there.
chainsaw
parents: 869
diff changeset
115 command_loop ();
4709ce4e209e [svn] Run indent -ts4 -nut -bli0 -cdw on this messy lot. Upstream is not consistent with whitespace anyway, no loss there.
chainsaw
parents: 869
diff changeset
116 }
4709ce4e209e [svn] Run indent -ts4 -nut -bli0 -cdw on this messy lot. Upstream is not consistent with whitespace anyway, no loss there.
chainsaw
parents: 869
diff changeset
117
4709ce4e209e [svn] Run indent -ts4 -nut -bli0 -cdw on this messy lot. Upstream is not consistent with whitespace anyway, no loss there.
chainsaw
parents: 869
diff changeset
118 // on all Adlib channels: freq slide/vibrato, mute factor slide
4709ce4e209e [svn] Run indent -ts4 -nut -bli0 -cdw on this messy lot. Upstream is not consistent with whitespace anyway, no loss there.
chainsaw
parents: 869
diff changeset
119 for (int i = 0; i < 9; i++)
0
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
120 {
955
4709ce4e209e [svn] Run indent -ts4 -nut -bli0 -cdw on this messy lot. Upstream is not consistent with whitespace anyway, no loss there.
chainsaw
parents: 869
diff changeset
121 if (channel_freq_signed_delta[i] != 0)
4709ce4e209e [svn] Run indent -ts4 -nut -bli0 -cdw on this messy lot. Upstream is not consistent with whitespace anyway, no loss there.
chainsaw
parents: 869
diff changeset
122 // frequency slide + mute factor slide
4709ce4e209e [svn] Run indent -ts4 -nut -bli0 -cdw on this messy lot. Upstream is not consistent with whitespace anyway, no loss there.
chainsaw
parents: 869
diff changeset
123 {
4709ce4e209e [svn] Run indent -ts4 -nut -bli0 -cdw on this messy lot. Upstream is not consistent with whitespace anyway, no loss there.
chainsaw
parents: 869
diff changeset
124 // freq slide
4709ce4e209e [svn] Run indent -ts4 -nut -bli0 -cdw on this messy lot. Upstream is not consistent with whitespace anyway, no loss there.
chainsaw
parents: 869
diff changeset
125 freq_slide (i);
4709ce4e209e [svn] Run indent -ts4 -nut -bli0 -cdw on this messy lot. Upstream is not consistent with whitespace anyway, no loss there.
chainsaw
parents: 869
diff changeset
126
4709ce4e209e [svn] Run indent -ts4 -nut -bli0 -cdw on this messy lot. Upstream is not consistent with whitespace anyway, no loss there.
chainsaw
parents: 869
diff changeset
127 // mute factor slide
4709ce4e209e [svn] Run indent -ts4 -nut -bli0 -cdw on this messy lot. Upstream is not consistent with whitespace anyway, no loss there.
chainsaw
parents: 869
diff changeset
128 if (carrier_mf_signed_delta[i] != 0)
0
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
129 {
955
4709ce4e209e [svn] Run indent -ts4 -nut -bli0 -cdw on this messy lot. Upstream is not consistent with whitespace anyway, no loss there.
chainsaw
parents: 869
diff changeset
130 mf_slide (i);
4709ce4e209e [svn] Run indent -ts4 -nut -bli0 -cdw on this messy lot. Upstream is not consistent with whitespace anyway, no loss there.
chainsaw
parents: 869
diff changeset
131 }
4709ce4e209e [svn] Run indent -ts4 -nut -bli0 -cdw on this messy lot. Upstream is not consistent with whitespace anyway, no loss there.
chainsaw
parents: 869
diff changeset
132 }
4709ce4e209e [svn] Run indent -ts4 -nut -bli0 -cdw on this messy lot. Upstream is not consistent with whitespace anyway, no loss there.
chainsaw
parents: 869
diff changeset
133 else
4709ce4e209e [svn] Run indent -ts4 -nut -bli0 -cdw on this messy lot. Upstream is not consistent with whitespace anyway, no loss there.
chainsaw
parents: 869
diff changeset
134 // vibrato + mute factor slide
4709ce4e209e [svn] Run indent -ts4 -nut -bli0 -cdw on this messy lot. Upstream is not consistent with whitespace anyway, no loss there.
chainsaw
parents: 869
diff changeset
135 {
4709ce4e209e [svn] Run indent -ts4 -nut -bli0 -cdw on this messy lot. Upstream is not consistent with whitespace anyway, no loss there.
chainsaw
parents: 869
diff changeset
136 // vibrato
4709ce4e209e [svn] Run indent -ts4 -nut -bli0 -cdw on this messy lot. Upstream is not consistent with whitespace anyway, no loss there.
chainsaw
parents: 869
diff changeset
137 if ((vb_multiplier[i] != 0) && ((channel_freq[i].hi & 0x20) == 0x20))
4709ce4e209e [svn] Run indent -ts4 -nut -bli0 -cdw on this messy lot. Upstream is not consistent with whitespace anyway, no loss there.
chainsaw
parents: 869
diff changeset
138 {
4709ce4e209e [svn] Run indent -ts4 -nut -bli0 -cdw on this messy lot. Upstream is not consistent with whitespace anyway, no loss there.
chainsaw
parents: 869
diff changeset
139 vibrato (i);
0
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
140 }
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
141
955
4709ce4e209e [svn] Run indent -ts4 -nut -bli0 -cdw on this messy lot. Upstream is not consistent with whitespace anyway, no loss there.
chainsaw
parents: 869
diff changeset
142 // mute factor slide
4709ce4e209e [svn] Run indent -ts4 -nut -bli0 -cdw on this messy lot. Upstream is not consistent with whitespace anyway, no loss there.
chainsaw
parents: 869
diff changeset
143 if (carrier_mf_signed_delta[i] != 0)
0
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
144 {
955
4709ce4e209e [svn] Run indent -ts4 -nut -bli0 -cdw on this messy lot. Upstream is not consistent with whitespace anyway, no loss there.
chainsaw
parents: 869
diff changeset
145 mf_slide (i);
0
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
146 }
955
4709ce4e209e [svn] Run indent -ts4 -nut -bli0 -cdw on this messy lot. Upstream is not consistent with whitespace anyway, no loss there.
chainsaw
parents: 869
diff changeset
147 }
0
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
148 }
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
149
955
4709ce4e209e [svn] Run indent -ts4 -nut -bli0 -cdw on this messy lot. Upstream is not consistent with whitespace anyway, no loss there.
chainsaw
parents: 869
diff changeset
150 driver_active = false;
4709ce4e209e [svn] Run indent -ts4 -nut -bli0 -cdw on this messy lot. Upstream is not consistent with whitespace anyway, no loss there.
chainsaw
parents: 869
diff changeset
151 }
4709ce4e209e [svn] Run indent -ts4 -nut -bli0 -cdw on this messy lot. Upstream is not consistent with whitespace anyway, no loss there.
chainsaw
parents: 869
diff changeset
152
4709ce4e209e [svn] Run indent -ts4 -nut -bli0 -cdw on this messy lot. Upstream is not consistent with whitespace anyway, no loss there.
chainsaw
parents: 869
diff changeset
153 return !songend;
0
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
154 }
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
155
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
156
955
4709ce4e209e [svn] Run indent -ts4 -nut -bli0 -cdw on this messy lot. Upstream is not consistent with whitespace anyway, no loss there.
chainsaw
parents: 869
diff changeset
157 void
4709ce4e209e [svn] Run indent -ts4 -nut -bli0 -cdw on this messy lot. Upstream is not consistent with whitespace anyway, no loss there.
chainsaw
parents: 869
diff changeset
158 Cu6mPlayer::rewind (int subsong)
0
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
159 {
955
4709ce4e209e [svn] Run indent -ts4 -nut -bli0 -cdw on this messy lot. Upstream is not consistent with whitespace anyway, no loss there.
chainsaw
parents: 869
diff changeset
160 played_ticks = 0;
4709ce4e209e [svn] Run indent -ts4 -nut -bli0 -cdw on this messy lot. Upstream is not consistent with whitespace anyway, no loss there.
chainsaw
parents: 869
diff changeset
161 songend = false;
0
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
162
955
4709ce4e209e [svn] Run indent -ts4 -nut -bli0 -cdw on this messy lot. Upstream is not consistent with whitespace anyway, no loss there.
chainsaw
parents: 869
diff changeset
163 // set the driver's internal variables
4709ce4e209e [svn] Run indent -ts4 -nut -bli0 -cdw on this messy lot. Upstream is not consistent with whitespace anyway, no loss there.
chainsaw
parents: 869
diff changeset
164 byte_pair freq_word = { 0, 0 };
4709ce4e209e [svn] Run indent -ts4 -nut -bli0 -cdw on this messy lot. Upstream is not consistent with whitespace anyway, no loss there.
chainsaw
parents: 869
diff changeset
165
4709ce4e209e [svn] Run indent -ts4 -nut -bli0 -cdw on this messy lot. Upstream is not consistent with whitespace anyway, no loss there.
chainsaw
parents: 869
diff changeset
166 driver_active = false;
4709ce4e209e [svn] Run indent -ts4 -nut -bli0 -cdw on this messy lot. Upstream is not consistent with whitespace anyway, no loss there.
chainsaw
parents: 869
diff changeset
167 song_pos = 0;
4709ce4e209e [svn] Run indent -ts4 -nut -bli0 -cdw on this messy lot. Upstream is not consistent with whitespace anyway, no loss there.
chainsaw
parents: 869
diff changeset
168 loop_position = 0; // position of the loop point
4709ce4e209e [svn] Run indent -ts4 -nut -bli0 -cdw on this messy lot. Upstream is not consistent with whitespace anyway, no loss there.
chainsaw
parents: 869
diff changeset
169 read_delay = 0; // delay (in timer ticks) before further song data is read
0
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
170
955
4709ce4e209e [svn] Run indent -ts4 -nut -bli0 -cdw on this messy lot. Upstream is not consistent with whitespace anyway, no loss there.
chainsaw
parents: 869
diff changeset
171 for (int i = 0; i < 9; i++)
4709ce4e209e [svn] Run indent -ts4 -nut -bli0 -cdw on this messy lot. Upstream is not consistent with whitespace anyway, no loss there.
chainsaw
parents: 869
diff changeset
172 {
4709ce4e209e [svn] Run indent -ts4 -nut -bli0 -cdw on this messy lot. Upstream is not consistent with whitespace anyway, no loss there.
chainsaw
parents: 869
diff changeset
173 // frequency
4709ce4e209e [svn] Run indent -ts4 -nut -bli0 -cdw on this messy lot. Upstream is not consistent with whitespace anyway, no loss there.
chainsaw
parents: 869
diff changeset
174 channel_freq_signed_delta[i] = 0;
4709ce4e209e [svn] Run indent -ts4 -nut -bli0 -cdw on this messy lot. Upstream is not consistent with whitespace anyway, no loss there.
chainsaw
parents: 869
diff changeset
175 channel_freq[i] = freq_word; // Adlib freq settings for each channel
4709ce4e209e [svn] Run indent -ts4 -nut -bli0 -cdw on this messy lot. Upstream is not consistent with whitespace anyway, no loss there.
chainsaw
parents: 869
diff changeset
176
4709ce4e209e [svn] Run indent -ts4 -nut -bli0 -cdw on this messy lot. Upstream is not consistent with whitespace anyway, no loss there.
chainsaw
parents: 869
diff changeset
177 // vibrato ("vb")
4709ce4e209e [svn] Run indent -ts4 -nut -bli0 -cdw on this messy lot. Upstream is not consistent with whitespace anyway, no loss there.
chainsaw
parents: 869
diff changeset
178 vb_current_value[i] = 0;
4709ce4e209e [svn] Run indent -ts4 -nut -bli0 -cdw on this messy lot. Upstream is not consistent with whitespace anyway, no loss there.
chainsaw
parents: 869
diff changeset
179 vb_double_amplitude[i] = 0;
4709ce4e209e [svn] Run indent -ts4 -nut -bli0 -cdw on this messy lot. Upstream is not consistent with whitespace anyway, no loss there.
chainsaw
parents: 869
diff changeset
180 vb_multiplier[i] = 0;
4709ce4e209e [svn] Run indent -ts4 -nut -bli0 -cdw on this messy lot. Upstream is not consistent with whitespace anyway, no loss there.
chainsaw
parents: 869
diff changeset
181 vb_direction_flag[i] = 0;
0
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
182
955
4709ce4e209e [svn] Run indent -ts4 -nut -bli0 -cdw on this messy lot. Upstream is not consistent with whitespace anyway, no loss there.
chainsaw
parents: 869
diff changeset
183 // mute factor ("mf") == ~(volume)
4709ce4e209e [svn] Run indent -ts4 -nut -bli0 -cdw on this messy lot. Upstream is not consistent with whitespace anyway, no loss there.
chainsaw
parents: 869
diff changeset
184 carrier_mf[i] = 0;
4709ce4e209e [svn] Run indent -ts4 -nut -bli0 -cdw on this messy lot. Upstream is not consistent with whitespace anyway, no loss there.
chainsaw
parents: 869
diff changeset
185 carrier_mf_signed_delta[i] = 0;
4709ce4e209e [svn] Run indent -ts4 -nut -bli0 -cdw on this messy lot. Upstream is not consistent with whitespace anyway, no loss there.
chainsaw
parents: 869
diff changeset
186 carrier_mf_mod_delay_backup[i] = 0;
4709ce4e209e [svn] Run indent -ts4 -nut -bli0 -cdw on this messy lot. Upstream is not consistent with whitespace anyway, no loss there.
chainsaw
parents: 869
diff changeset
187 carrier_mf_mod_delay[i] = 0;
4709ce4e209e [svn] Run indent -ts4 -nut -bli0 -cdw on this messy lot. Upstream is not consistent with whitespace anyway, no loss there.
chainsaw
parents: 869
diff changeset
188 }
0
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
189
955
4709ce4e209e [svn] Run indent -ts4 -nut -bli0 -cdw on this messy lot. Upstream is not consistent with whitespace anyway, no loss there.
chainsaw
parents: 869
diff changeset
190 while (!subsong_stack.empty ()) // empty subsong stack
4709ce4e209e [svn] Run indent -ts4 -nut -bli0 -cdw on this messy lot. Upstream is not consistent with whitespace anyway, no loss there.
chainsaw
parents: 869
diff changeset
191 subsong_stack.pop ();
0
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
192
955
4709ce4e209e [svn] Run indent -ts4 -nut -bli0 -cdw on this messy lot. Upstream is not consistent with whitespace anyway, no loss there.
chainsaw
parents: 869
diff changeset
193 opl->init ();
4709ce4e209e [svn] Run indent -ts4 -nut -bli0 -cdw on this messy lot. Upstream is not consistent with whitespace anyway, no loss there.
chainsaw
parents: 869
diff changeset
194 out_adlib (1, 32); // go to OPL2 mode
0
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
195 }
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
196
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
197
955
4709ce4e209e [svn] Run indent -ts4 -nut -bli0 -cdw on this messy lot. Upstream is not consistent with whitespace anyway, no loss there.
chainsaw
parents: 869
diff changeset
198 float
4709ce4e209e [svn] Run indent -ts4 -nut -bli0 -cdw on this messy lot. Upstream is not consistent with whitespace anyway, no loss there.
chainsaw
parents: 869
diff changeset
199 Cu6mPlayer::getrefresh ()
0
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
200 {
955
4709ce4e209e [svn] Run indent -ts4 -nut -bli0 -cdw on this messy lot. Upstream is not consistent with whitespace anyway, no loss there.
chainsaw
parents: 869
diff changeset
201 return ((float) 60); // the Ultima 6 music driver expects to be called at 60 Hz
0
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
202 }
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
203
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
204
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
205 // ============================================================================================
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
206 //
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
207 //
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
208 // Functions called by load()
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
209 //
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
210 //
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
211 // ============================================================================================
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
212
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
213
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
214 // decompress from memory to memory
955
4709ce4e209e [svn] Run indent -ts4 -nut -bli0 -cdw on this messy lot. Upstream is not consistent with whitespace anyway, no loss there.
chainsaw
parents: 869
diff changeset
215 bool
4709ce4e209e [svn] Run indent -ts4 -nut -bli0 -cdw on this messy lot. Upstream is not consistent with whitespace anyway, no loss there.
chainsaw
parents: 869
diff changeset
216 Cu6mPlayer::lzw_decompress (Cu6mPlayer::data_block source,
4709ce4e209e [svn] Run indent -ts4 -nut -bli0 -cdw on this messy lot. Upstream is not consistent with whitespace anyway, no loss there.
chainsaw
parents: 869
diff changeset
217 Cu6mPlayer::data_block dest)
0
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
218 {
955
4709ce4e209e [svn] Run indent -ts4 -nut -bli0 -cdw on this messy lot. Upstream is not consistent with whitespace anyway, no loss there.
chainsaw
parents: 869
diff changeset
219 bool end_marker_reached = false;
4709ce4e209e [svn] Run indent -ts4 -nut -bli0 -cdw on this messy lot. Upstream is not consistent with whitespace anyway, no loss there.
chainsaw
parents: 869
diff changeset
220 int codeword_size = 9;
4709ce4e209e [svn] Run indent -ts4 -nut -bli0 -cdw on this messy lot. Upstream is not consistent with whitespace anyway, no loss there.
chainsaw
parents: 869
diff changeset
221 long bits_read = 0;
4709ce4e209e [svn] Run indent -ts4 -nut -bli0 -cdw on this messy lot. Upstream is not consistent with whitespace anyway, no loss there.
chainsaw
parents: 869
diff changeset
222 int next_free_codeword = 0x102;
4709ce4e209e [svn] Run indent -ts4 -nut -bli0 -cdw on this messy lot. Upstream is not consistent with whitespace anyway, no loss there.
chainsaw
parents: 869
diff changeset
223 int dictionary_size = 0x200;
4709ce4e209e [svn] Run indent -ts4 -nut -bli0 -cdw on this messy lot. Upstream is not consistent with whitespace anyway, no loss there.
chainsaw
parents: 869
diff changeset
224 MyDict dictionary = MyDict ();
4709ce4e209e [svn] Run indent -ts4 -nut -bli0 -cdw on this messy lot. Upstream is not consistent with whitespace anyway, no loss there.
chainsaw
parents: 869
diff changeset
225 std::stack < unsigned char >root_stack;
4709ce4e209e [svn] Run indent -ts4 -nut -bli0 -cdw on this messy lot. Upstream is not consistent with whitespace anyway, no loss there.
chainsaw
parents: 869
diff changeset
226
4709ce4e209e [svn] Run indent -ts4 -nut -bli0 -cdw on this messy lot. Upstream is not consistent with whitespace anyway, no loss there.
chainsaw
parents: 869
diff changeset
227 long bytes_written = 0;
4709ce4e209e [svn] Run indent -ts4 -nut -bli0 -cdw on this messy lot. Upstream is not consistent with whitespace anyway, no loss there.
chainsaw
parents: 869
diff changeset
228
3025
f27d73fb0bcd Zero out variables explicitly where required.
Tony Vroon <chainsaw@gentoo.org>
parents: 955
diff changeset
229 int cW, pW = 0;
955
4709ce4e209e [svn] Run indent -ts4 -nut -bli0 -cdw on this messy lot. Upstream is not consistent with whitespace anyway, no loss there.
chainsaw
parents: 869
diff changeset
230 unsigned char C;
0
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
231
955
4709ce4e209e [svn] Run indent -ts4 -nut -bli0 -cdw on this messy lot. Upstream is not consistent with whitespace anyway, no loss there.
chainsaw
parents: 869
diff changeset
232 while (!end_marker_reached)
4709ce4e209e [svn] Run indent -ts4 -nut -bli0 -cdw on this messy lot. Upstream is not consistent with whitespace anyway, no loss there.
chainsaw
parents: 869
diff changeset
233 {
4709ce4e209e [svn] Run indent -ts4 -nut -bli0 -cdw on this messy lot. Upstream is not consistent with whitespace anyway, no loss there.
chainsaw
parents: 869
diff changeset
234 cW = get_next_codeword (bits_read, source.data, codeword_size);
4709ce4e209e [svn] Run indent -ts4 -nut -bli0 -cdw on this messy lot. Upstream is not consistent with whitespace anyway, no loss there.
chainsaw
parents: 869
diff changeset
235 switch (cW)
0
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
236 {
955
4709ce4e209e [svn] Run indent -ts4 -nut -bli0 -cdw on this messy lot. Upstream is not consistent with whitespace anyway, no loss there.
chainsaw
parents: 869
diff changeset
237 // re-init the dictionary
4709ce4e209e [svn] Run indent -ts4 -nut -bli0 -cdw on this messy lot. Upstream is not consistent with whitespace anyway, no loss there.
chainsaw
parents: 869
diff changeset
238 case 0x100:
4709ce4e209e [svn] Run indent -ts4 -nut -bli0 -cdw on this messy lot. Upstream is not consistent with whitespace anyway, no loss there.
chainsaw
parents: 869
diff changeset
239 codeword_size = 9;
4709ce4e209e [svn] Run indent -ts4 -nut -bli0 -cdw on this messy lot. Upstream is not consistent with whitespace anyway, no loss there.
chainsaw
parents: 869
diff changeset
240 next_free_codeword = 0x102;
4709ce4e209e [svn] Run indent -ts4 -nut -bli0 -cdw on this messy lot. Upstream is not consistent with whitespace anyway, no loss there.
chainsaw
parents: 869
diff changeset
241 dictionary_size = 0x200;
4709ce4e209e [svn] Run indent -ts4 -nut -bli0 -cdw on this messy lot. Upstream is not consistent with whitespace anyway, no loss there.
chainsaw
parents: 869
diff changeset
242 dictionary.reset ();
4709ce4e209e [svn] Run indent -ts4 -nut -bli0 -cdw on this messy lot. Upstream is not consistent with whitespace anyway, no loss there.
chainsaw
parents: 869
diff changeset
243 cW = get_next_codeword (bits_read, source.data, codeword_size);
4709ce4e209e [svn] Run indent -ts4 -nut -bli0 -cdw on this messy lot. Upstream is not consistent with whitespace anyway, no loss there.
chainsaw
parents: 869
diff changeset
244 SAVE_OUTPUT_ROOT ((unsigned char) cW, dest, bytes_written);
4709ce4e209e [svn] Run indent -ts4 -nut -bli0 -cdw on this messy lot. Upstream is not consistent with whitespace anyway, no loss there.
chainsaw
parents: 869
diff changeset
245 break;
4709ce4e209e [svn] Run indent -ts4 -nut -bli0 -cdw on this messy lot. Upstream is not consistent with whitespace anyway, no loss there.
chainsaw
parents: 869
diff changeset
246 // end of compressed file has been reached
4709ce4e209e [svn] Run indent -ts4 -nut -bli0 -cdw on this messy lot. Upstream is not consistent with whitespace anyway, no loss there.
chainsaw
parents: 869
diff changeset
247 case 0x101:
4709ce4e209e [svn] Run indent -ts4 -nut -bli0 -cdw on this messy lot. Upstream is not consistent with whitespace anyway, no loss there.
chainsaw
parents: 869
diff changeset
248 end_marker_reached = true;
4709ce4e209e [svn] Run indent -ts4 -nut -bli0 -cdw on this messy lot. Upstream is not consistent with whitespace anyway, no loss there.
chainsaw
parents: 869
diff changeset
249 break;
4709ce4e209e [svn] Run indent -ts4 -nut -bli0 -cdw on this messy lot. Upstream is not consistent with whitespace anyway, no loss there.
chainsaw
parents: 869
diff changeset
250 // (cW <> 0x100) && (cW <> 0x101)
4709ce4e209e [svn] Run indent -ts4 -nut -bli0 -cdw on this messy lot. Upstream is not consistent with whitespace anyway, no loss there.
chainsaw
parents: 869
diff changeset
251 default:
4709ce4e209e [svn] Run indent -ts4 -nut -bli0 -cdw on this messy lot. Upstream is not consistent with whitespace anyway, no loss there.
chainsaw
parents: 869
diff changeset
252 if (cW < next_free_codeword) // codeword is already in the dictionary
4709ce4e209e [svn] Run indent -ts4 -nut -bli0 -cdw on this messy lot. Upstream is not consistent with whitespace anyway, no loss there.
chainsaw
parents: 869
diff changeset
253 {
4709ce4e209e [svn] Run indent -ts4 -nut -bli0 -cdw on this messy lot. Upstream is not consistent with whitespace anyway, no loss there.
chainsaw
parents: 869
diff changeset
254 // create the string associated with cW (on the stack)
4709ce4e209e [svn] Run indent -ts4 -nut -bli0 -cdw on this messy lot. Upstream is not consistent with whitespace anyway, no loss there.
chainsaw
parents: 869
diff changeset
255 get_string (cW, dictionary, root_stack);
4709ce4e209e [svn] Run indent -ts4 -nut -bli0 -cdw on this messy lot. Upstream is not consistent with whitespace anyway, no loss there.
chainsaw
parents: 869
diff changeset
256 C = root_stack.top ();
4709ce4e209e [svn] Run indent -ts4 -nut -bli0 -cdw on this messy lot. Upstream is not consistent with whitespace anyway, no loss there.
chainsaw
parents: 869
diff changeset
257 // output the string represented by cW
4709ce4e209e [svn] Run indent -ts4 -nut -bli0 -cdw on this messy lot. Upstream is not consistent with whitespace anyway, no loss there.
chainsaw
parents: 869
diff changeset
258 while (!root_stack.empty ())
0
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
259 {
955
4709ce4e209e [svn] Run indent -ts4 -nut -bli0 -cdw on this messy lot. Upstream is not consistent with whitespace anyway, no loss there.
chainsaw
parents: 869
diff changeset
260 SAVE_OUTPUT_ROOT (root_stack.top (), dest, bytes_written);
4709ce4e209e [svn] Run indent -ts4 -nut -bli0 -cdw on this messy lot. Upstream is not consistent with whitespace anyway, no loss there.
chainsaw
parents: 869
diff changeset
261 root_stack.pop ();
4709ce4e209e [svn] Run indent -ts4 -nut -bli0 -cdw on this messy lot. Upstream is not consistent with whitespace anyway, no loss there.
chainsaw
parents: 869
diff changeset
262 }
4709ce4e209e [svn] Run indent -ts4 -nut -bli0 -cdw on this messy lot. Upstream is not consistent with whitespace anyway, no loss there.
chainsaw
parents: 869
diff changeset
263 // add pW+C to the dictionary
4709ce4e209e [svn] Run indent -ts4 -nut -bli0 -cdw on this messy lot. Upstream is not consistent with whitespace anyway, no loss there.
chainsaw
parents: 869
diff changeset
264 dictionary.add (C, pW);
0
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
265
955
4709ce4e209e [svn] Run indent -ts4 -nut -bli0 -cdw on this messy lot. Upstream is not consistent with whitespace anyway, no loss there.
chainsaw
parents: 869
diff changeset
266 next_free_codeword++;
4709ce4e209e [svn] Run indent -ts4 -nut -bli0 -cdw on this messy lot. Upstream is not consistent with whitespace anyway, no loss there.
chainsaw
parents: 869
diff changeset
267 if (next_free_codeword >= dictionary_size)
4709ce4e209e [svn] Run indent -ts4 -nut -bli0 -cdw on this messy lot. Upstream is not consistent with whitespace anyway, no loss there.
chainsaw
parents: 869
diff changeset
268 {
4709ce4e209e [svn] Run indent -ts4 -nut -bli0 -cdw on this messy lot. Upstream is not consistent with whitespace anyway, no loss there.
chainsaw
parents: 869
diff changeset
269 if (codeword_size < max_codeword_length)
4709ce4e209e [svn] Run indent -ts4 -nut -bli0 -cdw on this messy lot. Upstream is not consistent with whitespace anyway, no loss there.
chainsaw
parents: 869
diff changeset
270 {
4709ce4e209e [svn] Run indent -ts4 -nut -bli0 -cdw on this messy lot. Upstream is not consistent with whitespace anyway, no loss there.
chainsaw
parents: 869
diff changeset
271 codeword_size += 1;
4709ce4e209e [svn] Run indent -ts4 -nut -bli0 -cdw on this messy lot. Upstream is not consistent with whitespace anyway, no loss there.
chainsaw
parents: 869
diff changeset
272 dictionary_size *= 2;
4709ce4e209e [svn] Run indent -ts4 -nut -bli0 -cdw on this messy lot. Upstream is not consistent with whitespace anyway, no loss there.
chainsaw
parents: 869
diff changeset
273 }
4709ce4e209e [svn] Run indent -ts4 -nut -bli0 -cdw on this messy lot. Upstream is not consistent with whitespace anyway, no loss there.
chainsaw
parents: 869
diff changeset
274 }
4709ce4e209e [svn] Run indent -ts4 -nut -bli0 -cdw on this messy lot. Upstream is not consistent with whitespace anyway, no loss there.
chainsaw
parents: 869
diff changeset
275 }
4709ce4e209e [svn] Run indent -ts4 -nut -bli0 -cdw on this messy lot. Upstream is not consistent with whitespace anyway, no loss there.
chainsaw
parents: 869
diff changeset
276 else // codeword is not yet defined
4709ce4e209e [svn] Run indent -ts4 -nut -bli0 -cdw on this messy lot. Upstream is not consistent with whitespace anyway, no loss there.
chainsaw
parents: 869
diff changeset
277 {
4709ce4e209e [svn] Run indent -ts4 -nut -bli0 -cdw on this messy lot. Upstream is not consistent with whitespace anyway, no loss there.
chainsaw
parents: 869
diff changeset
278 // create the string associated with pW (on the stack)
4709ce4e209e [svn] Run indent -ts4 -nut -bli0 -cdw on this messy lot. Upstream is not consistent with whitespace anyway, no loss there.
chainsaw
parents: 869
diff changeset
279 get_string (pW, dictionary, root_stack);
4709ce4e209e [svn] Run indent -ts4 -nut -bli0 -cdw on this messy lot. Upstream is not consistent with whitespace anyway, no loss there.
chainsaw
parents: 869
diff changeset
280 C = root_stack.top ();
4709ce4e209e [svn] Run indent -ts4 -nut -bli0 -cdw on this messy lot. Upstream is not consistent with whitespace anyway, no loss there.
chainsaw
parents: 869
diff changeset
281 // output the string represented by pW
4709ce4e209e [svn] Run indent -ts4 -nut -bli0 -cdw on this messy lot. Upstream is not consistent with whitespace anyway, no loss there.
chainsaw
parents: 869
diff changeset
282 while (!root_stack.empty ())
4709ce4e209e [svn] Run indent -ts4 -nut -bli0 -cdw on this messy lot. Upstream is not consistent with whitespace anyway, no loss there.
chainsaw
parents: 869
diff changeset
283 {
4709ce4e209e [svn] Run indent -ts4 -nut -bli0 -cdw on this messy lot. Upstream is not consistent with whitespace anyway, no loss there.
chainsaw
parents: 869
diff changeset
284 SAVE_OUTPUT_ROOT (root_stack.top (), dest, bytes_written);
4709ce4e209e [svn] Run indent -ts4 -nut -bli0 -cdw on this messy lot. Upstream is not consistent with whitespace anyway, no loss there.
chainsaw
parents: 869
diff changeset
285 root_stack.pop ();
4709ce4e209e [svn] Run indent -ts4 -nut -bli0 -cdw on this messy lot. Upstream is not consistent with whitespace anyway, no loss there.
chainsaw
parents: 869
diff changeset
286 }
4709ce4e209e [svn] Run indent -ts4 -nut -bli0 -cdw on this messy lot. Upstream is not consistent with whitespace anyway, no loss there.
chainsaw
parents: 869
diff changeset
287 // output the char C
4709ce4e209e [svn] Run indent -ts4 -nut -bli0 -cdw on this messy lot. Upstream is not consistent with whitespace anyway, no loss there.
chainsaw
parents: 869
diff changeset
288 SAVE_OUTPUT_ROOT (C, dest, bytes_written);
0
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
289
955
4709ce4e209e [svn] Run indent -ts4 -nut -bli0 -cdw on this messy lot. Upstream is not consistent with whitespace anyway, no loss there.
chainsaw
parents: 869
diff changeset
290 // the new dictionary entry must correspond to cW
4709ce4e209e [svn] Run indent -ts4 -nut -bli0 -cdw on this messy lot. Upstream is not consistent with whitespace anyway, no loss there.
chainsaw
parents: 869
diff changeset
291 // if it doesn't, something is wrong with the lzw-compressed data.
4709ce4e209e [svn] Run indent -ts4 -nut -bli0 -cdw on this messy lot. Upstream is not consistent with whitespace anyway, no loss there.
chainsaw
parents: 869
diff changeset
292 if (cW != next_free_codeword)
4709ce4e209e [svn] Run indent -ts4 -nut -bli0 -cdw on this messy lot. Upstream is not consistent with whitespace anyway, no loss there.
chainsaw
parents: 869
diff changeset
293 {
4709ce4e209e [svn] Run indent -ts4 -nut -bli0 -cdw on this messy lot. Upstream is not consistent with whitespace anyway, no loss there.
chainsaw
parents: 869
diff changeset
294 /* printf("cW != next_free_codeword!\n");
4709ce4e209e [svn] Run indent -ts4 -nut -bli0 -cdw on this messy lot. Upstream is not consistent with whitespace anyway, no loss there.
chainsaw
parents: 869
diff changeset
295 exit(-1); */
4709ce4e209e [svn] Run indent -ts4 -nut -bli0 -cdw on this messy lot. Upstream is not consistent with whitespace anyway, no loss there.
chainsaw
parents: 869
diff changeset
296 return false;
0
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
297 }
955
4709ce4e209e [svn] Run indent -ts4 -nut -bli0 -cdw on this messy lot. Upstream is not consistent with whitespace anyway, no loss there.
chainsaw
parents: 869
diff changeset
298 // add pW+C to the dictionary
4709ce4e209e [svn] Run indent -ts4 -nut -bli0 -cdw on this messy lot. Upstream is not consistent with whitespace anyway, no loss there.
chainsaw
parents: 869
diff changeset
299 dictionary.add (C, pW);
4709ce4e209e [svn] Run indent -ts4 -nut -bli0 -cdw on this messy lot. Upstream is not consistent with whitespace anyway, no loss there.
chainsaw
parents: 869
diff changeset
300
4709ce4e209e [svn] Run indent -ts4 -nut -bli0 -cdw on this messy lot. Upstream is not consistent with whitespace anyway, no loss there.
chainsaw
parents: 869
diff changeset
301 next_free_codeword++;
4709ce4e209e [svn] Run indent -ts4 -nut -bli0 -cdw on this messy lot. Upstream is not consistent with whitespace anyway, no loss there.
chainsaw
parents: 869
diff changeset
302 if (next_free_codeword >= dictionary_size)
4709ce4e209e [svn] Run indent -ts4 -nut -bli0 -cdw on this messy lot. Upstream is not consistent with whitespace anyway, no loss there.
chainsaw
parents: 869
diff changeset
303 {
4709ce4e209e [svn] Run indent -ts4 -nut -bli0 -cdw on this messy lot. Upstream is not consistent with whitespace anyway, no loss there.
chainsaw
parents: 869
diff changeset
304 if (codeword_size < max_codeword_length)
4709ce4e209e [svn] Run indent -ts4 -nut -bli0 -cdw on this messy lot. Upstream is not consistent with whitespace anyway, no loss there.
chainsaw
parents: 869
diff changeset
305 {
4709ce4e209e [svn] Run indent -ts4 -nut -bli0 -cdw on this messy lot. Upstream is not consistent with whitespace anyway, no loss there.
chainsaw
parents: 869
diff changeset
306 codeword_size += 1;
4709ce4e209e [svn] Run indent -ts4 -nut -bli0 -cdw on this messy lot. Upstream is not consistent with whitespace anyway, no loss there.
chainsaw
parents: 869
diff changeset
307 dictionary_size *= 2;
4709ce4e209e [svn] Run indent -ts4 -nut -bli0 -cdw on this messy lot. Upstream is not consistent with whitespace anyway, no loss there.
chainsaw
parents: 869
diff changeset
308 }
4709ce4e209e [svn] Run indent -ts4 -nut -bli0 -cdw on this messy lot. Upstream is not consistent with whitespace anyway, no loss there.
chainsaw
parents: 869
diff changeset
309 }
4709ce4e209e [svn] Run indent -ts4 -nut -bli0 -cdw on this messy lot. Upstream is not consistent with whitespace anyway, no loss there.
chainsaw
parents: 869
diff changeset
310 };
4709ce4e209e [svn] Run indent -ts4 -nut -bli0 -cdw on this messy lot. Upstream is not consistent with whitespace anyway, no loss there.
chainsaw
parents: 869
diff changeset
311 break;
0
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
312 }
955
4709ce4e209e [svn] Run indent -ts4 -nut -bli0 -cdw on this messy lot. Upstream is not consistent with whitespace anyway, no loss there.
chainsaw
parents: 869
diff changeset
313 // shift roles - the current cW becomes the new pW
4709ce4e209e [svn] Run indent -ts4 -nut -bli0 -cdw on this messy lot. Upstream is not consistent with whitespace anyway, no loss there.
chainsaw
parents: 869
diff changeset
314 pW = cW;
4709ce4e209e [svn] Run indent -ts4 -nut -bli0 -cdw on this messy lot. Upstream is not consistent with whitespace anyway, no loss there.
chainsaw
parents: 869
diff changeset
315 }
0
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
316
955
4709ce4e209e [svn] Run indent -ts4 -nut -bli0 -cdw on this messy lot. Upstream is not consistent with whitespace anyway, no loss there.
chainsaw
parents: 869
diff changeset
317 return (true); // indicate successful decompression
0
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
318 }
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
319
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
320
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
321 // --------------------
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
322 // Additional functions
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
323 // --------------------
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
324
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
325
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
326 // Read the next code word from the source buffer
955
4709ce4e209e [svn] Run indent -ts4 -nut -bli0 -cdw on this messy lot. Upstream is not consistent with whitespace anyway, no loss there.
chainsaw
parents: 869
diff changeset
327 int
4709ce4e209e [svn] Run indent -ts4 -nut -bli0 -cdw on this messy lot. Upstream is not consistent with whitespace anyway, no loss there.
chainsaw
parents: 869
diff changeset
328 Cu6mPlayer::get_next_codeword (long &bits_read, unsigned char *source,
4709ce4e209e [svn] Run indent -ts4 -nut -bli0 -cdw on this messy lot. Upstream is not consistent with whitespace anyway, no loss there.
chainsaw
parents: 869
diff changeset
329 int codeword_size)
0
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
330 {
955
4709ce4e209e [svn] Run indent -ts4 -nut -bli0 -cdw on this messy lot. Upstream is not consistent with whitespace anyway, no loss there.
chainsaw
parents: 869
diff changeset
331 unsigned char b0, b1, b2;
4709ce4e209e [svn] Run indent -ts4 -nut -bli0 -cdw on this messy lot. Upstream is not consistent with whitespace anyway, no loss there.
chainsaw
parents: 869
diff changeset
332 int codeword;
4709ce4e209e [svn] Run indent -ts4 -nut -bli0 -cdw on this messy lot. Upstream is not consistent with whitespace anyway, no loss there.
chainsaw
parents: 869
diff changeset
333
4709ce4e209e [svn] Run indent -ts4 -nut -bli0 -cdw on this messy lot. Upstream is not consistent with whitespace anyway, no loss there.
chainsaw
parents: 869
diff changeset
334 b0 = source[bits_read / 8];
4709ce4e209e [svn] Run indent -ts4 -nut -bli0 -cdw on this messy lot. Upstream is not consistent with whitespace anyway, no loss there.
chainsaw
parents: 869
diff changeset
335 b1 = source[bits_read / 8 + 1];
4709ce4e209e [svn] Run indent -ts4 -nut -bli0 -cdw on this messy lot. Upstream is not consistent with whitespace anyway, no loss there.
chainsaw
parents: 869
diff changeset
336 b2 = source[bits_read / 8 + 2];
0
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
337
955
4709ce4e209e [svn] Run indent -ts4 -nut -bli0 -cdw on this messy lot. Upstream is not consistent with whitespace anyway, no loss there.
chainsaw
parents: 869
diff changeset
338 codeword = ((b2 << 16) + (b1 << 8) + b0);
4709ce4e209e [svn] Run indent -ts4 -nut -bli0 -cdw on this messy lot. Upstream is not consistent with whitespace anyway, no loss there.
chainsaw
parents: 869
diff changeset
339 codeword = codeword >> (bits_read % 8);
4709ce4e209e [svn] Run indent -ts4 -nut -bli0 -cdw on this messy lot. Upstream is not consistent with whitespace anyway, no loss there.
chainsaw
parents: 869
diff changeset
340 switch (codeword_size)
4709ce4e209e [svn] Run indent -ts4 -nut -bli0 -cdw on this messy lot. Upstream is not consistent with whitespace anyway, no loss there.
chainsaw
parents: 869
diff changeset
341 {
4709ce4e209e [svn] Run indent -ts4 -nut -bli0 -cdw on this messy lot. Upstream is not consistent with whitespace anyway, no loss there.
chainsaw
parents: 869
diff changeset
342 case 0x9:
4709ce4e209e [svn] Run indent -ts4 -nut -bli0 -cdw on this messy lot. Upstream is not consistent with whitespace anyway, no loss there.
chainsaw
parents: 869
diff changeset
343 codeword = codeword & 0x1ff;
4709ce4e209e [svn] Run indent -ts4 -nut -bli0 -cdw on this messy lot. Upstream is not consistent with whitespace anyway, no loss there.
chainsaw
parents: 869
diff changeset
344 break;
4709ce4e209e [svn] Run indent -ts4 -nut -bli0 -cdw on this messy lot. Upstream is not consistent with whitespace anyway, no loss there.
chainsaw
parents: 869
diff changeset
345 case 0xa:
4709ce4e209e [svn] Run indent -ts4 -nut -bli0 -cdw on this messy lot. Upstream is not consistent with whitespace anyway, no loss there.
chainsaw
parents: 869
diff changeset
346 codeword = codeword & 0x3ff;
4709ce4e209e [svn] Run indent -ts4 -nut -bli0 -cdw on this messy lot. Upstream is not consistent with whitespace anyway, no loss there.
chainsaw
parents: 869
diff changeset
347 break;
4709ce4e209e [svn] Run indent -ts4 -nut -bli0 -cdw on this messy lot. Upstream is not consistent with whitespace anyway, no loss there.
chainsaw
parents: 869
diff changeset
348 case 0xb:
4709ce4e209e [svn] Run indent -ts4 -nut -bli0 -cdw on this messy lot. Upstream is not consistent with whitespace anyway, no loss there.
chainsaw
parents: 869
diff changeset
349 codeword = codeword & 0x7ff;
4709ce4e209e [svn] Run indent -ts4 -nut -bli0 -cdw on this messy lot. Upstream is not consistent with whitespace anyway, no loss there.
chainsaw
parents: 869
diff changeset
350 break;
4709ce4e209e [svn] Run indent -ts4 -nut -bli0 -cdw on this messy lot. Upstream is not consistent with whitespace anyway, no loss there.
chainsaw
parents: 869
diff changeset
351 case 0xc:
4709ce4e209e [svn] Run indent -ts4 -nut -bli0 -cdw on this messy lot. Upstream is not consistent with whitespace anyway, no loss there.
chainsaw
parents: 869
diff changeset
352 codeword = codeword & 0xfff;
4709ce4e209e [svn] Run indent -ts4 -nut -bli0 -cdw on this messy lot. Upstream is not consistent with whitespace anyway, no loss there.
chainsaw
parents: 869
diff changeset
353 break;
4709ce4e209e [svn] Run indent -ts4 -nut -bli0 -cdw on this messy lot. Upstream is not consistent with whitespace anyway, no loss there.
chainsaw
parents: 869
diff changeset
354 default:
4709ce4e209e [svn] Run indent -ts4 -nut -bli0 -cdw on this messy lot. Upstream is not consistent with whitespace anyway, no loss there.
chainsaw
parents: 869
diff changeset
355 codeword = -1; // indicates that an error has occurred
4709ce4e209e [svn] Run indent -ts4 -nut -bli0 -cdw on this messy lot. Upstream is not consistent with whitespace anyway, no loss there.
chainsaw
parents: 869
diff changeset
356 break;
4709ce4e209e [svn] Run indent -ts4 -nut -bli0 -cdw on this messy lot. Upstream is not consistent with whitespace anyway, no loss there.
chainsaw
parents: 869
diff changeset
357 }
0
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
358
955
4709ce4e209e [svn] Run indent -ts4 -nut -bli0 -cdw on this messy lot. Upstream is not consistent with whitespace anyway, no loss there.
chainsaw
parents: 869
diff changeset
359 bits_read += codeword_size;
4709ce4e209e [svn] Run indent -ts4 -nut -bli0 -cdw on this messy lot. Upstream is not consistent with whitespace anyway, no loss there.
chainsaw
parents: 869
diff changeset
360 return (codeword);
0
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
361 }
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
362
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
363
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
364 // output a root to memory
955
4709ce4e209e [svn] Run indent -ts4 -nut -bli0 -cdw on this messy lot. Upstream is not consistent with whitespace anyway, no loss there.
chainsaw
parents: 869
diff changeset
365 void
4709ce4e209e [svn] Run indent -ts4 -nut -bli0 -cdw on this messy lot. Upstream is not consistent with whitespace anyway, no loss there.
chainsaw
parents: 869
diff changeset
366 Cu6mPlayer::output_root (unsigned char root, unsigned char *destination,
4709ce4e209e [svn] Run indent -ts4 -nut -bli0 -cdw on this messy lot. Upstream is not consistent with whitespace anyway, no loss there.
chainsaw
parents: 869
diff changeset
367 long &position)
0
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
368 {
955
4709ce4e209e [svn] Run indent -ts4 -nut -bli0 -cdw on this messy lot. Upstream is not consistent with whitespace anyway, no loss there.
chainsaw
parents: 869
diff changeset
369 destination[position] = root;
4709ce4e209e [svn] Run indent -ts4 -nut -bli0 -cdw on this messy lot. Upstream is not consistent with whitespace anyway, no loss there.
chainsaw
parents: 869
diff changeset
370 position++;
0
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
371 }
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
372
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
373
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
374 // output the string represented by a codeword
955
4709ce4e209e [svn] Run indent -ts4 -nut -bli0 -cdw on this messy lot. Upstream is not consistent with whitespace anyway, no loss there.
chainsaw
parents: 869
diff changeset
375 void
4709ce4e209e [svn] Run indent -ts4 -nut -bli0 -cdw on this messy lot. Upstream is not consistent with whitespace anyway, no loss there.
chainsaw
parents: 869
diff changeset
376 Cu6mPlayer::get_string (int codeword, Cu6mPlayer::MyDict & dictionary,
4709ce4e209e [svn] Run indent -ts4 -nut -bli0 -cdw on this messy lot. Upstream is not consistent with whitespace anyway, no loss there.
chainsaw
parents: 869
diff changeset
377 std::stack < unsigned char >&root_stack)
0
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
378 {
955
4709ce4e209e [svn] Run indent -ts4 -nut -bli0 -cdw on this messy lot. Upstream is not consistent with whitespace anyway, no loss there.
chainsaw
parents: 869
diff changeset
379 unsigned char root;
4709ce4e209e [svn] Run indent -ts4 -nut -bli0 -cdw on this messy lot. Upstream is not consistent with whitespace anyway, no loss there.
chainsaw
parents: 869
diff changeset
380 int current_codeword;
0
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
381
955
4709ce4e209e [svn] Run indent -ts4 -nut -bli0 -cdw on this messy lot. Upstream is not consistent with whitespace anyway, no loss there.
chainsaw
parents: 869
diff changeset
382 current_codeword = codeword;
0
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
383
955
4709ce4e209e [svn] Run indent -ts4 -nut -bli0 -cdw on this messy lot. Upstream is not consistent with whitespace anyway, no loss there.
chainsaw
parents: 869
diff changeset
384 while (current_codeword > 0xff)
4709ce4e209e [svn] Run indent -ts4 -nut -bli0 -cdw on this messy lot. Upstream is not consistent with whitespace anyway, no loss there.
chainsaw
parents: 869
diff changeset
385 {
4709ce4e209e [svn] Run indent -ts4 -nut -bli0 -cdw on this messy lot. Upstream is not consistent with whitespace anyway, no loss there.
chainsaw
parents: 869
diff changeset
386 root = dictionary.get_root (current_codeword);
4709ce4e209e [svn] Run indent -ts4 -nut -bli0 -cdw on this messy lot. Upstream is not consistent with whitespace anyway, no loss there.
chainsaw
parents: 869
diff changeset
387 current_codeword = dictionary.get_codeword (current_codeword);
4709ce4e209e [svn] Run indent -ts4 -nut -bli0 -cdw on this messy lot. Upstream is not consistent with whitespace anyway, no loss there.
chainsaw
parents: 869
diff changeset
388 root_stack.push (root);
4709ce4e209e [svn] Run indent -ts4 -nut -bli0 -cdw on this messy lot. Upstream is not consistent with whitespace anyway, no loss there.
chainsaw
parents: 869
diff changeset
389 }
0
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
390
955
4709ce4e209e [svn] Run indent -ts4 -nut -bli0 -cdw on this messy lot. Upstream is not consistent with whitespace anyway, no loss there.
chainsaw
parents: 869
diff changeset
391 // push the root at the leaf
4709ce4e209e [svn] Run indent -ts4 -nut -bli0 -cdw on this messy lot. Upstream is not consistent with whitespace anyway, no loss there.
chainsaw
parents: 869
diff changeset
392 root_stack.push ((unsigned char) current_codeword);
0
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
393 }
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
394
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
395
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
396 // ============================================================================================
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
397 //
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
398 //
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
399 // Functions called by update()
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
400 //
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
401 //
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
402 // ============================================================================================
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
403
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
404
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
405 // This function reads the song data and executes the embedded commands.
955
4709ce4e209e [svn] Run indent -ts4 -nut -bli0 -cdw on this messy lot. Upstream is not consistent with whitespace anyway, no loss there.
chainsaw
parents: 869
diff changeset
406 void
4709ce4e209e [svn] Run indent -ts4 -nut -bli0 -cdw on this messy lot. Upstream is not consistent with whitespace anyway, no loss there.
chainsaw
parents: 869
diff changeset
407 Cu6mPlayer::command_loop ()
0
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
408 {
955
4709ce4e209e [svn] Run indent -ts4 -nut -bli0 -cdw on this messy lot. Upstream is not consistent with whitespace anyway, no loss there.
chainsaw
parents: 869
diff changeset
409 unsigned char command_byte; // current command byte
4709ce4e209e [svn] Run indent -ts4 -nut -bli0 -cdw on this messy lot. Upstream is not consistent with whitespace anyway, no loss there.
chainsaw
parents: 869
diff changeset
410 int command_nibble_hi; // command byte, bits 4-7
4709ce4e209e [svn] Run indent -ts4 -nut -bli0 -cdw on this messy lot. Upstream is not consistent with whitespace anyway, no loss there.
chainsaw
parents: 869
diff changeset
411 int command_nibble_lo; // command byte, bite 0-3
4709ce4e209e [svn] Run indent -ts4 -nut -bli0 -cdw on this messy lot. Upstream is not consistent with whitespace anyway, no loss there.
chainsaw
parents: 869
diff changeset
412 bool repeat_loop = true; //
0
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
413
955
4709ce4e209e [svn] Run indent -ts4 -nut -bli0 -cdw on this messy lot. Upstream is not consistent with whitespace anyway, no loss there.
chainsaw
parents: 869
diff changeset
414 do
4709ce4e209e [svn] Run indent -ts4 -nut -bli0 -cdw on this messy lot. Upstream is not consistent with whitespace anyway, no loss there.
chainsaw
parents: 869
diff changeset
415 {
4709ce4e209e [svn] Run indent -ts4 -nut -bli0 -cdw on this messy lot. Upstream is not consistent with whitespace anyway, no loss there.
chainsaw
parents: 869
diff changeset
416 // extract low and high command nibbles
4709ce4e209e [svn] Run indent -ts4 -nut -bli0 -cdw on this messy lot. Upstream is not consistent with whitespace anyway, no loss there.
chainsaw
parents: 869
diff changeset
417 command_byte = read_song_byte (); // implicitly increments song_pos
4709ce4e209e [svn] Run indent -ts4 -nut -bli0 -cdw on this messy lot. Upstream is not consistent with whitespace anyway, no loss there.
chainsaw
parents: 869
diff changeset
418 command_nibble_hi = command_byte >> 4;
4709ce4e209e [svn] Run indent -ts4 -nut -bli0 -cdw on this messy lot. Upstream is not consistent with whitespace anyway, no loss there.
chainsaw
parents: 869
diff changeset
419 command_nibble_lo = command_byte & 0xf;
4709ce4e209e [svn] Run indent -ts4 -nut -bli0 -cdw on this messy lot. Upstream is not consistent with whitespace anyway, no loss there.
chainsaw
parents: 869
diff changeset
420
4709ce4e209e [svn] Run indent -ts4 -nut -bli0 -cdw on this messy lot. Upstream is not consistent with whitespace anyway, no loss there.
chainsaw
parents: 869
diff changeset
421 switch (command_nibble_hi)
0
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
422 {
955
4709ce4e209e [svn] Run indent -ts4 -nut -bli0 -cdw on this messy lot. Upstream is not consistent with whitespace anyway, no loss there.
chainsaw
parents: 869
diff changeset
423 case 0x0:
4709ce4e209e [svn] Run indent -ts4 -nut -bli0 -cdw on this messy lot. Upstream is not consistent with whitespace anyway, no loss there.
chainsaw
parents: 869
diff changeset
424 command_0 (command_nibble_lo);
4709ce4e209e [svn] Run indent -ts4 -nut -bli0 -cdw on this messy lot. Upstream is not consistent with whitespace anyway, no loss there.
chainsaw
parents: 869
diff changeset
425 break;
4709ce4e209e [svn] Run indent -ts4 -nut -bli0 -cdw on this messy lot. Upstream is not consistent with whitespace anyway, no loss there.
chainsaw
parents: 869
diff changeset
426 case 0x1:
4709ce4e209e [svn] Run indent -ts4 -nut -bli0 -cdw on this messy lot. Upstream is not consistent with whitespace anyway, no loss there.
chainsaw
parents: 869
diff changeset
427 command_1 (command_nibble_lo);
4709ce4e209e [svn] Run indent -ts4 -nut -bli0 -cdw on this messy lot. Upstream is not consistent with whitespace anyway, no loss there.
chainsaw
parents: 869
diff changeset
428 break;
4709ce4e209e [svn] Run indent -ts4 -nut -bli0 -cdw on this messy lot. Upstream is not consistent with whitespace anyway, no loss there.
chainsaw
parents: 869
diff changeset
429 case 0x2:
4709ce4e209e [svn] Run indent -ts4 -nut -bli0 -cdw on this messy lot. Upstream is not consistent with whitespace anyway, no loss there.
chainsaw
parents: 869
diff changeset
430 command_2 (command_nibble_lo);
4709ce4e209e [svn] Run indent -ts4 -nut -bli0 -cdw on this messy lot. Upstream is not consistent with whitespace anyway, no loss there.
chainsaw
parents: 869
diff changeset
431 break;
4709ce4e209e [svn] Run indent -ts4 -nut -bli0 -cdw on this messy lot. Upstream is not consistent with whitespace anyway, no loss there.
chainsaw
parents: 869
diff changeset
432 case 0x3:
4709ce4e209e [svn] Run indent -ts4 -nut -bli0 -cdw on this messy lot. Upstream is not consistent with whitespace anyway, no loss there.
chainsaw
parents: 869
diff changeset
433 command_3 (command_nibble_lo);
4709ce4e209e [svn] Run indent -ts4 -nut -bli0 -cdw on this messy lot. Upstream is not consistent with whitespace anyway, no loss there.
chainsaw
parents: 869
diff changeset
434 break;
4709ce4e209e [svn] Run indent -ts4 -nut -bli0 -cdw on this messy lot. Upstream is not consistent with whitespace anyway, no loss there.
chainsaw
parents: 869
diff changeset
435 case 0x4:
4709ce4e209e [svn] Run indent -ts4 -nut -bli0 -cdw on this messy lot. Upstream is not consistent with whitespace anyway, no loss there.
chainsaw
parents: 869
diff changeset
436 command_4 (command_nibble_lo);
4709ce4e209e [svn] Run indent -ts4 -nut -bli0 -cdw on this messy lot. Upstream is not consistent with whitespace anyway, no loss there.
chainsaw
parents: 869
diff changeset
437 break;
4709ce4e209e [svn] Run indent -ts4 -nut -bli0 -cdw on this messy lot. Upstream is not consistent with whitespace anyway, no loss there.
chainsaw
parents: 869
diff changeset
438 case 0x5:
4709ce4e209e [svn] Run indent -ts4 -nut -bli0 -cdw on this messy lot. Upstream is not consistent with whitespace anyway, no loss there.
chainsaw
parents: 869
diff changeset
439 command_5 (command_nibble_lo);
4709ce4e209e [svn] Run indent -ts4 -nut -bli0 -cdw on this messy lot. Upstream is not consistent with whitespace anyway, no loss there.
chainsaw
parents: 869
diff changeset
440 break;
4709ce4e209e [svn] Run indent -ts4 -nut -bli0 -cdw on this messy lot. Upstream is not consistent with whitespace anyway, no loss there.
chainsaw
parents: 869
diff changeset
441 case 0x6:
4709ce4e209e [svn] Run indent -ts4 -nut -bli0 -cdw on this messy lot. Upstream is not consistent with whitespace anyway, no loss there.
chainsaw
parents: 869
diff changeset
442 command_6 (command_nibble_lo);
4709ce4e209e [svn] Run indent -ts4 -nut -bli0 -cdw on this messy lot. Upstream is not consistent with whitespace anyway, no loss there.
chainsaw
parents: 869
diff changeset
443 break;
4709ce4e209e [svn] Run indent -ts4 -nut -bli0 -cdw on this messy lot. Upstream is not consistent with whitespace anyway, no loss there.
chainsaw
parents: 869
diff changeset
444 case 0x7:
4709ce4e209e [svn] Run indent -ts4 -nut -bli0 -cdw on this messy lot. Upstream is not consistent with whitespace anyway, no loss there.
chainsaw
parents: 869
diff changeset
445 command_7 (command_nibble_lo);
4709ce4e209e [svn] Run indent -ts4 -nut -bli0 -cdw on this messy lot. Upstream is not consistent with whitespace anyway, no loss there.
chainsaw
parents: 869
diff changeset
446 break;
4709ce4e209e [svn] Run indent -ts4 -nut -bli0 -cdw on this messy lot. Upstream is not consistent with whitespace anyway, no loss there.
chainsaw
parents: 869
diff changeset
447 case 0x8:
4709ce4e209e [svn] Run indent -ts4 -nut -bli0 -cdw on this messy lot. Upstream is not consistent with whitespace anyway, no loss there.
chainsaw
parents: 869
diff changeset
448 switch (command_nibble_lo)
4709ce4e209e [svn] Run indent -ts4 -nut -bli0 -cdw on this messy lot. Upstream is not consistent with whitespace anyway, no loss there.
chainsaw
parents: 869
diff changeset
449 {
4709ce4e209e [svn] Run indent -ts4 -nut -bli0 -cdw on this messy lot. Upstream is not consistent with whitespace anyway, no loss there.
chainsaw
parents: 869
diff changeset
450 case 1:
4709ce4e209e [svn] Run indent -ts4 -nut -bli0 -cdw on this messy lot. Upstream is not consistent with whitespace anyway, no loss there.
chainsaw
parents: 869
diff changeset
451 command_81 ();
4709ce4e209e [svn] Run indent -ts4 -nut -bli0 -cdw on this messy lot. Upstream is not consistent with whitespace anyway, no loss there.
chainsaw
parents: 869
diff changeset
452 break;
4709ce4e209e [svn] Run indent -ts4 -nut -bli0 -cdw on this messy lot. Upstream is not consistent with whitespace anyway, no loss there.
chainsaw
parents: 869
diff changeset
453 case 2:
4709ce4e209e [svn] Run indent -ts4 -nut -bli0 -cdw on this messy lot. Upstream is not consistent with whitespace anyway, no loss there.
chainsaw
parents: 869
diff changeset
454 command_82 ();
4709ce4e209e [svn] Run indent -ts4 -nut -bli0 -cdw on this messy lot. Upstream is not consistent with whitespace anyway, no loss there.
chainsaw
parents: 869
diff changeset
455 repeat_loop = false;
4709ce4e209e [svn] Run indent -ts4 -nut -bli0 -cdw on this messy lot. Upstream is not consistent with whitespace anyway, no loss there.
chainsaw
parents: 869
diff changeset
456 break;
4709ce4e209e [svn] Run indent -ts4 -nut -bli0 -cdw on this messy lot. Upstream is not consistent with whitespace anyway, no loss there.
chainsaw
parents: 869
diff changeset
457 case 3:
4709ce4e209e [svn] Run indent -ts4 -nut -bli0 -cdw on this messy lot. Upstream is not consistent with whitespace anyway, no loss there.
chainsaw
parents: 869
diff changeset
458 command_83 ();
4709ce4e209e [svn] Run indent -ts4 -nut -bli0 -cdw on this messy lot. Upstream is not consistent with whitespace anyway, no loss there.
chainsaw
parents: 869
diff changeset
459 break;
4709ce4e209e [svn] Run indent -ts4 -nut -bli0 -cdw on this messy lot. Upstream is not consistent with whitespace anyway, no loss there.
chainsaw
parents: 869
diff changeset
460 case 5:
4709ce4e209e [svn] Run indent -ts4 -nut -bli0 -cdw on this messy lot. Upstream is not consistent with whitespace anyway, no loss there.
chainsaw
parents: 869
diff changeset
461 command_85 ();
4709ce4e209e [svn] Run indent -ts4 -nut -bli0 -cdw on this messy lot. Upstream is not consistent with whitespace anyway, no loss there.
chainsaw
parents: 869
diff changeset
462 break;
4709ce4e209e [svn] Run indent -ts4 -nut -bli0 -cdw on this messy lot. Upstream is not consistent with whitespace anyway, no loss there.
chainsaw
parents: 869
diff changeset
463 case 6:
4709ce4e209e [svn] Run indent -ts4 -nut -bli0 -cdw on this messy lot. Upstream is not consistent with whitespace anyway, no loss there.
chainsaw
parents: 869
diff changeset
464 command_86 ();
4709ce4e209e [svn] Run indent -ts4 -nut -bli0 -cdw on this messy lot. Upstream is not consistent with whitespace anyway, no loss there.
chainsaw
parents: 869
diff changeset
465 break;
4709ce4e209e [svn] Run indent -ts4 -nut -bli0 -cdw on this messy lot. Upstream is not consistent with whitespace anyway, no loss there.
chainsaw
parents: 869
diff changeset
466 default:
4709ce4e209e [svn] Run indent -ts4 -nut -bli0 -cdw on this messy lot. Upstream is not consistent with whitespace anyway, no loss there.
chainsaw
parents: 869
diff changeset
467 break; // maybe generate an error?
4709ce4e209e [svn] Run indent -ts4 -nut -bli0 -cdw on this messy lot. Upstream is not consistent with whitespace anyway, no loss there.
chainsaw
parents: 869
diff changeset
468 }
4709ce4e209e [svn] Run indent -ts4 -nut -bli0 -cdw on this messy lot. Upstream is not consistent with whitespace anyway, no loss there.
chainsaw
parents: 869
diff changeset
469 break;
4709ce4e209e [svn] Run indent -ts4 -nut -bli0 -cdw on this messy lot. Upstream is not consistent with whitespace anyway, no loss there.
chainsaw
parents: 869
diff changeset
470 case 0xE:
4709ce4e209e [svn] Run indent -ts4 -nut -bli0 -cdw on this messy lot. Upstream is not consistent with whitespace anyway, no loss there.
chainsaw
parents: 869
diff changeset
471 command_E ();
4709ce4e209e [svn] Run indent -ts4 -nut -bli0 -cdw on this messy lot. Upstream is not consistent with whitespace anyway, no loss there.
chainsaw
parents: 869
diff changeset
472 break;
4709ce4e209e [svn] Run indent -ts4 -nut -bli0 -cdw on this messy lot. Upstream is not consistent with whitespace anyway, no loss there.
chainsaw
parents: 869
diff changeset
473 case 0xF:
4709ce4e209e [svn] Run indent -ts4 -nut -bli0 -cdw on this messy lot. Upstream is not consistent with whitespace anyway, no loss there.
chainsaw
parents: 869
diff changeset
474 command_F ();
4709ce4e209e [svn] Run indent -ts4 -nut -bli0 -cdw on this messy lot. Upstream is not consistent with whitespace anyway, no loss there.
chainsaw
parents: 869
diff changeset
475 break;
4709ce4e209e [svn] Run indent -ts4 -nut -bli0 -cdw on this messy lot. Upstream is not consistent with whitespace anyway, no loss there.
chainsaw
parents: 869
diff changeset
476 default:
4709ce4e209e [svn] Run indent -ts4 -nut -bli0 -cdw on this messy lot. Upstream is not consistent with whitespace anyway, no loss there.
chainsaw
parents: 869
diff changeset
477 break; // maybe generate an error?
4709ce4e209e [svn] Run indent -ts4 -nut -bli0 -cdw on this messy lot. Upstream is not consistent with whitespace anyway, no loss there.
chainsaw
parents: 869
diff changeset
478 }
0
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
479
955
4709ce4e209e [svn] Run indent -ts4 -nut -bli0 -cdw on this messy lot. Upstream is not consistent with whitespace anyway, no loss there.
chainsaw
parents: 869
diff changeset
480 } while (repeat_loop);
0
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
481 }
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
482
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
483
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
484 // --------------------------------------------------------
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
485 // The commands supported by the U6 music file format
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
486 // --------------------------------------------------------
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
487
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
488 // ----------------------------------------
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
489 // Set octave and frequency, note off
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
490 // Format: 0c nn
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
491 // c = channel, nn = packed Adlib frequency
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
492 // ----------------------------------------
955
4709ce4e209e [svn] Run indent -ts4 -nut -bli0 -cdw on this messy lot. Upstream is not consistent with whitespace anyway, no loss there.
chainsaw
parents: 869
diff changeset
493 void
4709ce4e209e [svn] Run indent -ts4 -nut -bli0 -cdw on this messy lot. Upstream is not consistent with whitespace anyway, no loss there.
chainsaw
parents: 869
diff changeset
494 Cu6mPlayer::command_0 (int channel)
0
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
495 {
955
4709ce4e209e [svn] Run indent -ts4 -nut -bli0 -cdw on this messy lot. Upstream is not consistent with whitespace anyway, no loss there.
chainsaw
parents: 869
diff changeset
496 unsigned char freq_byte;
4709ce4e209e [svn] Run indent -ts4 -nut -bli0 -cdw on this messy lot. Upstream is not consistent with whitespace anyway, no loss there.
chainsaw
parents: 869
diff changeset
497 byte_pair freq_word;
0
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
498
955
4709ce4e209e [svn] Run indent -ts4 -nut -bli0 -cdw on this messy lot. Upstream is not consistent with whitespace anyway, no loss there.
chainsaw
parents: 869
diff changeset
499 freq_byte = read_song_byte ();
4709ce4e209e [svn] Run indent -ts4 -nut -bli0 -cdw on this messy lot. Upstream is not consistent with whitespace anyway, no loss there.
chainsaw
parents: 869
diff changeset
500 freq_word = expand_freq_byte (freq_byte);
4709ce4e209e [svn] Run indent -ts4 -nut -bli0 -cdw on this messy lot. Upstream is not consistent with whitespace anyway, no loss there.
chainsaw
parents: 869
diff changeset
501 set_adlib_freq (channel, freq_word);
0
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
502 }
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
503
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
504
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
505 // ---------------------------------------------------
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
506 // Set octave and frequency, old note off, new note on
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
507 // Format: 1c nn
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
508 // c = channel, nn = packed Adlib frequency
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
509 // ---------------------------------------------------
955
4709ce4e209e [svn] Run indent -ts4 -nut -bli0 -cdw on this messy lot. Upstream is not consistent with whitespace anyway, no loss there.
chainsaw
parents: 869
diff changeset
510 void
4709ce4e209e [svn] Run indent -ts4 -nut -bli0 -cdw on this messy lot. Upstream is not consistent with whitespace anyway, no loss there.
chainsaw
parents: 869
diff changeset
511 Cu6mPlayer::command_1 (int channel)
0
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
512 {
955
4709ce4e209e [svn] Run indent -ts4 -nut -bli0 -cdw on this messy lot. Upstream is not consistent with whitespace anyway, no loss there.
chainsaw
parents: 869
diff changeset
513 unsigned char freq_byte;
4709ce4e209e [svn] Run indent -ts4 -nut -bli0 -cdw on this messy lot. Upstream is not consistent with whitespace anyway, no loss there.
chainsaw
parents: 869
diff changeset
514 byte_pair freq_word;
0
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
515
955
4709ce4e209e [svn] Run indent -ts4 -nut -bli0 -cdw on this messy lot. Upstream is not consistent with whitespace anyway, no loss there.
chainsaw
parents: 869
diff changeset
516 vb_direction_flag[channel] = 0;
4709ce4e209e [svn] Run indent -ts4 -nut -bli0 -cdw on this messy lot. Upstream is not consistent with whitespace anyway, no loss there.
chainsaw
parents: 869
diff changeset
517 vb_current_value[channel] = 0;
0
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
518
955
4709ce4e209e [svn] Run indent -ts4 -nut -bli0 -cdw on this messy lot. Upstream is not consistent with whitespace anyway, no loss there.
chainsaw
parents: 869
diff changeset
519 freq_byte = read_song_byte ();
4709ce4e209e [svn] Run indent -ts4 -nut -bli0 -cdw on this messy lot. Upstream is not consistent with whitespace anyway, no loss there.
chainsaw
parents: 869
diff changeset
520 freq_word = expand_freq_byte (freq_byte);
4709ce4e209e [svn] Run indent -ts4 -nut -bli0 -cdw on this messy lot. Upstream is not consistent with whitespace anyway, no loss there.
chainsaw
parents: 869
diff changeset
521 set_adlib_freq (channel, freq_word);
4709ce4e209e [svn] Run indent -ts4 -nut -bli0 -cdw on this messy lot. Upstream is not consistent with whitespace anyway, no loss there.
chainsaw
parents: 869
diff changeset
522
4709ce4e209e [svn] Run indent -ts4 -nut -bli0 -cdw on this messy lot. Upstream is not consistent with whitespace anyway, no loss there.
chainsaw
parents: 869
diff changeset
523 freq_word.hi = freq_word.hi | 0x20; // note on
4709ce4e209e [svn] Run indent -ts4 -nut -bli0 -cdw on this messy lot. Upstream is not consistent with whitespace anyway, no loss there.
chainsaw
parents: 869
diff changeset
524 set_adlib_freq (channel, freq_word);
0
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
525 }
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
526
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
527
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
528 // ----------------------------------------
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
529 // Set octave and frequency, note on
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
530 // Format: 2c nn
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
531 // c = channel, nn = packed Adlib frequency
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
532 // ----------------------------------------
955
4709ce4e209e [svn] Run indent -ts4 -nut -bli0 -cdw on this messy lot. Upstream is not consistent with whitespace anyway, no loss there.
chainsaw
parents: 869
diff changeset
533 void
4709ce4e209e [svn] Run indent -ts4 -nut -bli0 -cdw on this messy lot. Upstream is not consistent with whitespace anyway, no loss there.
chainsaw
parents: 869
diff changeset
534 Cu6mPlayer::command_2 (int channel)
0
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
535 {
955
4709ce4e209e [svn] Run indent -ts4 -nut -bli0 -cdw on this messy lot. Upstream is not consistent with whitespace anyway, no loss there.
chainsaw
parents: 869
diff changeset
536 unsigned char freq_byte;
4709ce4e209e [svn] Run indent -ts4 -nut -bli0 -cdw on this messy lot. Upstream is not consistent with whitespace anyway, no loss there.
chainsaw
parents: 869
diff changeset
537 byte_pair freq_word;
4709ce4e209e [svn] Run indent -ts4 -nut -bli0 -cdw on this messy lot. Upstream is not consistent with whitespace anyway, no loss there.
chainsaw
parents: 869
diff changeset
538
4709ce4e209e [svn] Run indent -ts4 -nut -bli0 -cdw on this messy lot. Upstream is not consistent with whitespace anyway, no loss there.
chainsaw
parents: 869
diff changeset
539 freq_byte = read_song_byte ();
4709ce4e209e [svn] Run indent -ts4 -nut -bli0 -cdw on this messy lot. Upstream is not consistent with whitespace anyway, no loss there.
chainsaw
parents: 869
diff changeset
540 freq_word = expand_freq_byte (freq_byte);
4709ce4e209e [svn] Run indent -ts4 -nut -bli0 -cdw on this messy lot. Upstream is not consistent with whitespace anyway, no loss there.
chainsaw
parents: 869
diff changeset
541 freq_word.hi = freq_word.hi | 0x20; // note on
4709ce4e209e [svn] Run indent -ts4 -nut -bli0 -cdw on this messy lot. Upstream is not consistent with whitespace anyway, no loss there.
chainsaw
parents: 869
diff changeset
542 set_adlib_freq (channel, freq_word);
0
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
543 }
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
544
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
545
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
546 // --------------------------------------
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
547 // Set "carrier mute factor"==not(volume)
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
548 // Format: 3c nn
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
549 // c = channel, nn = mute factor
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
550 // --------------------------------------
955
4709ce4e209e [svn] Run indent -ts4 -nut -bli0 -cdw on this messy lot. Upstream is not consistent with whitespace anyway, no loss there.
chainsaw
parents: 869
diff changeset
551 void
4709ce4e209e [svn] Run indent -ts4 -nut -bli0 -cdw on this messy lot. Upstream is not consistent with whitespace anyway, no loss there.
chainsaw
parents: 869
diff changeset
552 Cu6mPlayer::command_3 (int channel)
0
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
553 {
955
4709ce4e209e [svn] Run indent -ts4 -nut -bli0 -cdw on this messy lot. Upstream is not consistent with whitespace anyway, no loss there.
chainsaw
parents: 869
diff changeset
554 unsigned char mf_byte;
0
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
555
955
4709ce4e209e [svn] Run indent -ts4 -nut -bli0 -cdw on this messy lot. Upstream is not consistent with whitespace anyway, no loss there.
chainsaw
parents: 869
diff changeset
556 carrier_mf_signed_delta[channel] = 0;
4709ce4e209e [svn] Run indent -ts4 -nut -bli0 -cdw on this messy lot. Upstream is not consistent with whitespace anyway, no loss there.
chainsaw
parents: 869
diff changeset
557 mf_byte = read_song_byte ();
4709ce4e209e [svn] Run indent -ts4 -nut -bli0 -cdw on this messy lot. Upstream is not consistent with whitespace anyway, no loss there.
chainsaw
parents: 869
diff changeset
558 set_carrier_mf (channel, mf_byte);
0
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
559 }
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
560
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
561
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
562 // ----------------------------------------
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
563 // set "modulator mute factor"==not(volume)
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
564 // Format: 4c nn
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
565 // c = channel, nn = mute factor
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
566 // ----------------------------------------
955
4709ce4e209e [svn] Run indent -ts4 -nut -bli0 -cdw on this messy lot. Upstream is not consistent with whitespace anyway, no loss there.
chainsaw
parents: 869
diff changeset
567 void
4709ce4e209e [svn] Run indent -ts4 -nut -bli0 -cdw on this messy lot. Upstream is not consistent with whitespace anyway, no loss there.
chainsaw
parents: 869
diff changeset
568 Cu6mPlayer::command_4 (int channel)
0
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
569 {
955
4709ce4e209e [svn] Run indent -ts4 -nut -bli0 -cdw on this messy lot. Upstream is not consistent with whitespace anyway, no loss there.
chainsaw
parents: 869
diff changeset
570 unsigned char mf_byte;
0
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
571
955
4709ce4e209e [svn] Run indent -ts4 -nut -bli0 -cdw on this messy lot. Upstream is not consistent with whitespace anyway, no loss there.
chainsaw
parents: 869
diff changeset
572 mf_byte = read_song_byte ();
4709ce4e209e [svn] Run indent -ts4 -nut -bli0 -cdw on this messy lot. Upstream is not consistent with whitespace anyway, no loss there.
chainsaw
parents: 869
diff changeset
573 set_modulator_mf (channel, mf_byte);
0
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
574 }
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
575
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
576
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
577 // --------------------------------------------
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
578 // Set portamento (pitch slide)
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
579 // Format: 5c nn
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
580 // c = channel, nn = signed channel pitch delta
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
581 // --------------------------------------------
955
4709ce4e209e [svn] Run indent -ts4 -nut -bli0 -cdw on this messy lot. Upstream is not consistent with whitespace anyway, no loss there.
chainsaw
parents: 869
diff changeset
582 void
4709ce4e209e [svn] Run indent -ts4 -nut -bli0 -cdw on this messy lot. Upstream is not consistent with whitespace anyway, no loss there.
chainsaw
parents: 869
diff changeset
583 Cu6mPlayer::command_5 (int channel)
0
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
584 {
955
4709ce4e209e [svn] Run indent -ts4 -nut -bli0 -cdw on this messy lot. Upstream is not consistent with whitespace anyway, no loss there.
chainsaw
parents: 869
diff changeset
585 channel_freq_signed_delta[channel] = read_signed_song_byte ();
0
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
586 }
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
587
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
588
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
589 // --------------------------------------------
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
590 // Set vibrato paramters
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
591 // Format: 6c mn
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
592 // c = channel
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
593 // m = vibrato double amplitude
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
594 // n = vibrato multiplier
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
595 // --------------------------------------------
955
4709ce4e209e [svn] Run indent -ts4 -nut -bli0 -cdw on this messy lot. Upstream is not consistent with whitespace anyway, no loss there.
chainsaw
parents: 869
diff changeset
596 void
4709ce4e209e [svn] Run indent -ts4 -nut -bli0 -cdw on this messy lot. Upstream is not consistent with whitespace anyway, no loss there.
chainsaw
parents: 869
diff changeset
597 Cu6mPlayer::command_6 (int channel)
0
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
598 {
955
4709ce4e209e [svn] Run indent -ts4 -nut -bli0 -cdw on this messy lot. Upstream is not consistent with whitespace anyway, no loss there.
chainsaw
parents: 869
diff changeset
599 unsigned char vb_parameters;
0
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
600
955
4709ce4e209e [svn] Run indent -ts4 -nut -bli0 -cdw on this messy lot. Upstream is not consistent with whitespace anyway, no loss there.
chainsaw
parents: 869
diff changeset
601 vb_parameters = read_song_byte ();
4709ce4e209e [svn] Run indent -ts4 -nut -bli0 -cdw on this messy lot. Upstream is not consistent with whitespace anyway, no loss there.
chainsaw
parents: 869
diff changeset
602 vb_double_amplitude[channel] = vb_parameters >> 4; // high nibble
4709ce4e209e [svn] Run indent -ts4 -nut -bli0 -cdw on this messy lot. Upstream is not consistent with whitespace anyway, no loss there.
chainsaw
parents: 869
diff changeset
603 vb_multiplier[channel] = vb_parameters & 0xF; // low nibble
0
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
604 }
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
605
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
606
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
607 // ----------------------------------------
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
608 // Assign Adlib instrument to Adlib channel
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
609 // Format: 7c nn
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
610 // c = channel, nn = instrument number
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
611 // ----------------------------------------
955
4709ce4e209e [svn] Run indent -ts4 -nut -bli0 -cdw on this messy lot. Upstream is not consistent with whitespace anyway, no loss there.
chainsaw
parents: 869
diff changeset
612 void
4709ce4e209e [svn] Run indent -ts4 -nut -bli0 -cdw on this messy lot. Upstream is not consistent with whitespace anyway, no loss there.
chainsaw
parents: 869
diff changeset
613 Cu6mPlayer::command_7 (int channel)
0
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
614 {
955
4709ce4e209e [svn] Run indent -ts4 -nut -bli0 -cdw on this messy lot. Upstream is not consistent with whitespace anyway, no loss there.
chainsaw
parents: 869
diff changeset
615 int instrument_offset = instrument_offsets[read_song_byte ()];
4709ce4e209e [svn] Run indent -ts4 -nut -bli0 -cdw on this messy lot. Upstream is not consistent with whitespace anyway, no loss there.
chainsaw
parents: 869
diff changeset
616 out_adlib_opcell (channel, false, 0x20,
4709ce4e209e [svn] Run indent -ts4 -nut -bli0 -cdw on this messy lot. Upstream is not consistent with whitespace anyway, no loss there.
chainsaw
parents: 869
diff changeset
617 *(song_data + instrument_offset + 0));
4709ce4e209e [svn] Run indent -ts4 -nut -bli0 -cdw on this messy lot. Upstream is not consistent with whitespace anyway, no loss there.
chainsaw
parents: 869
diff changeset
618 out_adlib_opcell (channel, false, 0x40,
4709ce4e209e [svn] Run indent -ts4 -nut -bli0 -cdw on this messy lot. Upstream is not consistent with whitespace anyway, no loss there.
chainsaw
parents: 869
diff changeset
619 *(song_data + instrument_offset + 1));
4709ce4e209e [svn] Run indent -ts4 -nut -bli0 -cdw on this messy lot. Upstream is not consistent with whitespace anyway, no loss there.
chainsaw
parents: 869
diff changeset
620 out_adlib_opcell (channel, false, 0x60,
4709ce4e209e [svn] Run indent -ts4 -nut -bli0 -cdw on this messy lot. Upstream is not consistent with whitespace anyway, no loss there.
chainsaw
parents: 869
diff changeset
621 *(song_data + instrument_offset + 2));
4709ce4e209e [svn] Run indent -ts4 -nut -bli0 -cdw on this messy lot. Upstream is not consistent with whitespace anyway, no loss there.
chainsaw
parents: 869
diff changeset
622 out_adlib_opcell (channel, false, 0x80,
4709ce4e209e [svn] Run indent -ts4 -nut -bli0 -cdw on this messy lot. Upstream is not consistent with whitespace anyway, no loss there.
chainsaw
parents: 869
diff changeset
623 *(song_data + instrument_offset + 3));
4709ce4e209e [svn] Run indent -ts4 -nut -bli0 -cdw on this messy lot. Upstream is not consistent with whitespace anyway, no loss there.
chainsaw
parents: 869
diff changeset
624 out_adlib_opcell (channel, false, 0xE0,
4709ce4e209e [svn] Run indent -ts4 -nut -bli0 -cdw on this messy lot. Upstream is not consistent with whitespace anyway, no loss there.
chainsaw
parents: 869
diff changeset
625 *(song_data + instrument_offset + 4));
4709ce4e209e [svn] Run indent -ts4 -nut -bli0 -cdw on this messy lot. Upstream is not consistent with whitespace anyway, no loss there.
chainsaw
parents: 869
diff changeset
626 out_adlib_opcell (channel, true, 0x20,
4709ce4e209e [svn] Run indent -ts4 -nut -bli0 -cdw on this messy lot. Upstream is not consistent with whitespace anyway, no loss there.
chainsaw
parents: 869
diff changeset
627 *(song_data + instrument_offset + 5));
4709ce4e209e [svn] Run indent -ts4 -nut -bli0 -cdw on this messy lot. Upstream is not consistent with whitespace anyway, no loss there.
chainsaw
parents: 869
diff changeset
628 out_adlib_opcell (channel, true, 0x40,
4709ce4e209e [svn] Run indent -ts4 -nut -bli0 -cdw on this messy lot. Upstream is not consistent with whitespace anyway, no loss there.
chainsaw
parents: 869
diff changeset
629 *(song_data + instrument_offset + 6));
4709ce4e209e [svn] Run indent -ts4 -nut -bli0 -cdw on this messy lot. Upstream is not consistent with whitespace anyway, no loss there.
chainsaw
parents: 869
diff changeset
630 out_adlib_opcell (channel, true, 0x60,
4709ce4e209e [svn] Run indent -ts4 -nut -bli0 -cdw on this messy lot. Upstream is not consistent with whitespace anyway, no loss there.
chainsaw
parents: 869
diff changeset
631 *(song_data + instrument_offset + 7));
4709ce4e209e [svn] Run indent -ts4 -nut -bli0 -cdw on this messy lot. Upstream is not consistent with whitespace anyway, no loss there.
chainsaw
parents: 869
diff changeset
632 out_adlib_opcell (channel, true, 0x80,
4709ce4e209e [svn] Run indent -ts4 -nut -bli0 -cdw on this messy lot. Upstream is not consistent with whitespace anyway, no loss there.
chainsaw
parents: 869
diff changeset
633 *(song_data + instrument_offset + 8));
4709ce4e209e [svn] Run indent -ts4 -nut -bli0 -cdw on this messy lot. Upstream is not consistent with whitespace anyway, no loss there.
chainsaw
parents: 869
diff changeset
634 out_adlib_opcell (channel, true, 0xE0,
4709ce4e209e [svn] Run indent -ts4 -nut -bli0 -cdw on this messy lot. Upstream is not consistent with whitespace anyway, no loss there.
chainsaw
parents: 869
diff changeset
635 *(song_data + instrument_offset + 9));
4709ce4e209e [svn] Run indent -ts4 -nut -bli0 -cdw on this messy lot. Upstream is not consistent with whitespace anyway, no loss there.
chainsaw
parents: 869
diff changeset
636 out_adlib (0xC0 + channel, *(song_data + instrument_offset + 10));
0
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
637 }
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
638
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
639
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
640 // -------------------------------------------
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
641 // Branch to a new subsong
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
642 // Format: 81 nn aa bb
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
643 // nn == number of times to repeat the subsong
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
644 // aa == subsong offset (low byte)
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
645 // bb == subsong offset (high byte)
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
646 // -------------------------------------------
955
4709ce4e209e [svn] Run indent -ts4 -nut -bli0 -cdw on this messy lot. Upstream is not consistent with whitespace anyway, no loss there.
chainsaw
parents: 869
diff changeset
647 void
4709ce4e209e [svn] Run indent -ts4 -nut -bli0 -cdw on this messy lot. Upstream is not consistent with whitespace anyway, no loss there.
chainsaw
parents: 869
diff changeset
648 Cu6mPlayer::command_81 ()
0
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
649 {
955
4709ce4e209e [svn] Run indent -ts4 -nut -bli0 -cdw on this messy lot. Upstream is not consistent with whitespace anyway, no loss there.
chainsaw
parents: 869
diff changeset
650 subsong_info new_ss_info;
0
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
651
955
4709ce4e209e [svn] Run indent -ts4 -nut -bli0 -cdw on this messy lot. Upstream is not consistent with whitespace anyway, no loss there.
chainsaw
parents: 869
diff changeset
652 new_ss_info.subsong_repetitions = read_song_byte ();
4709ce4e209e [svn] Run indent -ts4 -nut -bli0 -cdw on this messy lot. Upstream is not consistent with whitespace anyway, no loss there.
chainsaw
parents: 869
diff changeset
653 new_ss_info.subsong_start = read_song_byte ();
4709ce4e209e [svn] Run indent -ts4 -nut -bli0 -cdw on this messy lot. Upstream is not consistent with whitespace anyway, no loss there.
chainsaw
parents: 869
diff changeset
654 new_ss_info.subsong_start += read_song_byte () << 8;
4709ce4e209e [svn] Run indent -ts4 -nut -bli0 -cdw on this messy lot. Upstream is not consistent with whitespace anyway, no loss there.
chainsaw
parents: 869
diff changeset
655 new_ss_info.continue_pos = song_pos;
4709ce4e209e [svn] Run indent -ts4 -nut -bli0 -cdw on this messy lot. Upstream is not consistent with whitespace anyway, no loss there.
chainsaw
parents: 869
diff changeset
656
4709ce4e209e [svn] Run indent -ts4 -nut -bli0 -cdw on this messy lot. Upstream is not consistent with whitespace anyway, no loss there.
chainsaw
parents: 869
diff changeset
657 subsong_stack.push (new_ss_info);
4709ce4e209e [svn] Run indent -ts4 -nut -bli0 -cdw on this messy lot. Upstream is not consistent with whitespace anyway, no loss there.
chainsaw
parents: 869
diff changeset
658 song_pos = new_ss_info.subsong_start;
0
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
659 }
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
660
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
661
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
662 // ------------------------------------------------------------
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
663 // Stop interpreting commands for this timer tick
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
664 // Format: 82 nn
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
665 // nn == delay (in timer ticks) until further data will be read
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
666 // ------------------------------------------------------------
955
4709ce4e209e [svn] Run indent -ts4 -nut -bli0 -cdw on this messy lot. Upstream is not consistent with whitespace anyway, no loss there.
chainsaw
parents: 869
diff changeset
667 void
4709ce4e209e [svn] Run indent -ts4 -nut -bli0 -cdw on this messy lot. Upstream is not consistent with whitespace anyway, no loss there.
chainsaw
parents: 869
diff changeset
668 Cu6mPlayer::command_82 ()
0
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
669 {
955
4709ce4e209e [svn] Run indent -ts4 -nut -bli0 -cdw on this messy lot. Upstream is not consistent with whitespace anyway, no loss there.
chainsaw
parents: 869
diff changeset
670 read_delay = read_song_byte ();
0
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
671 }
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
672
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
673
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
674 // -----------------------------
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
675 // Adlib instrument data follows
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
676 // Format: 83 nn <11 bytes>
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
677 // nn == instrument number
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
678 // -----------------------------
955
4709ce4e209e [svn] Run indent -ts4 -nut -bli0 -cdw on this messy lot. Upstream is not consistent with whitespace anyway, no loss there.
chainsaw
parents: 869
diff changeset
679 void
4709ce4e209e [svn] Run indent -ts4 -nut -bli0 -cdw on this messy lot. Upstream is not consistent with whitespace anyway, no loss there.
chainsaw
parents: 869
diff changeset
680 Cu6mPlayer::command_83 ()
0
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
681 {
955
4709ce4e209e [svn] Run indent -ts4 -nut -bli0 -cdw on this messy lot. Upstream is not consistent with whitespace anyway, no loss there.
chainsaw
parents: 869
diff changeset
682 unsigned char instrument_number = read_song_byte ();
4709ce4e209e [svn] Run indent -ts4 -nut -bli0 -cdw on this messy lot. Upstream is not consistent with whitespace anyway, no loss there.
chainsaw
parents: 869
diff changeset
683 instrument_offsets[instrument_number] = song_pos;
4709ce4e209e [svn] Run indent -ts4 -nut -bli0 -cdw on this messy lot. Upstream is not consistent with whitespace anyway, no loss there.
chainsaw
parents: 869
diff changeset
684 song_pos += 11;
0
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
685 }
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
686
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
687
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
688 // ----------------------------------------------
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
689 // Set -1 mute factor slide (upward volume slide)
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
690 // Format: 85 cn
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
691 // c == channel
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
692 // n == slide delay
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
693 // ----------------------------------------------
955
4709ce4e209e [svn] Run indent -ts4 -nut -bli0 -cdw on this messy lot. Upstream is not consistent with whitespace anyway, no loss there.
chainsaw
parents: 869
diff changeset
694 void
4709ce4e209e [svn] Run indent -ts4 -nut -bli0 -cdw on this messy lot. Upstream is not consistent with whitespace anyway, no loss there.
chainsaw
parents: 869
diff changeset
695 Cu6mPlayer::command_85 ()
0
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
696 {
955
4709ce4e209e [svn] Run indent -ts4 -nut -bli0 -cdw on this messy lot. Upstream is not consistent with whitespace anyway, no loss there.
chainsaw
parents: 869
diff changeset
697 unsigned char data_byte = read_song_byte ();
4709ce4e209e [svn] Run indent -ts4 -nut -bli0 -cdw on this messy lot. Upstream is not consistent with whitespace anyway, no loss there.
chainsaw
parents: 869
diff changeset
698 int channel = data_byte >> 4; // high nibble
4709ce4e209e [svn] Run indent -ts4 -nut -bli0 -cdw on this messy lot. Upstream is not consistent with whitespace anyway, no loss there.
chainsaw
parents: 869
diff changeset
699 unsigned char slide_delay = data_byte & 0xF; // low nibble
4709ce4e209e [svn] Run indent -ts4 -nut -bli0 -cdw on this messy lot. Upstream is not consistent with whitespace anyway, no loss there.
chainsaw
parents: 869
diff changeset
700 carrier_mf_signed_delta[channel] = +1;
4709ce4e209e [svn] Run indent -ts4 -nut -bli0 -cdw on this messy lot. Upstream is not consistent with whitespace anyway, no loss there.
chainsaw
parents: 869
diff changeset
701 carrier_mf_mod_delay[channel] = slide_delay + 1;
4709ce4e209e [svn] Run indent -ts4 -nut -bli0 -cdw on this messy lot. Upstream is not consistent with whitespace anyway, no loss there.
chainsaw
parents: 869
diff changeset
702 carrier_mf_mod_delay_backup[channel] = slide_delay + 1;
0
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
703 }
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
704
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
705
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
706 // ------------------------------------------------
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
707 // Set +1 mute factor slide (downward volume slide)
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
708 // Format: 86 cn
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
709 // c == channel
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
710 // n == slide speed
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
711 // ------------------------------------------------
955
4709ce4e209e [svn] Run indent -ts4 -nut -bli0 -cdw on this messy lot. Upstream is not consistent with whitespace anyway, no loss there.
chainsaw
parents: 869
diff changeset
712 void
4709ce4e209e [svn] Run indent -ts4 -nut -bli0 -cdw on this messy lot. Upstream is not consistent with whitespace anyway, no loss there.
chainsaw
parents: 869
diff changeset
713 Cu6mPlayer::command_86 ()
0
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
714 {
955
4709ce4e209e [svn] Run indent -ts4 -nut -bli0 -cdw on this messy lot. Upstream is not consistent with whitespace anyway, no loss there.
chainsaw
parents: 869
diff changeset
715 unsigned char data_byte = read_song_byte ();
4709ce4e209e [svn] Run indent -ts4 -nut -bli0 -cdw on this messy lot. Upstream is not consistent with whitespace anyway, no loss there.
chainsaw
parents: 869
diff changeset
716 int channel = data_byte >> 4; // high nibble
4709ce4e209e [svn] Run indent -ts4 -nut -bli0 -cdw on this messy lot. Upstream is not consistent with whitespace anyway, no loss there.
chainsaw
parents: 869
diff changeset
717 unsigned char slide_delay = data_byte & 0xF; // low nibble
4709ce4e209e [svn] Run indent -ts4 -nut -bli0 -cdw on this messy lot. Upstream is not consistent with whitespace anyway, no loss there.
chainsaw
parents: 869
diff changeset
718 carrier_mf_signed_delta[channel] = -1;
4709ce4e209e [svn] Run indent -ts4 -nut -bli0 -cdw on this messy lot. Upstream is not consistent with whitespace anyway, no loss there.
chainsaw
parents: 869
diff changeset
719 carrier_mf_mod_delay[channel] = slide_delay + 1;
4709ce4e209e [svn] Run indent -ts4 -nut -bli0 -cdw on this messy lot. Upstream is not consistent with whitespace anyway, no loss there.
chainsaw
parents: 869
diff changeset
720 carrier_mf_mod_delay_backup[channel] = slide_delay + 1;
0
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
721 }
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
722
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
723
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
724 // --------------
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
725 // Set loop point
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
726 // Format: E?
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
727 // --------------
955
4709ce4e209e [svn] Run indent -ts4 -nut -bli0 -cdw on this messy lot. Upstream is not consistent with whitespace anyway, no loss there.
chainsaw
parents: 869
diff changeset
728 void
4709ce4e209e [svn] Run indent -ts4 -nut -bli0 -cdw on this messy lot. Upstream is not consistent with whitespace anyway, no loss there.
chainsaw
parents: 869
diff changeset
729 Cu6mPlayer::command_E ()
0
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
730 {
955
4709ce4e209e [svn] Run indent -ts4 -nut -bli0 -cdw on this messy lot. Upstream is not consistent with whitespace anyway, no loss there.
chainsaw
parents: 869
diff changeset
731 loop_position = song_pos;
0
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
732 }
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
733
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
734
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
735 // ---------------------------
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
736 // Return from current subsong
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
737 // Format: F?
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
738 // ---------------------------
955
4709ce4e209e [svn] Run indent -ts4 -nut -bli0 -cdw on this messy lot. Upstream is not consistent with whitespace anyway, no loss there.
chainsaw
parents: 869
diff changeset
739 void
4709ce4e209e [svn] Run indent -ts4 -nut -bli0 -cdw on this messy lot. Upstream is not consistent with whitespace anyway, no loss there.
chainsaw
parents: 869
diff changeset
740 Cu6mPlayer::command_F ()
0
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
741 {
955
4709ce4e209e [svn] Run indent -ts4 -nut -bli0 -cdw on this messy lot. Upstream is not consistent with whitespace anyway, no loss there.
chainsaw
parents: 869
diff changeset
742 if (!subsong_stack.empty ())
4709ce4e209e [svn] Run indent -ts4 -nut -bli0 -cdw on this messy lot. Upstream is not consistent with whitespace anyway, no loss there.
chainsaw
parents: 869
diff changeset
743 {
4709ce4e209e [svn] Run indent -ts4 -nut -bli0 -cdw on this messy lot. Upstream is not consistent with whitespace anyway, no loss there.
chainsaw
parents: 869
diff changeset
744 subsong_info temp = subsong_stack.top ();
4709ce4e209e [svn] Run indent -ts4 -nut -bli0 -cdw on this messy lot. Upstream is not consistent with whitespace anyway, no loss there.
chainsaw
parents: 869
diff changeset
745 subsong_stack.pop ();
4709ce4e209e [svn] Run indent -ts4 -nut -bli0 -cdw on this messy lot. Upstream is not consistent with whitespace anyway, no loss there.
chainsaw
parents: 869
diff changeset
746 temp.subsong_repetitions--;
4709ce4e209e [svn] Run indent -ts4 -nut -bli0 -cdw on this messy lot. Upstream is not consistent with whitespace anyway, no loss there.
chainsaw
parents: 869
diff changeset
747 if (temp.subsong_repetitions == 0)
0
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
748 {
955
4709ce4e209e [svn] Run indent -ts4 -nut -bli0 -cdw on this messy lot. Upstream is not consistent with whitespace anyway, no loss there.
chainsaw
parents: 869
diff changeset
749 song_pos = temp.continue_pos;
0
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
750 }
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
751 else
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
752 {
955
4709ce4e209e [svn] Run indent -ts4 -nut -bli0 -cdw on this messy lot. Upstream is not consistent with whitespace anyway, no loss there.
chainsaw
parents: 869
diff changeset
753 song_pos = temp.subsong_start;
4709ce4e209e [svn] Run indent -ts4 -nut -bli0 -cdw on this messy lot. Upstream is not consistent with whitespace anyway, no loss there.
chainsaw
parents: 869
diff changeset
754 subsong_stack.push (temp);
0
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
755 }
955
4709ce4e209e [svn] Run indent -ts4 -nut -bli0 -cdw on this messy lot. Upstream is not consistent with whitespace anyway, no loss there.
chainsaw
parents: 869
diff changeset
756 }
4709ce4e209e [svn] Run indent -ts4 -nut -bli0 -cdw on this messy lot. Upstream is not consistent with whitespace anyway, no loss there.
chainsaw
parents: 869
diff changeset
757 else
4709ce4e209e [svn] Run indent -ts4 -nut -bli0 -cdw on this messy lot. Upstream is not consistent with whitespace anyway, no loss there.
chainsaw
parents: 869
diff changeset
758 {
4709ce4e209e [svn] Run indent -ts4 -nut -bli0 -cdw on this messy lot. Upstream is not consistent with whitespace anyway, no loss there.
chainsaw
parents: 869
diff changeset
759 song_pos = loop_position;
4709ce4e209e [svn] Run indent -ts4 -nut -bli0 -cdw on this messy lot. Upstream is not consistent with whitespace anyway, no loss there.
chainsaw
parents: 869
diff changeset
760 songend = true;
4709ce4e209e [svn] Run indent -ts4 -nut -bli0 -cdw on this messy lot. Upstream is not consistent with whitespace anyway, no loss there.
chainsaw
parents: 869
diff changeset
761 }
0
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
762 }
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
763
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
764
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
765 // --------------------
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
766 // Additional functions
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
767 // --------------------
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
768
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
769 // This function decrements its argument, without allowing it to become negative.
955
4709ce4e209e [svn] Run indent -ts4 -nut -bli0 -cdw on this messy lot. Upstream is not consistent with whitespace anyway, no loss there.
chainsaw
parents: 869
diff changeset
770 void
4709ce4e209e [svn] Run indent -ts4 -nut -bli0 -cdw on this messy lot. Upstream is not consistent with whitespace anyway, no loss there.
chainsaw
parents: 869
diff changeset
771 Cu6mPlayer::dec_clip (int &param)
0
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
772 {
955
4709ce4e209e [svn] Run indent -ts4 -nut -bli0 -cdw on this messy lot. Upstream is not consistent with whitespace anyway, no loss there.
chainsaw
parents: 869
diff changeset
773 param--;
4709ce4e209e [svn] Run indent -ts4 -nut -bli0 -cdw on this messy lot. Upstream is not consistent with whitespace anyway, no loss there.
chainsaw
parents: 869
diff changeset
774 if (param < 0)
4709ce4e209e [svn] Run indent -ts4 -nut -bli0 -cdw on this messy lot. Upstream is not consistent with whitespace anyway, no loss there.
chainsaw
parents: 869
diff changeset
775 {
4709ce4e209e [svn] Run indent -ts4 -nut -bli0 -cdw on this messy lot. Upstream is not consistent with whitespace anyway, no loss there.
chainsaw
parents: 869
diff changeset
776 param = 0;
4709ce4e209e [svn] Run indent -ts4 -nut -bli0 -cdw on this messy lot. Upstream is not consistent with whitespace anyway, no loss there.
chainsaw
parents: 869
diff changeset
777 }
0
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
778 }
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
779
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
780
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
781 // Returns the byte at the current song position.
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
782 // Side effect: increments song_pos.
955
4709ce4e209e [svn] Run indent -ts4 -nut -bli0 -cdw on this messy lot. Upstream is not consistent with whitespace anyway, no loss there.
chainsaw
parents: 869
diff changeset
783 unsigned char
4709ce4e209e [svn] Run indent -ts4 -nut -bli0 -cdw on this messy lot. Upstream is not consistent with whitespace anyway, no loss there.
chainsaw
parents: 869
diff changeset
784 Cu6mPlayer::read_song_byte ()
0
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
785 {
955
4709ce4e209e [svn] Run indent -ts4 -nut -bli0 -cdw on this messy lot. Upstream is not consistent with whitespace anyway, no loss there.
chainsaw
parents: 869
diff changeset
786 unsigned char song_byte;
4709ce4e209e [svn] Run indent -ts4 -nut -bli0 -cdw on this messy lot. Upstream is not consistent with whitespace anyway, no loss there.
chainsaw
parents: 869
diff changeset
787 song_byte = song_data[song_pos];
4709ce4e209e [svn] Run indent -ts4 -nut -bli0 -cdw on this messy lot. Upstream is not consistent with whitespace anyway, no loss there.
chainsaw
parents: 869
diff changeset
788 song_pos++;
4709ce4e209e [svn] Run indent -ts4 -nut -bli0 -cdw on this messy lot. Upstream is not consistent with whitespace anyway, no loss there.
chainsaw
parents: 869
diff changeset
789 return (song_byte);
0
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
790 }
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
791
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
792
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
793 // Same as read_song_byte(), except that it returns a signed byte
955
4709ce4e209e [svn] Run indent -ts4 -nut -bli0 -cdw on this messy lot. Upstream is not consistent with whitespace anyway, no loss there.
chainsaw
parents: 869
diff changeset
794 signed char
4709ce4e209e [svn] Run indent -ts4 -nut -bli0 -cdw on this messy lot. Upstream is not consistent with whitespace anyway, no loss there.
chainsaw
parents: 869
diff changeset
795 Cu6mPlayer::read_signed_song_byte ()
0
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
796 {
955
4709ce4e209e [svn] Run indent -ts4 -nut -bli0 -cdw on this messy lot. Upstream is not consistent with whitespace anyway, no loss there.
chainsaw
parents: 869
diff changeset
797 unsigned char song_byte;
4709ce4e209e [svn] Run indent -ts4 -nut -bli0 -cdw on this messy lot. Upstream is not consistent with whitespace anyway, no loss there.
chainsaw
parents: 869
diff changeset
798 int signed_value;
4709ce4e209e [svn] Run indent -ts4 -nut -bli0 -cdw on this messy lot. Upstream is not consistent with whitespace anyway, no loss there.
chainsaw
parents: 869
diff changeset
799 song_byte = *(song_data + song_pos);
4709ce4e209e [svn] Run indent -ts4 -nut -bli0 -cdw on this messy lot. Upstream is not consistent with whitespace anyway, no loss there.
chainsaw
parents: 869
diff changeset
800 song_pos++;
4709ce4e209e [svn] Run indent -ts4 -nut -bli0 -cdw on this messy lot. Upstream is not consistent with whitespace anyway, no loss there.
chainsaw
parents: 869
diff changeset
801 if (song_byte <= 127)
4709ce4e209e [svn] Run indent -ts4 -nut -bli0 -cdw on this messy lot. Upstream is not consistent with whitespace anyway, no loss there.
chainsaw
parents: 869
diff changeset
802 {
4709ce4e209e [svn] Run indent -ts4 -nut -bli0 -cdw on this messy lot. Upstream is not consistent with whitespace anyway, no loss there.
chainsaw
parents: 869
diff changeset
803 signed_value = song_byte;
4709ce4e209e [svn] Run indent -ts4 -nut -bli0 -cdw on this messy lot. Upstream is not consistent with whitespace anyway, no loss there.
chainsaw
parents: 869
diff changeset
804 }
4709ce4e209e [svn] Run indent -ts4 -nut -bli0 -cdw on this messy lot. Upstream is not consistent with whitespace anyway, no loss there.
chainsaw
parents: 869
diff changeset
805 else
4709ce4e209e [svn] Run indent -ts4 -nut -bli0 -cdw on this messy lot. Upstream is not consistent with whitespace anyway, no loss there.
chainsaw
parents: 869
diff changeset
806 {
4709ce4e209e [svn] Run indent -ts4 -nut -bli0 -cdw on this messy lot. Upstream is not consistent with whitespace anyway, no loss there.
chainsaw
parents: 869
diff changeset
807 signed_value = (int) song_byte - 0x100;
4709ce4e209e [svn] Run indent -ts4 -nut -bli0 -cdw on this messy lot. Upstream is not consistent with whitespace anyway, no loss there.
chainsaw
parents: 869
diff changeset
808 }
4709ce4e209e [svn] Run indent -ts4 -nut -bli0 -cdw on this messy lot. Upstream is not consistent with whitespace anyway, no loss there.
chainsaw
parents: 869
diff changeset
809 return ((signed char) signed_value);
0
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
810 }
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
811
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
812
955
4709ce4e209e [svn] Run indent -ts4 -nut -bli0 -cdw on this messy lot. Upstream is not consistent with whitespace anyway, no loss there.
chainsaw
parents: 869
diff changeset
813 Cu6mPlayer::byte_pair Cu6mPlayer::expand_freq_byte (unsigned char freq_byte)
0
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
814 {
955
4709ce4e209e [svn] Run indent -ts4 -nut -bli0 -cdw on this messy lot. Upstream is not consistent with whitespace anyway, no loss there.
chainsaw
parents: 869
diff changeset
815 const byte_pair
4709ce4e209e [svn] Run indent -ts4 -nut -bli0 -cdw on this messy lot. Upstream is not consistent with whitespace anyway, no loss there.
chainsaw
parents: 869
diff changeset
816 freq_table[24] = {
4709ce4e209e [svn] Run indent -ts4 -nut -bli0 -cdw on this messy lot. Upstream is not consistent with whitespace anyway, no loss there.
chainsaw
parents: 869
diff changeset
817 {0x00, 0x00}, {0x58, 0x01}, {0x82, 0x01}, {0xB0, 0x01},
4709ce4e209e [svn] Run indent -ts4 -nut -bli0 -cdw on this messy lot. Upstream is not consistent with whitespace anyway, no loss there.
chainsaw
parents: 869
diff changeset
818 {0xCC, 0x01}, {0x03, 0x02}, {0x41, 0x02}, {0x86, 0x02},
4709ce4e209e [svn] Run indent -ts4 -nut -bli0 -cdw on this messy lot. Upstream is not consistent with whitespace anyway, no loss there.
chainsaw
parents: 869
diff changeset
819 {0x00, 0x00}, {0x6A, 0x01}, {0x96, 0x01}, {0xC7, 0x01},
4709ce4e209e [svn] Run indent -ts4 -nut -bli0 -cdw on this messy lot. Upstream is not consistent with whitespace anyway, no loss there.
chainsaw
parents: 869
diff changeset
820 {0xE4, 0x01}, {0x1E, 0x02}, {0x5F, 0x02}, {0xA8, 0x02},
4709ce4e209e [svn] Run indent -ts4 -nut -bli0 -cdw on this messy lot. Upstream is not consistent with whitespace anyway, no loss there.
chainsaw
parents: 869
diff changeset
821 {0x00, 0x00}, {0x47, 0x01}, {0x6E, 0x01}, {0x9A, 0x01},
4709ce4e209e [svn] Run indent -ts4 -nut -bli0 -cdw on this messy lot. Upstream is not consistent with whitespace anyway, no loss there.
chainsaw
parents: 869
diff changeset
822 {0xB5, 0x01}, {0xE9, 0x01}, {0x24, 0x02}, {0x66, 0x02}
4709ce4e209e [svn] Run indent -ts4 -nut -bli0 -cdw on this messy lot. Upstream is not consistent with whitespace anyway, no loss there.
chainsaw
parents: 869
diff changeset
823 };
0
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
824
955
4709ce4e209e [svn] Run indent -ts4 -nut -bli0 -cdw on this messy lot. Upstream is not consistent with whitespace anyway, no loss there.
chainsaw
parents: 869
diff changeset
825 int
4709ce4e209e [svn] Run indent -ts4 -nut -bli0 -cdw on this messy lot. Upstream is not consistent with whitespace anyway, no loss there.
chainsaw
parents: 869
diff changeset
826 packed_freq;
4709ce4e209e [svn] Run indent -ts4 -nut -bli0 -cdw on this messy lot. Upstream is not consistent with whitespace anyway, no loss there.
chainsaw
parents: 869
diff changeset
827 int
4709ce4e209e [svn] Run indent -ts4 -nut -bli0 -cdw on this messy lot. Upstream is not consistent with whitespace anyway, no loss there.
chainsaw
parents: 869
diff changeset
828 octave;
4709ce4e209e [svn] Run indent -ts4 -nut -bli0 -cdw on this messy lot. Upstream is not consistent with whitespace anyway, no loss there.
chainsaw
parents: 869
diff changeset
829 byte_pair
4709ce4e209e [svn] Run indent -ts4 -nut -bli0 -cdw on this messy lot. Upstream is not consistent with whitespace anyway, no loss there.
chainsaw
parents: 869
diff changeset
830 freq_word;
0
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
831
955
4709ce4e209e [svn] Run indent -ts4 -nut -bli0 -cdw on this messy lot. Upstream is not consistent with whitespace anyway, no loss there.
chainsaw
parents: 869
diff changeset
832 packed_freq = freq_byte & 0x1F;
4709ce4e209e [svn] Run indent -ts4 -nut -bli0 -cdw on this messy lot. Upstream is not consistent with whitespace anyway, no loss there.
chainsaw
parents: 869
diff changeset
833 octave = freq_byte >> 5;
0
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
834
955
4709ce4e209e [svn] Run indent -ts4 -nut -bli0 -cdw on this messy lot. Upstream is not consistent with whitespace anyway, no loss there.
chainsaw
parents: 869
diff changeset
835 // range check (not present in the original U6 music driver)
4709ce4e209e [svn] Run indent -ts4 -nut -bli0 -cdw on this messy lot. Upstream is not consistent with whitespace anyway, no loss there.
chainsaw
parents: 869
diff changeset
836 if (packed_freq >= 24)
4709ce4e209e [svn] Run indent -ts4 -nut -bli0 -cdw on this messy lot. Upstream is not consistent with whitespace anyway, no loss there.
chainsaw
parents: 869
diff changeset
837 {
4709ce4e209e [svn] Run indent -ts4 -nut -bli0 -cdw on this messy lot. Upstream is not consistent with whitespace anyway, no loss there.
chainsaw
parents: 869
diff changeset
838 packed_freq = 0;
4709ce4e209e [svn] Run indent -ts4 -nut -bli0 -cdw on this messy lot. Upstream is not consistent with whitespace anyway, no loss there.
chainsaw
parents: 869
diff changeset
839 }
0
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
840
955
4709ce4e209e [svn] Run indent -ts4 -nut -bli0 -cdw on this messy lot. Upstream is not consistent with whitespace anyway, no loss there.
chainsaw
parents: 869
diff changeset
841 freq_word.hi = freq_table[packed_freq].hi + (octave << 2);
4709ce4e209e [svn] Run indent -ts4 -nut -bli0 -cdw on this messy lot. Upstream is not consistent with whitespace anyway, no loss there.
chainsaw
parents: 869
diff changeset
842 freq_word.lo = freq_table[packed_freq].lo;
0
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
843
955
4709ce4e209e [svn] Run indent -ts4 -nut -bli0 -cdw on this messy lot. Upstream is not consistent with whitespace anyway, no loss there.
chainsaw
parents: 869
diff changeset
844 return (freq_word);
0
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
845 }
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
846
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
847
955
4709ce4e209e [svn] Run indent -ts4 -nut -bli0 -cdw on this messy lot. Upstream is not consistent with whitespace anyway, no loss there.
chainsaw
parents: 869
diff changeset
848 void
4709ce4e209e [svn] Run indent -ts4 -nut -bli0 -cdw on this messy lot. Upstream is not consistent with whitespace anyway, no loss there.
chainsaw
parents: 869
diff changeset
849 Cu6mPlayer::set_adlib_freq (int channel, Cu6mPlayer::byte_pair freq_word)
0
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
850 {
955
4709ce4e209e [svn] Run indent -ts4 -nut -bli0 -cdw on this messy lot. Upstream is not consistent with whitespace anyway, no loss there.
chainsaw
parents: 869
diff changeset
851 out_adlib (0xA0 + channel, freq_word.lo);
4709ce4e209e [svn] Run indent -ts4 -nut -bli0 -cdw on this messy lot. Upstream is not consistent with whitespace anyway, no loss there.
chainsaw
parents: 869
diff changeset
852 out_adlib (0xB0 + channel, freq_word.hi);
4709ce4e209e [svn] Run indent -ts4 -nut -bli0 -cdw on this messy lot. Upstream is not consistent with whitespace anyway, no loss there.
chainsaw
parents: 869
diff changeset
853 // update the Adlib register backups
4709ce4e209e [svn] Run indent -ts4 -nut -bli0 -cdw on this messy lot. Upstream is not consistent with whitespace anyway, no loss there.
chainsaw
parents: 869
diff changeset
854 channel_freq[channel] = freq_word;
0
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
855 }
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
856
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
857
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
858 // this function sets the Adlib frequency, but does not update the register backups
955
4709ce4e209e [svn] Run indent -ts4 -nut -bli0 -cdw on this messy lot. Upstream is not consistent with whitespace anyway, no loss there.
chainsaw
parents: 869
diff changeset
859 void
4709ce4e209e [svn] Run indent -ts4 -nut -bli0 -cdw on this messy lot. Upstream is not consistent with whitespace anyway, no loss there.
chainsaw
parents: 869
diff changeset
860 Cu6mPlayer::set_adlib_freq_no_update (int channel,
4709ce4e209e [svn] Run indent -ts4 -nut -bli0 -cdw on this messy lot. Upstream is not consistent with whitespace anyway, no loss there.
chainsaw
parents: 869
diff changeset
861 Cu6mPlayer::byte_pair freq_word)
0
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
862 {
955
4709ce4e209e [svn] Run indent -ts4 -nut -bli0 -cdw on this messy lot. Upstream is not consistent with whitespace anyway, no loss there.
chainsaw
parents: 869
diff changeset
863 out_adlib (0xA0 + channel, freq_word.lo);
4709ce4e209e [svn] Run indent -ts4 -nut -bli0 -cdw on this messy lot. Upstream is not consistent with whitespace anyway, no loss there.
chainsaw
parents: 869
diff changeset
864 out_adlib (0xB0 + channel, freq_word.hi);
0
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
865 }
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
866
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
867
955
4709ce4e209e [svn] Run indent -ts4 -nut -bli0 -cdw on this messy lot. Upstream is not consistent with whitespace anyway, no loss there.
chainsaw
parents: 869
diff changeset
868 void
4709ce4e209e [svn] Run indent -ts4 -nut -bli0 -cdw on this messy lot. Upstream is not consistent with whitespace anyway, no loss there.
chainsaw
parents: 869
diff changeset
869 Cu6mPlayer::set_carrier_mf (int channel, unsigned char mute_factor)
0
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
870 {
955
4709ce4e209e [svn] Run indent -ts4 -nut -bli0 -cdw on this messy lot. Upstream is not consistent with whitespace anyway, no loss there.
chainsaw
parents: 869
diff changeset
871 out_adlib_opcell (channel, true, 0x40, mute_factor);
4709ce4e209e [svn] Run indent -ts4 -nut -bli0 -cdw on this messy lot. Upstream is not consistent with whitespace anyway, no loss there.
chainsaw
parents: 869
diff changeset
872 carrier_mf[channel] = mute_factor;
0
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
873 }
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
874
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
875
955
4709ce4e209e [svn] Run indent -ts4 -nut -bli0 -cdw on this messy lot. Upstream is not consistent with whitespace anyway, no loss there.
chainsaw
parents: 869
diff changeset
876 void
4709ce4e209e [svn] Run indent -ts4 -nut -bli0 -cdw on this messy lot. Upstream is not consistent with whitespace anyway, no loss there.
chainsaw
parents: 869
diff changeset
877 Cu6mPlayer::set_modulator_mf (int channel, unsigned char mute_factor)
0
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
878 {
955
4709ce4e209e [svn] Run indent -ts4 -nut -bli0 -cdw on this messy lot. Upstream is not consistent with whitespace anyway, no loss there.
chainsaw
parents: 869
diff changeset
879 out_adlib_opcell (channel, false, 0x40, mute_factor);
0
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
880 }
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
881
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
882
955
4709ce4e209e [svn] Run indent -ts4 -nut -bli0 -cdw on this messy lot. Upstream is not consistent with whitespace anyway, no loss there.
chainsaw
parents: 869
diff changeset
883 void
4709ce4e209e [svn] Run indent -ts4 -nut -bli0 -cdw on this messy lot. Upstream is not consistent with whitespace anyway, no loss there.
chainsaw
parents: 869
diff changeset
884 Cu6mPlayer::freq_slide (int channel)
0
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
885 {
955
4709ce4e209e [svn] Run indent -ts4 -nut -bli0 -cdw on this messy lot. Upstream is not consistent with whitespace anyway, no loss there.
chainsaw
parents: 869
diff changeset
886 byte_pair freq = channel_freq[channel];
0
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
887
955
4709ce4e209e [svn] Run indent -ts4 -nut -bli0 -cdw on this messy lot. Upstream is not consistent with whitespace anyway, no loss there.
chainsaw
parents: 869
diff changeset
888 long freq_word =
4709ce4e209e [svn] Run indent -ts4 -nut -bli0 -cdw on this messy lot. Upstream is not consistent with whitespace anyway, no loss there.
chainsaw
parents: 869
diff changeset
889 freq.lo + (freq.hi << 8) + channel_freq_signed_delta[channel];
4709ce4e209e [svn] Run indent -ts4 -nut -bli0 -cdw on this messy lot. Upstream is not consistent with whitespace anyway, no loss there.
chainsaw
parents: 869
diff changeset
890 if (freq_word < 0)
4709ce4e209e [svn] Run indent -ts4 -nut -bli0 -cdw on this messy lot. Upstream is not consistent with whitespace anyway, no loss there.
chainsaw
parents: 869
diff changeset
891 {
4709ce4e209e [svn] Run indent -ts4 -nut -bli0 -cdw on this messy lot. Upstream is not consistent with whitespace anyway, no loss there.
chainsaw
parents: 869
diff changeset
892 freq_word += 0x10000;
4709ce4e209e [svn] Run indent -ts4 -nut -bli0 -cdw on this messy lot. Upstream is not consistent with whitespace anyway, no loss there.
chainsaw
parents: 869
diff changeset
893 }
4709ce4e209e [svn] Run indent -ts4 -nut -bli0 -cdw on this messy lot. Upstream is not consistent with whitespace anyway, no loss there.
chainsaw
parents: 869
diff changeset
894 if (freq_word > 0xFFFF)
4709ce4e209e [svn] Run indent -ts4 -nut -bli0 -cdw on this messy lot. Upstream is not consistent with whitespace anyway, no loss there.
chainsaw
parents: 869
diff changeset
895 {
4709ce4e209e [svn] Run indent -ts4 -nut -bli0 -cdw on this messy lot. Upstream is not consistent with whitespace anyway, no loss there.
chainsaw
parents: 869
diff changeset
896 freq_word -= 0x10000;
4709ce4e209e [svn] Run indent -ts4 -nut -bli0 -cdw on this messy lot. Upstream is not consistent with whitespace anyway, no loss there.
chainsaw
parents: 869
diff changeset
897 }
0
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
898
955
4709ce4e209e [svn] Run indent -ts4 -nut -bli0 -cdw on this messy lot. Upstream is not consistent with whitespace anyway, no loss there.
chainsaw
parents: 869
diff changeset
899 freq.lo = freq_word & 0xFF;
4709ce4e209e [svn] Run indent -ts4 -nut -bli0 -cdw on this messy lot. Upstream is not consistent with whitespace anyway, no loss there.
chainsaw
parents: 869
diff changeset
900 freq.hi = (freq_word >> 8) & 0xFF;
4709ce4e209e [svn] Run indent -ts4 -nut -bli0 -cdw on this messy lot. Upstream is not consistent with whitespace anyway, no loss there.
chainsaw
parents: 869
diff changeset
901 set_adlib_freq (channel, freq);
0
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
902 }
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
903
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
904
955
4709ce4e209e [svn] Run indent -ts4 -nut -bli0 -cdw on this messy lot. Upstream is not consistent with whitespace anyway, no loss there.
chainsaw
parents: 869
diff changeset
905 void
4709ce4e209e [svn] Run indent -ts4 -nut -bli0 -cdw on this messy lot. Upstream is not consistent with whitespace anyway, no loss there.
chainsaw
parents: 869
diff changeset
906 Cu6mPlayer::vibrato (int channel)
0
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
907 {
955
4709ce4e209e [svn] Run indent -ts4 -nut -bli0 -cdw on this messy lot. Upstream is not consistent with whitespace anyway, no loss there.
chainsaw
parents: 869
diff changeset
908 byte_pair freq;
0
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
909
955
4709ce4e209e [svn] Run indent -ts4 -nut -bli0 -cdw on this messy lot. Upstream is not consistent with whitespace anyway, no loss there.
chainsaw
parents: 869
diff changeset
910 if (vb_current_value[channel] >= vb_double_amplitude[channel])
4709ce4e209e [svn] Run indent -ts4 -nut -bli0 -cdw on this messy lot. Upstream is not consistent with whitespace anyway, no loss there.
chainsaw
parents: 869
diff changeset
911 {
4709ce4e209e [svn] Run indent -ts4 -nut -bli0 -cdw on this messy lot. Upstream is not consistent with whitespace anyway, no loss there.
chainsaw
parents: 869
diff changeset
912 vb_direction_flag[channel] = 1;
4709ce4e209e [svn] Run indent -ts4 -nut -bli0 -cdw on this messy lot. Upstream is not consistent with whitespace anyway, no loss there.
chainsaw
parents: 869
diff changeset
913 }
4709ce4e209e [svn] Run indent -ts4 -nut -bli0 -cdw on this messy lot. Upstream is not consistent with whitespace anyway, no loss there.
chainsaw
parents: 869
diff changeset
914 else if (vb_current_value[channel] <= 0)
4709ce4e209e [svn] Run indent -ts4 -nut -bli0 -cdw on this messy lot. Upstream is not consistent with whitespace anyway, no loss there.
chainsaw
parents: 869
diff changeset
915 {
4709ce4e209e [svn] Run indent -ts4 -nut -bli0 -cdw on this messy lot. Upstream is not consistent with whitespace anyway, no loss there.
chainsaw
parents: 869
diff changeset
916 vb_direction_flag[channel] = 0;
4709ce4e209e [svn] Run indent -ts4 -nut -bli0 -cdw on this messy lot. Upstream is not consistent with whitespace anyway, no loss there.
chainsaw
parents: 869
diff changeset
917 }
0
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
918
955
4709ce4e209e [svn] Run indent -ts4 -nut -bli0 -cdw on this messy lot. Upstream is not consistent with whitespace anyway, no loss there.
chainsaw
parents: 869
diff changeset
919 if (vb_direction_flag[channel] == 0)
4709ce4e209e [svn] Run indent -ts4 -nut -bli0 -cdw on this messy lot. Upstream is not consistent with whitespace anyway, no loss there.
chainsaw
parents: 869
diff changeset
920 {
4709ce4e209e [svn] Run indent -ts4 -nut -bli0 -cdw on this messy lot. Upstream is not consistent with whitespace anyway, no loss there.
chainsaw
parents: 869
diff changeset
921 vb_current_value[channel]++;
4709ce4e209e [svn] Run indent -ts4 -nut -bli0 -cdw on this messy lot. Upstream is not consistent with whitespace anyway, no loss there.
chainsaw
parents: 869
diff changeset
922 }
4709ce4e209e [svn] Run indent -ts4 -nut -bli0 -cdw on this messy lot. Upstream is not consistent with whitespace anyway, no loss there.
chainsaw
parents: 869
diff changeset
923 else
4709ce4e209e [svn] Run indent -ts4 -nut -bli0 -cdw on this messy lot. Upstream is not consistent with whitespace anyway, no loss there.
chainsaw
parents: 869
diff changeset
924 {
4709ce4e209e [svn] Run indent -ts4 -nut -bli0 -cdw on this messy lot. Upstream is not consistent with whitespace anyway, no loss there.
chainsaw
parents: 869
diff changeset
925 vb_current_value[channel]--;
4709ce4e209e [svn] Run indent -ts4 -nut -bli0 -cdw on this messy lot. Upstream is not consistent with whitespace anyway, no loss there.
chainsaw
parents: 869
diff changeset
926 }
0
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
927
955
4709ce4e209e [svn] Run indent -ts4 -nut -bli0 -cdw on this messy lot. Upstream is not consistent with whitespace anyway, no loss there.
chainsaw
parents: 869
diff changeset
928 long freq_word = channel_freq[channel].lo + (channel_freq[channel].hi << 8);
4709ce4e209e [svn] Run indent -ts4 -nut -bli0 -cdw on this messy lot. Upstream is not consistent with whitespace anyway, no loss there.
chainsaw
parents: 869
diff changeset
929 freq_word +=
4709ce4e209e [svn] Run indent -ts4 -nut -bli0 -cdw on this messy lot. Upstream is not consistent with whitespace anyway, no loss there.
chainsaw
parents: 869
diff changeset
930 (vb_current_value[channel] -
4709ce4e209e [svn] Run indent -ts4 -nut -bli0 -cdw on this messy lot. Upstream is not consistent with whitespace anyway, no loss there.
chainsaw
parents: 869
diff changeset
931 (vb_double_amplitude[channel] >> 1)) * vb_multiplier[channel];
4709ce4e209e [svn] Run indent -ts4 -nut -bli0 -cdw on this messy lot. Upstream is not consistent with whitespace anyway, no loss there.
chainsaw
parents: 869
diff changeset
932 if (freq_word < 0)
4709ce4e209e [svn] Run indent -ts4 -nut -bli0 -cdw on this messy lot. Upstream is not consistent with whitespace anyway, no loss there.
chainsaw
parents: 869
diff changeset
933 {
4709ce4e209e [svn] Run indent -ts4 -nut -bli0 -cdw on this messy lot. Upstream is not consistent with whitespace anyway, no loss there.
chainsaw
parents: 869
diff changeset
934 freq_word += 0x10000;
4709ce4e209e [svn] Run indent -ts4 -nut -bli0 -cdw on this messy lot. Upstream is not consistent with whitespace anyway, no loss there.
chainsaw
parents: 869
diff changeset
935 }
4709ce4e209e [svn] Run indent -ts4 -nut -bli0 -cdw on this messy lot. Upstream is not consistent with whitespace anyway, no loss there.
chainsaw
parents: 869
diff changeset
936 if (freq_word > 0xFFFF)
4709ce4e209e [svn] Run indent -ts4 -nut -bli0 -cdw on this messy lot. Upstream is not consistent with whitespace anyway, no loss there.
chainsaw
parents: 869
diff changeset
937 {
4709ce4e209e [svn] Run indent -ts4 -nut -bli0 -cdw on this messy lot. Upstream is not consistent with whitespace anyway, no loss there.
chainsaw
parents: 869
diff changeset
938 freq_word -= 0x10000;
4709ce4e209e [svn] Run indent -ts4 -nut -bli0 -cdw on this messy lot. Upstream is not consistent with whitespace anyway, no loss there.
chainsaw
parents: 869
diff changeset
939 }
0
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
940
955
4709ce4e209e [svn] Run indent -ts4 -nut -bli0 -cdw on this messy lot. Upstream is not consistent with whitespace anyway, no loss there.
chainsaw
parents: 869
diff changeset
941 freq.lo = freq_word & 0xFF;
4709ce4e209e [svn] Run indent -ts4 -nut -bli0 -cdw on this messy lot. Upstream is not consistent with whitespace anyway, no loss there.
chainsaw
parents: 869
diff changeset
942 freq.hi = (freq_word >> 8) & 0xFF;
4709ce4e209e [svn] Run indent -ts4 -nut -bli0 -cdw on this messy lot. Upstream is not consistent with whitespace anyway, no loss there.
chainsaw
parents: 869
diff changeset
943 set_adlib_freq_no_update (channel, freq);
0
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
944 }
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
945
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
946
955
4709ce4e209e [svn] Run indent -ts4 -nut -bli0 -cdw on this messy lot. Upstream is not consistent with whitespace anyway, no loss there.
chainsaw
parents: 869
diff changeset
947 void
4709ce4e209e [svn] Run indent -ts4 -nut -bli0 -cdw on this messy lot. Upstream is not consistent with whitespace anyway, no loss there.
chainsaw
parents: 869
diff changeset
948 Cu6mPlayer::mf_slide (int channel)
0
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
949 {
955
4709ce4e209e [svn] Run indent -ts4 -nut -bli0 -cdw on this messy lot. Upstream is not consistent with whitespace anyway, no loss there.
chainsaw
parents: 869
diff changeset
950 carrier_mf_mod_delay[channel]--;
4709ce4e209e [svn] Run indent -ts4 -nut -bli0 -cdw on this messy lot. Upstream is not consistent with whitespace anyway, no loss there.
chainsaw
parents: 869
diff changeset
951 if (carrier_mf_mod_delay[channel] == 0)
4709ce4e209e [svn] Run indent -ts4 -nut -bli0 -cdw on this messy lot. Upstream is not consistent with whitespace anyway, no loss there.
chainsaw
parents: 869
diff changeset
952 {
4709ce4e209e [svn] Run indent -ts4 -nut -bli0 -cdw on this messy lot. Upstream is not consistent with whitespace anyway, no loss there.
chainsaw
parents: 869
diff changeset
953 carrier_mf_mod_delay[channel] = carrier_mf_mod_delay_backup[channel];
4709ce4e209e [svn] Run indent -ts4 -nut -bli0 -cdw on this messy lot. Upstream is not consistent with whitespace anyway, no loss there.
chainsaw
parents: 869
diff changeset
954 int current_mf = carrier_mf[channel] + carrier_mf_signed_delta[channel];
4709ce4e209e [svn] Run indent -ts4 -nut -bli0 -cdw on this messy lot. Upstream is not consistent with whitespace anyway, no loss there.
chainsaw
parents: 869
diff changeset
955 if (current_mf > 0x3F)
0
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
956 {
955
4709ce4e209e [svn] Run indent -ts4 -nut -bli0 -cdw on this messy lot. Upstream is not consistent with whitespace anyway, no loss there.
chainsaw
parents: 869
diff changeset
957 current_mf = 0x3F;
4709ce4e209e [svn] Run indent -ts4 -nut -bli0 -cdw on this messy lot. Upstream is not consistent with whitespace anyway, no loss there.
chainsaw
parents: 869
diff changeset
958 carrier_mf_signed_delta[channel] = 0;
4709ce4e209e [svn] Run indent -ts4 -nut -bli0 -cdw on this messy lot. Upstream is not consistent with whitespace anyway, no loss there.
chainsaw
parents: 869
diff changeset
959 }
4709ce4e209e [svn] Run indent -ts4 -nut -bli0 -cdw on this messy lot. Upstream is not consistent with whitespace anyway, no loss there.
chainsaw
parents: 869
diff changeset
960 else if (current_mf < 0)
4709ce4e209e [svn] Run indent -ts4 -nut -bli0 -cdw on this messy lot. Upstream is not consistent with whitespace anyway, no loss there.
chainsaw
parents: 869
diff changeset
961 {
4709ce4e209e [svn] Run indent -ts4 -nut -bli0 -cdw on this messy lot. Upstream is not consistent with whitespace anyway, no loss there.
chainsaw
parents: 869
diff changeset
962 current_mf = 0;
4709ce4e209e [svn] Run indent -ts4 -nut -bli0 -cdw on this messy lot. Upstream is not consistent with whitespace anyway, no loss there.
chainsaw
parents: 869
diff changeset
963 carrier_mf_signed_delta[channel] = 0;
4709ce4e209e [svn] Run indent -ts4 -nut -bli0 -cdw on this messy lot. Upstream is not consistent with whitespace anyway, no loss there.
chainsaw
parents: 869
diff changeset
964 }
0
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
965
955
4709ce4e209e [svn] Run indent -ts4 -nut -bli0 -cdw on this messy lot. Upstream is not consistent with whitespace anyway, no loss there.
chainsaw
parents: 869
diff changeset
966 set_carrier_mf (channel, (unsigned char) current_mf);
4709ce4e209e [svn] Run indent -ts4 -nut -bli0 -cdw on this messy lot. Upstream is not consistent with whitespace anyway, no loss there.
chainsaw
parents: 869
diff changeset
967 }
0
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
968 }
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
969
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
970
955
4709ce4e209e [svn] Run indent -ts4 -nut -bli0 -cdw on this messy lot. Upstream is not consistent with whitespace anyway, no loss there.
chainsaw
parents: 869
diff changeset
971 void
4709ce4e209e [svn] Run indent -ts4 -nut -bli0 -cdw on this messy lot. Upstream is not consistent with whitespace anyway, no loss there.
chainsaw
parents: 869
diff changeset
972 Cu6mPlayer::out_adlib (unsigned char adlib_register, unsigned char adlib_data)
0
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
973 {
955
4709ce4e209e [svn] Run indent -ts4 -nut -bli0 -cdw on this messy lot. Upstream is not consistent with whitespace anyway, no loss there.
chainsaw
parents: 869
diff changeset
974 opl->write (adlib_register, adlib_data);
0
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
975 }
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
976
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
977
955
4709ce4e209e [svn] Run indent -ts4 -nut -bli0 -cdw on this messy lot. Upstream is not consistent with whitespace anyway, no loss there.
chainsaw
parents: 869
diff changeset
978 void
4709ce4e209e [svn] Run indent -ts4 -nut -bli0 -cdw on this messy lot. Upstream is not consistent with whitespace anyway, no loss there.
chainsaw
parents: 869
diff changeset
979 Cu6mPlayer::out_adlib_opcell (int channel, bool carrier,
4709ce4e209e [svn] Run indent -ts4 -nut -bli0 -cdw on this messy lot. Upstream is not consistent with whitespace anyway, no loss there.
chainsaw
parents: 869
diff changeset
980 unsigned char adlib_register,
4709ce4e209e [svn] Run indent -ts4 -nut -bli0 -cdw on this messy lot. Upstream is not consistent with whitespace anyway, no loss there.
chainsaw
parents: 869
diff changeset
981 unsigned char out_byte)
0
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
982 {
955
4709ce4e209e [svn] Run indent -ts4 -nut -bli0 -cdw on this messy lot. Upstream is not consistent with whitespace anyway, no loss there.
chainsaw
parents: 869
diff changeset
983 const unsigned char adlib_channel_to_carrier_offset[9] =
4709ce4e209e [svn] Run indent -ts4 -nut -bli0 -cdw on this messy lot. Upstream is not consistent with whitespace anyway, no loss there.
chainsaw
parents: 869
diff changeset
984 { 0x03, 0x04, 0x05, 0x0B, 0x0C, 0x0D, 0x13, 0x14, 0x15 };
4709ce4e209e [svn] Run indent -ts4 -nut -bli0 -cdw on this messy lot. Upstream is not consistent with whitespace anyway, no loss there.
chainsaw
parents: 869
diff changeset
985 const unsigned char adlib_channel_to_modulator_offset[9] =
4709ce4e209e [svn] Run indent -ts4 -nut -bli0 -cdw on this messy lot. Upstream is not consistent with whitespace anyway, no loss there.
chainsaw
parents: 869
diff changeset
986 { 0x00, 0x01, 0x02, 0x08, 0x09, 0x0A, 0x10, 0x11, 0x12 };
0
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
987
955
4709ce4e209e [svn] Run indent -ts4 -nut -bli0 -cdw on this messy lot. Upstream is not consistent with whitespace anyway, no loss there.
chainsaw
parents: 869
diff changeset
988 if (carrier)
4709ce4e209e [svn] Run indent -ts4 -nut -bli0 -cdw on this messy lot. Upstream is not consistent with whitespace anyway, no loss there.
chainsaw
parents: 869
diff changeset
989 {
4709ce4e209e [svn] Run indent -ts4 -nut -bli0 -cdw on this messy lot. Upstream is not consistent with whitespace anyway, no loss there.
chainsaw
parents: 869
diff changeset
990 out_adlib (adlib_register + adlib_channel_to_carrier_offset[channel],
4709ce4e209e [svn] Run indent -ts4 -nut -bli0 -cdw on this messy lot. Upstream is not consistent with whitespace anyway, no loss there.
chainsaw
parents: 869
diff changeset
991 out_byte);
4709ce4e209e [svn] Run indent -ts4 -nut -bli0 -cdw on this messy lot. Upstream is not consistent with whitespace anyway, no loss there.
chainsaw
parents: 869
diff changeset
992 }
4709ce4e209e [svn] Run indent -ts4 -nut -bli0 -cdw on this messy lot. Upstream is not consistent with whitespace anyway, no loss there.
chainsaw
parents: 869
diff changeset
993 else
4709ce4e209e [svn] Run indent -ts4 -nut -bli0 -cdw on this messy lot. Upstream is not consistent with whitespace anyway, no loss there.
chainsaw
parents: 869
diff changeset
994 {
4709ce4e209e [svn] Run indent -ts4 -nut -bli0 -cdw on this messy lot. Upstream is not consistent with whitespace anyway, no loss there.
chainsaw
parents: 869
diff changeset
995 out_adlib (adlib_register + adlib_channel_to_modulator_offset[channel],
4709ce4e209e [svn] Run indent -ts4 -nut -bli0 -cdw on this messy lot. Upstream is not consistent with whitespace anyway, no loss there.
chainsaw
parents: 869
diff changeset
996 out_byte);
4709ce4e209e [svn] Run indent -ts4 -nut -bli0 -cdw on this messy lot. Upstream is not consistent with whitespace anyway, no loss there.
chainsaw
parents: 869
diff changeset
997 }
0
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
998 }
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
999
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
1000
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
1001 // ============================================================================================
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
1002 //
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
1003 //
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
1004 // The Dictionary
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
1005 //
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
1006 //
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
1007 // ============================================================================================
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
1008
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
1009
955
4709ce4e209e [svn] Run indent -ts4 -nut -bli0 -cdw on this messy lot. Upstream is not consistent with whitespace anyway, no loss there.
chainsaw
parents: 869
diff changeset
1010 Cu6mPlayer::MyDict::MyDict ()
0
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
1011 {
955
4709ce4e209e [svn] Run indent -ts4 -nut -bli0 -cdw on this messy lot. Upstream is not consistent with whitespace anyway, no loss there.
chainsaw
parents: 869
diff changeset
1012 dict_size = default_dict_size;
4709ce4e209e [svn] Run indent -ts4 -nut -bli0 -cdw on this messy lot. Upstream is not consistent with whitespace anyway, no loss there.
chainsaw
parents: 869
diff changeset
1013 dictionary = new dict_entry[dict_size - 0x100]; // don't allocate space for the roots
4709ce4e209e [svn] Run indent -ts4 -nut -bli0 -cdw on this messy lot. Upstream is not consistent with whitespace anyway, no loss there.
chainsaw
parents: 869
diff changeset
1014 contains = 0x102;
0
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
1015 }
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
1016
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
1017
955
4709ce4e209e [svn] Run indent -ts4 -nut -bli0 -cdw on this messy lot. Upstream is not consistent with whitespace anyway, no loss there.
chainsaw
parents: 869
diff changeset
1018 Cu6mPlayer::MyDict::MyDict (int max_size)
0
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
1019 {
955
4709ce4e209e [svn] Run indent -ts4 -nut -bli0 -cdw on this messy lot. Upstream is not consistent with whitespace anyway, no loss there.
chainsaw
parents: 869
diff changeset
1020 dict_size = max_size;
4709ce4e209e [svn] Run indent -ts4 -nut -bli0 -cdw on this messy lot. Upstream is not consistent with whitespace anyway, no loss there.
chainsaw
parents: 869
diff changeset
1021 dictionary = new dict_entry[dict_size - 0x100]; // don't allocate space for the roots
4709ce4e209e [svn] Run indent -ts4 -nut -bli0 -cdw on this messy lot. Upstream is not consistent with whitespace anyway, no loss there.
chainsaw
parents: 869
diff changeset
1022 contains = 0x102;
0
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
1023 }
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
1024
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
1025
955
4709ce4e209e [svn] Run indent -ts4 -nut -bli0 -cdw on this messy lot. Upstream is not consistent with whitespace anyway, no loss there.
chainsaw
parents: 869
diff changeset
1026 Cu6mPlayer::MyDict::~MyDict ()
0
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
1027 {
955
4709ce4e209e [svn] Run indent -ts4 -nut -bli0 -cdw on this messy lot. Upstream is not consistent with whitespace anyway, no loss there.
chainsaw
parents: 869
diff changeset
1028 delete[]dictionary;
4709ce4e209e [svn] Run indent -ts4 -nut -bli0 -cdw on this messy lot. Upstream is not consistent with whitespace anyway, no loss there.
chainsaw
parents: 869
diff changeset
1029 dictionary = 0;
0
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
1030 }
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
1031
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
1032 // re-initializes the dictionary
955
4709ce4e209e [svn] Run indent -ts4 -nut -bli0 -cdw on this messy lot. Upstream is not consistent with whitespace anyway, no loss there.
chainsaw
parents: 869
diff changeset
1033 void
4709ce4e209e [svn] Run indent -ts4 -nut -bli0 -cdw on this messy lot. Upstream is not consistent with whitespace anyway, no loss there.
chainsaw
parents: 869
diff changeset
1034 Cu6mPlayer::MyDict::reset ()
0
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
1035 {
955
4709ce4e209e [svn] Run indent -ts4 -nut -bli0 -cdw on this messy lot. Upstream is not consistent with whitespace anyway, no loss there.
chainsaw
parents: 869
diff changeset
1036 contains = 0x102;
0
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
1037 }
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
1038
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
1039
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
1040 // Note: If the dictionary is already full, this function does nothing.
955
4709ce4e209e [svn] Run indent -ts4 -nut -bli0 -cdw on this messy lot. Upstream is not consistent with whitespace anyway, no loss there.
chainsaw
parents: 869
diff changeset
1041 void
4709ce4e209e [svn] Run indent -ts4 -nut -bli0 -cdw on this messy lot. Upstream is not consistent with whitespace anyway, no loss there.
chainsaw
parents: 869
diff changeset
1042 Cu6mPlayer::MyDict::add (unsigned char root, int codeword)
0
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
1043 {
955
4709ce4e209e [svn] Run indent -ts4 -nut -bli0 -cdw on this messy lot. Upstream is not consistent with whitespace anyway, no loss there.
chainsaw
parents: 869
diff changeset
1044 if (contains < dict_size)
4709ce4e209e [svn] Run indent -ts4 -nut -bli0 -cdw on this messy lot. Upstream is not consistent with whitespace anyway, no loss there.
chainsaw
parents: 869
diff changeset
1045 {
4709ce4e209e [svn] Run indent -ts4 -nut -bli0 -cdw on this messy lot. Upstream is not consistent with whitespace anyway, no loss there.
chainsaw
parents: 869
diff changeset
1046 dictionary[contains - 0x100].root = root;
4709ce4e209e [svn] Run indent -ts4 -nut -bli0 -cdw on this messy lot. Upstream is not consistent with whitespace anyway, no loss there.
chainsaw
parents: 869
diff changeset
1047 dictionary[contains - 0x100].codeword = codeword;
4709ce4e209e [svn] Run indent -ts4 -nut -bli0 -cdw on this messy lot. Upstream is not consistent with whitespace anyway, no loss there.
chainsaw
parents: 869
diff changeset
1048 contains++;
4709ce4e209e [svn] Run indent -ts4 -nut -bli0 -cdw on this messy lot. Upstream is not consistent with whitespace anyway, no loss there.
chainsaw
parents: 869
diff changeset
1049 }
0
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
1050 }
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
1051
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
1052
955
4709ce4e209e [svn] Run indent -ts4 -nut -bli0 -cdw on this messy lot. Upstream is not consistent with whitespace anyway, no loss there.
chainsaw
parents: 869
diff changeset
1053 unsigned char
4709ce4e209e [svn] Run indent -ts4 -nut -bli0 -cdw on this messy lot. Upstream is not consistent with whitespace anyway, no loss there.
chainsaw
parents: 869
diff changeset
1054 Cu6mPlayer::MyDict::get_root (int codeword)
0
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
1055 {
955
4709ce4e209e [svn] Run indent -ts4 -nut -bli0 -cdw on this messy lot. Upstream is not consistent with whitespace anyway, no loss there.
chainsaw
parents: 869
diff changeset
1056 return (dictionary[codeword - 0x100].root);
0
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
1057 }
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
1058
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
1059
955
4709ce4e209e [svn] Run indent -ts4 -nut -bli0 -cdw on this messy lot. Upstream is not consistent with whitespace anyway, no loss there.
chainsaw
parents: 869
diff changeset
1060 int
4709ce4e209e [svn] Run indent -ts4 -nut -bli0 -cdw on this messy lot. Upstream is not consistent with whitespace anyway, no loss there.
chainsaw
parents: 869
diff changeset
1061 Cu6mPlayer::MyDict::get_codeword (int codeword)
0
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
1062 {
955
4709ce4e209e [svn] Run indent -ts4 -nut -bli0 -cdw on this messy lot. Upstream is not consistent with whitespace anyway, no loss there.
chainsaw
parents: 869
diff changeset
1063 return (dictionary[codeword - 0x100].codeword);
0
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
1064 }