OpenTTD Source: src/sound/sound_driver.hpp Source File

OpenTTD Source 13.1

sound_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 SOUND_SOUND_DRIVER_HPP
11 #define SOUND_SOUND_DRIVER_HPP
12
13 #include "../driver.h"
14
16 class SoundDriver : public Driver {
17 public:
19 virtual void MainLoop() {}
20
27 virtual bool HasOutput() const
28 {
29 return true;
30 }
31
35 static SoundDriver *GetInstance() {
36 return static_cast<SoundDriver*>(*DriverFactoryBase::GetActiveDriver(Driver::DT_SOUND));
37 }
38 };
39
40 extern std::string _ini_sounddriver;
41
42 #endif /* SOUND_SOUND_DRIVER_HPP */
DriverFactoryBase::GetActiveDriver
static Driver ** GetActiveDriver(Driver::Type type)
Get the active driver for the given type.
Definition: driver.h:86
SoundDriver::MainLoop
virtual void MainLoop()
Called once every tick.
Definition: sound_driver.hpp:19
_ini_sounddriver
std::string _ini_sounddriver
The sound driver a stored in the configuration file.
Definition: driver.cpp:28
Driver::DT_SOUND
@ DT_SOUND
A sound driver.
Definition: driver.h:43
SoundDriver::HasOutput
virtual bool HasOutput() const
Whether the driver has an output from which the user can hear sound.
Definition: sound_driver.hpp:27
SoundDriver
Base for all sound drivers.
Definition: sound_driver.hpp:16
SoundDriver::GetInstance
static SoundDriver * GetInstance()
Get the currently active instance of the sound driver.
Definition: sound_driver.hpp:35
Driver
A driver for communicating with the user.
Definition: driver.h:23