ScummVM API documentation
myst_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 MOHAWK_MYST_SOUND_H
23 #define MOHAWK_MYST_SOUND_H
24 
25 #include "common/scummsys.h"
26 #include "common/str.h"
27 
28 #include "audio/mixer.h"
29 
30 namespace Audio {
31 class RewindableAudioStream;
32 }
33 
34 namespace Mohawk {
35 
36 struct CueList;
37 class MohawkEngine_Myst;
38 
39 class MystSound {
40 public:
41  explicit MystSound(MohawkEngine_Myst *vm);
42  ~MystSound();
43 
44  // Effect channel
45  void playEffect(uint16 id, bool loop = false);
46  void stopEffect();
47  bool isEffectPlaying();
48 
49  // Background channel
50  void playBackground(uint16 id, uint16 volume = 0xFFFF);
51  void pauseBackground();
52  void resumeBackground();
53  void stopBackground();
54  void changeBackgroundVolume(uint16 volume);
55 
56  // Speech channel
57  void playSpeech(uint16 id, CueList *cueList = nullptr);
58  bool isSpeechPlaying();
59  uint getSpeechNumSamplesPlayed();
60  void stopSpeech();
61 
62 private:
63  MohawkEngine_Myst *_vm;
64 
65  Audio::RewindableAudioStream *makeAudioStream(uint16 id, CueList *cueList = nullptr);
66  uint16 convertMystID(uint16 id);
67 
68  Audio::SoundHandle _effectHandle;
69  int _speechSamplesPerSecond;
70  uint16 _effectId;
71 
72  Audio::SoundHandle _backgroundHandle;
73  uint16 _backgroundId;
74 
75  Audio::SoundHandle _speechHandle;
76 };
77 
78 } // End of namespace Mohawk
79 
80 #endif
Definition: mixer.h:49
Definition: myst.h:129
Definition: sound.h:74
Definition: audiostream.h:109
Definition: system.h:38
Definition: bitmap.h:32
Definition: myst_sound.h:39