audio_common for ROS 2
Loading...
Searching...
No Matches
audio_common::WaveFile Class Reference

#include <wave_file.hpp>

Collaboration diagram for audio_common::WaveFile:

Public Member Functions

 WaveFile (const std::string &filepath)
 
 ~WaveFile ()
 
bool open ()
 
void rewind ()
 
bool read (std::vector< float > &buffer, size_t size)
 
int get_sample_rate () const
 
int get_num_channels () const
 
int get_bits_per_sample () const
 

Private Member Functions

float int16ToFloat (int16_t sample)
 

Private Attributes

std::string filepath_
 
std::ifstream file_
 
int sample_rate_
 
int channels_
 
int bits_per_sample_
 

Constructor & Destructor Documentation

◆ WaveFile()

WaveFile::WaveFile ( const std::string & filepath)
explicit

◆ ~WaveFile()

WaveFile::~WaveFile ( )

Member Function Documentation

◆ get_bits_per_sample()

int audio_common::WaveFile::get_bits_per_sample ( ) const
inline

◆ get_num_channels()

int audio_common::WaveFile::get_num_channels ( ) const
inline

◆ get_sample_rate()

int audio_common::WaveFile::get_sample_rate ( ) const
inline

◆ int16ToFloat()

float audio_common::WaveFile::int16ToFloat ( int16_t sample)
inlineprivate

◆ open()

bool WaveFile::open ( )

◆ read()

bool WaveFile::read ( std::vector< float > & buffer,
size_t size )

◆ rewind()

void WaveFile::rewind ( )

Member Data Documentation

◆ bits_per_sample_

int audio_common::WaveFile::bits_per_sample_
private

◆ channels_

int audio_common::WaveFile::channels_
private

◆ file_

std::ifstream audio_common::WaveFile::file_
private

◆ filepath_

std::string audio_common::WaveFile::filepath_
private

◆ sample_rate_

int audio_common::WaveFile::sample_rate_
private

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