|
Roc Toolkit internal modules
Roc Toolkit: real-time audio streaming
|
Sample specification. Describes sample rate and channels. More...
#include <sample_spec.h>
Public Member Functions | |
| SampleSpec () | |
| Construct empty specification. | |
| SampleSpec (size_t sample_rate, const ChannelSet &channel_set) | |
| Construct specification with parameters. | |
| SampleSpec (size_t sample_rate, ChannelLayout channel_layout, ChannelOrder channel_order, ChannelMask channel_mask) | |
| Construct specification with parameters. | |
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 | |
| bool | is_valid () const |
| Check if sample spec has non-zero rate and valid channel set. | |
| size_t | sample_rate () const |
| Get sample rate. | |
| void | set_sample_rate (size_t sample_rate) |
| Set sample rate. | |
| const ChannelSet & | channel_set () const |
| Get channel set. | |
| ChannelSet & | channel_set () |
| Get mutable channel set. | |
| void | set_channel_set (const ChannelSet &channel_set) |
| Set channel set. | |
| size_t | num_channels () const |
| Get number enabled channels in channel set. | |
Nanosecond duration converters | |
| 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. | |
| core::nanoseconds_t | fract_samples_per_chan_2_ns (float n_samples) const |
| Convert (possibly fractional) number 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. | |
| core::nanoseconds_t | fract_samples_overall_2_ns (float n_samples) const |
| Convert number of samples (possibly non-integer) to nanoseconds. | |
RTP timestamp converters | |
| packet::stream_timestamp_diff_t | ns_2_stream_timestamp_delta (core::nanoseconds_t ns_delta) const |
| Convert nanoseconds delta to stream timestamp delta. | |
| core::nanoseconds_t | stream_timestamp_delta_2_ns (packet::stream_timestamp_diff_t sts_delta) const |
| Convert stream timestamp delta to nanoseconds delta. | |
Sample specification. Describes sample rate and channels.
Definition at line 26 of file sample_spec.h.
| roc::audio::SampleSpec::SampleSpec | ( | ) |
Construct empty specification.
| roc::audio::SampleSpec::SampleSpec | ( | size_t | sample_rate, |
| const ChannelSet & | channel_set ) |
Construct specification with parameters.
| roc::audio::SampleSpec::SampleSpec | ( | size_t | sample_rate, |
| ChannelLayout | channel_layout, | ||
| ChannelOrder | channel_order, | ||
| ChannelMask | channel_mask ) |
Construct specification with parameters.
| ChannelSet & roc::audio::SampleSpec::channel_set | ( | ) |
Get mutable channel set.
| const ChannelSet & roc::audio::SampleSpec::channel_set | ( | ) | const |
Get channel set.
| core::nanoseconds_t roc::audio::SampleSpec::fract_samples_overall_2_ns | ( | float | n_samples | ) | const |
Convert number of samples (possibly non-integer) to nanoseconds.
| core::nanoseconds_t roc::audio::SampleSpec::fract_samples_per_chan_2_ns | ( | float | n_samples | ) | const |
Convert (possibly fractional) number samples per channel to nanoseconds duration.
| bool roc::audio::SampleSpec::is_valid | ( | ) | const |
Check if sample spec has non-zero rate and valid channel set.
| 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_duration should not be negative. | 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.
ns_duration should not be negative. | packet::stream_timestamp_diff_t roc::audio::SampleSpec::ns_2_stream_timestamp_delta | ( | core::nanoseconds_t | ns_delta | ) | const |
Convert nanoseconds delta to stream timestamp delta.
| size_t roc::audio::SampleSpec::num_channels | ( | ) | const |
Get number enabled channels in channel set.
| bool roc::audio::SampleSpec::operator!= | ( | const SampleSpec & | other | ) | const |
Check two specifications for equality.
| bool roc::audio::SampleSpec::operator== | ( | const SampleSpec & | other | ) | const |
Check two specifications for equality.
| size_t roc::audio::SampleSpec::sample_rate | ( | ) | const |
Get sample rate.
| 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.
n_samples should be multiple of number of channels. | 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.
| void roc::audio::SampleSpec::set_channel_set | ( | const ChannelSet & | channel_set | ) |
Set channel set.
| void roc::audio::SampleSpec::set_sample_rate | ( | size_t | sample_rate | ) |
Set sample rate.
| core::nanoseconds_t roc::audio::SampleSpec::stream_timestamp_delta_2_ns | ( | packet::stream_timestamp_diff_t | sts_delta | ) | const |
Convert stream timestamp delta to nanoseconds delta.