1 /* ScummVM - Graphic Adventure Engine 2 * 3 * ScummVM is the legal property of its developers, whose names 4 * are too numerous to list here. Please refer to the COPYRIGHT 5 * file distributed with this source distribution. 6 * 7 * This program is free software; you can redistribute it and/or 8 * modify it under the terms of the GNU General Public License 9 * as published by the Free Software Foundation; either version 2 10 * of the License, or (at your option) any later version. 11 * 12 * This program is distributed in the hope that it will be useful, 13 * but WITHOUT ANY WARRANTY; without even the implied warranty of 14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 15 * GNU General Public License for more details. 16 * 17 * You should have received a copy of the GNU General Public License 18 * along with this program; if not, write to the Free Software 19 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. 20 * 21 */ 22 23 #ifndef AUDIO_MODS_MODULE_H 24 #define AUDIO_MODS_MODULE_H 25 26 #include "common/scummsys.h" 27 28 namespace Common { 29 class SeekableReadStream; 30 } 31 32 namespace Modules { 33 34 #include "common/pack-start.h" // START STRUCT PACKING 35 36 struct note_t { 37 byte sample; 38 byte note; 39 uint16 period; 40 uint16 effect; 41 } PACKED_STRUCT; 42 43 #include "common/pack-end.h" // END STRUCT PACKING 44 45 typedef note_t pattern_t[64][4]; 46 47 struct sample_t { 48 byte name[23]; 49 uint16 len; 50 byte finetune; 51 byte vol; 52 uint16 repeat; 53 uint16 replen; 54 int8 *data; 55 }; 56 57 struct sample_offs { 58 byte name[23]; 59 uint16 len; 60 uint32 offs; 61 }; 62 63 class Module { 64 public: 65 byte songname[21]; 66 67 static const int NUM_SAMPLES = 31; 68 sample_t sample[NUM_SAMPLES]; 69 sample_offs commonSamples[NUM_SAMPLES]; 70 71 byte songlen; 72 byte undef; 73 byte songpos[128]; 74 uint32 sig; 75 pattern_t *pattern; 76 77 Module(); 78 ~Module(); 79 80 bool load(Common::SeekableReadStream &stream, int offs); 81 static byte periodToNote(int16 period, byte finetune = 0); 82 static int16 noteToPeriod(byte note, byte finetune = 0); 83 84 private: 85 static const int16 periods[16][60]; 86 static const uint32 signatures[]; 87 }; 88 89 } // End of namespace Modules 90 91 #endif 92