4 * This file is part of OpenTTD.
5 * 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.
6 * 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.
7 * 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/>.
10 /** @file music_driver.hpp Base for all music playback. */
12 #ifndef MUSIC_MUSIC_DRIVER_HPP
13 #define MUSIC_MUSIC_DRIVER_HPP
15 #include "../driver.h"
17 /** Driver for all music playback. */
18 class MusicDriver
: public Driver
{
21 * Play a particular song.
22 * @param filename The name of file with the song to play.
24 virtual void PlaySong(const char *filename
) = 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(byte vol
) = 0;
44 * Get the currently active instance of the music driver.
46 static MusicDriver
*GetInstance() {
47 return static_cast<MusicDriver
*>(*DriverFactoryBase::GetActiveDriver(Driver::DT_MUSIC
));
51 extern char *_ini_musicdriver
;
53 #endif /* MUSIC_MUSIC_DRIVER_HPP */