2 * This file is part of OpenTTD.
3 * OpenTTD is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, version 2.
4 * OpenTTD is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
5 * See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with OpenTTD. If not, see <http://www.gnu.org/licenses/>.
8 /** @file music_driver.hpp Base for all music playback. */
10 #ifndef MUSIC_MUSIC_DRIVER_HPP
11 #define MUSIC_MUSIC_DRIVER_HPP
13 #include "../driver.h"
17 /** Driver for all music playback. */
18 class MusicDriver
: public Driver
{
21 * Play a particular song.
22 * @param song The information for the song to play.
24 virtual void PlaySong(const MusicSongInfo
&song
) = 0;
27 * Stop playing the current song.
29 virtual void StopSong() = 0;
32 * Are we currently playing a song?
33 * @return True if a song is being played.
35 virtual bool IsSongPlaying() = 0;
38 * Set the volume, if possible.
39 * @param vol The new volume.
41 virtual void SetVolume(uint8_t vol
) = 0;
44 * Get the currently active instance of the music driver.
46 static MusicDriver
*GetInstance()
48 return static_cast<MusicDriver
*>(*DriverFactoryBase::GetActiveDriver(Driver::DT_MUSIC
));
52 extern std::string _ini_musicdriver
;
54 #endif /* MUSIC_MUSIC_DRIVER_HPP */