SAL
A C++ library for spatial audio.
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
Public Member Functions | Static Public Member Functions | Static Public Attributes | List of all members
sal::PropagationLine Class Reference

#include <propagationline.h>

Public Member Functions

 PropagationLine (const sal::Length distance, const sal::Time sampling_frequency, const sal::Length max_distance=100.0, const sal::InterpolationType=sal::InterpolationType::kRounding, const bool air_filters_active=false, const bool allow_attenuation_larger_than_one=false, const sal::Length reference_distance=kOneSampleDistance) noexcept
 
sal::Sample attenuation () const noexcept
 
sal::Length distance () const noexcept
 
void SetAttenuation (const sal::Sample, const sal::Time ramp_time=0.0) noexcept
 
sal::Time current_latency () const noexcept
 
sal::Time target_latency () const noexcept
 
void SetAirFiltersActive (const bool) noexcept
 
void Write (const sal::Sample &sample) noexcept
 
void Write (const Sample *samples, const Int num_samples) noexcept
 
sal::Sample Read () const noexcept
 
void Read (const Int num_samples, Sample *output_data) const noexcept
 
void Tick () noexcept
 
void Tick (const Int num_samples) noexcept
 
void SetDistance (const sal::Length distance, const sal::Time ramp_time=0.0) noexcept
 
void Reset () noexcept
 

Static Public Member Functions

static bool Test ()
 

Static Public Attributes

static const Length kOneSampleDistance = NAN
 

Detailed Description

This describes a simple propagation line. It has one input and one output and models the delay between them. It also models attenuation between these two points, following 1/r rule. This object can also handle changes in the propagation line length.

Constructor & Destructor Documentation

sal::PropagationLine::PropagationLine ( const sal::Length  distance,
const sal::Time  sampling_frequency,
const sal::Length  max_distance = 100.0,
const sal::InterpolationType  interpolation_type = sal::InterpolationType::kRounding,
const bool  air_filters_active = false,
const bool  allow_attenuation_larger_than_one = false,
const sal::Length  reference_distance = kOneSampleDistance 
)
noexcept

This constructs a PropagationLine object. You need to feed the distance between the two points (in [m]), the sampling_frequency and the maximum distance you expect that this propagaiton line may have. The value of distance_update_step is the length (in meters) by which the delay line length changes at each sample. A distance_update_step of 0 will not change the delay line length. The value of attenuation_update_length is the number of samples it takes to update the attenuation. A attenuation_update_length of 0 will immediately change the attenuation of the delay line.

Member Function Documentation

sal::Sample sal::PropagationLine::attenuation ( ) const
noexcept

Returns the multiplicative attenuation of the propagation line

sal::Time sal::PropagationLine::current_latency ( ) const
inlinenoexcept
sal::Length sal::PropagationLine::distance ( ) const
noexcept
sal::Sample sal::PropagationLine::Read ( ) const
inlinenoexcept

Returns the current read sample

void sal::PropagationLine::Read ( const Int  num_samples,
Sample output_data 
) const
noexcept

Returns a set of num_samples samples and writes them into output_data.

Parameters
[in]num_samplesthe number of samples to read.
[out]output_datathe output array
void sal::PropagationLine::Reset ( )
noexcept

Resets the state of the filter

void sal::PropagationLine::SetAirFiltersActive ( const bool  air_filters_active)
noexcept
void sal::PropagationLine::SetAttenuation ( const sal::Sample  attenuation,
const sal::Time  ramp_time = 0.0 
)
noexcept

This overrides the 1/r rule attenuation.

void sal::PropagationLine::SetDistance ( const sal::Length  distance,
const sal::Time  ramp_time = 0.0 
)
noexcept

This resets the propagation line's length. It updates also the attenuation according to 1/r law. You need to be careful with this method, since if the distance is changed too fast, sound distortion will be observed.

sal::Time sal::PropagationLine::target_latency ( ) const
inlinenoexcept
bool sal::PropagationLine::Test ( )
static
void sal::PropagationLine::Tick ( )
noexcept
void sal::PropagationLine::Tick ( const Int  num_samples)
noexcept

Ticks time to next sample

void sal::PropagationLine::Write ( const sal::Sample sample)
noexcept
void sal::PropagationLine::Write ( const Sample samples,
const Int  num_samples 
)
noexcept

Member Data Documentation

const Length sal::PropagationLine::kOneSampleDistance = NAN
static

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