1 // Licensed GNU LGPL v3 or later: http://www.gnu.org/licenses/lgpl.html 2 3 #ifndef SPECTMORPH_MORPH_WAV_SOURCE_HH 4 #define SPECTMORPH_MORPH_WAV_SOURCE_HH 5 6 #include "smmorphoperator.hh" 7 #include "smproperty.hh" 8 9 #include <string> 10 11 namespace SpectMorph 12 { 13 14 class MorphWavSource; 15 16 struct MorphWavSourceProperties 17 { 18 MorphWavSourceProperties (MorphWavSource *lfo); 19 20 LinearParamProperty<MorphWavSource> position; 21 }; 22 23 class MorphWavSource : public MorphOperator 24 { 25 public: 26 enum PlayMode { 27 PLAY_MODE_STANDARD = 1, 28 PLAY_MODE_CUSTOM_POSITION = 2 29 }; 30 protected: 31 std::string load_position_op; 32 33 int m_object_id = 0; 34 int m_instrument = 1; 35 std::string m_lv2_filename; 36 PlayMode m_play_mode = PLAY_MODE_STANDARD; 37 ControlType m_position_control_type = CONTROL_GUI; 38 float m_position = 50; 39 MorphOperator *m_position_op = nullptr; 40 41 public: 42 MorphWavSource (MorphPlan *morph_plan); 43 ~MorphWavSource(); 44 45 // inherited from MorphOperator 46 const char *type() override; 47 int insert_order() override; 48 bool save (OutFile& out_file) override; 49 bool load (InFile& in_file) override; 50 OutputType output_type() override; 51 void post_load (OpNameMap& op_name_map) override; 52 std::vector<MorphOperator *> dependencies() override; 53 54 void set_object_id (int id); 55 int object_id(); 56 57 void set_instrument (int inst); 58 int instrument(); 59 60 void set_lv2_filename (const std::string& filename); 61 std::string lv2_filename(); 62 63 void set_play_mode (PlayMode play_mode); 64 PlayMode play_mode() const; 65 66 void set_position_control_type (ControlType new_control_type); 67 ControlType position_control_type() const; 68 69 void set_position (float new_position); 70 float position() const; 71 72 void set_position_op (MorphOperator *op); 73 MorphOperator *position_op() const; 74 75 void set_position_control_type_and_op (ControlType new_control_type, MorphOperator *op); 76 77 void on_operator_removed (MorphOperator *op); 78 }; 79 80 } 81 82 #endif 83