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