ape  0.5.0
Audio Programming Environment
generator.h
Go to the documentation of this file.
1 #ifndef CPPAPE_GENERATOR_H
2 #define CPPAPE_GENERATOR_H
3 
4 #include "common.h"
5 #include "fpoint.h"
6 #include "simd.h"
7 
8 namespace ape
9 {
15  class Generator : public Processor
16  {
17  protected:
18 
19  Generator() {}
20 
25  virtual void process(umatrix<float> buffer, size_t frames) {}
26 
27  private:
28 
29  void process(umatrix<const float> inputs, umatrix<float> outputs, size_t frames) final
30  {
31  process(outputs, frames);
32  }
33  };
34 
41  {
42  protected:
43 
45 
50  virtual void process(umatrix<float> buffer, size_t frames) {}
51 
52  private:
53 
54  void process(umatrix<const float> inputs, umatrix<float> outputs, size_t frames) final
55  {
56  process(outputs, frames);
57  }
58  };
59 
68  template<class TGenerator>
69  class EmbeddedGenerator final : public EmbeddedProcessor<TGenerator>
70  {
71  public:
72 
73  static_assert(std::is_base_of<Generator, TGenerator>::value || std::is_base_of<TransportGenerator, TGenerator>::value, "Embedded generators must derive from a generator");
74 
75  void process(umatrix<float> buffer, size_t frames)
76  {
77  this->processor.processFrames(buffer, buffer, frames);
78  }
79  };
80 }
81 
82 
83 #endif
ape::EmbeddedProcessor< TGenerator >::processor
TGenerator processor
Definition: processor.h:358
fpoint.h
ape::TransportGenerator::TransportGenerator
TransportGenerator()
Definition: generator.h:44
ape::umatrix
A container representing a 2d rectangular array (and can be used syntactically like one)....
Definition: misc.h:212
simd.h
ape::EmbeddedGenerator
A utility class to embed another Generator inside your own. It takes care of initialization....
Definition: generator.h:69
ape::Generator::Generator
Generator()
Definition: generator.h:19
ape::TransportGenerator::process
virtual void process(umatrix< float > buffer, size_t frames)
Override this to emit sound.
Definition: generator.h:50
ape
Definition: audiofile.h:7
ape::Generator::process
virtual void process(umatrix< float > buffer, size_t frames)
Override this to emit sound.
Definition: generator.h:25
common.h
ape::TransportProcessor
A Processor with additional access to the transport / playhead of the host.
Definition: processor.h:206
ape::EmbeddedGenerator::process
void process(umatrix< float > buffer, size_t frames)
Definition: generator.h:75
ape::Generator
A generator is a processor that only creates sounds (so it has no inputs). GlobalData,...
Definition: generator.h:15
ape::Processor
Definition: processor.h:41
ape::EmbeddedProcessor
Class for easily embedding processors within your processor. Base functionality for EmbeddedEffect an...
Definition: processor.h:280
ape::TransportGenerator
A generator is a processor that only creates sounds (so it has no inputs). GlobalData,...
Definition: generator.h:40