OpenTTD Source 20260917-master-gec444f7315
MusicDriver_DMusic Class Reference

Music player making use of DirectX. More...

#include <dmusic.h>

Inheritance diagram for MusicDriver_DMusic:
MusicDriver Driver

Public Member Functions

 ~MusicDriver_DMusic () override
 Stop the playing of the music.
std::optional< std::string_view > Start (const StringList &param) override
 Start this driver.
void Stop () override
 Stop this driver.
void PlaySong (const MusicSongInfo &song) override
 Play a particular song.
void StopSong () override
 Stop playing the current song.
bool IsSongPlaying () override
 Are we currently playing a song?
void SetVolume (uint8_t vol) override
 Set the volume, if possible.
std::string_view GetName () const override
 Get the name of this driver.
Public Member Functions inherited from Driver
virtual ~Driver ()=default
 Ensure the destructor of the sub classes are called as well.

Additional Inherited Members

Public Types inherited from Driver
enum class  Type : uint8_t {
  Begin = 0 , Music = 0 , Sound , Video ,
  End
}
 The type of driver. More...
Static Public Member Functions inherited from MusicDriver
static MusicDriver * GetInstance ()
 Get the currently active instance of the music driver.

Detailed Description

Music player making use of DirectX.

Definition at line 16 of file dmusic.h.

Constructor & Destructor Documentation

◆ ~MusicDriver_DMusic()

MusicDriver_DMusic::~MusicDriver_DMusic ( )
override

Stop the playing of the music.

Definition at line 1193 of file dmusic.cpp.

References Stop().

Member Function Documentation

◆ GetName()

std::string_view MusicDriver_DMusic::GetName ( ) const
inlineoverridevirtual

Get the name of this driver.

Returns
The name of the driver.

Implements Driver.

Definition at line 31 of file dmusic.h.

◆ IsSongPlaying()

bool MusicDriver_DMusic::IsSongPlaying ( )
overridevirtual

Are we currently playing a song?

Returns
True if a song is being played.

Implements MusicDriver.

Definition at line 1270 of file dmusic.cpp.

◆ PlaySong()

void MusicDriver_DMusic::PlaySong ( const MusicSongInfo & song)
overridevirtual

Play a particular song.

Parameters
songThe information for the song to play.

Implements MusicDriver.

Definition at line 1248 of file dmusic.cpp.

References _thread_event, _thread_mutex, lock, MusicSongInfo::loop, MusicSongInfo::override_end, and MusicSongInfo::override_start.

◆ SetVolume()

void MusicDriver_DMusic::SetVolume ( uint8_t vol)
overridevirtual

Set the volume, if possible.

Parameters
volThe new volume.

Implements MusicDriver.

Definition at line 1276 of file dmusic.cpp.

◆ Start()

std::optional< std::string_view > MusicDriver_DMusic::Start ( const StringList & parm)
overridevirtual

Start this driver.

Parameters
parmParameters passed to the driver.
Returns
std::nullopt if everything went okay, otherwise an error message.

Implements Driver.

Definition at line 1112 of file dmusic.cpp.

References _buffer, _dmusic_thread, _music, _port, _thread_event, convert_from_fs(), Debug, Driver, Error, GetDriverParam(), GetDriverParamInt(), IsVisibleSeverity(), and StartNewThread().

◆ Stop()

void MusicDriver_DMusic::Stop ( )
overridevirtual

Stop this driver.

Implements Driver.

Definition at line 1199 of file dmusic.cpp.

References _buffer, _dls_downloads, _dmusic_thread, _music, _port, and _thread_event.

Referenced by ~MusicDriver_DMusic().

◆ StopSong()

void MusicDriver_DMusic::StopSong ( )
overridevirtual

Stop playing the current song.

Implements MusicDriver.

Definition at line 1263 of file dmusic.cpp.

References _thread_event.


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