Skip to content

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.

virtual std::shared_ptr< ResamplerInstance > Amplitude::Resampler::CreateInstance () = 0

Returns:

A new instance of the resampler.

GetName

Gets the name of this resampler.

const AmString & Amplitude::Resampler::GetName () const

Returns:

The name of this resampler.

Resampler[1/2]

Create a new resampler instance.

explicit Amplitude::Resampler::Resampler (
    AmString name
) 

Parameters:

  • name The resampler name, e.g., "Libsamplerate".
Resampler[2/2]

Default resampler constructor.

Amplitude::Resampler::Resampler () 

Warning:

This constructor is meant for internal resamplers only.

~Resampler

Default destructor.

virtual Amplitude::Resampler::~Resampler () 

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:

  • name The name of the resampler.

Returns:

The resampler with the given name, or nullptr if not found.

Find

Look up a resampler by name.

static std::shared_ptr< Resampler > Amplitude::Resampler::Find (
    const AmString & name
) 

Parameters:

  • name The 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.

static void Amplitude::Resampler::LockRegistry () 

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.

static void Amplitude::Resampler::Register (
    std::shared_ptr< Resampler > resampler
) 

Note:

This method does nothing if the registry is locked.

Parameters:

  • resampler The resampler to add in the registry.

See also: LockRegistry, UnlockRegistry

UnlockRegistry

Unlocks the resamplers registry.

static void Amplitude::Resampler::UnlockRegistry () 

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.

static void Amplitude::Resampler::Unregister (
    std::shared_ptr< const Resampler > resampler
) 

Note:

This method does nothing if the registry is locked.

Parameters:

  • resampler The resampler to remove from the registry.

See also: LockRegistry, UnlockRegistry

Protected Attributes Documentation

m_name

The name of this resampler.

AmString SparkyStudios::Audio::Amplitude::Resampler::m_name;

The documentation for this class was generated from the following file: include/SparkyStudios/Audio/Amplitude/DSP/Resampler.h