SpectMorph
smwavsetbuilder.hh
1 // Licensed GNU LGPL v2.1 or later: http://www.gnu.org/licenses/lgpl-2.1.html
2 
3 #ifndef SPECTMORPH_WAVSETBUILDER_HH
4 #define SPECTMORPH_WAVSETBUILDER_HH
5 
6 #include "sminstrument.hh"
7 #include "smwavset.hh"
8 #include "sminstenccache.hh"
9 
10 namespace SpectMorph
11 {
12 
14 {
15  struct SampleData
16  {
17  int midi_note;
18  double volume;
19  Sample::Loop loop;
20  double clip_start_ms;
21  double clip_end_ms;
22  double loop_start_ms;
23  double loop_end_ms;
24 
25  Sample::SharedP shared;
26  };
27  std::vector<SampleData> sample_data_vec;
28  WavSet *wav_set;
29  InstEncCache::Group *cache_group = nullptr;
30 
31  std::function<bool()> kill_function;
32  bool killed();
33 
34  double global_volume = 0;
35  Instrument::AutoVolume auto_volume;
36  Instrument::AutoTune auto_tune;
37  Instrument::EncoderConfig encoder_config;
38  bool keep_samples;
39 
40  void apply_loop_settings();
41  void apply_volume_settings();
42  void apply_auto_volume();
43  void apply_auto_tune();
44 
45  void add_sample (const Sample *sample);
46 public:
47  WavSetBuilder (const Instrument *instrument, bool keep_samples);
48  ~WavSetBuilder();
49 
50  void set_kill_function (const std::function<bool()>& kill_function);
51  void set_cache_group (InstEncCache::Group *group);
52  WavSet *run();
53 };
54 
55 }
56 
57 #endif
Definition: sminstenccache.hh:43
Definition: sminstrument.hh:83
Definition: sminstrument.hh:30
Definition: smwavsetbuilder.hh:14
Definition: smwavset.hh:29
Definition: sminstrument.hh:92
Definition: sminstrument.hh:85
Definition: sminstrument.hh:106