TracktionEngine
Classes | Public Types | Static Public Member Functions | List of all members
tracktion::engine::AudioFadeCurve Struct Reference

Classes

struct  Concave
 A concave sine-shaped curve. More...
 
struct  Convex
 A convex sine-shaped curve. More...
 
struct  CrossfadeLevels
 Calculates the two gain multipliers to use for mixing between two sources, given a position alpha from 0 to 1.0. More...
 
struct  Linear
 A linear fade curve. More...
 
struct  SCurve
 An S-shaped curve. More...
 

Public Types

enum  Type { linear = 1 , convex = 2 , concave = 3 , sCurve = 4 }
 A enumeration of the curve classes available. More...
 

Static Public Member Functions

template<typename CurveClass >
static float alphaToGain (float alpha) noexcept
 Converts an alpha position along the curve (0 to 1.0) into the gain at that point. More...
 
static float alphaToGainForType (Type type, float alpha) noexcept
 Converts an alpha position along the curve (0 to 1.0) into the gain at that point. More...
 
template<typename CurveClass , typename DestSamplePointer >
static void renderBlock (DestSamplePointer &dest, int numSamples, float startAlpha, float endAlpha) noexcept
 Multiplies a block of samples by the curve shape between two alpha-positions. More...
 
template<typename DestSamplePointer >
static void renderBlockForType (DestSamplePointer &dest, int numSamples, float startAlpha, float endAlpha, Type type) noexcept
 Multiplies a block of samples by the curve shape between two alpha-positions. More...
 
static void applyCrossfadeSection (juce::AudioBuffer< float > &, int channel, int startSample, int numSamples, Type type, float startAlpha, float endAlpha)
 
static void applyCrossfadeSection (juce::AudioBuffer< float > &, int startSample, int numSamples, Type type, float startAlpha, float endAlpha)
 
static void addWithCrossfade (juce::AudioBuffer< float > &dest, const juce::AudioBuffer< float > &src, int destChannel, int destStartIndex, int sourceChannel, int sourceStartIndex, int numSamples, Type type, float startAlpha, float endAlpha)
 
static void drawFadeCurve (juce::Graphics &, const AudioFadeCurve::Type, float x1, float x2, float top, float bottom, juce::Rectangle< int > clip)
 

Member Enumeration Documentation

◆ Type

A enumeration of the curve classes available.

Enumerator
linear 
convex 
concave 
sCurve 

Member Function Documentation

◆ alphaToGain()

template<typename CurveClass >
static float tracktion::engine::AudioFadeCurve::alphaToGain ( float  alpha)
staticnoexcept

Converts an alpha position along the curve (0 to 1.0) into the gain at that point.

◆ alphaToGainForType()

static float tracktion::engine::AudioFadeCurve::alphaToGainForType ( Type  type,
float  alpha 
)
staticnoexcept

Converts an alpha position along the curve (0 to 1.0) into the gain at that point.

References concave, convex, linear, and sCurve.

◆ renderBlock()

template<typename CurveClass , typename DestSamplePointer >
static void tracktion::engine::AudioFadeCurve::renderBlock ( DestSamplePointer &  dest,
int  numSamples,
float  startAlpha,
float  endAlpha 
)
staticnoexcept

Multiplies a block of samples by the curve shape between two alpha-positions.

The DestSamplePointer object must be a class that implements an apply() method that gets called with each gain level.

◆ renderBlockForType()

template<typename DestSamplePointer >
static void tracktion::engine::AudioFadeCurve::renderBlockForType ( DestSamplePointer &  dest,
int  numSamples,
float  startAlpha,
float  endAlpha,
Type  type 
)
staticnoexcept

Multiplies a block of samples by the curve shape between two alpha-positions.

The DestSamplePointer object must be a class that implements an apply() method that gets called with each gain level.

References concave, convex, linear, and sCurve.

◆ applyCrossfadeSection() [1/2]

static void tracktion::engine::AudioFadeCurve::applyCrossfadeSection ( juce::AudioBuffer< float > &  ,
int  channel,
int  startSample,
int  numSamples,
Type  type,
float  startAlpha,
float  endAlpha 
)
static

◆ applyCrossfadeSection() [2/2]

static void tracktion::engine::AudioFadeCurve::applyCrossfadeSection ( juce::AudioBuffer< float > &  ,
int  startSample,
int  numSamples,
Type  type,
float  startAlpha,
float  endAlpha 
)
static

◆ addWithCrossfade()

static void tracktion::engine::AudioFadeCurve::addWithCrossfade ( juce::AudioBuffer< float > &  dest,
const juce::AudioBuffer< float > &  src,
int  destChannel,
int  destStartIndex,
int  sourceChannel,
int  sourceStartIndex,
int  numSamples,
Type  type,
float  startAlpha,
float  endAlpha 
)
static

◆ drawFadeCurve()

static void tracktion::engine::AudioFadeCurve::drawFadeCurve ( juce::Graphics &  ,
const AudioFadeCurve::Type  ,
float  x1,
float  x2,
float  top,
float  bottom,
juce::Rectangle< int >  clip 
)
static

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