3 #ifndef SPECTMORPH_INSTRUMENT_HH
4 #define SPECTMORPH_INSTRUMENT_HH
7 #include "smwavdata.hh"
32 enum class Loop { NONE, FORWARD, PING_PONG, SINGLE_FRAME };
37 std::string m_wav_data_hash;
41 const WavData& wav_data()
const;
42 std::string wav_data_hash()
const;
44 typedef std::shared_ptr<Shared> SharedP;
47 SPECTMORPH_CLASS_NON_COPYABLE (
Sample);
49 std::map<MarkerType, double> marker_map;
52 Loop m_loop = Loop::NONE;
59 void set_marker (MarkerType marker_type,
double value);
60 double get_marker (MarkerType marker_type)
const;
62 int midi_note()
const;
63 void set_midi_note (
int note);
66 void set_loop (Loop loop);
68 double volume()
const;
69 void set_volume (
double volume);
71 SharedP shared()
const;
73 const WavData& wav_data()
const;
74 std::string wav_data_hash()
const;
77 std::string short_name;
79 std::unique_ptr<Audio> audio;
86 enum { FROM_LOOP, GLOBAL } method = FROM_LOOP;
93 enum { SIMPLE, ALL_FRAMES, SMOOTH } method = SIMPLE;
107 bool enabled =
false;
109 std::vector<EncoderEntry> entries;
112 enum class LoadOptions
121 std::vector<std::unique_ptr<Sample>> samples;
123 std::string m_name =
"untitled";
124 std::string m_short_name;
126 double m_global_volume = 0;
127 AutoVolume m_auto_volume;
128 AutoTune m_auto_tune;
129 EncoderConfig m_encoder_config;
131 Error load (
const std::string& filename,
ZipReader *zip_reader, LoadOptions load_options = LoadOptions::ALL);
132 Error save (
const std::string& filename,
ZipWriter *zip_writer)
const;
136 Sample *add_sample (
const WavData& wav_data,
const std::string& filename);
137 Sample *sample (
size_t n)
const;
138 void remove_sample();
139 std::string gen_short_name (std::vector<std::unique_ptr<Sample>>& samples,
const std::string& filename);
143 std::string name()
const;
144 void set_name (
const std::string& name);
145 std::string short_name()
const;
146 void set_short_name (
const std::string& short_name);
148 std::string version();
150 int selected()
const;
151 void set_selected (
int sel);
153 Error load (
const std::string& filename, LoadOptions load_options = LoadOptions::ALL);
154 Error load (
ZipReader& zip_reader, LoadOptions load_options = LoadOptions::ALL);
156 Error save (
const std::string& filename)
const;
161 void marker_changed();
162 void volume_changed();
164 std::map<int, int> used_count()
const;
166 double global_volume()
const;
167 void set_global_volume (
double new_volume);
169 AutoVolume auto_volume()
const;
170 void set_auto_volume (
const AutoVolume& new_value);
172 AutoTune auto_tune()
const;
173 void set_auto_tune (
const AutoTune& new_value);
175 EncoderConfig encoder_config()
const;
176 void set_encoder_config (
const EncoderConfig& new_value);
180 Signal<> signal_selected_sample_changed;
Definition: smutils.hh:102
Definition: sminstrument.hh:83
Definition: sminstrument.hh:30
Definition: smsignal.hh:150
Definition: smwavdata.hh:17
Definition: sminstrument.hh:92
Definition: sminstrument.hh:85
Definition: sminstrument.hh:106
Definition: sminstrument.hh:101
Definition: sminstrument.hh:35