foobar2000 SDK  2015-08-03
Public Member Functions | Data Fields
t_pcmspec

#include <output.h>

Public Member Functions

 t_pcmspec ()
 
 t_pcmspec (const t_pcmspec &p_source)
 
unsigned align () const
 
double bytes_to_time (t_size p_bytes) const
 
bool is_valid () const
 
bool operator!= (const t_pcmspec &p_spec2) const
 
bool operator== (const t_pcmspec &p_spec2) const
 
void reset ()
 
t_size time_to_bytes (double p_time) const
 

Data Fields

unsigned m_bits_per_sample
 
unsigned m_channel_config
 
unsigned m_channels
 
bool m_float
 
unsigned m_sample_rate
 

Detailed Description

Structure describing PCM audio data format, with basic helper functions.

Definition at line 17 of file output.h.

Constructor & Destructor Documentation

t_pcmspec::t_pcmspec ( )
inline

Definition at line 19 of file output.h.

19 {reset();}
void reset()
Definition: output.h:45
t_pcmspec::t_pcmspec ( const t_pcmspec p_source)
inline

Definition at line 20 of file output.h.

20 {*this = p_source;}

Member Function Documentation

unsigned t_pcmspec::align ( ) const
inline

Definition at line 26 of file output.h.

26 {return (m_bits_per_sample / 8) * m_channels;}
unsigned m_channels
Definition: output.h:23
unsigned m_bits_per_sample
Definition: output.h:22
double t_pcmspec::bytes_to_time ( t_size  p_bytes) const
inline

Definition at line 29 of file output.h.

29 {return (double) (p_bytes / ((m_bits_per_sample / 8) * m_channels)) / (double) m_sample_rate;}
unsigned m_sample_rate
Definition: output.h:21
unsigned m_channels
Definition: output.h:23
unsigned m_bits_per_sample
Definition: output.h:22
bool t_pcmspec::is_valid ( ) const
inline

Definition at line 46 of file output.h.

47  {
48  return m_sample_rate >= 1000 && m_sample_rate <= 1000000 &&
49  m_channels > 0 && m_channels <= 256 && m_channel_config != 0 &&
51  }
unsigned m_sample_rate
Definition: output.h:21
unsigned m_channels
Definition: output.h:23
unsigned m_bits_per_sample
Definition: output.h:22
unsigned m_channel_config
Definition: output.h:23
bool t_pcmspec::operator!= ( const t_pcmspec p_spec2) const
inline

Definition at line 40 of file output.h.

41  {
42  return !(*this == p_spec2);
43  }
bool t_pcmspec::operator== ( const t_pcmspec p_spec2) const
inline

Definition at line 31 of file output.h.

32  {
33  return /*p_spec1.*/m_sample_rate == p_spec2.m_sample_rate
34  && /*p_spec1.*/m_bits_per_sample == p_spec2.m_bits_per_sample
35  && /*p_spec1.*/m_channels == p_spec2.m_channels
36  && /*p_spec1.*/m_channel_config == p_spec2.m_channel_config
37  && /*p_spec1.*/m_float == p_spec2.m_float;
38  }
bool m_float
Definition: output.h:24
unsigned m_sample_rate
Definition: output.h:21
unsigned m_channels
Definition: output.h:23
unsigned m_bits_per_sample
Definition: output.h:22
unsigned m_channel_config
Definition: output.h:23
void t_pcmspec::reset ( )
inline

Definition at line 45 of file output.h.

bool m_float
Definition: output.h:24
unsigned m_sample_rate
Definition: output.h:21
unsigned m_channels
Definition: output.h:23
unsigned m_bits_per_sample
Definition: output.h:22
unsigned m_channel_config
Definition: output.h:23
t_size t_pcmspec::time_to_bytes ( double  p_time) const
inline

Definition at line 28 of file output.h.

28 {return (t_size)audio_math::time_to_samples(p_time,m_sample_rate) * (m_bits_per_sample / 8) * m_channels;}
unsigned m_sample_rate
Definition: output.h:21
unsigned m_channels
Definition: output.h:23
unsigned m_bits_per_sample
Definition: output.h:22
size_t t_size
Definition: int_types.h:48

Field Documentation

unsigned t_pcmspec::m_bits_per_sample

Definition at line 22 of file output.h.

unsigned t_pcmspec::m_channel_config

Definition at line 23 of file output.h.

unsigned t_pcmspec::m_channels

Definition at line 23 of file output.h.

bool t_pcmspec::m_float

Definition at line 24 of file output.h.

unsigned t_pcmspec::m_sample_rate

Definition at line 21 of file output.h.


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