SLIP  1.4
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
Public Types | Public Member Functions | Protected Attributes | List of all members
slip::WavWriter< Container1d, T > Class Template Reference

WavWriter is the wave array writer. More...

#include <WavWriter.hpp>

Inheritance diagram for slip::WavWriter< Container1d, T >:
Inheritance graph

Public Types

typedef Container1d container_type
 
typedef T value_type
 
typedef ContainerWriter
< Container1d, T > 
base
 

Public Member Functions

void initialize (const WAVE_HEADER &wave, std::size_t output_audio_size)
 initialized the writing process. Has to be called before the first write() call of a given array. More...
 
void initialize (short sample_rate, short byte_per_sample, std::size_t output_audio_size)
 initialized the writing process. Has to be called before the first write() call of a given array. More...
 
void release ()
 release the writing process. Has to be called when an audio file has been fully written. More...
 
int write (const container_type &data)
 write function. This function write the data within the output file after the previous one. When last is set to true, the output file is closed. More...
 
void set_header (const WAVE_HEADER &wave)
 Set the wav header file. More...
 
const WAVE_HEADER & get_header () const
 Get the wav file header. More...
 
Constructors & Destructors
 WavWriter ()
 
 WavWriter (std::string output_filename, const WAVE_HEADER &wave, std::size_t output_audio_size)
 
 WavWriter (std::string output_filename, short sample_rate, short byte_per_sample, std::size_t output_audio_size)
 
virtual ~WavWriter ()
 
Getters and setters
const std::string & get_output_filename () const
 return the output file name. More...
 
void set_output_filename (const std::string &output_filename)
 set the output file name. More...
 

Protected Attributes

std::string output_filename_
 

Detailed Description

template<class Container1d, typename T>
class slip::WavWriter< Container1d, T >

WavWriter is the wave array writer.

Version
Fluex 1.0
Date
2013/04/18
Author
Denis Arrivault <denis.arrivault_AT_inria.fr>
Parameters
Container1dis the type of the containers that will be written in the wav file. It should be a one dimensional container with [] operator, begin(), end() and size() methods defined.
Tthe type of the container data.
Note
only 8,16 and 32 bits/sample format could be written. If more than one channel is specified in the header, the container will be duplicated on each channel.
Examples:
wav_file_io.cpp.

Definition at line 35 of file WavWriter.hpp.

Member Typedef Documentation

template<class Container1d, typename T>
typedef ContainerWriter<Container1d, T> slip::WavWriter< Container1d, T >::base

Definition at line 39 of file WavWriter.hpp.

template<class Container1d, typename T>
typedef Container1d slip::WavWriter< Container1d, T >::container_type

Definition at line 37 of file WavWriter.hpp.

template<class Container1d, typename T>
typedef T slip::WavWriter< Container1d, T >::value_type

Definition at line 38 of file WavWriter.hpp.

Constructor & Destructor Documentation

template<class Container1d, typename T>
slip::WavWriter< Container1d, T >::WavWriter ( )
inline

Default constructor

Definition at line 49 of file WavWriter.hpp.

template<class Container1d , typename T >
slip::WavWriter< Container1d, T >::WavWriter ( std::string  output_filename,
const WAVE_HEADER &  wave,
std::size_t  output_audio_size 
)
inline

Constructor with parameters.

Parameters
output_filenameis the name of the output file where the data of the container will be saved.
wavethe WAVE_HEADER that has to be written in the output file
output_audio_sizeis the total audio array size.

Definition at line 160 of file WavWriter.hpp.

template<class Container1d , typename T >
slip::WavWriter< Container1d, T >::WavWriter ( std::string  output_filename,
short  sample_rate,
short  byte_per_sample,
std::size_t  output_audio_size 
)
inline

Constructor with parameters.

Parameters
output_filenameis the name of the output file where the data of the container will be saved.
sample_rateis the sample frequency (11025,22050,44100,48000 or 96000)
bytes_per_sampleshould be 8, 16 or 32
output_audio_sizeis the total audio array size.

Definition at line 171 of file WavWriter.hpp.

template<class Container1d, typename T>
virtual slip::WavWriter< Container1d, T >::~WavWriter ( )
inlinevirtual

Destructor

Definition at line 78 of file WavWriter.hpp.

Member Function Documentation

template<class Container1d, typename T>
const WAVE_HEADER& slip::WavWriter< Container1d, T >::get_header ( ) const
inline

Get the wav file header.

Returns
the wav file header
Note
The data chunk size parameter can be wrong as it is adjusted by the read function

Definition at line 129 of file WavWriter.hpp.

const std::string& slip::ContainerWriter< Container1d , T >::get_output_filename ( ) const
inherited

return the output file name.

template<class Container1d , typename T >
void slip::WavWriter< Container1d, T >::initialize ( const WAVE_HEADER &  wave,
std::size_t  output_audio_size 
)
inline

initialized the writing process. Has to be called before the first write() call of a given array.

Parameters
wavethe WAVE_HEADER that has to be written in the output file
output_audio_sizethe total audio array size

Definition at line 232 of file WavWriter.hpp.

template<class Container1d , typename T >
void slip::WavWriter< Container1d, T >::initialize ( short  sample_rate,
short  byte_per_sample,
std::size_t  output_audio_size 
)
inline

initialized the writing process. Has to be called before the first write() call of a given array.

Parameters
sample_rateis the sample frequency (11025,22050,44100,48000 or 96000)
bytes_per_sampleshould be 8, 16 or 32
output_audio_sizethe total audio array size

Definition at line 223 of file WavWriter.hpp.

template<class Container1d , typename T >
void slip::WavWriter< Container1d, T >::release ( )
inline

release the writing process. Has to be called when an audio file has been fully written.

Definition at line 431 of file WavWriter.hpp.

template<class Container1d, typename T>
void slip::WavWriter< Container1d, T >::set_header ( const WAVE_HEADER &  wave)
inline

Set the wav header file.

Parameters
wavethe WAVE_HEADER that has to be written in the output file
Note
The data chunk size parameter will be adjusted with the data size.

Definition at line 119 of file WavWriter.hpp.

void slip::ContainerWriter< Container1d , T >::set_output_filename ( const std::string &  output_filename)
inherited

set the output file name.

template<class Container1d , typename T >
int slip::WavWriter< Container1d, T >::write ( const container_type data)
inlinevirtual

write function. This function write the data within the output file after the previous one. When last is set to true, the output file is closed.

Parameters
datais the audio container to save. Warning, the container should be a 1d container with [] operator, begin(), end() and size() methods defined.
Returns
false if the file has been completely filled.
Note
only 8,16 and 32 bits/sample are valid.

Implements slip::ContainerWriter< Container1d, T >.

Definition at line 308 of file WavWriter.hpp.

Member Data Documentation

std::string slip::ContainerWriter< Container1d , T >::output_filename_
protectedinherited

Definition at line 89 of file ContainerWriter.hpp.


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