SpectMorph
smmorphplan.hh
1 // Licensed GNU LGPL v3 or later: http://www.gnu.org/licenses/lgpl.html
2 
3 #ifndef SPECTMORPH_MORPH_PLAN_HH
4 #define SPECTMORPH_MORPH_PLAN_HH
5 
6 #include "smindex.hh"
7 #include "smmorphoperator.hh"
8 #include "smobject.hh"
9 #include "smaudio.hh"
10 
11 namespace SpectMorph
12 {
13 
14 class MorphPlan : public Object
15 {
16  Q_OBJECT
17  Index m_index;
18  std::vector<MorphOperator *> m_operators;
19 
20  std::string index_filename;
21  bool in_restore;
22 
23  void clear();
24 
25 public:
26  MorphPlan();
27  ~MorphPlan();
28 
30  {
31  public:
32  virtual std::string section() = 0;
33  virtual void save (OutFile& out_file) = 0;
34  virtual void handle_event (InFile& ifile) = 0;
35  };
36 
37  bool load_index (const std::string& filename);
38  const Index *index();
39 
40  enum AddPos {
41  ADD_POS_AUTO,
42  ADD_POS_END
43  };
44 
45  void add_operator (MorphOperator *op, AddPos = ADD_POS_END, const std::string& name = "", const std::string& id = "");
46  const std::vector<MorphOperator *>& operators();
47  void remove (MorphOperator *op);
48  void move (MorphOperator *op, MorphOperator *op_next);
49 
50  void set_plan_str (const std::string& plan_str);
51  void emit_plan_changed();
52  void emit_index_changed();
53 
54  Bse::Error save (GenericOut *file, ExtraParameters *params = nullptr) const;
55  Bse::Error load (GenericIn *in, ExtraParameters *params = nullptr);
56 
57  MorphPlan *clone() const; // create a deep copy
58 
59  static std::string id_chars();
60  static std::string generate_id();
61 
62 signals:
63  void plan_changed();
64  void index_changed();
65  void operator_removed (MorphOperator *op);
66  void need_view_rebuild();
67 };
68 
70 
71 }
72 
73 #endif
Generic Input Stream.
Definition: smgenericin.hh:17
Definition: smoutfile.hh:15
Definition: smmorphplan.hh:14
const std::vector< MorphOperator * > & operators()
Definition: smmorphplan.cc:295
Class to read SpectMorph binary data.
Definition: sminfile.hh:25
Definition: smmorphplan.hh:29
Definition: smmorphoperator.hh:19
Definition: smindex.hh:19
Definition: smaudio.hh:15
Generic Output Stream.
Definition: smgenericout.hh:17
Definition: smobject.hh:12
bool load_index(const std::string &filename)
Definition: smmorphplan.cc:61
Bse::Error load(GenericIn *in, ExtraParameters *params=nullptr)
Definition: smmorphplan.cc:149