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

Bit crusher with adjustable frequency and bit depth. More...

#include "SuperpoweredBitcrusher.h"

Inheritance diagram for Superpowered::Bitcrusher:
Collaboration diagram for Superpowered::Bitcrusher:

Public Member Functions

 Bitcrusher (unsigned int samplerate)
 Constructor. More...
 
 ~Bitcrusher ()
 
bool process (float *input, float *output, unsigned int numberOfFrames)
 Processes the audio. More...
 

Public Attributes

unsigned char bits
 Bit depth, from 1 to 16. More...
 
bool enabled = false
 Turns the effect on/off. The actual switch will happen on the next process() call for smooth, audio-artifact free operation. More...
 
unsigned int frequency
 Frequency in Hz, from 20 Hz to the half of the samplerate. More...
 
unsigned int samplerate = 0
 Sample rate in Hz. More...
 

Private Member Functions

 Bitcrusher (const Bitcrusher &)
 
Bitcrusheroperator= (const Bitcrusher &)
 

Private Attributes

bitcrusherInternals * internals
 

Detailed Description

Bit crusher with adjustable frequency and bit depth.

Simulates an old-school digital sound card. It doesn't allocate any internal buffers and needs just a few bytes of memory.

Constructor & Destructor Documentation

◆ Bitcrusher() [1/2]

Superpowered::Bitcrusher::Bitcrusher ( unsigned int  samplerate)

Constructor.

Enabled is false by default.

Parameters
samplerateThe initial sample rate in Hz.

◆ ~Bitcrusher()

Superpowered::Bitcrusher::~Bitcrusher ( )

◆ Bitcrusher() [2/2]

Superpowered::Bitcrusher::Bitcrusher ( const Bitcrusher )
private

Member Function Documentation

◆ operator=()

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

◆ process()

bool Superpowered::Bitcrusher::process ( float *  input,
float *  output,
unsigned int  numberOfFrames 
)
virtual

Processes the audio.

Always call it in the audio processing callback, regardless if the effect is enabled or not for smooth, audio-artifact free operation. 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
inputPointer to floating point numbers. 32-bit interleaved stereo input.
outputPointer to floating point numbers. 32-bit interleaved stereo output. Can point to the same location with input (in-place processing).
numberOfFramesNumber of frames to process. Recommendations for best performance: multiply of 4.

Implements Superpowered::FX.

Member Data Documentation

◆ bits

unsigned char Superpowered::Bitcrusher::bits

Bit depth, from 1 to 16.

◆ enabled

bool Superpowered::FX::enabled = false
inherited

Turns the effect on/off. The actual switch will happen on the next process() call for smooth, audio-artifact free operation.

◆ frequency

unsigned int Superpowered::Bitcrusher::frequency

Frequency in Hz, from 20 Hz to the half of the samplerate.

◆ internals

bitcrusherInternals* Superpowered::Bitcrusher::internals
private

◆ samplerate

unsigned int Superpowered::FX::samplerate = 0
inherited

Sample rate in Hz.


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