itpp::SND_IO_File Class Reference
Source Coding Module » Audio

A class for doing both input and output of audio samples. More...

`#include <itpp/srccode/audiofile.h>`

## Public Member Functions

| SND_IO_File ()
| Constructor - creates uninitialized stream.
| SND_IO_File (const char *fname)
| Open the file fname, check file header.
| SND_IO_File (const char *fname, const Audio_Stream_Description &d)
| Open the file fname, truncate and overwrite header with description d.
| ~SND_IO_File ()
| Stream destructor.
bool | open (const char *fname)
| Open the file fname, check file header.
bool | open (const char *fname, const Audio_Stream_Description &d)
| Open the file fname, truncate and overwrite header with description d.
void | close ()
| Close the file.
Audio_Stream_Description | get_description () const
| Get stream description.
bool | seek_read (std::streamoff pos)
| Set current position to read from pos (samples).
std::streamoff | tell_read ()
| Get current position to read from in samples.
bool | seek_write (std::streamoff pos)
| Set current position to write to pos (samples).
std::streamoff | tell_write ()
| Get current position to write in samples.
std::streamoff | num_samples () const
| Get number of samples in stream.
bool | read_sample (double &s, int ch=0)
| Read single sample s at current position to channel ch.
vec | read_channel (int n, int ch=0)
| Read n samples from channel ch starting at current position.
mat | read (int n)
| Read n samples from all channels starting at current position.
bool | write_sample (const double &s, int ch=0)
| Write single sample s at current position to channel ch.
bool | write_channel (const vec &v, int ch=0)
| Write the vector v to channel ch starting at current position.
bool | write (const mat &m)
| Write audio channels from columns of the matrix m starting at current position.

## Detailed Description

A class for doing both input and output of audio samples.

SND_IO_File provides facilities for doing both input and output of audio samples.

Definition at line 374 of file audiofile.h.

## Member Function Documentation

## get_description()

Audio_Stream_Description itpp::SND_IO_File::get_description | ( |  | ) | const

inline

Get stream description.

Definition at line 392 of file audiofile.h.

## seek_read()

bool itpp::SND_IO_File::seek_read | ( | std::streamoff | pos | ) |

inline

Set current position to read from pos (samples).

Definition at line 394 of file audiofile.h.

## tell_read()

std::streamoff itpp::SND_IO_File::tell_read | ( |  | ) |

inline

Get current position to read from in samples.

Definition at line 405 of file audiofile.h.

## seek_write()

bool itpp::SND_IO_File::seek_write | ( | std::streamoff | pos | ) |

inline

Set current position to write to pos (samples).

Definition at line 413 of file audiofile.h.

## tell_write()

std::streamoff itpp::SND_IO_File::tell_write | ( |  | ) |

inline

Get current position to write in samples.

Definition at line 424 of file audiofile.h.

## num_samples()

std::streamoff itpp::SND_IO_File::num_samples | ( |  | ) | const

inline

Get number of samples in stream.

Definition at line 432 of file audiofile.h.

## read_sample()

bool itpp::SND_IO_File::read_sample | ( | double & | s,
|  | int | ch = `0`
| ) |  |

inline

Read single sample s at current position to channel ch.

Definition at line 434 of file audiofile.h.

## read_channel()

vec itpp::SND_IO_File::read_channel | ( | int | n,
|  | int | ch = `0`
| ) |  |

inline

Read n samples from channel ch starting at current position.

Definition at line 442 of file audiofile.h.

## read()

mat itpp::SND_IO_File::read | ( | int | n | ) |

inline

Read n samples from all channels starting at current position.

Definition at line 450 of file audiofile.h.

## write_sample()

bool itpp::SND_IO_File::write_sample | ( | const double & | s,
|  | int | ch = `0`
| ) |  |

inline

Write single sample s at current position to channel ch.

Definition at line 459 of file audiofile.h.

## write_channel()

bool itpp::SND_IO_File::write_channel | ( | const vec & | v,
|  | int | ch = `0`
| ) |  |

inline

Write the vector v to channel ch starting at current position.

Definition at line 472 of file audiofile.h.

## write()

bool itpp::SND_IO_File::write | ( | const mat & | m | ) |

inline

Write audio channels from columns of the matrix m starting at current position.

Definition at line 485 of file audiofile.h.

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

- itpp/srccode/audiofile.h

Generated on Mon Jun 10 2024 11:49:40 for IT++ by Doxygen 1.9.8