2009-08-21 22:21:05 +02:00
|
|
|
/*
|
|
|
|
* This file is part of OpenTTD.
|
|
|
|
* 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.
|
|
|
|
* 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.
|
|
|
|
* 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/>.
|
|
|
|
*/
|
|
|
|
|
2008-05-06 17:11:33 +02:00
|
|
|
/** @file sound_driver.hpp Base for all sound drivers. */
|
|
|
|
|
2007-07-05 14:23:54 +02:00
|
|
|
#ifndef SOUND_SOUND_DRIVER_HPP
|
|
|
|
#define SOUND_SOUND_DRIVER_HPP
|
|
|
|
|
|
|
|
#include "../driver.h"
|
|
|
|
|
2011-05-02 18:14:23 +02:00
|
|
|
/** Base for all sound drivers. */
|
2013-11-25 15:30:22 +01:00
|
|
|
class SoundDriver : public Driver {
|
2008-11-25 22:09:00 +01:00
|
|
|
public:
|
2011-05-02 18:14:23 +02:00
|
|
|
/** Called once every tick */
|
2008-11-25 22:09:00 +01:00
|
|
|
virtual void MainLoop() {}
|
2014-04-28 23:06:51 +02:00
|
|
|
|
2020-12-08 10:24:59 +01:00
|
|
|
/**
|
|
|
|
* Whether the driver has an output from which the user can hear sound.
|
|
|
|
* Or in other words, whether we should warn the user if no soundset is
|
|
|
|
* loaded and that loading one would fix the sound problems.
|
|
|
|
* @return True for all drivers except null.
|
|
|
|
*/
|
|
|
|
virtual bool HasOutput() const
|
|
|
|
{
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
|
2014-04-28 23:06:51 +02:00
|
|
|
/**
|
|
|
|
* Get the currently active instance of the sound driver.
|
|
|
|
*/
|
2023-11-09 20:20:41 +01:00
|
|
|
static SoundDriver *GetInstance()
|
|
|
|
{
|
2014-04-28 23:06:51 +02:00
|
|
|
return static_cast<SoundDriver*>(*DriverFactoryBase::GetActiveDriver(Driver::DT_SOUND));
|
|
|
|
}
|
2007-07-05 14:23:54 +02:00
|
|
|
};
|
|
|
|
|
2020-05-17 23:32:08 +02:00
|
|
|
extern std::string _ini_sounddriver;
|
2007-07-05 14:23:54 +02:00
|
|
|
|
|
|
|
#endif /* SOUND_SOUND_DRIVER_HPP */
|