1 #ifndef AUDIOGRAPHER_DEINTERLEAVER_H
2 #define AUDIOGRAPHER_DEINTERLEAVER_H
17 template<
typename T = DefaultSampleType>
23 typedef std::shared_ptr<IdentityVertex<T> >
OutputPtr;
45 for (
unsigned int i = 0; i <
channels; ++i) {
54 throw Exception (*
this,
"channel out of range");
64 T
const * data = c.
data();
69 throw Exception (*
this,
"wrong amount of channels given to process()");
73 throw Exception (*
this,
"too many samples given to process()");
76 unsigned int channel = 0;
77 for (
typename std::vector<OutputPtr>::iterator it =
outputs.begin(); it !=
outputs.end(); ++it, ++channel) {
78 if (!*it) {
continue; }
80 for (
unsigned int i = 0; i < samples_per_channel; ++i) {
85 (*it)->process (c_out);
Converts on stream of interleaved data to many streams of uninterleaved data.
DeInterleaver()
Constructor. RT safe.
std::shared_ptr< IdentityVertex< T > > OutputPtr
void process(ProcessContext< T > const &c)
Deinterleaves data and outputs it to the outputs. RT safe.
SourcePtr output(unsigned int channel)
Returns an output indexed by channel RT safe.
void init(unsigned int num_channels, samplecnt_t max_samples_per_channel)
Inits the deinterleaver. Must be called before using. Not RT safe.
std::vector< OutputPtr > outputs
std::shared_ptr< Source< T > > SourcePtr
Outputs its input directly to a number of Sinks.
ChannelCount const & channels() const
T const * data() const
data points to the array of data to process
samplecnt_t const & samples() const
samples tells how many samples the array pointed by data contains
bool throw_level(ThrowLevel level)
@ ThrowObject
Object level stuff, ctors, initalizers etc.
@ ThrowProcess
Process cycle level stuff.