OpenTTD Source 20260815-master-gdf55704e7d
SoundResampler Class Referenceabstract

Base interface for a SoundResampler implementation. More...

#include <soundresampler_type.h>

Inheritance diagram for SoundResampler:
PriorityBaseProvider< SoundResampler > BaseProvider< SoundResampler > SoundResampler_Soxr

Public Member Functions

 SoundResampler (std::string_view name, std::string_view description, int priority)
 Create the provider.
virtual ~SoundResampler ()
 Unregister this sound resampler.
virtual bool Resample (SoundEntry &sound, uint32_t play_rate) const =0
 Resample a loaded sound.
Public Member Functions inherited from PriorityBaseProvider< SoundResampler >
constexpr PriorityBaseProvider (std::string_view name, std::string_view description, int priority)
 Create the provider.
int GetPriority () const
 Get the priority of this provider.
Public Member Functions inherited from BaseProvider< SoundResampler >
constexpr BaseProvider (std::string_view name, std::string_view description)
 Create the provider.
virtual ~BaseProvider ()=default
 Ensure the destructor of the sub classes are called as well.
std::string_view GetName () const
 Get the name of this provider.
std::string_view GetDescription () const
 Get a description of this provider.

Additional Inherited Members

Protected Attributes inherited from PriorityBaseProvider< SoundResampler >
const int priority
 The priority of this provider.
Protected Attributes inherited from BaseProvider< SoundResampler >
const std::string_view name
 The name of the provider.
const std::string_view description
 A description of the provider.

Detailed Description

Base interface for a SoundResampler implementation.

Definition at line 17 of file soundresampler_type.h.

Constructor & Destructor Documentation

◆ SoundResampler()

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

Create the provider.

Parameters
nameThe name of the provider.
descriptionA description of the provider.
priorityThe priority number to sort all providers by.

Definition at line 20 of file soundresampler_type.h.

References BaseProvider< SoundResampler >::description, BaseProvider< SoundResampler >::name, PriorityBaseProvider< SoundResampler >::priority, PriorityBaseProvider< SoundResampler >::PriorityBaseProvider(), and SoundResampler().

Referenced by SoundResampler(), and SoundResampler_Soxr::SoundResampler_Soxr().

◆ ~SoundResampler()

virtual SoundResampler::~SoundResampler ( )
inlinevirtual

Unregister this sound resampler.

Definition at line 26 of file soundresampler_type.h.

Member Function Documentation

◆ Resample()

virtual bool SoundResampler::Resample ( SoundEntry & sound,
uint32_t play_rate ) const
pure virtual

Resample a loaded sound.

Parameters
soundThe sound to resample.
play_rateThe new sample rate.
Returns
true iff the sound was resampled.

Implemented in SoundResampler_Soxr.


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