basic freeze

This commit is contained in:
michalcourson
2025-11-05 18:55:38 -05:00
parent fe6ee5e51e
commit f4a0b995ba
6 changed files with 130 additions and 35 deletions

View File

@ -158,17 +158,22 @@ public:
float getOutputPitch() const { return sample_rate_ / out_period; }
void SetHarmonyMix(float mix);
void SetAutoTuneEnable(bool enable) { enable_autotune = enable; }
void SetFreeze(bool);
float out_midi = 40;
ShifterVoice voices[MAX_VOICES];
ShifterVoice freeze_voices[MAX_VOICES];
private:
void DetectPitch(const float* const* in, float** out, size_t size);
void SetRates();
void GetSamples(float** output, const float* input, size_t size);
float GetOutputEnvelopePeriod(int out_voice);
float GetOutputEnvelopePeriodFreeze(int freeze_voice);
int GetPeakIndex();
void AddInterpolatedFrame(int voice, int max_index, float period_to_use);
void AddFreezeToOutput(int voice, float resampling_period);
void CopyInputToFreezeBuffer(int);
Helmholtz helm;
// GranularSustain player;
@ -189,6 +194,7 @@ private:
bool pitch_trigger = false;
float harmony_mix = 0.0f;
float melody_mix = 0.0f;
bool freeze_needs_copy;
int trigger_bank;
@ -206,13 +212,14 @@ private:
float last_freqs[3];
float in_buffer[BUFFER_SIZE];
float out_buffer[2][BUFFER_SIZE];
float freeze_buffer[BUFFER_SIZE];
int out_playhead = 0;
int in_playhead = 0;
int last_autotune_midi = -1;
float out_period_filter_amount = 0.7f; // You can expose this as a parameter
bool freeze_mode = false;
float out_period = 0; //C3
float in_period = 366.936;
@ -221,6 +228,8 @@ private:
float sample_rate_;
int blocksize;
bool enable_autotune = false;
float freeze_period;
float freeze_volume = 1;
MidiPitchSmoother out_midi_smoother;
};
#endif