OpenTTD Source 20260206-master-g4d4e37dbf1
SoundLoader Class Referenceabstract

Base interface for a SoundLoader implementation. More...

#include <soundloader_type.h>

Inheritance diagram for SoundLoader:
PriorityBaseProvider< SoundLoader > BaseProvider< SoundLoader > SoundLoader_Opus SoundLoader_Raw SoundLoader_Wav

Public Member Functions

 SoundLoader (std::string_view name, std::string_view description, int priority)
virtual bool Load (SoundEntry &sound, bool new_format, std::vector< std::byte > &data) const =0
 Load a sound from the file and offset in the given sound entry.
Public Member Functions inherited from PriorityBaseProvider< SoundLoader >
constexpr PriorityBaseProvider (std::string_view name, std::string_view description, int priority)
int GetPriority () const
Public Member Functions inherited from BaseProvider< SoundLoader >
constexpr BaseProvider (std::string_view name, std::string_view description)
std::string_view GetName () const
std::string_view GetDescription () const

Additional Inherited Members

Protected Attributes inherited from PriorityBaseProvider< SoundLoader >
const int priority
Protected Attributes inherited from BaseProvider< SoundLoader >
const std::string_view name
const std::string_view description

Detailed Description

Base interface for a SoundLoader implementation.

Definition at line 17 of file soundloader_type.h.

Constructor & Destructor Documentation

◆ SoundLoader()

SoundLoader::SoundLoader ( std::string_view name,
std::string_view description,
int priority )
inline

Definition at line 19 of file soundloader_type.h.

◆ ~SoundLoader()

SoundLoader::~SoundLoader ( )
inlineoverride

Definition at line 24 of file soundloader_type.h.

Member Function Documentation

◆ Load()

virtual bool SoundLoader::Load ( SoundEntry & sound,
bool new_format,
std::vector< std::byte > & data ) const
pure virtual

Load a sound from the file and offset in the given sound entry.

It is up to the implementations to update the sound's channels, bits_per_sample and rate.

Parameters
soundThe entry to load.
new_formatWhether this is an old format soundset (with some buggy data), or the new format.
[out]dataThe vector to write the decoded sound data into.
Returns
true iff the entry was loaded correctly.

Implemented in SoundLoader_Opus, SoundLoader_Raw, and SoundLoader_Wav.


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