|
OpenTTD Source 20260815-master-gdf55704e7d
|
Soxr SoundResampler implementation. More...
Public Member Functions | |
| SoundResampler_Soxr () | |
| Create this SoundResample_Soxr instance. | |
| bool | Resample (SoundEntry &sound, uint32_t play_rate) const override |
| Resample a loaded sound. | |
| Public Member Functions inherited from SoundResampler | |
| SoundResampler (std::string_view name, std::string_view description, int priority) | |
| Create the provider. | |
| virtual | ~SoundResampler () |
| Unregister this sound resampler. | |
| 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. | |
Static Public Member Functions | |
| static void | ConvertInt8toInt16 (std::span< const std::byte > in, std::span< std::byte > out) |
| Convert samples from 8 bits to 16 bits. | |
Private Attributes | |
| const soxr_io_spec_t | io = soxr_io_spec(SOXR_INT16_I, SOXR_INT16_I) |
| Input/output settings. | |
| const soxr_quality_spec_t | quality = soxr_quality_spec(SOXR_VHQ, 0) |
| Quality settings. | |
| const soxr_runtime_spec_t | runtime = soxr_runtime_spec(1) |
| Runtime settings. | |
Static Private Attributes | |
| static SoundResampler_Soxr | instance {} |
| Instance of this SoundResampler. | |
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. | |
Soxr SoundResampler implementation.
Definition at line 21 of file soundresampler_soxr.cpp.
|
inline |
Create this SoundResample_Soxr instance.
Definition at line 24 of file soundresampler_soxr.cpp.
References SoundResampler::SoundResampler().
|
inlinestatic |
Convert samples from 8 bits to 16 bits.
| in | Span of samples to convert. |
| out | Span to place converted samples. |
out must be exactly twice the size of in. Definition at line 32 of file soundresampler_soxr.cpp.
Referenced by Resample().
|
inlineoverridevirtual |
Resample a loaded sound.
| sound | The sound to resample. |
| play_rate | The new sample rate. |
true iff the sound was resampled. Implements SoundResampler.
Definition at line 48 of file soundresampler_soxr.cpp.
References Align(), ConvertInt8toInt16(), and Debug.
|
staticprivate |
Instance of this SoundResampler.
Definition at line 92 of file soundresampler_soxr.cpp.
|
private |
Input/output settings.
Definition at line 87 of file soundresampler_soxr.cpp.
|
private |
Quality settings.
Definition at line 88 of file soundresampler_soxr.cpp.
|
private |
Runtime settings.
Definition at line 89 of file soundresampler_soxr.cpp.