Mercurial > audlegacy-plugins
annotate src/adplug/core/sa2.cxx @ 3163:26a2c237ef53
alsa-ng: Destroy the ringbuffer when the plugin closes.
author | William Pitcock <nenolod@atheme.org> |
---|---|
date | Thu, 14 May 2009 21:08:03 -0500 |
parents | 4709ce4e209e |
children |
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. |
952
87666f9bf6d0
[svn] Upstream commit "Vastly enhanced generic Protracker player and modified loaders accordingly.
chainsaw
parents:
703
diff
changeset
|
3 * Copyright (C) 1999 - 2007 Simon Peter, <dn.tlp@gmx.net>, et al. |
0
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 * sa2.cpp - SAdT2 Loader by Simon Peter <dn.tlp@gmx.net> |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
20 * SAdT Loader by Mamiya <mamiya@users.sourceforge.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 <stdio.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 #include "sa2.h" |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
26 #include "debug.h" |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
27 |
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:
952
diff
changeset
|
28 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:
952
diff
changeset
|
29 Csa2Loader::factory (Copl * newopl) |
0
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
30 { |
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:
952
diff
changeset
|
31 return new Csa2Loader (newopl); |
0
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
32 } |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
33 |
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:
952
diff
changeset
|
34 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:
952
diff
changeset
|
35 Csa2Loader::load (VFSFile * fd, const CFileProvider & fp) |
0
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
36 { |
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:
952
diff
changeset
|
37 binistream *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:
952
diff
changeset
|
38 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:
952
diff
changeset
|
39 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:
952
diff
changeset
|
40 struct |
4709ce4e209e
[svn] Run indent -ts4 -nut -bli0 -cdw on this messy lot. Upstream is not consistent with whitespace anyway, no loss there.
chainsaw
parents:
952
diff
changeset
|
41 { |
4709ce4e209e
[svn] Run indent -ts4 -nut -bli0 -cdw on this messy lot. Upstream is not consistent with whitespace anyway, no loss there.
chainsaw
parents:
952
diff
changeset
|
42 unsigned char data[11], arpstart, arpspeed, arppos, arpspdcnt; |
4709ce4e209e
[svn] Run indent -ts4 -nut -bli0 -cdw on this messy lot. Upstream is not consistent with whitespace anyway, no loss there.
chainsaw
parents:
952
diff
changeset
|
43 } insts; |
4709ce4e209e
[svn] Run indent -ts4 -nut -bli0 -cdw on this messy lot. Upstream is not consistent with whitespace anyway, no loss there.
chainsaw
parents:
952
diff
changeset
|
44 unsigned char buf; |
4709ce4e209e
[svn] Run indent -ts4 -nut -bli0 -cdw on this messy lot. Upstream is not consistent with whitespace anyway, no loss there.
chainsaw
parents:
952
diff
changeset
|
45 int i, j, k, notedis = 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:
952
diff
changeset
|
46 const unsigned char convfx[16] = |
4709ce4e209e
[svn] Run indent -ts4 -nut -bli0 -cdw on this messy lot. Upstream is not consistent with whitespace anyway, no loss there.
chainsaw
parents:
952
diff
changeset
|
47 { 0, 1, 2, 3, 4, 5, 6, 255, 8, 255, 10, 11, 12, 13, 255, 15 }; |
4709ce4e209e
[svn] Run indent -ts4 -nut -bli0 -cdw on this messy lot. Upstream is not consistent with whitespace anyway, no loss there.
chainsaw
parents:
952
diff
changeset
|
48 unsigned char sat_type; |
4709ce4e209e
[svn] Run indent -ts4 -nut -bli0 -cdw on this messy lot. Upstream is not consistent with whitespace anyway, no loss there.
chainsaw
parents:
952
diff
changeset
|
49 enum SAT_TYPE |
4709ce4e209e
[svn] Run indent -ts4 -nut -bli0 -cdw on this messy lot. Upstream is not consistent with whitespace anyway, no loss there.
chainsaw
parents:
952
diff
changeset
|
50 { |
4709ce4e209e
[svn] Run indent -ts4 -nut -bli0 -cdw on this messy lot. Upstream is not consistent with whitespace anyway, no loss there.
chainsaw
parents:
952
diff
changeset
|
51 HAS_ARPEGIOLIST = (1 << 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:
952
diff
changeset
|
52 HAS_V7PATTERNS = (1 << 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:
952
diff
changeset
|
53 HAS_ACTIVECHANNELS = (1 << 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:
952
diff
changeset
|
54 HAS_TRACKORDER = (1 << 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:
952
diff
changeset
|
55 HAS_ARPEGIO = (1 << 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:
952
diff
changeset
|
56 HAS_OLDBPM = (1 << 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:
952
diff
changeset
|
57 HAS_OLDPATTERNS = (1 << 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:
952
diff
changeset
|
58 HAS_UNKNOWN127 = (1 << 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:
952
diff
changeset
|
59 }; |
0
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
60 |
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:
952
diff
changeset
|
61 // read 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:
952
diff
changeset
|
62 f->readString (header.sadt, 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:
952
diff
changeset
|
63 header.version = f->readInt (1); |
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:
952
diff
changeset
|
65 // 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:
952
diff
changeset
|
66 if (strncmp (header.sadt, "SAdT", 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:
952
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:
952
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:
952
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:
952
diff
changeset
|
70 } |
4709ce4e209e
[svn] Run indent -ts4 -nut -bli0 -cdw on this messy lot. Upstream is not consistent with whitespace anyway, no loss there.
chainsaw
parents:
952
diff
changeset
|
71 switch (header.version) |
4709ce4e209e
[svn] Run indent -ts4 -nut -bli0 -cdw on this messy lot. Upstream is not consistent with whitespace anyway, no loss there.
chainsaw
parents:
952
diff
changeset
|
72 { |
4709ce4e209e
[svn] Run indent -ts4 -nut -bli0 -cdw on this messy lot. Upstream is not consistent with whitespace anyway, no loss there.
chainsaw
parents:
952
diff
changeset
|
73 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:
952
diff
changeset
|
74 notedis = +0x18; |
4709ce4e209e
[svn] Run indent -ts4 -nut -bli0 -cdw on this messy lot. Upstream is not consistent with whitespace anyway, no loss there.
chainsaw
parents:
952
diff
changeset
|
75 sat_type = HAS_UNKNOWN127 | HAS_OLDPATTERNS | HAS_OLDBPM; |
4709ce4e209e
[svn] Run indent -ts4 -nut -bli0 -cdw on this messy lot. Upstream is not consistent with whitespace anyway, no loss there.
chainsaw
parents:
952
diff
changeset
|
76 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:
952
diff
changeset
|
77 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:
952
diff
changeset
|
78 notedis = +0x18; |
4709ce4e209e
[svn] Run indent -ts4 -nut -bli0 -cdw on this messy lot. Upstream is not consistent with whitespace anyway, no loss there.
chainsaw
parents:
952
diff
changeset
|
79 sat_type = HAS_OLDPATTERNS | HAS_OLDBPM; |
4709ce4e209e
[svn] Run indent -ts4 -nut -bli0 -cdw on this messy lot. Upstream is not consistent with whitespace anyway, no loss there.
chainsaw
parents:
952
diff
changeset
|
80 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:
952
diff
changeset
|
81 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:
952
diff
changeset
|
82 notedis = +0x0c; |
4709ce4e209e
[svn] Run indent -ts4 -nut -bli0 -cdw on this messy lot. Upstream is not consistent with whitespace anyway, no loss there.
chainsaw
parents:
952
diff
changeset
|
83 sat_type = HAS_OLDPATTERNS | HAS_OLDBPM; |
4709ce4e209e
[svn] Run indent -ts4 -nut -bli0 -cdw on this messy lot. Upstream is not consistent with whitespace anyway, no loss there.
chainsaw
parents:
952
diff
changeset
|
84 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:
952
diff
changeset
|
85 case 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:
952
diff
changeset
|
86 notedis = +0x0c; |
4709ce4e209e
[svn] Run indent -ts4 -nut -bli0 -cdw on this messy lot. Upstream is not consistent with whitespace anyway, no loss there.
chainsaw
parents:
952
diff
changeset
|
87 sat_type = HAS_ARPEGIO | HAS_OLDPATTERNS | HAS_OLDBPM; |
4709ce4e209e
[svn] Run indent -ts4 -nut -bli0 -cdw on this messy lot. Upstream is not consistent with whitespace anyway, no loss there.
chainsaw
parents:
952
diff
changeset
|
88 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:
952
diff
changeset
|
89 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:
952
diff
changeset
|
90 notedis = +0x0c; |
4709ce4e209e
[svn] Run indent -ts4 -nut -bli0 -cdw on this messy lot. Upstream is not consistent with whitespace anyway, no loss there.
chainsaw
parents:
952
diff
changeset
|
91 sat_type = HAS_ARPEGIO | HAS_ARPEGIOLIST | HAS_OLDPATTERNS | HAS_OLDBPM; |
4709ce4e209e
[svn] Run indent -ts4 -nut -bli0 -cdw on this messy lot. Upstream is not consistent with whitespace anyway, no loss there.
chainsaw
parents:
952
diff
changeset
|
92 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:
952
diff
changeset
|
93 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:
952
diff
changeset
|
94 sat_type = HAS_ARPEGIO | HAS_ARPEGIOLIST | HAS_OLDPATTERNS | HAS_OLDBPM; |
4709ce4e209e
[svn] Run indent -ts4 -nut -bli0 -cdw on this messy lot. Upstream is not consistent with whitespace anyway, no loss there.
chainsaw
parents:
952
diff
changeset
|
95 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:
952
diff
changeset
|
96 case 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:
952
diff
changeset
|
97 sat_type = HAS_ARPEGIO | HAS_ARPEGIOLIST | HAS_V7PATTERNS; |
4709ce4e209e
[svn] Run indent -ts4 -nut -bli0 -cdw on this messy lot. Upstream is not consistent with whitespace anyway, no loss there.
chainsaw
parents:
952
diff
changeset
|
98 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:
952
diff
changeset
|
99 case 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:
952
diff
changeset
|
100 sat_type = HAS_ARPEGIO | HAS_ARPEGIOLIST | HAS_TRACKORDER; |
4709ce4e209e
[svn] Run indent -ts4 -nut -bli0 -cdw on this messy lot. Upstream is not consistent with whitespace anyway, no loss there.
chainsaw
parents:
952
diff
changeset
|
101 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:
952
diff
changeset
|
102 case 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:
952
diff
changeset
|
103 sat_type = |
4709ce4e209e
[svn] Run indent -ts4 -nut -bli0 -cdw on this messy lot. Upstream is not consistent with whitespace anyway, no loss there.
chainsaw
parents:
952
diff
changeset
|
104 HAS_ARPEGIO | HAS_ARPEGIOLIST | HAS_TRACKORDER | HAS_ACTIVECHANNELS; |
4709ce4e209e
[svn] Run indent -ts4 -nut -bli0 -cdw on this messy lot. Upstream is not consistent with whitespace anyway, no loss there.
chainsaw
parents:
952
diff
changeset
|
105 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:
952
diff
changeset
|
106 default: /* unknown */ |
4709ce4e209e
[svn] Run indent -ts4 -nut -bli0 -cdw on this messy lot. Upstream is not consistent with whitespace anyway, no loss there.
chainsaw
parents:
952
diff
changeset
|
107 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:
952
diff
changeset
|
108 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:
952
diff
changeset
|
109 } |
0
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
110 |
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:
952
diff
changeset
|
111 // 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:
952
diff
changeset
|
112 // instruments |
4709ce4e209e
[svn] Run indent -ts4 -nut -bli0 -cdw on this messy lot. Upstream is not consistent with whitespace anyway, no loss there.
chainsaw
parents:
952
diff
changeset
|
113 for (i = 0; i < 31; 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:
952
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:
952
diff
changeset
|
115 if (sat_type & HAS_ARPEGIO) |
4709ce4e209e
[svn] Run indent -ts4 -nut -bli0 -cdw on this messy lot. Upstream is not consistent with whitespace anyway, no loss there.
chainsaw
parents:
952
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:
952
diff
changeset
|
117 for (j = 0; j < 11; j++) |
4709ce4e209e
[svn] Run indent -ts4 -nut -bli0 -cdw on this messy lot. Upstream is not consistent with whitespace anyway, no loss there.
chainsaw
parents:
952
diff
changeset
|
118 insts.data[j] = f->readInt (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:
952
diff
changeset
|
119 insts.arpstart = f->readInt (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:
952
diff
changeset
|
120 insts.arpspeed = f->readInt (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:
952
diff
changeset
|
121 insts.arppos = f->readInt (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:
952
diff
changeset
|
122 insts.arpspdcnt = f->readInt (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:
952
diff
changeset
|
123 inst[i].arpstart = insts.arpstart; |
4709ce4e209e
[svn] Run indent -ts4 -nut -bli0 -cdw on this messy lot. Upstream is not consistent with whitespace anyway, no loss there.
chainsaw
parents:
952
diff
changeset
|
124 inst[i].arpspeed = insts.arpspeed; |
4709ce4e209e
[svn] Run indent -ts4 -nut -bli0 -cdw on this messy lot. Upstream is not consistent with whitespace anyway, no loss there.
chainsaw
parents:
952
diff
changeset
|
125 inst[i].arppos = insts.arppos; |
4709ce4e209e
[svn] Run indent -ts4 -nut -bli0 -cdw on this messy lot. Upstream is not consistent with whitespace anyway, no loss there.
chainsaw
parents:
952
diff
changeset
|
126 inst[i].arpspdcnt = insts.arpspdcnt; |
4709ce4e209e
[svn] Run indent -ts4 -nut -bli0 -cdw on this messy lot. Upstream is not consistent with whitespace anyway, no loss there.
chainsaw
parents:
952
diff
changeset
|
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:
952
diff
changeset
|
128 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:
952
diff
changeset
|
129 { |
4709ce4e209e
[svn] Run indent -ts4 -nut -bli0 -cdw on this messy lot. Upstream is not consistent with whitespace anyway, no loss there.
chainsaw
parents:
952
diff
changeset
|
130 for (j = 0; j < 11; j++) |
4709ce4e209e
[svn] Run indent -ts4 -nut -bli0 -cdw on this messy lot. Upstream is not consistent with whitespace anyway, no loss there.
chainsaw
parents:
952
diff
changeset
|
131 insts.data[j] = f->readInt (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:
952
diff
changeset
|
132 inst[i].arpstart = 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:
952
diff
changeset
|
133 inst[i].arpspeed = 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:
952
diff
changeset
|
134 inst[i].arppos = 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:
952
diff
changeset
|
135 inst[i].arpspdcnt = 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:
952
diff
changeset
|
136 } |
4709ce4e209e
[svn] Run indent -ts4 -nut -bli0 -cdw on this messy lot. Upstream is not consistent with whitespace anyway, no loss there.
chainsaw
parents:
952
diff
changeset
|
137 for (j = 0; j < 11; j++) |
4709ce4e209e
[svn] Run indent -ts4 -nut -bli0 -cdw on this messy lot. Upstream is not consistent with whitespace anyway, no loss there.
chainsaw
parents:
952
diff
changeset
|
138 inst[i].data[j] = insts.data[j]; |
4709ce4e209e
[svn] Run indent -ts4 -nut -bli0 -cdw on this messy lot. Upstream is not consistent with whitespace anyway, no loss there.
chainsaw
parents:
952
diff
changeset
|
139 inst[i].misc = 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:
952
diff
changeset
|
140 inst[i].slide = 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:
952
diff
changeset
|
141 } |
0
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
142 |
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:
952
diff
changeset
|
143 // instrument names |
4709ce4e209e
[svn] Run indent -ts4 -nut -bli0 -cdw on this messy lot. Upstream is not consistent with whitespace anyway, no loss there.
chainsaw
parents:
952
diff
changeset
|
144 for (i = 0; i < 29; 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:
952
diff
changeset
|
145 f->readString (instname[i], 17); |
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:
952
diff
changeset
|
147 f->ignore (3); // dummy bytes |
4709ce4e209e
[svn] Run indent -ts4 -nut -bli0 -cdw on this messy lot. Upstream is not consistent with whitespace anyway, no loss there.
chainsaw
parents:
952
diff
changeset
|
148 for (i = 0; i < 128; 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:
952
diff
changeset
|
149 order[i] = f->readInt (1); // pattern orders |
4709ce4e209e
[svn] Run indent -ts4 -nut -bli0 -cdw on this messy lot. Upstream is not consistent with whitespace anyway, no loss there.
chainsaw
parents:
952
diff
changeset
|
150 if (sat_type & HAS_UNKNOWN127) |
4709ce4e209e
[svn] Run indent -ts4 -nut -bli0 -cdw on this messy lot. Upstream is not consistent with whitespace anyway, no loss there.
chainsaw
parents:
952
diff
changeset
|
151 f->ignore (127); |
0
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
152 |
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:
952
diff
changeset
|
153 // infos |
4709ce4e209e
[svn] Run indent -ts4 -nut -bli0 -cdw on this messy lot. Upstream is not consistent with whitespace anyway, no loss there.
chainsaw
parents:
952
diff
changeset
|
154 nop = f->readInt (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:
952
diff
changeset
|
155 length = f->readInt (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:
952
diff
changeset
|
156 restartpos = f->readInt (1); |
0
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
157 |
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:
952
diff
changeset
|
158 // bpm |
4709ce4e209e
[svn] Run indent -ts4 -nut -bli0 -cdw on this messy lot. Upstream is not consistent with whitespace anyway, no loss there.
chainsaw
parents:
952
diff
changeset
|
159 bpm = f->readInt (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:
952
diff
changeset
|
160 if (sat_type & HAS_OLDBPM) |
4709ce4e209e
[svn] Run indent -ts4 -nut -bli0 -cdw on this messy lot. Upstream is not consistent with whitespace anyway, no loss there.
chainsaw
parents:
952
diff
changeset
|
161 { |
4709ce4e209e
[svn] Run indent -ts4 -nut -bli0 -cdw on this messy lot. Upstream is not consistent with whitespace anyway, no loss there.
chainsaw
parents:
952
diff
changeset
|
162 bpm = bpm * 125 / 50; // cps -> bpm |
4709ce4e209e
[svn] Run indent -ts4 -nut -bli0 -cdw on this messy lot. Upstream is not consistent with whitespace anyway, no loss there.
chainsaw
parents:
952
diff
changeset
|
163 } |
0
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
164 |
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:
952
diff
changeset
|
165 if (sat_type & HAS_ARPEGIOLIST) |
4709ce4e209e
[svn] Run indent -ts4 -nut -bli0 -cdw on this messy lot. Upstream is not consistent with whitespace anyway, no loss there.
chainsaw
parents:
952
diff
changeset
|
166 { |
4709ce4e209e
[svn] Run indent -ts4 -nut -bli0 -cdw on this messy lot. Upstream is not consistent with whitespace anyway, no loss there.
chainsaw
parents:
952
diff
changeset
|
167 init_specialarp (); |
4709ce4e209e
[svn] Run indent -ts4 -nut -bli0 -cdw on this messy lot. Upstream is not consistent with whitespace anyway, no loss there.
chainsaw
parents:
952
diff
changeset
|
168 for (i = 0; i < 256; 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:
952
diff
changeset
|
169 arplist[i] = f->readInt (1); // arpeggio list |
4709ce4e209e
[svn] Run indent -ts4 -nut -bli0 -cdw on this messy lot. Upstream is not consistent with whitespace anyway, no loss there.
chainsaw
parents:
952
diff
changeset
|
170 for (i = 0; i < 256; 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:
952
diff
changeset
|
171 arpcmd[i] = f->readInt (1); // arpeggio commands |
4709ce4e209e
[svn] Run indent -ts4 -nut -bli0 -cdw on this messy lot. Upstream is not consistent with whitespace anyway, no loss there.
chainsaw
parents:
952
diff
changeset
|
172 } |
0
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
173 |
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:
952
diff
changeset
|
174 for (i = 0; i < 64; 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:
952
diff
changeset
|
175 { // track orders |
4709ce4e209e
[svn] Run indent -ts4 -nut -bli0 -cdw on this messy lot. Upstream is not consistent with whitespace anyway, no loss there.
chainsaw
parents:
952
diff
changeset
|
176 for (j = 0; j < 9; j++) |
4709ce4e209e
[svn] Run indent -ts4 -nut -bli0 -cdw on this messy lot. Upstream is not consistent with whitespace anyway, no loss there.
chainsaw
parents:
952
diff
changeset
|
177 { |
4709ce4e209e
[svn] Run indent -ts4 -nut -bli0 -cdw on this messy lot. Upstream is not consistent with whitespace anyway, no loss there.
chainsaw
parents:
952
diff
changeset
|
178 if (sat_type & HAS_TRACKORDER) |
4709ce4e209e
[svn] Run indent -ts4 -nut -bli0 -cdw on this messy lot. Upstream is not consistent with whitespace anyway, no loss there.
chainsaw
parents:
952
diff
changeset
|
179 trackord[i][j] = f->readInt (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:
952
diff
changeset
|
180 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:
952
diff
changeset
|
181 { |
4709ce4e209e
[svn] Run indent -ts4 -nut -bli0 -cdw on this messy lot. Upstream is not consistent with whitespace anyway, no loss there.
chainsaw
parents:
952
diff
changeset
|
182 trackord[i][j] = i * 9 + j; |
4709ce4e209e
[svn] Run indent -ts4 -nut -bli0 -cdw on this messy lot. Upstream is not consistent with whitespace anyway, no loss there.
chainsaw
parents:
952
diff
changeset
|
183 } |
4709ce4e209e
[svn] Run indent -ts4 -nut -bli0 -cdw on this messy lot. Upstream is not consistent with whitespace anyway, no loss there.
chainsaw
parents:
952
diff
changeset
|
184 } |
4709ce4e209e
[svn] Run indent -ts4 -nut -bli0 -cdw on this messy lot. Upstream is not consistent with whitespace anyway, no loss there.
chainsaw
parents:
952
diff
changeset
|
185 } |
0
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
186 |
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:
952
diff
changeset
|
187 if (sat_type & HAS_ACTIVECHANNELS) |
4709ce4e209e
[svn] Run indent -ts4 -nut -bli0 -cdw on this messy lot. Upstream is not consistent with whitespace anyway, no loss there.
chainsaw
parents:
952
diff
changeset
|
188 activechan = f->readInt (2) << 16; // active channels |
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:
952
diff
changeset
|
190 AdPlug_LogWrite ("Csa2Loader::load(\"%s\"): sat_type = %x, nop = %d, " |
4709ce4e209e
[svn] Run indent -ts4 -nut -bli0 -cdw on this messy lot. Upstream is not consistent with whitespace anyway, no loss there.
chainsaw
parents:
952
diff
changeset
|
191 "length = %d, restartpos = %d, activechan = %x, bpm = %d\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:
952
diff
changeset
|
192 fd->uri, sat_type, nop, length, restartpos, activechan, |
4709ce4e209e
[svn] Run indent -ts4 -nut -bli0 -cdw on this messy lot. Upstream is not consistent with whitespace anyway, no loss there.
chainsaw
parents:
952
diff
changeset
|
193 bpm); |
0
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
194 |
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:
952
diff
changeset
|
195 // track 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:
952
diff
changeset
|
196 if (sat_type & HAS_OLDPATTERNS) |
4709ce4e209e
[svn] Run indent -ts4 -nut -bli0 -cdw on this messy lot. Upstream is not consistent with whitespace anyway, no loss there.
chainsaw
parents:
952
diff
changeset
|
197 { |
4709ce4e209e
[svn] Run indent -ts4 -nut -bli0 -cdw on this messy lot. Upstream is not consistent with whitespace anyway, no loss there.
chainsaw
parents:
952
diff
changeset
|
198 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:
952
diff
changeset
|
199 while (!f->ateof ()) |
4709ce4e209e
[svn] Run indent -ts4 -nut -bli0 -cdw on this messy lot. Upstream is not consistent with whitespace anyway, no loss there.
chainsaw
parents:
952
diff
changeset
|
200 { |
4709ce4e209e
[svn] Run indent -ts4 -nut -bli0 -cdw on this messy lot. Upstream is not consistent with whitespace anyway, no loss there.
chainsaw
parents:
952
diff
changeset
|
201 for (j = 0; j < 64; j++) |
4709ce4e209e
[svn] Run indent -ts4 -nut -bli0 -cdw on this messy lot. Upstream is not consistent with whitespace anyway, no loss there.
chainsaw
parents:
952
diff
changeset
|
202 { |
4709ce4e209e
[svn] Run indent -ts4 -nut -bli0 -cdw on this messy lot. Upstream is not consistent with whitespace anyway, no loss there.
chainsaw
parents:
952
diff
changeset
|
203 for (k = 0; k < 9; k++) |
4709ce4e209e
[svn] Run indent -ts4 -nut -bli0 -cdw on this messy lot. Upstream is not consistent with whitespace anyway, no loss there.
chainsaw
parents:
952
diff
changeset
|
204 { |
4709ce4e209e
[svn] Run indent -ts4 -nut -bli0 -cdw on this messy lot. Upstream is not consistent with whitespace anyway, no loss there.
chainsaw
parents:
952
diff
changeset
|
205 buf = f->readInt (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:
952
diff
changeset
|
206 tracks[i + k][j].note = buf ? (buf + notedis) : 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:
952
diff
changeset
|
207 tracks[i + k][j].inst = f->readInt (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:
952
diff
changeset
|
208 tracks[i + k][j].command = convfx[f->readInt (1) & 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:
952
diff
changeset
|
209 tracks[i + k][j].param1 = f->readInt (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:
952
diff
changeset
|
210 tracks[i + k][j].param2 = f->readInt (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:
952
diff
changeset
|
211 } |
4709ce4e209e
[svn] Run indent -ts4 -nut -bli0 -cdw on this messy lot. Upstream is not consistent with whitespace anyway, no loss there.
chainsaw
parents:
952
diff
changeset
|
212 } |
4709ce4e209e
[svn] Run indent -ts4 -nut -bli0 -cdw on this messy lot. Upstream is not consistent with whitespace anyway, no loss there.
chainsaw
parents:
952
diff
changeset
|
213 i += 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:
952
diff
changeset
|
214 } |
4709ce4e209e
[svn] Run indent -ts4 -nut -bli0 -cdw on this messy lot. Upstream is not consistent with whitespace anyway, no loss there.
chainsaw
parents:
952
diff
changeset
|
215 } |
4709ce4e209e
[svn] Run indent -ts4 -nut -bli0 -cdw on this messy lot. Upstream is not consistent with whitespace anyway, no loss there.
chainsaw
parents:
952
diff
changeset
|
216 else if (sat_type & HAS_V7PATTERNS) |
4709ce4e209e
[svn] Run indent -ts4 -nut -bli0 -cdw on this messy lot. Upstream is not consistent with whitespace anyway, no loss there.
chainsaw
parents:
952
diff
changeset
|
217 { |
4709ce4e209e
[svn] Run indent -ts4 -nut -bli0 -cdw on this messy lot. Upstream is not consistent with whitespace anyway, no loss there.
chainsaw
parents:
952
diff
changeset
|
218 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:
952
diff
changeset
|
219 while (!f->ateof ()) |
4709ce4e209e
[svn] Run indent -ts4 -nut -bli0 -cdw on this messy lot. Upstream is not consistent with whitespace anyway, no loss there.
chainsaw
parents:
952
diff
changeset
|
220 { |
4709ce4e209e
[svn] Run indent -ts4 -nut -bli0 -cdw on this messy lot. Upstream is not consistent with whitespace anyway, no loss there.
chainsaw
parents:
952
diff
changeset
|
221 for (j = 0; j < 64; j++) |
4709ce4e209e
[svn] Run indent -ts4 -nut -bli0 -cdw on this messy lot. Upstream is not consistent with whitespace anyway, no loss there.
chainsaw
parents:
952
diff
changeset
|
222 { |
4709ce4e209e
[svn] Run indent -ts4 -nut -bli0 -cdw on this messy lot. Upstream is not consistent with whitespace anyway, no loss there.
chainsaw
parents:
952
diff
changeset
|
223 for (k = 0; k < 9; k++) |
4709ce4e209e
[svn] Run indent -ts4 -nut -bli0 -cdw on this messy lot. Upstream is not consistent with whitespace anyway, no loss there.
chainsaw
parents:
952
diff
changeset
|
224 { |
4709ce4e209e
[svn] Run indent -ts4 -nut -bli0 -cdw on this messy lot. Upstream is not consistent with whitespace anyway, no loss there.
chainsaw
parents:
952
diff
changeset
|
225 buf = f->readInt (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:
952
diff
changeset
|
226 tracks[i + k][j].note = buf >> 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:
952
diff
changeset
|
227 tracks[i + k][j].inst = (buf & 1) << 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:
952
diff
changeset
|
228 buf = f->readInt (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:
952
diff
changeset
|
229 tracks[i + k][j].inst += buf >> 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:
952
diff
changeset
|
230 tracks[i + k][j].command = convfx[buf & 0x0f]; |
4709ce4e209e
[svn] Run indent -ts4 -nut -bli0 -cdw on this messy lot. Upstream is not consistent with whitespace anyway, no loss there.
chainsaw
parents:
952
diff
changeset
|
231 buf = f->readInt (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:
952
diff
changeset
|
232 tracks[i + k][j].param1 = buf >> 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:
952
diff
changeset
|
233 tracks[i + k][j].param2 = buf & 0x0f; |
4709ce4e209e
[svn] Run indent -ts4 -nut -bli0 -cdw on this messy lot. Upstream is not consistent with whitespace anyway, no loss there.
chainsaw
parents:
952
diff
changeset
|
234 } |
4709ce4e209e
[svn] Run indent -ts4 -nut -bli0 -cdw on this messy lot. Upstream is not consistent with whitespace anyway, no loss there.
chainsaw
parents:
952
diff
changeset
|
235 } |
4709ce4e209e
[svn] Run indent -ts4 -nut -bli0 -cdw on this messy lot. Upstream is not consistent with whitespace anyway, no loss there.
chainsaw
parents:
952
diff
changeset
|
236 i += 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:
952
diff
changeset
|
237 } |
4709ce4e209e
[svn] Run indent -ts4 -nut -bli0 -cdw on this messy lot. Upstream is not consistent with whitespace anyway, no loss there.
chainsaw
parents:
952
diff
changeset
|
238 } |
4709ce4e209e
[svn] Run indent -ts4 -nut -bli0 -cdw on this messy lot. Upstream is not consistent with whitespace anyway, no loss there.
chainsaw
parents:
952
diff
changeset
|
239 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:
952
diff
changeset
|
240 { |
4709ce4e209e
[svn] Run indent -ts4 -nut -bli0 -cdw on this messy lot. Upstream is not consistent with whitespace anyway, no loss there.
chainsaw
parents:
952
diff
changeset
|
241 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:
952
diff
changeset
|
242 while (!f->ateof ()) |
4709ce4e209e
[svn] Run indent -ts4 -nut -bli0 -cdw on this messy lot. Upstream is not consistent with whitespace anyway, no loss there.
chainsaw
parents:
952
diff
changeset
|
243 { |
4709ce4e209e
[svn] Run indent -ts4 -nut -bli0 -cdw on this messy lot. Upstream is not consistent with whitespace anyway, no loss there.
chainsaw
parents:
952
diff
changeset
|
244 for (j = 0; j < 64; j++) |
4709ce4e209e
[svn] Run indent -ts4 -nut -bli0 -cdw on this messy lot. Upstream is not consistent with whitespace anyway, no loss there.
chainsaw
parents:
952
diff
changeset
|
245 { |
4709ce4e209e
[svn] Run indent -ts4 -nut -bli0 -cdw on this messy lot. Upstream is not consistent with whitespace anyway, no loss there.
chainsaw
parents:
952
diff
changeset
|
246 buf = f->readInt (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:
952
diff
changeset
|
247 tracks[i][j].note = buf >> 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:
952
diff
changeset
|
248 tracks[i][j].inst = (buf & 1) << 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:
952
diff
changeset
|
249 buf = f->readInt (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:
952
diff
changeset
|
250 tracks[i][j].inst += buf >> 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:
952
diff
changeset
|
251 tracks[i][j].command = convfx[buf & 0x0f]; |
4709ce4e209e
[svn] Run indent -ts4 -nut -bli0 -cdw on this messy lot. Upstream is not consistent with whitespace anyway, no loss there.
chainsaw
parents:
952
diff
changeset
|
252 buf = f->readInt (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:
952
diff
changeset
|
253 tracks[i][j].param1 = buf >> 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:
952
diff
changeset
|
254 tracks[i][j].param2 = buf & 0x0f; |
4709ce4e209e
[svn] Run indent -ts4 -nut -bli0 -cdw on this messy lot. Upstream is not consistent with whitespace anyway, no loss there.
chainsaw
parents:
952
diff
changeset
|
255 } |
4709ce4e209e
[svn] Run indent -ts4 -nut -bli0 -cdw on this messy lot. Upstream is not consistent with whitespace anyway, no loss there.
chainsaw
parents:
952
diff
changeset
|
256 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:
952
diff
changeset
|
257 } |
4709ce4e209e
[svn] Run indent -ts4 -nut -bli0 -cdw on this messy lot. Upstream is not consistent with whitespace anyway, no loss there.
chainsaw
parents:
952
diff
changeset
|
258 } |
4709ce4e209e
[svn] Run indent -ts4 -nut -bli0 -cdw on this messy lot. Upstream is not consistent with whitespace anyway, no loss there.
chainsaw
parents:
952
diff
changeset
|
259 fp.close (f); |
0
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
260 |
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:
952
diff
changeset
|
261 // fix instrument names |
4709ce4e209e
[svn] Run indent -ts4 -nut -bli0 -cdw on this messy lot. Upstream is not consistent with whitespace anyway, no loss there.
chainsaw
parents:
952
diff
changeset
|
262 for (i = 0; i < 29; 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:
952
diff
changeset
|
263 for (j = 0; j < 17; j++) |
4709ce4e209e
[svn] Run indent -ts4 -nut -bli0 -cdw on this messy lot. Upstream is not consistent with whitespace anyway, no loss there.
chainsaw
parents:
952
diff
changeset
|
264 if (!instname[i][j]) |
4709ce4e209e
[svn] Run indent -ts4 -nut -bli0 -cdw on this messy lot. Upstream is not consistent with whitespace anyway, no loss there.
chainsaw
parents:
952
diff
changeset
|
265 instname[i][j] = ' '; |
0
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
266 |
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:
952
diff
changeset
|
267 rewind (0); // rewind module |
4709ce4e209e
[svn] Run indent -ts4 -nut -bli0 -cdw on this messy lot. Upstream is not consistent with whitespace anyway, no loss there.
chainsaw
parents:
952
diff
changeset
|
268 return true; |
0
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
269 } |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
270 |
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:
952
diff
changeset
|
271 std::string Csa2Loader::gettype () |
0
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
272 { |
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:
952
diff
changeset
|
273 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:
952
diff
changeset
|
274 tmpstr[40]; |
0
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
275 |
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:
952
diff
changeset
|
276 sprintf (tmpstr, "Surprise! Adlib Tracker 2 (version %d)", header.version); |
4709ce4e209e
[svn] Run indent -ts4 -nut -bli0 -cdw on this messy lot. Upstream is not consistent with whitespace anyway, no loss there.
chainsaw
parents:
952
diff
changeset
|
277 return std::string (tmpstr); |
0
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
278 } |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
279 |
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:
952
diff
changeset
|
280 std::string Csa2Loader::gettitle () |
0
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
281 { |
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:
952
diff
changeset
|
282 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:
952
diff
changeset
|
283 bufinst[29 * 17], |
4709ce4e209e
[svn] Run indent -ts4 -nut -bli0 -cdw on this messy lot. Upstream is not consistent with whitespace anyway, no loss there.
chainsaw
parents:
952
diff
changeset
|
284 buf[18]; |
4709ce4e209e
[svn] Run indent -ts4 -nut -bli0 -cdw on this messy lot. Upstream is not consistent with whitespace anyway, no loss there.
chainsaw
parents:
952
diff
changeset
|
285 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:
952
diff
changeset
|
286 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:
952
diff
changeset
|
287 ptr; |
0
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
288 |
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:
952
diff
changeset
|
289 // parse instrument names for song name |
4709ce4e209e
[svn] Run indent -ts4 -nut -bli0 -cdw on this messy lot. Upstream is not consistent with whitespace anyway, no loss there.
chainsaw
parents:
952
diff
changeset
|
290 memset (bufinst, '\0', 29 * 17); |
4709ce4e209e
[svn] Run indent -ts4 -nut -bli0 -cdw on this messy lot. Upstream is not consistent with whitespace anyway, no loss there.
chainsaw
parents:
952
diff
changeset
|
291 for (i = 0; i < 29; 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:
952
diff
changeset
|
292 { |
4709ce4e209e
[svn] Run indent -ts4 -nut -bli0 -cdw on this messy lot. Upstream is not consistent with whitespace anyway, no loss there.
chainsaw
parents:
952
diff
changeset
|
293 buf[16] = ' '; |
4709ce4e209e
[svn] Run indent -ts4 -nut -bli0 -cdw on this messy lot. Upstream is not consistent with whitespace anyway, no loss there.
chainsaw
parents:
952
diff
changeset
|
294 buf[17] = '\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:
952
diff
changeset
|
295 memcpy (buf, instname[i] + 1, 16); |
4709ce4e209e
[svn] Run indent -ts4 -nut -bli0 -cdw on this messy lot. Upstream is not consistent with whitespace anyway, no loss there.
chainsaw
parents:
952
diff
changeset
|
296 for (ptr = 16; ptr > 0; ptr--) |
4709ce4e209e
[svn] Run indent -ts4 -nut -bli0 -cdw on this messy lot. Upstream is not consistent with whitespace anyway, no loss there.
chainsaw
parents:
952
diff
changeset
|
297 if (buf[ptr] == ' ') |
4709ce4e209e
[svn] Run indent -ts4 -nut -bli0 -cdw on this messy lot. Upstream is not consistent with whitespace anyway, no loss there.
chainsaw
parents:
952
diff
changeset
|
298 buf[ptr] = '\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:
952
diff
changeset
|
299 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:
952
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:
952
diff
changeset
|
301 if (ptr < 16) |
4709ce4e209e
[svn] Run indent -ts4 -nut -bli0 -cdw on this messy lot. Upstream is not consistent with whitespace anyway, no loss there.
chainsaw
parents:
952
diff
changeset
|
302 buf[ptr + 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:
952
diff
changeset
|
303 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:
952
diff
changeset
|
304 } |
4709ce4e209e
[svn] Run indent -ts4 -nut -bli0 -cdw on this messy lot. Upstream is not consistent with whitespace anyway, no loss there.
chainsaw
parents:
952
diff
changeset
|
305 strcat (bufinst, buf); |
4709ce4e209e
[svn] Run indent -ts4 -nut -bli0 -cdw on this messy lot. Upstream is not consistent with whitespace anyway, no loss there.
chainsaw
parents:
952
diff
changeset
|
306 } |
0
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
307 |
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:
952
diff
changeset
|
308 if (strchr (bufinst, '"')) |
4709ce4e209e
[svn] Run indent -ts4 -nut -bli0 -cdw on this messy lot. Upstream is not consistent with whitespace anyway, no loss there.
chainsaw
parents:
952
diff
changeset
|
309 return std::string (bufinst, strchr (bufinst, '"') - bufinst + 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:
952
diff
changeset
|
310 strrchr (bufinst, '"') - strchr (bufinst, '"') - 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:
952
diff
changeset
|
311 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:
952
diff
changeset
|
312 return std::string (); |
0
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
313 } |