GameApi 28
Library used by GameApi Builder tool
Loading...
Searching...
No Matches
Midplay.hh
Go to the documentation of this file.
1//
2// Copyright (C) 2009 Tero Pulkkinen
3// Released under LGPL License.
4//
5// This file is part of Polygon.
6//
7// Polygon 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// Polygon 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 Library General Public License
18// along with Polygon. If not, see <http://www.gnu.org/licenses/>.
19//
20
21
22#include <string>
23#include <vector>
24
25struct Chunk
26{
27 unsigned char Id[4];
28 unsigned char Len[4];
29
30 unsigned long Length() { return long(Len[0])*256*256*256 +
31 long(Len[1])*256*256+
32 long(Len[2])*256+
33 long(Len[3]); }
34};
35
36/*
37struct Event
38{
39 long delta_time;
40 int event_type;
41 int channel;
42 int param1;
43 int param2;
44};
45
46class MidFileLoader
47{
48public:
49 MidFileLoader(std::string filename);
50 int NumberOfChunks() const;
51 Chunk *ChunkHeader(int chunk) const;
52 unsigned char *ChunkData(int chunk) const;
53 std::vector<Event> GetEvents(int chunk) const;
54 long VarLength(unsigned char *&data) const;
55private:
56 std::string contents;
57 std::vector<Chunk*> chunks;
58};
59*/
Definition Midplay.hh:26
unsigned long Length()
Definition Midplay.hh:30
unsigned char Id[4]
Definition Midplay.hh:27
unsigned char Len[4]
Definition Midplay.hh:28