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