SpectMorph
smmorphlfo.hh
1 // Licensed GNU LGPL v2.1 or later: http://www.gnu.org/licenses/lgpl-2.1.html
2 
3 #ifndef SPECTMORPH_MORPH_LFO_HH
4 #define SPECTMORPH_MORPH_LFO_HH
5 
6 #include "smmorphoperator.hh"
7 #include "smproperty.hh"
8 
9 #include <string>
10 
11 namespace SpectMorph
12 {
13 
14 class MorphLFO;
15 
16 class MorphLFO : public MorphOperator
17 {
18 public:
19  enum WaveType {
20  WAVE_SINE = 1,
21  WAVE_TRIANGLE = 2,
22  WAVE_SAW_UP = 3,
23  WAVE_SAW_DOWN = 4,
24  WAVE_SQUARE = 5,
25  WAVE_RANDOM_SH = 6,
26  WAVE_RANDOM_LINEAR = 7
27  };
28  enum Note {
29  NOTE_32_1 = 1,
30  NOTE_16_1 = 2,
31  NOTE_8_1 = 3,
32  NOTE_4_1 = 4,
33  NOTE_2_1 = 5,
34  NOTE_1_1 = 6,
35  NOTE_1_2 = 7,
36  NOTE_1_4 = 8,
37  NOTE_1_8 = 9,
38  NOTE_1_16 = 10,
39  NOTE_1_32 = 11,
40  NOTE_1_64 = 12
41  };
42  enum NoteMode {
43  NOTE_MODE_STRAIGHT = 1,
44  NOTE_MODE_TRIPLET = 2,
45  NOTE_MODE_DOTTED = 3
46  };
47  static constexpr auto P_WAVE_TYPE = "wave_type";
48  static constexpr auto P_FREQUENCY = "frequency";
49  static constexpr auto P_DEPTH = "depth";
50  static constexpr auto P_CENTER = "center";
51  static constexpr auto P_START_PHASE = "start_phase";
52  static constexpr auto P_NOTE = "note";
53  static constexpr auto P_NOTE_MODE = "note_mode";
54 
55  struct Config : public MorphOperatorConfig
56  {
57  WaveType wave_type;
58  float frequency;
59  float depth;
60  float center;
61  float start_phase;
62  bool sync_voices;
63  bool beat_sync;
64  Note note;
65  NoteMode note_mode;
66  };
67 protected:
68  Config m_config;
69 public:
70  MorphLFO (MorphPlan *morph_plan);
71  ~MorphLFO();
72 
73  // inherited from MorphOperator
74  const char *type() override;
75  int insert_order() override;
76  bool save (OutFile& out_file) override;
77  bool load (InFile& in_file) override;
78  OutputType output_type() override;
79  MorphOperatorConfig *clone_config() override;
80 
81  bool sync_voices() const;
82  void set_sync_voices (float new_sync_voices);
83 
84  bool beat_sync() const;
85  void set_beat_sync (bool beat_sync);
86 };
87 
88 }
89 
90 #endif
Class to read SpectMorph binary data.
Definition: sminfile.hh:27
Definition: smmorphlfo.hh:17
Definition: smmorphoperator.hh:27
Definition: smmorphplan.hh:18
Definition: smoutfile.hh:19
Definition: smmorphlfo.hh:56
Definition: smmorphoperator.hh:18