ScummVM API documentation
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_MUSICPROCESS_H
23 #define ULTIMA8_AUDIO_MUSICPROCESS_H
24 
25 #include "ultima/ultima8/kernel/process.h"
26 #include "ultima/ultima8/usecode/intrinsics.h"
27 #include "ultima/ultima8/misc/classtype.h"
28 #include "audio/mididrv.h"
29 
30 namespace Ultima {
31 namespace Ultima8 {
32 
33 class Debugger;
34 class MidiPlayer;
35 
36 class MusicProcess : public Process {
37  friend class Debugger;
38 
39 protected:
42  virtual void playMusic_internal(int track) = 0;
43 
44  static MusicProcess *_theMusicProcess;
45 
46 public:
47  MusicProcess();
48  ~MusicProcess() override;
49 
50  ENABLE_RUNTIME_CLASSTYPE()
51 
52 
54  return _theMusicProcess;
55  }
56 
58  virtual void playMusic(int track) = 0;
60  virtual void playCombatMusic(int track) = 0;
62  virtual void queueMusic(int track) = 0;
64  virtual void unqueueMusic() = 0;
66  virtual void restoreMusic() = 0;
67 
69  virtual void fadeMusic(uint16 length) = 0;
71  virtual bool isFading() = 0;
72 
74  virtual void saveTrackState() = 0;
76  virtual void restoreTrackState() = 0;
77 
79  virtual bool isPlaying() = 0;
80 
82  virtual void pauseMusic() = 0;
84  virtual void unpauseMusic() = 0;
85 
86  INTRINSIC(I_playMusic);
87  INTRINSIC(I_stopMusic);
88  INTRINSIC(I_pauseMusic);
89  INTRINSIC(I_unpauseMusic);
90 
91 };
92 
93 } // End of namespace Ultima8
94 } // End of namespace Ultima
95 
96 #endif
Definition: process.h:34
virtual void unpauseMusic()=0
Resume the current track after pausing.
Definition: detection.h:27
virtual void playMusic(int track)=0
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.
virtual void saveTrackState()=0
Save the current track state - used when the menu is opened.
virtual void queueMusic(int track)=0
Queue a track to start once the current one finishes.
virtual void fadeMusic(uint16 length)=0
Fades out the music over the specified time (in milliseconds)
virtual bool isFading()=0
Returns true if the music is currently fading.
virtual void unqueueMusic()=0
Clear any queued track (does not affect currently playing track)
static MusicProcess * get_instance()
Get the current instance of the Music Processes.
Definition: music_process.h:53
virtual bool isPlaying()=0
Is a track currently playing?
Definition: music_process.h:36
virtual void pauseMusic()=0
Pause the currently playing track.
virtual void restoreTrackState()=0
Bring back the track state from before it was put on hold.
Definition: debugger.h:37
virtual void restoreMusic()=0
Restore the last requested non-combat track (eg, at the end of combat)
virtual void playMusic_internal(int track)=0
virtual void playCombatMusic(int track)=0
Play some combat music - the last played track will be remembered.