sdr::WavSource Class Reference
Data sources.

A simple imput source that reads from a wav file. More...

`#include <wavfile.hh>`

Inheritance diagram for sdr::WavSource:

## Public Member Functions

| WavSource (size_t buffer_size=1024)
| Constructor, `buffer_size` specified the output buffer size. More...
| WavSource (const std::string &filename, size_t buffer_size=1024)
| Constructor with file name, `buffer_size` specified the output buffer size. More...
virtual | ~WavSource ()
| Destructor. More...
bool | isOpen () const
| Returns `true` if the file is open. More...
void | open (const std::string &filename)
| Open a new file. More...
void | close ()
| Close the current file. More...
bool | isReal () const
| Returns true, if the input is real (stereo files are handled as I/Q signals). More...
void | next ()
| Read the next data. More...
Public Member Functions inherited from sdr::Source
| Source ()
| Constructor. More...
virtual | ~Source ()
| Destructor. More...
virtual void | send (const RawBuffer &buffer, bool allow_overwrite=false)
| Sends the given buffer to all connected sinks. More...
void | connect (SinkBase *sink, bool direct=false)
| Connect this source to a sink. More...
void | disconnect (SinkBase *sink)
| Disconnect a sink again. More...
virtual void | setConfig (const Config &config)
| Stores the configuration and propergates it if the configuration has been changed. More...
virtual double | sampleRate () const
| Returns the configured sample rate or `0` otherwise. More...
virtual Config::Type | type () const
| Returns the configured source type or `Config::Type_UNDEFINED` otherwise. More...
template<class T >
void | addEOS (T *instance, void(T::*function)())
| Adds a callback to the end-of-stream signal of the source. More...

## Protected Attributes

std::fstream | _file
| The input file stream. More...
RawBuffer | _buffer
| The output buffer. More...
size_t | _buffer_size
| The current buffer size. More...
size_t | _frame_count
| The number of available frames. More...
Config::Type | _type
| The type of the data in the WAV file. More...
double | _sample_rate
| The sample rate. More...
size_t | _frames_left
| The number of frames left to be read. More...
Protected Attributes inherited from sdr::Source
Config | _config
| Holds the source configuration, this can be updated by calling `setConfig`. More...
std::map< SinkBase *, bool > | _sinks
| The connected sinks. More...
std::list< DelegateInterface * > | _eos
| The connected EOS singal handlers. More...

## Additional Inherited Members

Protected Member Functions inherited from sdr::Source
void | signalEOS ()
| Signals the EOS. More...
void | propagateConfig (const Config &config)
| Propagates the given configuration to all connected sinks. More...

## Detailed Description

A simple imput source that reads from a wav file.

Some data is read from the file on every call to `next` until the end of file is reached.

## Constructor & Destructor Documentation

WavSource::WavSource | ( | size_t | buffer_size = `1024` | ) |

Constructor, `buffer_size` specified the output buffer size.

WavSource::WavSource | ( | const std::string & | filename,
|  | size_t | buffer_size = `1024`
| ) |  |

Constructor with file name, `buffer_size` specified the output buffer size.

WavSource::~WavSource | ( |  | ) |

virtual

Destructor.

## Member Function Documentation

void WavSource::close | ( |  | ) |

Close the current file.

bool WavSource::isOpen | ( |  | ) | const

Returns `true` if the file is open.

bool WavSource::isReal | ( |  | ) | const

Returns true, if the input is real (stereo files are handled as I/Q signals).

void WavSource::next | ( |  | ) |

Read the next data.

void WavSource::open | ( | const std::string & | filename | ) |

Open a new file.

## Member Data Documentation

RawBuffer sdr::WavSource::_buffer

protected

The output buffer.

size_t sdr::WavSource::_buffer_size

protected

The current buffer size.

std::fstream sdr::WavSource::_file

protected

The input file stream.

size_t sdr::WavSource::_frame_count

protected

The number of available frames.

size_t sdr::WavSource::_frames_left

protected

The number of frames left to be read.

double sdr::WavSource::_sample_rate

protected

The sample rate.

Config::Type sdr::WavSource::_type

protected

The type of the data in the WAV file.

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

- /Users/hannes/Uni/Elektronik/sdr/libsdr/src/wavfile.hh
- /Users/hannes/Uni/Elektronik/sdr/libsdr/src/wavfile.cc