summaryrefslogtreecommitdiff
path: root/libs/audiographer/audiographer/general/deinterleaver.h
diff options
context:
space:
mode:
authorRobin Gareus <robin@gareus.org>2015-10-05 16:17:49 +0200
committerRobin Gareus <robin@gareus.org>2015-10-05 16:17:49 +0200
commit22b07e0233a29d9633ffa825a79503befaf2e16e (patch)
tree1d8b06056f8e12197158f5d906319767d3dedda5 /libs/audiographer/audiographer/general/deinterleaver.h
parente11ba7b79d68bc1070b170236c22123966d7bcc3 (diff)
NOOP, remove trailing tabs/whitespace.
Diffstat (limited to 'libs/audiographer/audiographer/general/deinterleaver.h')
-rw-r--r--libs/audiographer/audiographer/general/deinterleaver.h34
1 files changed, 17 insertions, 17 deletions
diff --git a/libs/audiographer/audiographer/general/deinterleaver.h b/libs/audiographer/audiographer/general/deinterleaver.h
index fac38912d7..63b6c95589 100644
--- a/libs/audiographer/audiographer/general/deinterleaver.h
+++ b/libs/audiographer/audiographer/general/deinterleaver.h
@@ -21,7 +21,7 @@ class /*LIBAUDIOGRAPHER_API*/ DeInterleaver
{
private:
typedef boost::shared_ptr<IdentityVertex<T> > OutputPtr;
-
+
public:
/// Constructor. \n RT safe
DeInterleaver()
@@ -29,11 +29,11 @@ class /*LIBAUDIOGRAPHER_API*/ DeInterleaver
, max_frames (0)
, buffer (0)
{}
-
+
~DeInterleaver() { reset(); }
-
+
typedef boost::shared_ptr<Source<T> > SourcePtr;
-
+
/// Inits the deinterleaver. Must be called before using. \n Not RT safe
void init (unsigned int num_channels, framecnt_t max_frames_per_channel)
{
@@ -41,53 +41,53 @@ class /*LIBAUDIOGRAPHER_API*/ DeInterleaver
channels = num_channels;
max_frames = max_frames_per_channel;
buffer = new T[max_frames];
-
+
for (unsigned int i = 0; i < channels; ++i) {
outputs.push_back (OutputPtr (new IdentityVertex<T>));
}
}
-
+
/// Returns an output indexed by \a channel \n RT safe
SourcePtr output (unsigned int channel)
{
if (throw_level (ThrowObject) && channel >= channels) {
throw Exception (*this, "channel out of range");
}
-
+
return outputs[channel];
}
-
+
/// Deinterleaves data and outputs it to the outputs. \n RT safe
void process (ProcessContext<T> const & c)
{
framecnt_t frames = c.frames();
T const * data = c.data();
-
+
framecnt_t const frames_per_channel = frames / channels;
-
+
if (throw_level (ThrowProcess) && c.channels() != channels) {
throw Exception (*this, "wrong amount of channels given to process()");
}
-
+
if (throw_level (ThrowProcess) && frames_per_channel > max_frames) {
throw Exception (*this, "too many frames given to process()");
}
-
+
unsigned int channel = 0;
for (typename std::vector<OutputPtr>::iterator it = outputs.begin(); it != outputs.end(); ++it, ++channel) {
if (!*it) { continue; }
-
+
for (unsigned int i = 0; i < frames_per_channel; ++i) {
buffer[i] = data[channel + (channels * i)];
}
-
+
ProcessContext<T> c_out (c, buffer, frames_per_channel, 1);
(*it)->process (c_out);
}
}
-
+
using Sink<T>::process;
-
+
private:
void reset ()
@@ -98,7 +98,7 @@ class /*LIBAUDIOGRAPHER_API*/ DeInterleaver
channels = 0;
max_frames = 0;
}
-
+
std::vector<OutputPtr> outputs;
unsigned int channels;
framecnt_t max_frames;