3 #ifndef SPECTMORPH_LIVEDECODER_HH
4 #define SPECTMORPH_LIVEDECODER_HH
7 #include "smsinedecoder.hh"
8 #include "smnoisedecoder.hh"
9 #include "smlivedecodersource.hh"
10 #include "smpolyphaseinter.hh"
11 #include "smalignedarray.hh"
15 namespace SpectMorph {
17 class LiveDecoderFilter;
20 static constexpr
size_t PARTIAL_STATE_RESERVE = 2048;
21 static constexpr
size_t MAX_N_VALUES = 64;
22 static constexpr
size_t MAX_UNISON_VOICES = 7;
29 std::vector<PartialState> pstate[2], *last_pstate;
31 struct PortamentoState {
32 std::vector<float> buffer;
49 bool filter_latency_compensation;
53 bool debug_fft_perf_enabled;
54 bool original_samples_enabled;
56 bool start_skip_enabled;
59 size_t zero_values_at_start_scaled;
60 size_t loop_start_scaled;
61 size_t loop_end_scaled;
70 double original_sample_pos;
71 double original_samples_norm_factor;
79 std::vector<float> unison_phases[2];
80 std::vector<float> unison_freq_factor;
82 Random unison_phase_random_gen;
87 float vibrato_frequency;
93 double start_env_pos = 0;
94 bool in_process =
false;
97 enum class DoneState {
102 DoneState done_state = DoneState::DONE;
104 Audio::LoopType get_loop_type();
106 void process_internal (
size_t n_values,
108 float portamento_stretch);
110 void portamento_grow (
double end_pos,
float portamento_stretch);
111 void portamento_shrink();
113 void process_portamento (
size_t n_values,
114 const float *freq_in,
116 void process_vibrato (
size_t n_values,
117 const float *freq_in,
119 void process_with_filter (
size_t n_values,
120 const float *freq_in,
130 void enable_noise (
bool ne);
131 void enable_sines (
bool se);
132 void enable_debug_fft_perf (
bool dfp);
133 void enable_original_samples (
bool eos);
134 void enable_loop (
bool eloop);
135 void enable_start_skip (
bool ess);
136 void set_noise_seed (
int seed);
137 void set_unison_voices (
int voices,
float detune);
138 void set_vibrato (
bool enable_vibrato,
float depth,
float frequency,
float attack);
142 static void precompute_tables (
float mix_freq);
143 void retrigger (
int channel,
float freq,
int midi_velocity);
146 const float *freq_in,
149 double current_pos()
const;
150 double fundamental_note()
const;
152 static size_t compute_loop_frame_index (
size_t index,
Audio *audio);
155 double time_offset_ms()
const;
Audio sample containing many blocks.
Definition: smaudio.hh:80
Definition: smifftsynth.hh:16
Definition: smlivedecoderfilter.hh:19
Definition: smlivedecodersource.hh:12
Definition: smlivedecoder.hh:19
Decoder for the noise component (stochastic component) of the signal.
Definition: smnoisedecoder.hh:17
Definition: smpolyphaseinter.hh:13
Definition: smrtmemory.hh:16
Definition: smrandom.hh:15
Definition: smwavset.hh:29