1 /* 2 AdPlug - Replayer for many OPL2/OPL3 audio file formats. 3 Copyright (C) 1999 - 2003 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 xad.h - XAD shell player by Riven the Mage <riven@ok.ru> 20 */ 21 22 /* 23 * Copyright (c) 2015 - 2017 Wraithverge <liam82067@yahoo.com> 24 * - Realigned to Tabs. 25 * - Added support for Speed indicator in 'File Info' dialogues. 26 */ 27 28 #ifndef H_ADPLUG_XAD 29 #define H_ADPLUG_XAD 30 31 #include "player.h" 32 33 class CxadPlayer: public CPlayer 34 { 35 public: 36 static CPlayer *factory(Copl *newopl); 37 38 CxadPlayer(Copl * newopl); 39 ~CxadPlayer(); 40 41 bool load(const std::string &filename, const CFileProvider &fp); 42 bool update(); 43 void rewind(int subsong); 44 float getrefresh(); 45 46 std::string gettype(); 47 std::string gettitle(); 48 std::string getauthor(); 49 std::string getinstrument(unsigned int i); 50 unsigned int getinstruments(); 51 52 // Wraithverge: added this. 53 unsigned int getspeed(); 54 55 protected: 56 virtual void xadplayer_rewind(int subsong) = 0; 57 virtual bool xadplayer_load() = 0; 58 virtual void xadplayer_update() = 0; 59 virtual float xadplayer_getrefresh() = 0; 60 virtual std::string xadplayer_gettype() = 0; xadplayer_gettitle()61 virtual std::string xadplayer_gettitle() 62 { 63 return std::string(xad.title); 64 } xadplayer_getauthor()65 virtual std::string xadplayer_getauthor() 66 { 67 return std::string(xad.author); 68 } xadplayer_getinstrument(unsigned int i)69 virtual std::string xadplayer_getinstrument(unsigned int i) 70 { 71 return std::string(""); 72 } xadplayer_getinstruments()73 virtual unsigned int xadplayer_getinstruments() 74 { 75 return 0; 76 } 77 78 // Wraithverge: added this. xadplayer_getspeed()79 virtual unsigned int xadplayer_getspeed() 80 { 81 return 0; 82 } 83 84 enum { HYP=1, PSI, FLASH, BMF, RAT, HYBRID }; 85 86 struct xad_header 87 { 88 unsigned long id; 89 char title[36]; 90 char author[36]; 91 unsigned short fmt; 92 unsigned char speed; 93 unsigned char reserved_a; 94 } xad; 95 96 unsigned char * tune; 97 unsigned long tune_size; 98 99 struct 100 { 101 int playing; 102 int looping; 103 unsigned char speed; 104 unsigned char speed_counter; 105 } plr; 106 107 unsigned char adlib[256]; 108 109 void opl_write(int reg, int val); 110 }; 111 #endif 112