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 NUVIE_SOUND_SOUND_H
23 #define NUVIE_SOUND_SOUND_H
24 
25 #include "ultima/nuvie/core/game.h"
26 #include "common/str.h"
27 #include "ultima/shared/std/containers.h"
28 
29 namespace Ultima {
30 namespace Nuvie {
31 
32 class Sound {
33 public:
34  virtual ~Sound() {};
35  virtual bool Play(bool looping = false) = 0;
36  virtual bool Stop() = 0;
37  virtual bool FadeOut(float seconds) = 0;
38  virtual bool SetVolume(uint8 volume) = 0; //range 0..255
39  const Common::String &GetName() const {
40  return m_Filename;
41  }
42  Common::String GetTitle() {
43  return m_Title;
44  }
45  Common::String GetId() {
46  return m_FileId;
47  }
48 protected:
49  // TODO: determine if filename should be a Common::Path
50  Common::String m_Filename;
51  Common::String m_Title;
52  Common::String m_FileId;
53  // static SoundManager *gpSM;
54 };
55 
57 public:
58  Sound *Select() {
59  int i = NUVIE_RAND() % m_Sounds.size();
60  return m_Sounds[i];
61  }; //randomly select one from the list
62  Common::Array<Sound *> m_Sounds;
63 };
64 
65 } // End of namespace Nuvie
66 } // End of namespace Ultima
67 
68 #endif
Definition: str.h:59
Definition: array.h:52
Definition: detection.h:27
Definition: sound.h:56
Definition: sound.h:32