1 // Licensed GNU LGPL v3 or later: http://www.gnu.org/licenses/lgpl.html 2 3 #ifndef SPECTMORPH_MORPH_LFO_HH 4 #define SPECTMORPH_MORPH_LFO_HH 5 6 #include "smmorphoperator.hh" 7 #include "smproperty.hh" 8 9 #include <string> 10 11 namespace SpectMorph 12 { 13 14 class MorphLFO; 15 16 struct MorphLFOProperties 17 { 18 MorphLFOProperties (MorphLFO *lfo); 19 20 LogParamProperty<MorphLFO> frequency; 21 LinearParamProperty<MorphLFO> depth; 22 LinearParamProperty<MorphLFO> center; 23 LinearParamProperty<MorphLFO> start_phase; 24 }; 25 26 class MorphLFO : public MorphOperator 27 { 28 public: 29 enum WaveType { 30 WAVE_SINE = 1, 31 WAVE_TRIANGLE = 2, 32 WAVE_SAW_UP = 3, 33 WAVE_SAW_DOWN = 4, 34 WAVE_SQUARE = 5, 35 WAVE_RANDOM_SH = 6, 36 WAVE_RANDOM_LINEAR = 7 37 }; 38 enum Note { 39 NOTE_32_1 = 1, 40 NOTE_16_1 = 2, 41 NOTE_8_1 = 3, 42 NOTE_4_1 = 4, 43 NOTE_2_1 = 5, 44 NOTE_1_1 = 6, 45 NOTE_1_2 = 7, 46 NOTE_1_4 = 8, 47 NOTE_1_8 = 9, 48 NOTE_1_16 = 10, 49 NOTE_1_32 = 11, 50 NOTE_1_64 = 12 51 }; 52 enum NoteMode { 53 NOTE_MODE_STRAIGHT = 1, 54 NOTE_MODE_TRIPLET = 2, 55 NOTE_MODE_DOTTED = 3 56 }; 57 protected: 58 WaveType m_wave_type; 59 float m_frequency; 60 float m_depth; 61 float m_center; 62 float m_start_phase; 63 bool m_sync_voices; 64 bool m_beat_sync; 65 Note m_note; 66 NoteMode m_note_mode; 67 68 public: 69 MorphLFO (MorphPlan *morph_plan); 70 ~MorphLFO(); 71 72 // inherited from MorphOperator 73 const char *type(); 74 int insert_order(); 75 bool save (OutFile& out_file); 76 bool load (InFile& in_file); 77 OutputType output_type(); 78 79 WaveType wave_type(); 80 void set_wave_type (WaveType new_wave_type); 81 82 float frequency() const; 83 void set_frequency (float new_frequency); 84 85 float depth() const; 86 void set_depth (float new_depth); 87 88 float center() const; 89 void set_center (float new_center); 90 91 float start_phase() const; 92 void set_start_phase (float new_start_phase); 93 94 bool sync_voices() const; 95 void set_sync_voices (float new_sync_voices); 96 97 bool beat_sync() const; 98 void set_beat_sync (bool beat_sync); 99 100 Note note() const; 101 void set_note (Note note); 102 103 NoteMode note_mode() const; 104 void set_note_mode (NoteMode mode); 105 }; 106 107 } 108 109 #endif 110