MPD: PcmResampler Class Reference

MPD 0.20.15

Public Member Functions
PcmResampler Class Referenceabstract

This is an interface for plugins that convert PCM data to a specific sample rate. More...

`#include <Resampler.hxx>`

Inheritance diagram for PcmResampler:
[legend]

## Public Member Functions
virtual | ~PcmResampler ()
virtual AudioFormat | Open (AudioFormat &af, unsigned new_sample_rate)=0
| Opens the resampler, preparing it for Resample(). More...
virtual void | Close ()=0
| Closes the resampler. More...
virtual void | Reset ()
| Reset the filter's state, e.g. More...
virtual ConstBuffer< void > | Resample (ConstBuffer< void > src)=0
| Resamples a block of PCM data. More...

## Detailed Description

This is an interface for plugins that convert PCM data to a specific sample rate.

Definition at line 32 of file Resampler.hxx.

## Constructor & Destructor Documentation

## ◆ ~PcmResampler()

virtual PcmResampler::~PcmResampler | ( |  | ) |
| inlinevirtual

Definition at line 34 of file Resampler.hxx.

## Member Function Documentation

## ◆ Close()

virtual void PcmResampler::Close | ( |  | ) |
| pure virtual

Closes the resampler.

After that, you may call Open() again.

Implemented in LibsampleratePcmResampler, SoxrPcmResampler, and FallbackPcmResampler.

## ◆ Open()

virtual AudioFormat PcmResampler::Open | ( | AudioFormat & | af,
|  | unsigned | new_sample_rate
| ) |  |
| pure virtual

Opens the resampler, preparing it for Resample().

Throws std::runtime_error on error.

Parameters

  af | the audio format of incoming data; the plugin may modify the object to enforce another input format (however, it may not request a different input sample rate)
  new_sample_rate | the requested output sample rate
  error | location to store the error

Returns
  the format of outgoing data

Implemented in LibsampleratePcmResampler, SoxrPcmResampler, and FallbackPcmResampler.

## ◆ Resample()

virtual ConstBuffer<void> PcmResampler::Resample | ( | ConstBuffer< void > | src | ) |
| pure virtual

Resamples a block of PCM data.

Throws std::runtime_error on error.

Parameters

  src | the input buffer

Returns
  the destination buffer (will be invalidated by filter_close() or filter_filter())

Implemented in LibsampleratePcmResampler, SoxrPcmResampler, and FallbackPcmResampler.

## ◆ Reset()

virtual void PcmResampler::Reset | ( |  | ) |
| inlinevirtual

Reset the filter's state, e.g.

drop/flush buffers.

Reimplemented in LibsampleratePcmResampler, and SoxrPcmResampler.

Definition at line 60 of file Resampler.hxx.

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

- pcm/Resampler.hxx