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 8 * modify it under the terms of the GNU General Public License 9 * as published by the Free Software Foundation; either version 2 10 * of the License, or (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, write to the Free Software 19 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. 20 * 21 */ 22 23 #ifndef ULTIMA8_AUDIO_MUSICPROCESS_H 24 #define ULTIMA8_AUDIO_MUSICPROCESS_H 25 26 #include "ultima/ultima8/kernel/process.h" 27 #include "ultima/ultima8/usecode/intrinsics.h" 28 #include "ultima/ultima8/misc/classtype.h" 29 #include "audio/mididrv.h" 30 31 namespace Ultima { 32 namespace Ultima8 { 33 34 class Debugger; 35 class MidiPlayer; 36 37 class MusicProcess : public Process { 38 friend class Debugger; 39 40 protected: 41 //! Play a music track 42 //! \param track The track number to play. Pass 0 to stop music 43 virtual void playMusic_internal(int track) = 0; 44 45 static MusicProcess *_theMusicProcess; 46 47 public: 48 MusicProcess(); 49 ~MusicProcess() override; 50 ENABLE_RUNTIME_CLASSTYPE()51 ENABLE_RUNTIME_CLASSTYPE() 52 53 //! Get the current instance of the Music Processes 54 static MusicProcess *get_instance() { 55 return _theMusicProcess; 56 } 57 58 //! 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. 59 virtual void playMusic(int track) = 0; 60 //! Play some combat music - the last played track will be remembered 61 virtual void playCombatMusic(int track) = 0; 62 //! Queue a track to start once the current one finishes 63 virtual void queueMusic(int track) = 0; 64 //! Clear any queued track (does not affect currently playing track) 65 virtual void unqueueMusic() = 0; 66 //! Restore the last requested non-combat track (eg, at the end of combat) 67 virtual void restoreMusic() = 0; 68 69 //! Fades out the music over the specified time (in milliseconds) 70 virtual void fadeMusic(uint16 length) = 0; 71 //! Returns true if the music is currently fading 72 virtual bool isFading() = 0; 73 74 //! Save the current track state - used when the menu is opened 75 virtual void saveTrackState() = 0; 76 //! Bring back the track state from before it was put on hold 77 virtual void restoreTrackState() = 0; 78 79 //! Is a track currently playing? 80 virtual bool isPlaying() = 0; 81 82 //! Pause the currently playing track 83 virtual void pauseMusic() = 0; 84 //! Resume the current track after pausing 85 virtual void unpauseMusic() = 0; 86 87 INTRINSIC(I_playMusic); 88 INTRINSIC(I_stopMusic); 89 INTRINSIC(I_pauseMusic); 90 INTRINSIC(I_unpauseMusic); 91 92 }; 93 94 } // End of namespace Ultima8 95 } // End of namespace Ultima 96 97 #endif 98