ScummVM API documentation
module.h
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 modify
8  * it under the terms of the GNU General Public License as published by
9  * the Free Software Foundation, either version 3 of the License, or
10  * (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, see <http://www.gnu.org/licenses/>.
19  *
20  */
21 
22 #ifndef AUDIO_MODS_MODULE_H
23 #define AUDIO_MODS_MODULE_H
24 
25 #include "common/scummsys.h"
26 
27 namespace Common {
28 class SeekableReadStream;
29 }
30 
31 namespace Modules {
32 
33 #include "common/pack-start.h" // START STRUCT PACKING
34 
35 struct note_t {
36  byte sample;
37  byte note;
38  uint16 period;
39  uint16 effect;
40 } PACKED_STRUCT;
41 
42 #include "common/pack-end.h" // END STRUCT PACKING
43 
44 typedef note_t pattern_t[64][4];
45 
46 struct sample_t {
47  byte name[23];
48  uint16 len;
49  byte finetune;
50  byte vol;
51  uint16 repeat;
52  uint16 replen;
53  int8 *data;
54 };
55 
56 struct sample_offs {
57  byte name[23];
58  uint16 len;
59  uint32 offs;
60 };
61 
62 class Module {
63 public:
64  byte songname[21];
65 
66  static const int NUM_SAMPLES = 31;
67  sample_t sample[NUM_SAMPLES];
68  sample_offs commonSamples[NUM_SAMPLES];
69 
70  byte songlen;
71  byte undef;
72  byte songpos[128];
73  uint32 sig;
74  pattern_t *pattern;
75 
76  Module();
77  virtual ~Module();
78 
79  virtual bool load(Common::SeekableReadStream &stream, int offs);
80  static byte periodToNote(int16 period, byte finetune = 0);
81  static int16 noteToPeriod(byte note, byte finetune = 0);
82 
83 protected:
84  static const int16 periods[16][60];
85  static const uint32 signatures[];
86 };
87 
88 } // End of namespace Modules
89 
90 #endif
Definition: module.h:46
Definition: module.h:62
Definition: module.h:31
Definition: stream.h:745
Definition: algorithm.h:29
Definition: module.h:56
Definition: module.h:35