foobar2000 SDK  2015-01-14
Public Member Functions | Data Fields
wavWriterSetup_t

#include <writer_wav.h>

Public Member Functions

void initialize (const audio_chunk &p_chunk, unsigned p_bps, bool p_float, bool p_dither, bool p_wave64=false)
 
void initialize2 (const audio_chunk &p_chunk, unsigned p_bps, unsigned p_bpsValid, bool p_float, bool p_dither, bool p_wave64=false)
 
void initialize3 (const audio_chunk::spec_t &spec, unsigned bps, unsigned bpsValid, bool bFloat, bool bDither, bool bWave64=false)
 
bool needWFXE () const
 
void setup_wfx (WAVEFORMATEX &p_wfx)
 
void setup_wfxe (WAVEFORMATEXTENSIBLE &p_wfx)
 

Data Fields

unsigned m_bps
 
unsigned m_bpsValid
 
unsigned m_channel_mask
 
unsigned m_channels
 
bool m_dither
 
bool m_float
 
unsigned m_samplerate
 
bool m_wave64
 

Detailed Description

Definition at line 8 of file writer_wav.h.

Member Function Documentation

void wavWriterSetup_t::initialize ( const audio_chunk p_chunk,
unsigned  p_bps,
bool  p_float,
bool  p_dither,
bool  p_wave64 = false 
)

Definition at line 63 of file writer_wav.cpp.

64 {
65  unsigned bpsValid = p_bps;
66  unsigned bps = (p_bps + 7) & ~7;
67  initialize2(p_chunk, bps, bpsValid, p_float, p_dither, p_wave64);
68 }
void initialize2(const audio_chunk &p_chunk, unsigned p_bps, unsigned p_bpsValid, bool p_float, bool p_dither, bool p_wave64=false)
Definition: writer_wav.cpp:52
void wavWriterSetup_t::initialize2 ( const audio_chunk p_chunk,
unsigned  p_bps,
unsigned  p_bpsValid,
bool  p_float,
bool  p_dither,
bool  p_wave64 = false 
)

Definition at line 52 of file writer_wav.cpp.

52  {
53  m_bps = p_bps;
54  m_bpsValid = p_bpsValid;
55  m_samplerate = p_chunk.get_srate();
56  m_channels = p_chunk.get_channels();
58  m_float = p_float;
59  m_dither = p_dither;
60  m_wave64 = p_wave64;
61 }
virtual unsigned get_channels() const =0
Retrieves channel count of contained audio data.
unsigned m_bpsValid
Definition: writer_wav.h:10
unsigned m_samplerate
Definition: writer_wav.h:10
virtual unsigned get_srate() const =0
Retrieves sample rate of contained audio data.
virtual unsigned get_channel_config() const =0
Retrieves channel map of contained audio data. Conditions where number of channels specified by chann...
unsigned m_bps
Definition: writer_wav.h:10
unsigned m_channel_mask
Definition: writer_wav.h:10
unsigned m_channels
Definition: writer_wav.h:10
void wavWriterSetup_t::initialize3 ( const audio_chunk::spec_t spec,
unsigned  bps,
unsigned  bpsValid,
bool  bFloat,
bool  bDither,
bool  bWave64 = false 
)

Definition at line 41 of file writer_wav.cpp.

41  {
42  m_bps = bps;
43  m_bpsValid = bpsValid;
44  m_samplerate = spec.sampleRate;
45  m_channels = spec.chanCount;
46  m_channel_mask = spec.chanMask;
47  m_float = bFloat;
48  m_dither = bDither;
49  m_wave64 = bWave64;
50 }
unsigned m_bpsValid
Definition: writer_wav.h:10
unsigned m_samplerate
Definition: writer_wav.h:10
unsigned m_bps
Definition: writer_wav.h:10
unsigned m_channel_mask
Definition: writer_wav.h:10
unsigned m_channels
Definition: writer_wav.h:10
bool wavWriterSetup_t::needWFXE ( ) const

Definition at line 21 of file writer_wav.cpp.

21  {
22  if (this->m_bpsValid != this->m_bps) return true;
23  switch(m_channels)
24  {
25  case 1:
27  case 2:
29 /* case 4:
30  m_wfxe = m_setup.m_channel_mask != (audio_chunk::channel_front_left | audio_chunk::channel_front_right | audio_chunk::channel_back_left | audio_chunk::channel_back_right);
31  break;
32  case 6:
33  m_wfxe = m_setup.m_channel_mask != audio_chunk::channel_config_5point1;
34  break;*/
35  default:
36  return true;
37  }
38 
39 }
unsigned m_bpsValid
Definition: writer_wav.h:10
unsigned m_bps
Definition: writer_wav.h:10
unsigned m_channel_mask
Definition: writer_wav.h:10
unsigned m_channels
Definition: writer_wav.h:10
void wavWriterSetup_t::setup_wfx ( WAVEFORMATEX &  p_wfx)

Definition at line 70 of file writer_wav.cpp.

71 {
72  p_wfx.wFormatTag = m_float ? WAVE_FORMAT_IEEE_FLOAT : WAVE_FORMAT_PCM;
73  p_wfx.nChannels = m_channels;
74  p_wfx.nSamplesPerSec = m_samplerate;
75  p_wfx.nAvgBytesPerSec = (m_bps >> 3) * m_channels * m_samplerate;
76  p_wfx.nBlockAlign = (m_bps>>3) * m_channels;
77  p_wfx.wBitsPerSample = m_bps;
78  p_wfx.cbSize = 0;
79 }
unsigned m_samplerate
Definition: writer_wav.h:10
unsigned m_bps
Definition: writer_wav.h:10
unsigned m_channels
Definition: writer_wav.h:10
void wavWriterSetup_t::setup_wfxe ( WAVEFORMATEXTENSIBLE &  p_wfx)

Definition at line 81 of file writer_wav.cpp.

82 {
83  setup_wfx(p_wfxe.Format);
84  p_wfxe.Format.wFormatTag=WAVE_FORMAT_EXTENSIBLE;
85  p_wfxe.Format.cbSize=22;
86  p_wfxe.Samples.wValidBitsPerSample = this->m_bpsValid;
88  p_wfxe.SubFormat = m_float ? KSDATAFORMAT_SUBTYPE_IEEE_FLOAT : KSDATAFORMAT_SUBTYPE_PCM;
89 
90 }
void setup_wfx(WAVEFORMATEX &p_wfx)
Definition: writer_wav.cpp:70
unsigned m_bpsValid
Definition: writer_wav.h:10
unsigned m_channel_mask
Definition: writer_wav.h:10
static uint32_t g_channel_config_to_wfx(unsigned p_config)
Helper function; translates audio_chunk channel map to WAVEFORMATEXTENSIBLE channel map...

Field Documentation

unsigned wavWriterSetup_t::m_bps

Definition at line 10 of file writer_wav.h.

unsigned wavWriterSetup_t::m_bpsValid

Definition at line 10 of file writer_wav.h.

unsigned wavWriterSetup_t::m_channel_mask

Definition at line 10 of file writer_wav.h.

unsigned wavWriterSetup_t::m_channels

Definition at line 10 of file writer_wav.h.

bool wavWriterSetup_t::m_dither

Definition at line 11 of file writer_wav.h.

bool wavWriterSetup_t::m_float

Definition at line 11 of file writer_wav.h.

unsigned wavWriterSetup_t::m_samplerate

Definition at line 10 of file writer_wav.h.

bool wavWriterSetup_t::m_wave64

Definition at line 11 of file writer_wav.h.


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