1 #ifndef __SDR_BUFFERNODE_HH__
2 #define __SDR_BUFFERNODE_HH__
17 template <
class Scalar>
33 if (Config::Type_UNDEFINED == src_cfg.
type()) {
return; }
37 if (src_cfg.
type() != Config::typeId<Scalar>()) {
39 err <<
"Can not configure BufferNode sink. Source type is " << src_cfg.
type()
40 <<
" expected " << Config::typeId<Scalar>() << std::endl;
45 size_t numBuffers = std::max(
size_t(2), totSize/
_bufferSize);
49 msg <<
"Configure BufferNode: " << std::endl
50 <<
" type: " << src_cfg.
type() << std::endl
51 <<
" sample-rate: " << src_cfg.
sampleRate() << std::endl
83 memcpy(out.
data(), buffer.
data()+in_offset*
sizeof(Scalar), _bufferSize*
sizeof(Scalar));
106 #endif // __SDR_BUFFERNODE_HH__
A collection of configuration information that is send by a source to all connected sinks to properga...
Definition: node.hh:35
virtual void process(const Buffer< Scalar > &buffer, bool allow_overwrite)
Process the incomming data.
Definition: buffernode.hh:61
virtual void send(const RawBuffer &buffer, bool allow_overwrite=false)
Sends the given buffer to all connected sinks.
Definition: node.cc:67
BufferNode(size_t bufferSize)
Constructs a new buffer node.
Definition: buffernode.hh:23
Typed sink.
Definition: node.hh:192
Definition: autocast.hh:8
size_t numBuffers() const
Returns the max.
Definition: node.hh:89
Generic source class.
Definition: node.hh:213
size_t _bufferSize
The desired buffer size.
Definition: buffernode.hh:95
size_t size() const
Returns the number of elements of type T in this buffer.
Definition: buffer.hh:166
A set of buffers, that tracks their usage.
Definition: buffer.hh:288
A simple buffering node, that ensures a fixed buffer size.
Definition: buffernode.hh:18
char * data() const
Returns the pointer to the data of the buffer view.
Definition: buffer.hh:69
size_t _samplesLeft
Number of samples left.
Definition: buffernode.hh:101
virtual void setConfig(const Config &config)
Stores the configuration and propergates it if the configuration has been changed.
Definition: node.cc:98
Buffer< Scalar > _temp
An intermediate buffer to hold left-over samples from the previous buffers.
Definition: buffernode.hh:99
Type type() const
Returns the type.
Definition: node.hh:71
The configuration error class.
Definition: exception.hh:24
A log message.
Definition: logger.hh:22
size_t bufferSize() const
Returns the max.
Definition: node.hh:83
BufferSet< Scalar > _bufferSet
A set of output buffers.
Definition: buffernode.hh:97
virtual void config(const Config &src_cfg)
Configures the buffer node.
Definition: buffernode.hh:30
double sampleRate() const
Returns the sample rate.
Definition: node.hh:77