ScummVM API documentation
midiparser_hmp.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_MIDIPARSER_HMP_H
23 #define AUDIO_MIDIPARSER_HMP_H
24 
25 #include "audio/midiparser_smf.h"
26 
34 protected:
35  enum class HmpVersion {
36  VERSION_HMI,
37  VERSION_HMP_1,
38  VERSION_HMP_013195
39  };
40 
41  static const char HEADER_HMI[];
42  static const char HEADER_HMP[];
43  static const char HEADER_HMP_VERSION_1[];
44  static const char HEADER_HMP_VERSION_013195[];
45 
46  uint32 readDelta(const byte *&data) override;
47 
48  HmpVersion determineVersion(const byte *pos);
49 
50 public:
51  MidiParser_HMP(int8 source = -1);
52 
53  bool loadMusic(const byte *data, uint32 size) override;
54 
55  int32 determineDataSize(Common::SeekableReadStream *stream) override;
56 
57 protected:
58  HmpVersion _version;
59  uint32 _branchOffset;
60  // Total track length in seconds
61  uint32 _songLength;
62  uint32 _channelPriorities[16];
63  uint32 _deviceTrackMappings[32][5];
64  uint8 _restoreControllers[128];
65  uint32 _callbackPointer;
66  uint32 _callbackSegment;
67 
68  // Read a word from the data with a length that is correct for the specified
69  // version (i.e. 2 bytes for HMI, 4 bytes for HMP)
70  uint32 readWord(const byte *&data, HmpVersion version);
71  uint32 readWord(Common::SeekableReadStream *stream, HmpVersion version);
72 };
73 
74 #endif
int32 determineDataSize(Common::SeekableReadStream *stream) override
Definition: stream.h:745
Definition: midiparser_hmp.h:33
Definition: midiparser_smf.h:30