ScummVM API documentation
te_music.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 TETRAEDGE_TE_TE_MUSIC_H
23 #define TETRAEDGE_TE_TE_MUSIC_H
24 
25 #include "audio/mixer.h"
26 #include "common/mutex.h"
27 #include "common/fs.h"
28 #include "common/str.h"
29 
30 #include "tetraedge/te/te_resource.h"
31 #include "tetraedge/te/te_signal.h"
32 
33 namespace Tetraedge {
34 
35 class TeMusic : public TeResource {
36 public:
37  TeMusic();
38  ~TeMusic();
39 
40  void close() {
41  stop();
42  }
43  void pause();
44  bool play();
45  bool repeat();
46  void repeat(bool val);
47  void resume();
48  void stop();
49 
50  byte currentData();
51  void entry();
52  const Common::Path &filePath() const {
53  return _rawPath;
54  }
55  bool isPlaying();
56  bool load(const Common::Path &path);
57  bool onSoundManagerVolumeChanged();
58  Common::Path path();
59  void setChannelName(const Common::String &name) {
60  _channelName = name;
61  }
62  const Common::String &channelName() const {
63  return _channelName;
64  }
65  void setFilePath(const Common::Path &name);
66  void update();
67  void volume(float vol);
68  float volume();
69 
70  TeSignal0Param &onStopSignal() { return _onStopSignal; }
71 
72  void setRetain(bool retain) { _retain = retain; }
73  bool retain() const { return _retain; }
74 
75 private:
76  Common::Path _rawPath; // Plain name of file requested
77  Common::Path _filePath; // file after finding it
78  Common::String _channelName;
79 
80  bool _repeat;
81  byte _currentData;
82 
83  bool _isPlaying;
84  bool _isPaused;
85  bool _retain;
86 
87  float _volume;
88 
89  Audio::SoundHandle _sndHandle;
90  bool _sndHandleValid;
91 
92  Common::Mutex _mutex;
93  TeSignal0Param _onStopSignal;
94 };
95 
96 } // end namespace Tetraedge
97 
98 #endif // TETRAEDGE_TE_TE_MUSIC_H
Definition: te_signal.h:40
Definition: str.h:59
Definition: detection.h:27
Definition: te_resource.h:31
Definition: path.h:52
Definition: mixer.h:49
Definition: mutex.h:67
Definition: te_music.h:35