SpectMorph
smmorphwavsource.hh
1 // Licensed GNU LGPL v2.1 or later: http://www.gnu.org/licenses/lgpl-2.1.html
2 
3 #ifndef SPECTMORPH_MORPH_WAV_SOURCE_HH
4 #define SPECTMORPH_MORPH_WAV_SOURCE_HH
5 
6 #include "smmorphoperator.hh"
7 #include "smmodulationlist.hh"
8 #include "smproperty.hh"
9 
10 #include <string>
11 
12 namespace SpectMorph
13 {
14 
15 class MorphWavSource;
16 class Project;
17 class Instrument;
18 
20 {
21 public:
22  enum PlayMode {
23  PLAY_MODE_STANDARD = 1,
24  PLAY_MODE_CUSTOM_POSITION = 2
25  };
26  struct Config : public MorphOperatorConfig
27  {
28  Project *project = nullptr;
29 
30  int object_id = 0;
31  PlayMode play_mode = PLAY_MODE_STANDARD;
32  ModulationData position_mod;
33  };
34  static constexpr auto P_PLAY_MODE = "play_mode";
35  static constexpr auto P_POSITION = "position";
36 
37  static constexpr auto USER_BANK = "User";
38 protected:
39  Config m_config;
40 
41  int m_instrument = 1;
42  std::string m_bank = USER_BANK;
43  std::string m_lv2_filename;
44 
45 public:
46  MorphWavSource (MorphPlan *morph_plan);
47  ~MorphWavSource();
48 
49  // inherited from MorphOperator
50  const char *type() override;
51  int insert_order() override;
52  bool save (OutFile& out_file) override;
53  bool load (InFile& in_file) override;
54  OutputType output_type() override;
55  std::vector<MorphOperator *> dependencies() override;
56  MorphOperatorConfig *clone_config() override;
57 
58  void set_object_id (int id);
59  int object_id();
60 
61  void set_bank_and_instrument (const std::string& bank, int inst);
62 
63  int instrument();
64  std::string bank();
65 
66  void set_lv2_filename (const std::string& filename);
67  std::string lv2_filename();
68 
69  void on_instrument_updated (const std::string& bank, int number, const Instrument *new_instrument);
70  void on_bank_removed (const std::string& bank);
71 
72  Signal<> signal_labels_changed;
73 };
74 
75 }
76 
77 #endif
Class to read SpectMorph binary data.
Definition: sminfile.hh:27
Definition: sminstrument.hh:83
Definition: smmodulationlist.hh:17
Definition: smmorphoperator.hh:27
Definition: smmorphplan.hh:18
Definition: smmorphwavsource.hh:20
Definition: smoutfile.hh:19
Definition: smproject.hh:67
Definition: smsignal.hh:150
Definition: smmorphoperator.hh:18
Definition: smmorphwavsource.hh:27