Files
harmonizer_plugin/Source/shifter_voice.h
2025-10-30 21:39:06 -04:00

48 lines
1021 B
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; }
bool onoff_;
private:
Port portamento_;
Adsr amplitude_envelope_;
bool overflow_;
float sample_rate_;
int current_midi;
float current_period_;
float current_amplitude;
float period_counter;
float panning;
};