OpenTTD Source: src/music/music_driver.hpp Source File

OpenTTD Source 14.1

music_driver.hpp
Go to the documentation of this file.
1 /*
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/>.
6 */
7
10 #ifndef MUSIC_MUSIC_DRIVER_HPP
11 #define MUSIC_MUSIC_DRIVER_HPP
12
13 #include "../driver.h"
14
15 struct MusicSongInfo;
16
18 class MusicDriver : public Driver {
19 public:
24 virtual void PlaySong(const MusicSongInfo &song) = 0;
25
29 virtual void StopSong() = 0;
30
35 virtual bool IsSongPlaying() = 0;
36
41 virtual void SetVolume(byte vol) = 0;
42
46 static MusicDriver *GetInstance()
47 {
48 return static_cast<MusicDriver*>(*DriverFactoryBase::GetActiveDriver(Driver::DT_MUSIC));
49 }
50 };
51
52 extern std::string _ini_musicdriver;
53
54 #endif /* MUSIC_MUSIC_DRIVER_HPP */
DriverFactoryBase::GetActiveDriver
static Driver ** GetActiveDriver(Driver::Type type)
Get the active driver for the given type.
Definition: driver.h:84
MusicDriver::PlaySong
virtual void PlaySong(const MusicSongInfo &song)=0
Play a particular song.
MusicDriver::SetVolume
virtual void SetVolume(byte vol)=0
Set the volume, if possible.
_ini_musicdriver
std::string _ini_musicdriver
The music driver a stored in the configuration file.
Definition: driver.cpp:37
MusicDriver::GetInstance
static MusicDriver * GetInstance()
Get the currently active instance of the music driver.
Definition: music_driver.hpp:46
MusicSongInfo
Metadata about a music track.
Definition: base_media_base.h:325
MusicDriver::IsSongPlaying
virtual bool IsSongPlaying()=0
Are we currently playing a song?
MusicDriver
Driver for all music playback.
Definition: music_driver.hpp:18
Driver
A driver for communicating with the user.
Definition: driver.h:21
Driver::DT_MUSIC
@ DT_MUSIC
A music driver, needs to be before sound to properly shut down extmidi forked music players.
Definition: driver.h:40
MusicDriver::StopSong
virtual void StopSong()=0
Stop playing the current song.