OpenTTD Source 20241224-master-gf74b0cf984
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
15struct MusicSongInfo;
16
18class MusicDriver : public Driver {
19public:
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(uint8_t vol) = 0;
42
50};
51
52extern std::string _ini_musicdriver;
53
54#endif /* MUSIC_MUSIC_DRIVER_HPP */
static Driver ** GetActiveDriver(Driver::Type type)
Get the active driver for the given type.
Definition driver.h:84
A driver for communicating with the user.
Definition driver.h:21
@ DT_MUSIC
A music driver, needs to be before sound to properly shut down extmidi forked music players.
Definition driver.h:40
Driver for all music playback.
virtual void StopSong()=0
Stop playing the current song.
static MusicDriver * GetInstance()
Get the currently active instance of the music driver.
virtual bool IsSongPlaying()=0
Are we currently playing a song?
virtual void PlaySong(const MusicSongInfo &song)=0
Play a particular song.
virtual void SetVolume(uint8_t vol)=0
Set the volume, if possible.
std::string _ini_musicdriver
The music driver a stored in the configuration file.
Definition driver.cpp:31
Metadata about a music track.