comparison src/Input/adplug/core/cff.h @ 0:13389e613d67 trunk

[svn] - initial import of audacious-plugins tree (lots to do)
author nenolod
date Mon, 18 Sep 2006 01:11:49 -0700
parents
children
comparison
equal deleted inserted replaced
-1:000000000000 0:13389e613d67
1 /*
2 AdPlug - Replayer for many OPL2/OPL3 audio file formats.
3 Copyright (C) 1999 - 2006 Simon Peter <dn.tlp@gmx.net>, et al.
4
5 This library is free software; you can redistribute it and/or
6 modify it under the terms of the GNU Lesser General Public
7 License as published by the Free Software Foundation; either
8 version 2.1 of the License, or (at your option) any later version.
9
10 This library is distributed in the hope that it will be useful,
11 but WITHOUT ANY WARRANTY; without even the implied warranty of
12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13 Lesser General Public License for more details.
14
15 You should have received a copy of the GNU Lesser General Public
16 License along with this library; if not, write to the Free Software
17 Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
18
19 cff.h - BoomTracker loader by Riven the Mage <riven@ok.ru>
20 */
21
22 #include "protrack.h"
23
24 class CcffLoader: public CmodPlayer
25 {
26 public:
27 static CPlayer *factory(Copl *newopl);
28
29 CcffLoader(Copl *newopl) : CmodPlayer(newopl) { };
30
31 bool load(const std::string &filename, const CFileProvider &fp);
32 void rewind(int subsong);
33
34 std::string gettype();
35 std::string gettitle();
36 std::string getauthor();
37 std::string getinstrument(unsigned int n);
38 unsigned int getinstruments();
39
40 private:
41
42 class cff_unpacker
43 {
44 public:
45
46 long unpack(unsigned char *ibuf, unsigned char *obuf);
47
48 private:
49
50 unsigned long get_code();
51 void translate_code(unsigned long code, unsigned char *string);
52
53 void cleanup();
54 int startup();
55
56 void expand_dictionary(unsigned char *string);
57
58 unsigned char *input;
59 unsigned char *output;
60
61 long output_length;
62
63 unsigned char code_length;
64
65 unsigned long bits_buffer;
66 unsigned int bits_left;
67
68 unsigned char *heap;
69 unsigned char **dictionary;
70
71 unsigned int heap_length;
72 unsigned int dictionary_length;
73
74 unsigned long old_code,new_code;
75
76 unsigned char the_string[256];
77 };
78
79 struct cff_header
80 {
81 char id[16];
82 unsigned char version;
83 unsigned short size;
84 unsigned char packed;
85 unsigned char reserved[12];
86 } header;
87
88 struct cff_instrument
89 {
90 unsigned char data[12];
91 char name[21];
92 } instruments[47];
93
94 char song_title[20];
95 char song_author[20];
96
97 struct cff_event
98 {
99 unsigned char byte0;
100 unsigned char byte1;
101 unsigned char byte2;
102 };
103 };