libsdr
0.1.0
A simple SDR library
|
A simple imput source that reads from a wav file. More...
#include <wavfile.hh>
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... | |
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.
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.
|
virtual |
Destructor.
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.
|
protected |
The output buffer.
|
protected |
The current buffer size.
|
protected |
The input file stream.
|
protected |
The number of available frames.
|
protected |
The number of frames left to be read.
|
protected |
The sample rate.
|
protected |
The type of the data in the WAV file.