Files
harmonizer_plugin/Source/shifter_voice.h
michalcourson e89620df27 closes #3
Added freeze pitch and volume controls
2025-11-05 19:17:34 -05:00

52 lines
1.1 KiB
C++

/*
==============================================================================
shifter_voice.h
Created: 25 Oct 2025 2:09:42pm
Author: mickl
==============================================================================
*/
#pragma once
#include "adsr.h"
#include "port.h"
#include "math.h"
#include <juce_core/juce_core.h>
#include <stdlib.h>
class ShifterVoice {
public:
ShifterVoice() {}
~ShifterVoice() {}
void Init(float sample_rate);
bool IsActive();
void Trigger(int midi_note);
void Release();
void Process();
float CurrentAmplitude();
float CurrentPeriod();
bool PeriodOverflow();
void SetPortamentoTime(float time);
void SetAdsrTimes(float attack, float decay, float release);
float GetPanning(int channel) const;
int GetMidiNote() const { return current_midi; }
void SetPitchAdjust(float);
bool onoff_;
float panning;
private:
Port portamento_;
Adsr amplitude_envelope_;
bool overflow_;
float sample_rate_;
int current_midi;
float current_period_;
float current_amplitude;
float period_counter;
float pitch_adjust = 0.0f;
};