ScummVM API documentation
cru_music_process.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 ULTIMA8_AUDIO_CRUMUSICPROCESS_H
23 #define ULTIMA8_AUDIO_CRUMUSICPROCESS_H
24 
25 #include "ultima/ultima8/audio/music_process.h"
26 #include "ultima/ultima8/misc/classtype.h"
27 #include "audio/audiostream.h"
28 #include "audio/mixer.h"
29 
30 namespace Ultima {
31 namespace Ultima8 {
32 
33 class Debugger;
34 class MidiPlayer;
35 
36 class CruMusicProcess : public MusicProcess {
37  friend class Debugger;
38 
39 protected:
42  void playMusic_internal(int track) override;
43 
44 private:
45  int _currentTrack;
46 
47  int _savedTrack;
48 
49  uint8 _m16offset;
50 
51  Audio::SoundHandle _soundHandle;
52 
53  // These are both initialized in constructor and do not need to be saved.
54  int _maxTrack;
55  const char *const *_trackNames;
56 
57 public:
59  ~CruMusicProcess() override;
60 
61  ENABLE_RUNTIME_CLASSTYPE()
62 
63 
64  void playMusic(int track) override;
66  void playCombatMusic(int track) override;
68  void queueMusic(int track) override;
70  void unqueueMusic() override;
72  void restoreMusic() override;
73 
75  void fadeMusic(uint16 length) override { };
77  bool isFading() override { return false; };
78 
80  void saveTrackState() override;
82  void restoreTrackState() override;
83 
85  bool isPlaying() override;
86 
88  void pauseMusic() override;
90  void unpauseMusic() override;
91 
92  void run() override;
93 
94  bool loadData(Common::ReadStream *rs, uint32 version);
95  void saveData(Common::WriteStream *ws) override;
96 };
97 
98 } // End of namespace Ultima8
99 } // End of namespace Ultima
100 
101 #endif
Definition: stream.h:77
void restoreMusic() override
Restore the last requested non-combat track (eg, at the end of combat)
void saveData(Common::WriteStream *ws) override
save Process data
void unpauseMusic() override
Resume the current track after pausing.
void playMusic_internal(int track) override
void queueMusic(int track) override
Queue a track to start once the current one finishes.
void playMusic(int track) override
Play some background music. Does not change the current track if combat music is active. If another track is currently queued, just queues this track for play.
void saveTrackState() override
Save the current track state - used when the menu is opened.
void restoreTrackState() override
Bring back the track state from before it was put on hold.
Definition: detection.h:27
Definition: mixer.h:49
void pauseMusic() override
Pause the currently playing track.
Definition: cru_music_process.h:36
void playCombatMusic(int track) override
Play some combat music - the last played track will be remembered.
bool isFading() override
Fading is not used, so this returns false.
Definition: cru_music_process.h:77
Definition: stream.h:385
Definition: music_process.h:36
void unqueueMusic() override
Clear any queued track (does not affect currently playing track)
Definition: debugger.h:37
void fadeMusic(uint16 length) override
Fading is not used, so this does nothing.
Definition: cru_music_process.h:75
bool isPlaying() override
Is a track currently playing?