TracktionEngine
Loading...
Searching...
No Matches
engine::AudioFadeCurve Struct Reference

#include <tracktion_AudioFadeCurve.h>

Classes

struct  Linear
 A linear fade curve. More...
struct  Convex
 A convex sine-shaped curve. More...
struct  Concave
 A concave sine-shaped curve. More...
struct  SCurve
 An S-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...

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.
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.
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.
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.
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>
float engine::AudioFadeCurve::alphaToGain ( float alpha)
staticnoexcept

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

Referenced by alphaToGainForType(), and engine::AudioFadeCurve::CrossfadeLevels::CrossfadeLevels().

◆ alphaToGainForType()

float 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 alphaToGain(), concave, convex, linear, and sCurve.

◆ renderBlock()

template<typename CurveClass, typename DestSamplePointer>
void 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.

Referenced by renderBlockForType().

◆ renderBlockForType()

template<typename DestSamplePointer>
void 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, renderBlock(), and sCurve.

◆ applyCrossfadeSection() [1/2]

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

◆ applyCrossfadeSection() [2/2]

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

◆ addWithCrossfade()

void 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()

void 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: