Re-integrate export-optimization branch.
[ardour.git] / libs / audiographer / audiographer / deinterleaver.h
1 #ifndef AUDIOGRAPHER_DEINTERLEAVER_H
2 #define AUDIOGRAPHER_DEINTERLEAVER_H
3
4 #include "types.h"
5 #include "source.h"
6 #include "sink.h"
7 #include "identity_vertex.h"
8 #include "exception.h"
9
10 #include <vector>
11
12 namespace AudioGrapher
13 {
14
15 template<typename T>
16 class DeInterleaver : public Sink<T>
17 {
18   private:
19         typedef boost::shared_ptr<IdentityVertex<T> > OutputPtr;
20         
21   public:
22         DeInterleaver();
23         ~DeInterleaver() { reset(); }
24         
25         typedef boost::shared_ptr<Source<T> > SourcePtr;
26         
27         void init (unsigned int num_channels, nframes_t max_frames_per_channel);
28         SourcePtr output (unsigned int channel);
29         void process (ProcessContext<T> const & c);
30         using Sink<T>::process;
31         
32   private:
33
34         void reset ();
35         
36         std::vector<OutputPtr> outputs;
37         unsigned int channels;
38         nframes_t max_frames;
39         T * buffer;
40 };
41
42 #include "deinterleaver-inl.h"
43
44 } // namespace
45
46 #endif // AUDIOGRAPHER_DEINTERLEAVER_H