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  Q_OBJECT
25 
26 public:
27  enum ControlType {
28  CONTROL_GUI = 1,
29  CONTROL_SIGNAL_1 = 2,
30  CONTROL_SIGNAL_2 = 3,
31  CONTROL_OP = 4
32  };
33 protected:
34  int m_width;
35  int m_height;
36  int m_zoom;
37  int m_selected_x;
38  int m_selected_y;
39  double m_x_morphing;
40  double m_y_morphing;
41  ControlType m_x_control_type;
42  ControlType m_y_control_type;
43  MorphOperator *m_x_control_op;
44  MorphOperator *m_y_control_op;
45 
46  std::vector< std::vector<MorphGridNode> > m_input_node;
47  std::map<std::string, std::string> load_map;
48 
49  void update_size();
50 public:
51  MorphGrid (MorphPlan *morph_plan);
52  ~MorphGrid();
53 
54  // inherited from MorphOperator
55  const char *type();
56  int insert_order();
57  bool save (OutFile& out_file);
58  bool load (InFile& in_file);
59  void post_load (OpNameMap& op_name_map);
60  OutputType output_type();
61 
62  void set_width (int width);
63  int width();
64 
65  void set_height (int height);
66  int height();
67 
68  void set_zoom (int new_zoom);
69  int zoom();
70 
71  void set_selected_x (int x);
72  void set_selected_y (int y);
73  int selected_x();
74  int selected_y();
75  bool has_selection();
76 
77  double x_morphing();
78  ControlType x_control_type();
79  MorphOperator *x_control_op();
80  double y_morphing();
81  ControlType y_control_type();
82  MorphOperator *y_control_op();
83  void set_x_morphing (double new_value);
84  void set_y_morphing (double new_value);
85  void set_x_control_type (ControlType new_control_type);
86  void set_y_control_type (ControlType new_control_type);
87  void set_x_control_op (MorphOperator *op);
88  void set_y_control_op (MorphOperator *op);
89 
90  void set_input_node (int x, int y, const MorphGridNode& node);
91  MorphGridNode input_node (int x, int y);
92  std::string input_node_label (int x, int y);
93 
94 public slots:
95  void on_operator_removed (MorphOperator *op);
96 };
97 
98 }
99 
100 #endif
Definition: smoutfile.hh:15
Definition: smmorphplan.hh:15
Definition: smmorphgrid.hh:13
Definition: smmorphgrid.hh:22
Class to read SpectMorph binary data.
Definition: sminfile.hh:25
Definition: smmorphoperator.hh:19
Definition: smalignedarray.cc:7