Resampler¶
Base class used to create resamplers.
Detailed Description¶
A resampler is used to change the sample rate of an audio buffer. The Resampler class implements factory methods to create instances of ResamplerInstance objects, which are where the resampling is done.
The Resampler class follows the plugin architecture, and thus, you are able to create your own resamplers and register them to the Engine by inheriting from this class and by implementing the necessary dependencies.
Public Functions¶
| Type | Name |
|---|---|
| virtual std::shared_ptr< ResamplerInstance > | CreateInstance () = 0 Creates a new instance of the resampler. |
| const AmString & | GetName () const Gets the name of this resampler. |
| Resampler (AmString name) Create a new resampler instance. | |
| Resampler () Default resampler constructor. | |
| virtual | ~Resampler () Default destructor. |
Public Static Functions¶
| Type | Name |
|---|---|
| std::shared_ptr< ResamplerInstance > | Construct (const AmString & name) Creates a new instance of the resampler with the given name and returns its pointer. |
| std::shared_ptr< Resampler > | Find (const AmString & name) Look up a resampler by name. |
| const std::map< AmString, std::shared_ptr< Resampler > > & | GetRegistry () Gets the list of registered resamplers. |
| void | LockRegistry () Locks the resamplers registry. |
| void | Register (std::shared_ptr< Resampler > resampler) Registers a new resampler. |
| void | UnlockRegistry () Unlocks the resamplers registry. |
| void | Unregister (std::shared_ptr< const Resampler > resampler) Unregisters a resampler. |
Protected Attributes¶
| Type | Name |
|---|---|
| AmString | m_name The name of this resampler. |
Public Functions Documentation¶
CreateInstance
Creates a new instance of the resampler.
Returns:
A new instance of the resampler.
GetName
Gets the name of this resampler.
Returns:
The name of this resampler.
Resampler[1/2]
Create a new resampler instance.
Parameters:
-
nameThe resampler name, e.g., "Libsamplerate".
Resampler[2/2]
Default resampler constructor.
Warning:
This constructor is meant for internal resamplers only.
Public Static Functions Documentation¶
Construct
Creates a new instance of the resampler with the given name and returns its pointer.
static std::shared_ptr< ResamplerInstance > Amplitude::Resampler::Construct (
const AmString & name
)
Parameters:
-
nameThe name of the resampler.
Returns:
The resampler with the given name, or nullptr if not found.
Find
Look up a resampler by name.
Parameters:
-
nameThe name of the resampler to find.
Returns:
The resampler with the given name, or nullptr if not found.
GetRegistry
Gets the list of registered resamplers.
static const std::map< AmString, std::shared_ptr< Resampler > > & Amplitude::Resampler::GetRegistry ()
Returns:
The registry of resamplers.
LockRegistry
Locks the resamplers registry.
Warning:
This function is mainly used for internal purposes. It's called before the Engine initialization, to discard the registration of new resamplers after the engine is fully loaded.
Register
Registers a new resampler.
Note:
This method does nothing if the registry is locked.
Parameters:
-
resamplerThe resampler to add in the registry.
See also: LockRegistry, UnlockRegistry
UnlockRegistry
Unlocks the resamplers registry.
Warning:
This function is mainly used for internal purposes. It's called after the Engine deinitialization, to allow the registration of new resamplers after the engine is fully unloaded.
Unregister
Unregisters a resampler.
Note:
This method does nothing if the registry is locked.
Parameters:
-
resamplerThe resampler to remove from the registry.
See also: LockRegistry, UnlockRegistry
Protected Attributes Documentation¶
The documentation for this class was generated from the following file: include/SparkyStudios/Audio/Amplitude/DSP/Resampler.h