SpectMorph
smmorphgrid.hh
1 // Licensed GNU LGPL v3 or later: http://www.gnu.org/licenses/lgpl.html
2 
3 #ifndef SPECTMORPH_MORPH_GRID_HH
4 #define SPECTMORPH_MORPH_GRID_HH
5 
6 #include "smmorphoperator.hh"
7 
8 #include <map>
9 
10 namespace SpectMorph
11 {
12 
14 {
15  MorphOperator *op; // a node has either an operator (op) as input,
16  std::string smset; // or an instrument (smset)
17  double delta_db;
18 
19  MorphGridNode();
20 };
21 
22 class MorphGrid : public MorphOperator
23 {
24 public:
25  enum ControlType {
26  CONTROL_GUI = 1,
27  CONTROL_SIGNAL_1 = 2,
28  CONTROL_SIGNAL_2 = 3,
29  CONTROL_OP = 4
30  };
31 protected:
32  int m_width;
33  int m_height;
34  int m_zoom;
35  int m_selected_x;
36  int m_selected_y;
37  double m_x_morphing;
38  double m_y_morphing;
39  ControlType m_x_control_type;
40  ControlType m_y_control_type;
41  MorphOperator *m_x_control_op;
42  MorphOperator *m_y_control_op;
43 
44  std::vector< std::vector<MorphGridNode> > m_input_node;
45  std::map<std::string, std::string> load_map;
46 
47  void update_size();
48 public:
49  MorphGrid (MorphPlan *morph_plan);
50  ~MorphGrid();
51 
52  // inherited from MorphOperator
53  const char *type();
54  int insert_order();
55  bool save (OutFile& out_file);
56  bool load (InFile& in_file);
57  void post_load (OpNameMap& op_name_map);
58  OutputType output_type();
59 
60  void set_width (int width);
61  int width();
62 
63  void set_height (int height);
64  int height();
65 
66  void set_zoom (int new_zoom);
67  int zoom();
68 
69  void set_selected_x (int x);
70  void set_selected_y (int y);
71  int selected_x();
72  int selected_y();
73  bool has_selection();
74 
75  double x_morphing();
76  ControlType x_control_type();
77  MorphOperator *x_control_op();
78  double y_morphing();
79  ControlType y_control_type();
80  MorphOperator *y_control_op();
81  void set_x_morphing (double new_value);
82  void set_y_morphing (double new_value);
83  void set_x_control_type (ControlType new_control_type);
84  void set_y_control_type (ControlType new_control_type);
85  void set_x_control_op (MorphOperator *op);
86  void set_y_control_op (MorphOperator *op);
87 
88  void set_input_node (int x, int y, const MorphGridNode& node);
89  MorphGridNode input_node (int x, int y);
90  std::string input_node_label (int x, int y);
91 
92 /* slots: */
93  void on_operator_removed (MorphOperator *op);
94 };
95 
96 }
97 
98 #endif
Definition: smoutfile.hh:15
Definition: smmorphplan.hh:16
Definition: smmorphgrid.hh:13
Definition: smmorphgrid.hh:22
Class to read SpectMorph binary data.
Definition: sminfile.hh:25
Definition: smmorphoperator.hh:18
Definition: smadsrenvelope.hh:8