SpectMorph
smmorphgridmodule.hh
1 // Licensed GNU LGPL v2.1 or later: http://www.gnu.org/licenses/lgpl-2.1.html
2 
3 #ifndef SPECTMORPH_MORPH_GRID_MODULE_HH
4 #define SPECTMORPH_MORPH_GRID_MODULE_HH
5 
6 #include "smmorphoperatormodule.hh"
7 #include "smmorphgrid.hh"
8 #include "smwavset.hh"
9 #include "smmorphsourcemodule.hh"
10 
11 #include <array>
12 
13 namespace SpectMorph
14 {
15 
17 {
18 public:
19  struct InputNode
20  {
22  double delta_db;
23  bool has_source;
24  SimpleWavSetSource source;
25  };
26 
27 private:
28  const MorphGrid::Config *cfg = nullptr;
29 
30  struct InputNodeMatrix {
31  static constexpr int MAX_DIM = 7;
32  std::array<InputNode, MAX_DIM * MAX_DIM> data;
33  public:
34  InputNode&
35  operator() (int x, int y)
36  {
37  assert (x < MAX_DIM && y < MAX_DIM);
38  return data[x + y * MAX_DIM];
39  }
40  } input_nodes;
41 
42  // output
43  Audio audio;
44 
45  struct MySource : public LiveDecoderSource
46  {
47  MorphGridModule *module;
48 
49  void retrigger (int channel, float freq, int midi_velocity) override;
50  Audio* audio() override;
51  bool rt_audio_block (size_t index, RTAudioBlock& out_block) override;
52  } my_source;
53 
54 public:
55  MorphGridModule (MorphPlanVoice *voice);
56  ~MorphGridModule();
57 
58  void set_config (const MorphOperatorConfig *cfg);
59  LiveDecoderSource *source();
60 };
61 
62 }
63 
64 #endif
Definition: smmorphgridmodule.hh:17
Definition: smmorphoperatormodule.hh:27
Definition: smmorphsourcemodule.hh:13
Definition: smmorphgridmodule.hh:20
Definition: smmorphgrid.hh:29