ScummVM API documentation
sound.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 DREAMWEB_SOUND_H
23 #define DREAMWEB_SOUND_H
24 
25 #include "common/array.h"
26 #include "common/str.h"
27 #include "audio/mixer.h"
28 
29 namespace DreamWeb {
30 
31 class DreamWebEngine;
32 
34 public:
36  ~DreamWebSound();
37 
38  bool loadSpeech(byte type1, int idx1, byte type2, int idx2);
39  void volumeSet(uint8 value) { _volume = value; }
40  void volumeChange(uint8 value, int8 direction);
41  void playChannel0(uint8 index, uint8 repeat);
42  void playChannel1(uint8 index);
43  uint8 getChannel0Playing() { return _channel0Playing; }
44  bool isChannel1Playing() { return _channel1Playing != 255; }
45  void cancelCh0();
46  void cancelCh1();
47  void loadRoomsSample(uint8 sample);
48  void soundHandler();
49  void loadSounds(uint bank, const Common::String &suffix);
50 
51 private:
52  DreamWebEngine *_vm;
53 
54  struct Sample {
55  uint offset;
56  uint size;
57  Sample(): offset(), size() {}
58  };
59 
60  struct SoundData {
61  Common::Array<Sample> samples;
63  };
64 
65  SoundData _soundData[2];
66  Common::Array<uint8> _speechData;
67 
68  Audio::SoundHandle _channelHandle[2];
69 
70  uint8 _currentSample;
71  uint8 _channel0Playing;
72  uint8 _channel0Repeat;
73  bool _channel0NewSound;
74  uint8 _channel1Playing;
75  bool _channel1NewSound;
76 
77  uint8 _volume;
78  uint8 _volumeTo;
79  int8 _volumeDirection;
80  uint8 _volumeCount;
81 
82  void volumeAdjust();
83  void playSound(uint8 channel, uint8 id, uint8 loops);
84  void stopSound(uint8 channel);
85  bool loadSpeech(const Common::String &filename);
86 };
87 
88 } // End of namespace DreamWeb
89 
90 #endif
Definition: str.h:59
Definition: console.h:27
Definition: mixer.h:49
Definition: sound.h:33
Definition: dreamweb.h:102