Roc Toolkit internal modules
Roc Toolkit: real-time audio streaming
Loading...
Searching...
No Matches
roc::audio::SampleSpec Class Reference

Sample stream specification. Defines sample rate and channel layout. More...

#include <sample_spec.h>

Public Member Functions

 SampleSpec ()
 Default constructor.
 
 SampleSpec (size_t sample_rate, packet::channel_mask_t channel_mask)
 Constructor with sample rate and channel mask.
 
Equality
bool operator== (const SampleSpec &other) const
 Check two specifications for equality.
 
bool operator!= (const SampleSpec &other) const
 Check two specifications for equality.
 
Getters and setters
size_t sample_rate () const
 Get sample rate.
 
void set_sample_rate (size_t sample_rate)
 Set sample rate.
 
packet::channel_mask_t channel_mask () const
 Get channel mask.
 
size_t num_channels () const
 Get number of channels.
 
void set_channel_mask (packet::channel_mask_t channel_mask)
 Set channel mask.
 
Nanosecond duration
size_t ns_2_samples_per_chan (core::nanoseconds_t ns_duration) const
 Convert nanoseconds duration to number of samples per channel.
 
core::nanoseconds_t samples_per_chan_2_ns (size_t n_samples) const
 Convert number of samples per channel to nanoseconds duration.
 
size_t ns_2_samples_overall (core::nanoseconds_t ns_duration) const
 Convert nanoseconds duration to number of samples for all channels.
 
core::nanoseconds_t samples_overall_2_ns (size_t n_samples) const
 Convert number of samples for all channels to nanoseconds duration.
 

RTP timestamp

packet::timestamp_diff_t ns_2_rtp_timestamp (core::nanoseconds_t ns_delta) const
 Convert nanoseconds delta to RTP timestamp delta.
 
core::nanoseconds_t rtp_timestamp_2_ns (packet::timestamp_diff_t rtp_delta) const
 Convert RTP timestamp delta to nanoseconds delta.
 

Detailed Description

Sample stream specification. Defines sample rate and channel layout.

Definition at line 24 of file sample_spec.h.

Constructor & Destructor Documentation

◆ SampleSpec() [1/2]

roc::audio::SampleSpec::SampleSpec ( )

Default constructor.

◆ SampleSpec() [2/2]

roc::audio::SampleSpec::SampleSpec ( size_t  sample_rate,
packet::channel_mask_t  channel_mask 
)

Constructor with sample rate and channel mask.

Member Function Documentation

◆ channel_mask()

packet::channel_mask_t roc::audio::SampleSpec::channel_mask ( ) const

Get channel mask.

◆ ns_2_rtp_timestamp()

packet::timestamp_diff_t roc::audio::SampleSpec::ns_2_rtp_timestamp ( core::nanoseconds_t  ns_delta) const

Convert nanoseconds delta to RTP timestamp delta.

Note
Same as ns_2_samples_per_chan(), but supports negative deltas.

◆ ns_2_samples_overall()

size_t roc::audio::SampleSpec::ns_2_samples_overall ( core::nanoseconds_t  ns_duration) const

Convert nanoseconds duration to number of samples for all channels.

◆ ns_2_samples_per_chan()

size_t roc::audio::SampleSpec::ns_2_samples_per_chan ( core::nanoseconds_t  ns_duration) const

Convert nanoseconds duration to number of samples per channel.

◆ num_channels()

size_t roc::audio::SampleSpec::num_channels ( ) const

Get number of channels.

◆ operator!=()

bool roc::audio::SampleSpec::operator!= ( const SampleSpec other) const

Check two specifications for equality.

◆ operator==()

bool roc::audio::SampleSpec::operator== ( const SampleSpec other) const

Check two specifications for equality.

◆ rtp_timestamp_2_ns()

core::nanoseconds_t roc::audio::SampleSpec::rtp_timestamp_2_ns ( packet::timestamp_diff_t  rtp_delta) const

Convert RTP timestamp delta to nanoseconds delta.

Note
Same as samples_per_chan_2_ns(), but supports negative deltas.

◆ sample_rate()

size_t roc::audio::SampleSpec::sample_rate ( ) const

Get sample rate.

◆ samples_overall_2_ns()

core::nanoseconds_t roc::audio::SampleSpec::samples_overall_2_ns ( size_t  n_samples) const

Convert number of samples for all channels to nanoseconds duration.

◆ samples_per_chan_2_ns()

core::nanoseconds_t roc::audio::SampleSpec::samples_per_chan_2_ns ( size_t  n_samples) const

Convert number of samples per channel to nanoseconds duration.

◆ set_channel_mask()

void roc::audio::SampleSpec::set_channel_mask ( packet::channel_mask_t  channel_mask)

Set channel mask.

◆ set_sample_rate()

void roc::audio::SampleSpec::set_sample_rate ( size_t  sample_rate)

Set sample rate.


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