SpectMorph
smmodulationlist.hh
1 // Licensed GNU LGPL v2.1 or later: http://www.gnu.org/licenses/lgpl-2.1.html
2 
3 #ifndef SPECTMORPH_MODULATION_LIST_HH
4 #define SPECTMORPH_MODULATION_LIST_HH
5 
6 #include "smmath.hh"
7 #include "smutils.hh"
8 #include "smmorphoperator.hh"
9 
10 #include <functional>
11 #include <string>
12 
13 namespace SpectMorph
14 {
15 
17 {
18 public:
19  Property::Scale property_scale = Property::Scale::NONE;
20 
21  float value = 0; // ui slider / base value
22  float min_value = 0;
23  float max_value = 0;
24  float value_scale = 0;
25 
26  MorphOperator::ControlType main_control_type = MorphOperator::CONTROL_GUI;
27  MorphOperatorPtr main_control_op;
28 
29  struct Entry
30  {
31  MorphOperator::ControlType control_type = MorphOperator::CONTROL_SIGNAL_1;
32  MorphOperatorPtr control_op;
33 
34  bool bipolar = false;
35  double amount = 0;
36  };
37  std::vector<Entry> entries;
38 };
39 
41 {
42  ModulationData& data;
43  Property& property;
44 
45  bool compat = false;
46  std::string compat_type_name;
47  std::string compat_op_name;
48 
49  std::string compat_main_control_op;
50  MorphOperator::ControlType compat_main_control_type;
51 
52  bool have_compat_main_control_op = false;
53  bool have_compat_main_control_type = false;
54 
55  std::vector<std::string> load_control_ops;
56  std::string m_main_control_op;
57 public:
58  ModulationList (ModulationData& data, Property& property);
59 
60  MorphOperator::ControlType main_control_type() const;
61  MorphOperator *main_control_op() const;
62 
63  void set_main_control_type_and_op (MorphOperator::ControlType type, MorphOperator *op);
64 
65  size_t count() const;
66  void add_entry();
67  void update_entry (size_t index, ModulationData::Entry& new_entry);
68  const ModulationData::Entry& operator[] (size_t index) const;
69  void remove_entry (size_t index);
70  void set_compat_type_and_op (const std::string& type, const std::string& op);
71  void save (OutFile& out_file);
72  std::string event_name (const std::string& id, int index = -1);
73  bool split_event_name (const std::string& name, const std::string& start, int& index);
74  bool load (InFile& in_file);
75  void post_load (MorphOperator::OpNameMap& op_name_map);
76  void get_dependencies (std::vector<MorphOperator *>& deps);
77 
78 /* slots: */
79  void on_operator_removed (MorphOperator *op);
80 
81 /* signals: */
82  Signal<> signal_modulation_changed;
83  Signal<> signal_size_changed;
84  Signal<> signal_main_control_changed;
85 };
86 
87 }
88 
89 #endif
Class to read SpectMorph binary data.
Definition: sminfile.hh:27
Definition: smmodulationlist.hh:17
Definition: smmodulationlist.hh:41
Definition: smmorphoperator.hh:147
Definition: smmorphoperator.hh:27
Definition: smoutfile.hh:19
Definition: smproperty.hh:25
Definition: smsignal.hh:35
Definition: smsignal.hh:150
Definition: smmodulationlist.hh:30