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 FREESCAPE_SOUND_H
23 #define FREESCAPE_SOUND_H
24 
25 #include "audio/softsynth/pcspk.h"
26 
27 namespace Freescape {
28 
29 // TODO: Migrate to Audio::PCSpeaker
31 public:
32  bool endOfStream() const override { return !isPlaying(); }
33 };
34 
35 class Sound {
36 public:
37  enum Type {
38  kTypeNormal,
39  kTypeMovement
40  };
41 
42  virtual ~Sound() {}
43 
44  virtual void playSound(int index, Type type) = 0;
45  virtual void stopSound(Type type) = 0;
46  virtual bool isPlayingSound(Type type) const = 0;
47 
48  // Whether the given sound index actually exists. Used to skip undefined
49  // sounds without disturbing the sound currently playing, matching the
50  // original engines where an unknown index leaves the active sound untouched.
51  virtual bool isSoundAvailable(int index) const { return true; }
52 };
53 
54 } // End of namespace Freescape
55 
56 #endif // FREESCAPE_SOUND_H
Definition: area.h:36
Definition: pcspk.h:88
bool endOfStream() const override
Definition: sound.h:32
Definition: sound.h:35
Definition: sound.h:30