1 /* 2 * Adplug - Replayer for many OPL2/OPL3 audio file formats. 3 * Copyright (C) 1999 - 2004 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 * lds.h - LOUDNESS Player by Simon Peter <dn.tlp@gmx.net> 20 */ 21 22 #include "player.h" 23 24 class CldsPlayer: public CPlayer 25 { 26 public: factory(Copl * newopl)27 static CPlayer *factory(Copl *newopl) { return new CldsPlayer(newopl); } 28 29 CldsPlayer(Copl *newopl); 30 virtual ~CldsPlayer(); 31 32 bool load(const std::string &filename, const CFileProvider &fp); 33 virtual bool update(); 34 virtual void rewind(int subsong = -1); getrefresh()35 float getrefresh() { return 1193182.0f / speed; } 36 gettype()37 std::string gettype() { return std::string("LOUDNESS Sound System"); } getorders()38 unsigned int getorders() { return numposi; } getorder()39 unsigned int getorder() { return posplay; } getrow()40 unsigned int getrow() { return pattplay; } getspeed()41 unsigned int getspeed() { return speed; } getinstruments()42 unsigned int getinstruments() { return numpatch; } 43 44 private: 45 typedef struct { 46 unsigned char mod_misc, mod_vol, mod_ad, mod_sr, mod_wave, 47 car_misc, car_vol, car_ad, car_sr, car_wave, feedback, keyoff, 48 portamento, glide, finetune, vibrato, vibdelay, mod_trem, car_trem, 49 tremwait, arpeggio, arp_tab[12]; 50 unsigned short start, size; 51 unsigned char fms; 52 unsigned short transp; 53 unsigned char midinst, midvelo, midkey, midtrans, middum1, middum2; 54 } SoundBank; 55 56 typedef struct { 57 unsigned short gototune, lasttune, packpos; 58 unsigned char finetune, glideto, portspeed, nextvol, volmod, volcar, 59 vibwait, vibspeed, vibrate, trmstay, trmwait, trmspeed, trmrate, trmcount, 60 trcwait, trcspeed, trcrate, trccount, arp_size, arp_speed, keycount, 61 vibcount, arp_pos, arp_count, packwait, arp_tab[12]; 62 63 struct { 64 unsigned char chandelay, sound; 65 unsigned short high; 66 } chancheat; 67 } Channel; 68 69 typedef struct { 70 unsigned short patnum; 71 unsigned char transpose; 72 } Position; 73 74 static const unsigned short frequency[]; 75 static const unsigned char vibtab[], tremtab[]; 76 static const unsigned short maxsound, maxpos; 77 78 SoundBank *soundbank; 79 Channel channel[9]; 80 Position *positions; 81 unsigned char fmchip[0xff], jumping, fadeonoff, allvolume, hardfade, 82 tempo_now, pattplay, tempo, regbd, chandelay[9], mode, pattlen; 83 unsigned short posplay, jumppos, *patterns, speed; 84 bool playing, songlooped; 85 unsigned int numpatch, numposi, patterns_size, mainvolume; 86 87 void playsound(int inst_number, int channel_number, int tunehigh); 88 inline void setregs(unsigned char reg, unsigned char val); 89 inline void setregs_adv(unsigned char reg, unsigned char mask, 90 unsigned char val); 91 }; 92