ScummVM API documentation
music_room_instrument.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 TITANIC_MUSIC_ROOM_INSTRUMENT_H
23#define TITANIC_MUSIC_ROOM_INSTRUMENT_H
24
25#include "common/array.h"
26#include "titanic/support/string.h"
27
28namespace Titanic {
29
30enum MusicWaveInstrument { MV_PIANO = 0, MV_BASS = 1, MV_BELLS = 2, MV_SNAKE = 3 };
31
32class CProjectItem;
33class CSoundManager;
34class CWaveFile;
35class CGameObject;
36
38 struct CInstrumentWaveFile {
39 CWaveFile *_waveFile;
40 int _value;
41 CInstrumentWaveFile() : _waveFile(nullptr), _value(0) {}
42 };
43private:
44 static bool _pianoToggle;
45 static int _pianoCtr;
46 static int _bassCtr;
47 static byte *_buffer;
48 static double *_array;
49 static int _arrayIndex;
50private:
51 CSoundManager *_soundManager;
53 MusicWaveInstrument _instrument;
54 CProjectItem *_project;
55 CGameObject *_gameObjects[4];
56 int _waveIndex;
57 int _readPos;
58 int _readIncrement;
59 uint _size;
60 uint _count;
61 int _field4C;
62private:
66 CWaveFile *createWaveFile(const CString &name);
67
73 void setupArray(int minVal, int maxVal);
74public:
75 double _insStartTime;
76public:
80 static void init();
81
85 static void deinit();
86public:
87 CMusicRoomInstrument(CProjectItem *project, CSoundManager *soundManager, MusicWaveInstrument instrument);
88
92 void setFilesCount(uint count);
93
97 void load(int index, const CString &filename, int v3);
98
99
103 void start();
104
108 void stop();
109
114 void update(int val);
115
119 void clear();
120
125 void reset(uint total);
126
131 int read(int16 *ptr, uint size);
132
136 void chooseWaveFile(int index, int freq);
137};
138
139} // End of namespace Titanic
140
141#endif /* TITANIC_MUSIC_ROOM_INSTRUMENT_H */
Definition: game_object.h:79
Definition: music_room_instrument.h:37
void setFilesCount(uint count)
void load(int index, const CString &filename, int v3)
void chooseWaveFile(int index, int freq)
int read(int16 *ptr, uint size)
Definition: project_item.h:84
Definition: sound_manager.h:42
Definition: string.h:40
Definition: wave_file.h:35