foobar2000 SDK
2015-08-03
|
#include <audio_chunk.h>
Public Member Functions | |
audio_chunk_impl_t () | |
audio_chunk_impl_t (const audio_sample *src, unsigned samples, unsigned nch, unsigned srate) | |
audio_chunk_impl_t (const audio_chunk &p_source) | |
audio_chunk_impl_t (const t_self &p_source) | |
virtual unsigned | get_channel_config () const |
virtual unsigned | get_channels () const |
virtual audio_sample * | get_data () |
virtual const audio_sample * | get_data () const |
virtual t_size | get_data_size () const |
virtual t_size | get_sample_count () const |
virtual unsigned | get_srate () const |
const t_self & | operator= (const audio_chunk &p_source) |
const t_self & | operator= (const t_self &p_source) |
virtual void | set_channels (unsigned val, unsigned setup) |
void | set_channels (unsigned val) |
virtual void | set_data_size (t_size new_size) |
virtual void | set_sample_count (t_size val) |
virtual void | set_srate (unsigned val) |
Public Member Functions inherited from audio_chunk | |
void | allocate (size_t size) |
void | copy (const audio_chunk &p_source) |
unsigned | get_channel_count () const |
size_t | get_data_length () const |
double | get_duration () const |
audio_sample | get_peak (audio_sample p_peak) const |
audio_sample | get_peak () const |
unsigned | get_sample_rate () const |
spec_t | get_spec () const |
size_t | get_used_size () const |
void | grow_data_size (t_size p_requested) |
void | insert_silence_fromstart (t_size samples) |
bool | is_empty () const |
bool | is_spec_valid () const |
bool | is_valid () const |
const audio_chunk & | operator= (const audio_chunk &p_source) |
void | pad_with_silence (t_size samples) |
void | pad_with_silence_ex (t_size samples, unsigned hint_nch, unsigned hint_srate) |
bool | process_skip (double &skipDuration) |
void | reset () |
void | scale (audio_sample p_value) |
void | set_channels (unsigned val) |
void | set_data (const audio_sample *src, t_size samples, unsigned nch, unsigned srate, unsigned channel_config) |
void | set_data (const audio_sample *src, t_size samples, unsigned nch, unsigned srate) |
void | set_data_32 (const float *src, t_size samples, unsigned nch, unsigned srate) |
void | set_data_fixedpoint (const void *ptr, t_size bytes, unsigned srate, unsigned nch, unsigned bps, unsigned channel_config) |
void | set_data_fixedpoint_ex (const void *ptr, t_size bytes, unsigned p_sample_rate, unsigned p_channels, unsigned p_bits_per_sample, unsigned p_flags, unsigned p_channel_config) |
void | set_data_fixedpoint_ms (const void *ptr, size_t bytes, unsigned sampleRate, unsigned channels, unsigned bps, unsigned channelConfig) |
void | set_data_fixedpoint_signed (const void *ptr, t_size bytes, unsigned srate, unsigned nch, unsigned bps, unsigned channel_config) |
void | set_data_floatingpoint_ex (const void *ptr, t_size bytes, unsigned p_sample_rate, unsigned p_channels, unsigned p_bits_per_sample, unsigned p_flags, unsigned p_channel_config) |
void | set_data_int16 (const int16_t *src, t_size samples, unsigned nch, unsigned srate, unsigned channel_config) |
void | set_sample_rate (unsigned val) |
void | set_silence (t_size samples) |
void | set_silence_seconds (double seconds) |
void | set_spec (const spec_t &) |
t_size | skip_first_samples (t_size samples) |
bool | to_raw_data (class mem_block_container &out, t_uint32 bps, bool useUpperBits=true, float scale=1.0) const |
bool | toFixedPoint (class mem_block_container &out, uint32_t bps, uint32_t bpsValid, bool useUpperBits=true, float scale=1.0) const |
Private Types | |
typedef audio_chunk_impl_t< container_t > | t_self |
Private Attributes | |
container_t | m_data |
unsigned | m_nch |
t_size | m_samples |
unsigned | m_setup |
unsigned | m_srate |
Additional Inherited Members | |
Public Types inherited from audio_chunk | |
enum | { sample_rate_min = 1000, sample_rate_max = 2822400 } |
enum | { channel_front_left = 1<<0, channel_front_right = 1<<1, channel_front_center = 1<<2, channel_lfe = 1<<3, channel_back_left = 1<<4, channel_back_right = 1<<5, channel_front_center_left = 1<<6, channel_front_center_right = 1<<7, channel_back_center = 1<<8, channel_side_left = 1<<9, channel_side_right = 1<<10, channel_top_center = 1<<11, channel_top_front_left = 1<<12, channel_top_front_center = 1<<13, channel_top_front_right = 1<<14, channel_top_back_left = 1<<15, channel_top_back_center = 1<<16, channel_top_back_right = 1<<17, channel_config_mono = channel_front_center, channel_config_stereo = channel_front_left | channel_front_right, channel_config_5point1 = channel_front_left | channel_front_right | channel_front_center | channel_lfe | channel_back_left | channel_back_right, channel_config_5point1_side = channel_front_left | channel_front_right | channel_front_center | channel_lfe | channel_side_left | channel_side_right, channel_config_7point1 = channel_config_5point1 | channel_side_left | channel_side_right, defined_channel_count = 18 } |
enum | { FLAG_LITTLE_ENDIAN = 1, FLAG_BIG_ENDIAN = 2, FLAG_SIGNED = 4, FLAG_UNSIGNED = 8 } |
Static Public Member Functions inherited from audio_chunk | |
static unsigned | flags_autoendian () |
static unsigned | g_channel_config_from_wfx (uint32_t p_wfx) |
static uint32_t | g_channel_config_to_wfx (unsigned p_config) |
static unsigned | g_channel_index_from_flag (unsigned p_config, unsigned p_flag) |
static const char * | g_channel_name (unsigned p_flag) |
static const char * | g_channel_name_byidx (unsigned p_index) |
static unsigned | g_count_channels (unsigned p_config) |
static unsigned | g_extract_channel_flag (unsigned p_config, unsigned p_index) |
static unsigned | g_find_channel_idx (unsigned p_flag) |
static void | g_formatChannelMaskDesc (unsigned flags, pfc::string_base &out) |
static unsigned | g_guess_channel_config (unsigned count) |
static unsigned | g_guess_channel_config_xiph (unsigned count) |
static bool | g_is_valid_sample_rate (t_uint32 p_val) |
static bool | g_toFixedPoint (const audio_sample *in, void *out, size_t count, uint32_t bps, uint32_t bpsValid, bool useUpperBits=true, float scale=1.0) |
static spec_t | makeSpec (uint32_t rate, uint32_t channels) |
static spec_t | makeSpec (uint32_t rate, uint32_t channels, uint32_t chanMask) |
Protected Member Functions inherited from audio_chunk | |
audio_chunk () | |
~audio_chunk () | |
Implementation of audio_chunk. Takes pfc allocator template as template parameter.
Definition at line 242 of file audio_chunk.h.
|
private |
Definition at line 243 of file audio_chunk.h.
|
inline |
Definition at line 248 of file audio_chunk.h.
|
inline |
Definition at line 249 of file audio_chunk.h.
|
inline |
Definition at line 251 of file audio_chunk.h.
|
inline |
Definition at line 252 of file audio_chunk.h.
|
inlinevirtual |
Retrieves channel map of contained audio data. Conditions where number of channels specified by channel map don't match get_channels() return value should not be possible.
Implements audio_chunk.
Definition at line 262 of file audio_chunk.h.
|
inlinevirtual |
Retrieves channel count of contained audio data.
Implements audio_chunk.
Definition at line 261 of file audio_chunk.h.
|
inlinevirtual |
Retrieves audio data buffer pointer (non-const version). Returned pointer is for temporary use only; it is valid until next set_data_size call, or until the object is destroyed.
Size of returned buffer is equal to get_data_size() return value (in audio_samples). Amount of actual data may be smaller, depending on sample count and channel count. Conditions where sample count * channel count are greater than data size should not be possible.
Implements audio_chunk.
Definition at line 254 of file audio_chunk.h.
|
inlinevirtual |
Retrieves audio data buffer pointer (const version). Returned pointer is for temporary use only; it is valid until next set_data_size call, or until the object is destroyed.
Size of returned buffer is equal to get_data_size() return value (in audio_samples). Amount of actual data may be smaller, depending on sample count and channel count. Conditions where sample count * channel count are greater than data size should not be possible.
Implements audio_chunk.
Definition at line 255 of file audio_chunk.h.
|
inlinevirtual |
Retrieves size of allocated buffer space, in audio_samples.
Implements audio_chunk.
Definition at line 256 of file audio_chunk.h.
|
inlinevirtual |
Retrieves number of valid samples in the buffer.
Note that a "sample" means a unit of interleaved PCM data representing states of each channel at given point of time, not a single PCM value.
For an example, duration of contained audio data is equal to sample count / sample rate, while actual size of contained data is equal to sample count * channel count.
Implements audio_chunk.
Definition at line 266 of file audio_chunk.h.
|
inlinevirtual |
Retrieves sample rate of contained audio data.
Implements audio_chunk.
Definition at line 259 of file audio_chunk.h.
|
inline |
Definition at line 269 of file audio_chunk.h.
|
inline |
Definition at line 270 of file audio_chunk.h.
|
inlinevirtual |
Sets channel count / channel map.
Implements audio_chunk.
Definition at line 263 of file audio_chunk.h.
|
inline |
Definition at line 264 of file audio_chunk.h.
|
inlinevirtual |
Resizes audio data buffer to specified size. Throws std::bad_alloc on failure.
Implements audio_chunk.
Definition at line 257 of file audio_chunk.h.
|
inlinevirtual |
Sets number of valid samples in the buffer. WARNING: sample count * channel count should never be above allocated buffer size.
Implements audio_chunk.
Definition at line 267 of file audio_chunk.h.
|
inlinevirtual |
Sets sample rate of contained audio data.
Implements audio_chunk.
Definition at line 260 of file audio_chunk.h.
|
private |
Definition at line 244 of file audio_chunk.h.
|
private |
Definition at line 245 of file audio_chunk.h.
|
private |
Definition at line 246 of file audio_chunk.h.
|
private |
Definition at line 245 of file audio_chunk.h.
|
private |
Definition at line 245 of file audio_chunk.h.