2007-05-30 21:56:52 +00:00
|
|
|
/* ScummVM - Graphic Adventure Engine
|
|
|
|
*
|
|
|
|
* ScummVM is the legal property of its developers, whose names
|
|
|
|
* are too numerous to list here. Please refer to the COPYRIGHT
|
|
|
|
* file distributed with this source distribution.
|
2006-10-16 22:20:46 +00:00
|
|
|
*
|
|
|
|
* This program is free software; you can redistribute it and/or
|
|
|
|
* modify it under the terms of the GNU General Public License
|
|
|
|
* as published by the Free Software Foundation; either version 2
|
|
|
|
* of the License, or (at your option) any later version.
|
|
|
|
|
|
|
|
* This program is distributed in the hope that it will be useful,
|
|
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
* GNU General Public License for more details.
|
|
|
|
|
|
|
|
* You should have received a copy of the GNU General Public License
|
|
|
|
* along with this program; if not, write to the Free Software
|
|
|
|
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
|
|
|
*
|
|
|
|
*/
|
|
|
|
|
2006-10-18 18:34:40 +00:00
|
|
|
#ifndef SOUND_MODS_MODULE_H
|
|
|
|
#define SOUND_MODS_MODULE_H
|
2006-10-16 22:20:46 +00:00
|
|
|
|
2011-04-24 08:34:27 +00:00
|
|
|
#include "common/scummsys.h"
|
|
|
|
|
|
|
|
namespace Common {
|
|
|
|
class SeekableReadStream;
|
|
|
|
}
|
2006-10-19 05:37:22 +00:00
|
|
|
|
2006-10-16 22:20:46 +00:00
|
|
|
namespace Modules {
|
|
|
|
|
2006-10-23 01:37:59 +00:00
|
|
|
#include "common/pack-start.h" // START STRUCT PACKING
|
|
|
|
|
2006-10-18 18:34:40 +00:00
|
|
|
struct note_t {
|
2006-10-16 22:20:46 +00:00
|
|
|
byte sample;
|
2007-01-27 21:55:26 +00:00
|
|
|
byte note;
|
2006-10-16 22:20:46 +00:00
|
|
|
uint16 period;
|
|
|
|
uint16 effect;
|
2007-07-01 18:18:43 +00:00
|
|
|
} PACKED_STRUCT;
|
2006-10-16 22:20:46 +00:00
|
|
|
|
2006-10-23 01:37:59 +00:00
|
|
|
#include "common/pack-end.h" // END STRUCT PACKING
|
|
|
|
|
2006-10-16 22:20:46 +00:00
|
|
|
typedef note_t pattern_t[64][4];
|
|
|
|
|
2006-10-18 18:34:40 +00:00
|
|
|
struct sample_t {
|
2006-10-16 22:20:46 +00:00
|
|
|
byte name[23];
|
|
|
|
uint16 len;
|
|
|
|
byte finetune;
|
|
|
|
byte vol;
|
|
|
|
uint16 repeat;
|
|
|
|
uint16 replen;
|
2006-10-23 01:37:59 +00:00
|
|
|
int8 *data;
|
2006-10-18 18:34:40 +00:00
|
|
|
};
|
2006-10-16 22:20:46 +00:00
|
|
|
|
2007-07-28 07:52:24 +00:00
|
|
|
struct sample_offs {
|
|
|
|
byte name[23];
|
|
|
|
uint16 len;
|
|
|
|
uint32 offs;
|
|
|
|
};
|
|
|
|
|
2006-10-16 22:20:46 +00:00
|
|
|
class Module {
|
|
|
|
public:
|
|
|
|
byte songname[21];
|
|
|
|
|
2007-01-27 00:11:15 +00:00
|
|
|
static const int NUM_SAMPLES = 31;
|
|
|
|
sample_t sample[NUM_SAMPLES];
|
2007-07-28 07:52:24 +00:00
|
|
|
sample_offs commonSamples[NUM_SAMPLES];
|
2006-10-16 22:20:46 +00:00
|
|
|
|
|
|
|
byte songlen;
|
|
|
|
byte undef;
|
|
|
|
byte songpos[128];
|
2009-05-23 20:38:08 +00:00
|
|
|
uint32 sig;
|
2006-10-16 22:20:46 +00:00
|
|
|
pattern_t *pattern;
|
|
|
|
|
|
|
|
Module();
|
|
|
|
~Module();
|
|
|
|
|
2007-07-28 07:52:24 +00:00
|
|
|
bool load(Common::SeekableReadStream &stream, int offs);
|
2007-01-27 22:03:33 +00:00
|
|
|
static byte periodToNote(int16 period, byte finetune = 0);
|
|
|
|
static int16 noteToPeriod(byte note, byte finetune = 0);
|
2007-01-27 21:55:26 +00:00
|
|
|
|
|
|
|
private:
|
|
|
|
static const int16 periods[16][60];
|
2009-05-23 20:38:08 +00:00
|
|
|
static const uint32 signatures[];
|
2006-10-16 22:20:46 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
} // End of namespace Modules
|
|
|
|
|
|
|
|
#endif
|