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 

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

Returns the multiplicative attenuation of the propagation line

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

Returns the current read sample

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

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

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

Resets the state of the filter

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

This overrides the 1/r rule attenuation.

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

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
bool sal::PropagationLine::Test ( )
void sal::PropagationLine::Tick ( )
void sal::PropagationLine::Tick ( const Int  num_samples)

Ticks time to next sample

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

Member Data Documentation

const Length sal::PropagationLine::kOneSampleDistance = NAN

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