OpenTTD Source 20241224-master-gf74b0cf984
SoundDriver Class Reference

Base for all sound drivers. More...

#include <sound_driver.hpp>

Inheritance diagram for SoundDriver:
Driver SoundDriver_Allegro SoundDriver_Cocoa SoundDriver_Null SoundDriver_SDL SoundDriver_Win32 SoundDriver_XAudio2

Public Member Functions

virtual void MainLoop ()
 Called once every tick.
 
virtual bool HasOutput () const
 Whether the driver has an output from which the user can hear sound.
 
- Public Member Functions inherited from Driver
virtual std::optional< std::string_view > Start (const StringList &parm)=0
 Start this driver.
 
virtual void Stop ()=0
 Stop this driver.
 
virtual std::string_view GetName () const =0
 Get the name of this driver.
 

Static Public Member Functions

static SoundDriverGetInstance ()
 Get the currently active instance of the sound driver.
 

Additional Inherited Members

- Public Types inherited from Driver
enum  Type {
  DT_BEGIN = 0 , DT_MUSIC = 0 , DT_SOUND , DT_VIDEO ,
  DT_END
}
 The type of driver. More...
 

Detailed Description

Base for all sound drivers.

Definition at line 16 of file sound_driver.hpp.

Member Function Documentation

◆ GetInstance()

static SoundDriver * SoundDriver::GetInstance ( )
inlinestatic

Get the currently active instance of the sound driver.

Definition at line 35 of file sound_driver.hpp.

References Driver::DT_SOUND, and DriverFactoryBase::GetActiveDriver().

Referenced by CrashLog::AfterCrashLogCleanup(), MusicDriver_ExtMidi::Start(), and SurveyConfiguration().

◆ HasOutput()

virtual bool SoundDriver::HasOutput ( ) const
inlinevirtual

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.

Returns
True for all drivers except null.

Reimplemented in SoundDriver_Null.

Definition at line 27 of file sound_driver.hpp.

◆ MainLoop()

virtual void SoundDriver::MainLoop ( )
inlinevirtual

Called once every tick.

Reimplemented in SoundDriver_Allegro.

Definition at line 19 of file sound_driver.hpp.


The documentation for this class was generated from the following file: