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

CPU-friendly 3D audio spatializer. More...

#include "SuperpoweredSpatializer.h"

Public Member Functions

 Spatializer (unsigned int samplerate)
 Constructor. More...
 
 ~Spatializer ()
 
bool process (float *inputLeft, float *inputRight, float *outputLeft, float *outputRight, unsigned int numberOfFrames, bool outputAdd)
 Processes the audio. More...
 

Static Public Member Functions

static bool reverbProcess (float *output, unsigned int numberOfFrames)
 Outputs the Global Spatializer Reverb. More...
 

Public Attributes

float azimuth
 From 0 to 360 degrees. More...
 
float elevation
 -90 to 90 degrees. More...
 
float inputVolume
 Input volume (gain). More...
 
float occlusion
 Occlusion factor (between 0 and 1);. More...
 
float reverbmix
 The ratio of how much audio the Global Spatializer Reverb can collect from this instance (between 0 and 1). More...
 
unsigned int samplerate
 Sample rate in Hz. More...
 
bool sound2
 Alternative sound option. True on, false off. More...
 

Static Public Attributes

static float reverbDamp
 Global Spatializer Reverb high frequency damping. >= 0 and <= 1. More...
 
static float reverbLowCutHz
 Global Spatializer Reverb frequency of the low cut in Hz (-12 db point). Default: 0 (no low frequency cut). More...
 
static float reverbPredelayMs
 Global Spatializer Reverb pre-delay in milliseconds. 0 to 500. More...
 
static float reverbRoomSize
 Global Spatializer Reverb room size. >= 0 and <= 1. More...
 
static float reverbWidth
 Global Spatializer Reverb stereo width. >= 0 and <= 1. More...
 

Private Member Functions

 Spatializer (const Spatializer &)
 
Spatializeroperator= (const Spatializer &)
 

Private Attributes

spatializerInternals * internals
 

Detailed Description

CPU-friendly 3D audio spatializer.

One instance allocates around 140 kb memory. The spatializer class also has one Global Spatializer Reverb instance to simulate "room sound". It collects audio from all Superpowered Spatializer instances and puts a reverb on the signal.

Constructor & Destructor Documentation

◆ Spatializer() [1/2]

Superpowered::Spatializer::Spatializer ( unsigned int  samplerate)

Constructor.

Parameters
samplerateThe initial sample rate in Hz.

◆ ~Spatializer()

Superpowered::Spatializer::~Spatializer ( )

◆ Spatializer() [2/2]

Superpowered::Spatializer::Spatializer ( const Spatializer )
private

Member Function Documentation

◆ operator=()

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

◆ process()

bool Superpowered::Spatializer::process ( float *  inputLeft,
float *  inputRight,
float *  outputLeft,
float *  outputRight,
unsigned int  numberOfFrames,
bool  outputAdd 
)

Processes the audio.

It's never blocking for real-time usage. You can change all properties on any thread, concurrently with process().

Returns
If process() returns with true, the contents of output are replaced with the audio output. If process() returns with false, the contents of output are not changed.
Parameters
inputLeftPointer to floating point numbers. 32-bit left channel or interleaved stereo input.
inputRightPointer to floating point numbers. 32-bit right channel input. Can be NULL, inputLeft will be used in this case as interleaved stereo input.
outputLeftPointer to floating point numbers. 32-bit left channel or interleaved stereo output.
outputRightPointer to floating point numbers. 32-bit right channel output. Can be NULL, outputLeft will be used in this case as interleaved stereo output.
numberOfFramesNumber of frames to process. Valid between 64-8192.
outputAddIf true, audio will be added to whatever content is in outputLeft or outputRight.

◆ reverbProcess()

static bool Superpowered::Spatializer::reverbProcess ( float *  output,
unsigned int  numberOfFrames 
)
static

Outputs the Global Spatializer Reverb.

Always call it in the audio processing callback, regardless if the effect is enabled or not for smooth, audio-artifact free operation. Should be called after every Superpowered Spatializer's process() method. It's never blocking for real-time usage. You can change all properties of the globalReverb on any thread, concurrently with process().

Returns
If process() returns with true, the contents of output are replaced with the audio output. If process() returns with false, the contents of output are not changed.
Parameters
outputPointer to floating point numbers. 32-bit interleaved stereo output.
numberOfFramesNumber of framesto process. Should not be higher than 8192.

Member Data Documentation

◆ azimuth

float Superpowered::Spatializer::azimuth

From 0 to 360 degrees.

◆ elevation

float Superpowered::Spatializer::elevation

-90 to 90 degrees.

◆ inputVolume

float Superpowered::Spatializer::inputVolume

Input volume (gain).

◆ internals

spatializerInternals* Superpowered::Spatializer::internals
private

◆ occlusion

float Superpowered::Spatializer::occlusion

Occlusion factor (between 0 and 1);.

◆ reverbDamp

float Superpowered::Spatializer::reverbDamp
static

Global Spatializer Reverb high frequency damping. >= 0 and <= 1.

◆ reverbLowCutHz

float Superpowered::Spatializer::reverbLowCutHz
static

Global Spatializer Reverb frequency of the low cut in Hz (-12 db point). Default: 0 (no low frequency cut).

◆ reverbmix

float Superpowered::Spatializer::reverbmix

The ratio of how much audio the Global Spatializer Reverb can collect from this instance (between 0 and 1).

◆ reverbPredelayMs

float Superpowered::Spatializer::reverbPredelayMs
static

Global Spatializer Reverb pre-delay in milliseconds. 0 to 500.

◆ reverbRoomSize

float Superpowered::Spatializer::reverbRoomSize
static

Global Spatializer Reverb room size. >= 0 and <= 1.

◆ reverbWidth

float Superpowered::Spatializer::reverbWidth
static

Global Spatializer Reverb stereo width. >= 0 and <= 1.

◆ samplerate

unsigned int Superpowered::Spatializer::samplerate

Sample rate in Hz.

◆ sound2

bool Superpowered::Spatializer::sound2

Alternative sound option. True on, false off.


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