libsdr
0.1.0
A simple SDR library
|
PortAudio input stream as a Source
.
More...
#include <portaudio.hh>
Public Member Functions | |
PortSource (double sampleRate, size_t bufferSize, int dev=-1) | |
Constructor. More... | |
virtual | ~PortSource () |
Destructor. More... | |
void | next () |
Reads (blocking) the next buffer from the PortAudio stream. More... | |
int | deviceIndex () const |
Returns the currently selected input device. More... | |
void | setDeviceIndex (int idx=-1) |
Selects the input device, throws a ConfigError exception if the device can not be setup as an input device. More... | |
bool | hasSampleRate (double sampleRate) |
Checks if the given sample rate is supported by the device. More... | |
void | setSampleRate (double sampleRate) |
Resets the sample rate of the input device. 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 Member Functions | |
void | _initializeStream (int idx=-1) |
Device setup. More... | |
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... | |
Protected Attributes | |
bool | _streamIsOpen |
If true, the PortAudio stream, _stream is open. More... | |
PaStream * | _stream |
The PortAudio input stream. More... | |
PaSampleFormat | _fmt |
The current format of the PortAudio stream. More... | |
double | _sampleRate |
The current sample rate. More... | |
int | _deviceIndex |
The current input device index. More... | |
bool | _is_real |
If true , the input stream is real (1 chanel), otherwise complex (2 chanels). More... | |
Buffer< Scalar > | _buffer |
The output buffer. 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... | |
|
inline |
Constructor.
|
inlinevirtual |
Destructor.
|
inlineprotected |
Device setup.
|
inline |
Returns the currently selected input device.
|
inline |
Checks if the given sample rate is supported by the device.
|
inline |
|
inline |
Selects the input device, throws a ConfigError
exception if the device can not be setup as an input device.
Do not call this function, while the Queue
is running.
|
inline |
Resets the sample rate of the input device.
Do not call this function, while the Queue
is running.
|
protected |
The output buffer.
|
protected |
The current input device index.
|
protected |
The current format of the PortAudio stream.
|
protected |
If true
, the input stream is real (1 chanel), otherwise complex (2 chanels).
|
protected |
The current sample rate.
|
protected |
The PortAudio input stream.
|
protected |
If true, the PortAudio stream, _stream
is open.