comparison Plugins/Input/adplug/core/hsc.h @ 359:8df427a314a8 trunk

[svn] Adlib synthesizer (AdPlug) support.
author chainsaw
date Fri, 30 Dec 2005 16:31:39 -0800
parents
children f12d7e208b43
comparison
equal deleted inserted replaced
358:70075730e187 359:8df427a314a8
1 /*
2 * Adplug - Replayer for many OPL2/OPL3 audio file formats.
3 * Copyright (C) 1999 - 2002 Simon Peter, <dn.tlp@gmx.net>, et al.
4 *
5 * This library is free software; you can redistribute it and/or
6 * modify it under the terms of the GNU Lesser General Public
7 * License as published by the Free Software Foundation; either
8 * version 2.1 of the License, or (at your option) any later version.
9 *
10 * This library is distributed in the hope that it will be useful,
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13 * Lesser General Public License for more details.
14 *
15 * You should have received a copy of the GNU Lesser General Public
16 * License along with this library; if not, write to the Free Software
17 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
18 *
19 * hsc.h - HSC Player by Simon Peter <dn.tlp@gmx.net>
20 */
21
22 #ifndef H_ADPLUG_HSCPLAYER
23 #define H_ADPLUG_HSCPLAYER
24
25 #include "player.h"
26
27 class ChscPlayer: public CPlayer
28 {
29 public:
30 static CPlayer *factory(Copl *newopl);
31
32 ChscPlayer(Copl *newopl): CPlayer(newopl), mtkmode(0) {}
33
34 bool load(const std::string &filename, const CFileProvider &fp);
35 bool update();
36 void rewind(int subsong);
37 float getrefresh() { return 18.2f; }; // refresh rate is fixed at 18.2Hz
38
39 std::string gettype() { return std::string("HSC Adlib Composer / HSC-Tracker"); }
40 unsigned int getpatterns();
41 unsigned int getpattern() { return song[songpos]; }
42 unsigned int getorders();
43 unsigned int getorder() { return songpos; }
44 unsigned int getrow() { return pattpos; }
45 unsigned int getspeed() { return speed; }
46 unsigned int getinstruments();
47
48 protected:
49 struct hscnote {
50 unsigned char note, effect;
51 }; // note type in HSC pattern
52
53 struct hscchan {
54 unsigned char inst; // current instrument
55 signed char slide; // used for manual slide-effects
56 unsigned short freq; // actual replaying frequency
57 }; // HSC channel data
58
59 hscchan channel[9]; // player channel-info
60 unsigned char instr[128][12]; // instrument data
61 unsigned char song[0x80]; // song-arrangement (MPU-401 Trakker enhanced)
62 hscnote patterns[50][64*9]; // pattern data
63 unsigned char pattpos,songpos, // various bytes & flags
64 pattbreak,songend,mode6,bd,fadein;
65 unsigned int speed,del;
66 unsigned char adl_freq[9]; // adlib frequency registers
67 int mtkmode; // flag: MPU-401 Trakker mode on/off
68
69 private:
70 void setfreq(unsigned char chan, unsigned short freq);
71 void setvolume(unsigned char chan, int volc, int volm);
72 void setinstr(unsigned char chan, unsigned char insnr);
73 };
74
75 #endif