SuperpoweredSDK  v2.0.2
Superpowered Audio SDK
Superpowered::Resampler Class Reference

Linear or 6-point resampler, audio reverser and 16-bit to 32-bit audio converter. More...

#include "SuperpoweredResampler.h"

Public Member Functions

 Resampler ()
 
 ~Resampler ()
 
int process (short int *input, float *output, int numberOfFrames, bool reverse=false, bool highQuality=false, float rateAdd=0.0f)
 Processes the audio. More...
 
int process (short int *input, float *temp, short int *output, int numberOfFrames, bool reverse=false, bool highQuality=false, float rateAdd=0.0f)
 Processes the audio. More...
 
void reset ()
 Reset all internals. Doesn't change rate. More...
 

Public Attributes

float rate
 Default: 1.0f. If rate = 1, process() is "transparent" without any effect on audio quality. More...
 

Private Member Functions

 Resampler (const Resampler &)
 
Resampleroperator= (const Resampler &)
 

Private Attributes

resamplerInternals * internals
 

Detailed Description

Linear or 6-point resampler, audio reverser and 16-bit to 32-bit audio converter.

It doesn't allocate any internal buffers and needs just a few bytes of memory.

Constructor & Destructor Documentation

◆ Resampler() [1/2]

Superpowered::Resampler::Resampler ( )

◆ ~Resampler()

Superpowered::Resampler::~Resampler ( )

◆ Resampler() [2/2]

Superpowered::Resampler::Resampler ( const Resampler )
private

Member Function Documentation

◆ operator=()

Resampler& Superpowered::Resampler::operator= ( const Resampler )
private

◆ process() [1/2]

int Superpowered::Resampler::process ( short int *  input,
float *  output,
int  numberOfFrames,
bool  reverse = false,
bool  highQuality = false,
float  rateAdd = 0.0f 
)

Processes the audio.

Returns
The number of output frames.
Parameters
inputPointer to short integer numbers, 16-bit stereo interleaved input. Should be numberOfFrames * 2 + 64 big.
outputPointer to floating point numbers, 32-bit stereo interleaved output. Should be big enough to store the expected number of output frames and some more.
numberOfFramesNumber of frames to process.
reverseIf true, the output will be backwards (reverse playback).
highQualityEnables more sophisticated processing to reduce interpolation noise. Good for scratching for example, but not recommended for continous music playback above 0.5 rate.
rateAddChanges rate smoothly during process(). Useful for scratching or super smooth rate changes. After process() rate will be changed, but may or may not be precisely equal to the desired target value.

◆ process() [2/2]

int Superpowered::Resampler::process ( short int *  input,
float *  temp,
short int *  output,
int  numberOfFrames,
bool  reverse = false,
bool  highQuality = false,
float  rateAdd = 0.0f 
)

Processes the audio.

Returns
The number of output frames.
Parameters
inputPointer to short integer numbers, 16-bit stereo interleaved input. Should be numberOfFrames * 2 + 64 big.
tempPointer to floating point numbers. Should be numberOfFrames * 2 + 64 big.
outputPointer to short integer numbers, 16-bit stereo interleaved output. Should be big enough to store the expected number of output frames and some more.
numberOfFramesNumber of frames to process.
reverseIf true, the output will be backwards (reverse playback).
highQualityEnables more sophisticated processing to reduce interpolation noise. Good for scratching for example, but not recommended for continous music playback above 0.5 rate.
rateAddChanges rate smoothly during process(). Useful for scratching or super smooth rate changes. After process() rate will be changed, but may or may not be precisely equal to the desired target value.

◆ reset()

void Superpowered::Resampler::reset ( )

Reset all internals. Doesn't change rate.

Member Data Documentation

◆ internals

resamplerInternals* Superpowered::Resampler::internals
private

◆ rate

float Superpowered::Resampler::rate

Default: 1.0f. If rate = 1, process() is "transparent" without any effect on audio quality.


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