ScummVM API documentation
music_room_handler.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_HANDLER_H
23 #define TITANIC_MUSIC_ROOM_HANDLER_H
24 
25 #include "titanic/sound/audio_buffer.h"
26 #include "titanic/sound/music_room_instrument.h"
27 #include "titanic/sound/music_song.h"
28 #include "titanic/sound/wave_file.h"
29 
30 namespace Titanic {
31 
32 class CProjectItem;
33 class CSoundManager;
34 
35 enum MusicInstrument { BELLS = 0, SNAKE = 1, PIANO = 2, BASS = 3 };
36 
38  int _pitchControl;
39  int _speedControl;
40  bool _directionControl;
41  bool _inversionControl;
42  bool _muteControl;
43  MusicRoomInstrument() : _pitchControl(0), _speedControl(0), _directionControl(false),
44  _inversionControl(false), _muteControl(false) {}
45 };
46 
48 private:
49  CProjectItem *_project;
50  CSoundManager *_soundManager;
51  CMusicRoomInstrument *_instruments[4];
52  MusicRoomInstrument _array1[4];
53  MusicRoomInstrument _array2[4];
54  CMusicSong *_songs[4];
55  int _startPos[4];
56  int _position[4];
57  double _animExpiryTime[4];
58 
59  bool _active;
60  CWaveFile *_waveFile;
61  int _soundHandle;
62  int _instrumentsActive;
63  CAudioBuffer *_audioBuffer;
64  bool _isPlaying;
65  uint _soundStartTicks;
66  uint _startTicks;
67  int _volume;
68 private:
72  void start();
73 
77  void updateAudio();
78 
82  void updateInstruments();
83 
89  bool pollInstrument(MusicInstrument instrument);
90 
96  double getAnimDuration(MusicInstrument instrument, int arrIndex);
97 
102  int getPitch(MusicInstrument instrument, int arrIndex);
103 public:
104  CMusicRoomHandler(CProjectItem *project, CSoundManager *soundManager);
106 
113  CMusicRoomInstrument *createInstrument(MusicInstrument instrument, int count);
114 
118  void setup(int volume);
119 
123  void setActive(bool flag) { _active = flag; }
124 
128  void stop();
129 
133  bool checkInstrument(MusicInstrument instrument) const;
134 
138  void setSpeedControl2(MusicInstrument instrument, int value);
139 
143  void setPitchControl2(MusicInstrument instrument, int value);
144 
148  void setInversionControl2(MusicInstrument instrument, bool value);
149 
153  void setDirectionControl2(MusicInstrument instrument, bool value);
154 
158  void setPitchControl(MusicInstrument instrument, int value);
159 
163  void setSpeedControl(MusicInstrument instrument, int value);
164 
168  void setDirectionControl(MusicInstrument instrument, bool value);
169 
173  void setInversionControl(MusicInstrument instrument, bool value);
174 
178  void setMuteControl(MusicInstrument instrument, bool value);
179 
184  bool update();
185 };
186 
187 } // End of namespace Titanic
188 
189 #endif /* TITANIC_MUSIC_ROOM_HANDLER_H */
void setActive(bool flag)
Definition: music_room_handler.h:123
Definition: music_room_handler.h:47
Definition: audio_buffer.h:32
Definition: music_song.h:36
Definition: sound_manager.h:42
Definition: arm.h:30
Definition: project_item.h:84
Definition: music_room_handler.h:37
Definition: wave_file.h:35
Definition: music_room_instrument.h:37