Initial release — InstaGrain granular synthesizer v1.0
8-voice polyphonic granular synth (VST3/AU/LV2) with: - 128 grain pool per voice, Hann windowing, linear interpolation - Root note selector, sample rate correction, sustain pedal (CC64) - Scatter controls, direction modes (Fwd/Rev/PingPong), freeze - ADSR envelope, global filter (LP/HP/BP), reverb - Waveform display with grain visualization - Drag & drop sample loading, full state save/restore - CI/CD for Windows/macOS/Linux Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
40
Source/GrainVoice.h
Normal file
40
Source/GrainVoice.h
Normal file
@@ -0,0 +1,40 @@
|
||||
#pragma once
|
||||
#include <JuceHeader.h>
|
||||
#include "GrainCloud.h"
|
||||
|
||||
class GrainVoice
|
||||
{
|
||||
public:
|
||||
GrainVoice();
|
||||
|
||||
void prepare (double sampleRate);
|
||||
void noteOn (int midiNote, float velocity);
|
||||
void noteOff();
|
||||
void forceStop();
|
||||
void processBlock (juce::AudioBuffer<float>& output, int numSamples,
|
||||
const juce::AudioBuffer<float>& sourceBuffer);
|
||||
bool isActive() const { return voiceActive; }
|
||||
int getCurrentNote() const { return currentNote; }
|
||||
|
||||
GrainCloud& getCloud() { return cloud; }
|
||||
const GrainCloud& getCloud() const { return cloud; }
|
||||
|
||||
// ADSR parameters (set from processor)
|
||||
// Root note reference (set from engine)
|
||||
std::atomic<int> rootNote { 60 };
|
||||
|
||||
// ADSR parameters (set from processor)
|
||||
std::atomic<float> attackTime { 0.01f };
|
||||
std::atomic<float> decayTime { 0.1f };
|
||||
std::atomic<float> sustainLevel { 1.0f };
|
||||
std::atomic<float> releaseTime { 0.3f };
|
||||
|
||||
private:
|
||||
GrainCloud cloud;
|
||||
juce::ADSR adsr;
|
||||
juce::ADSR::Parameters adsrParams;
|
||||
float velocityGain = 1.0f;
|
||||
int currentNote = -1;
|
||||
bool voiceActive = false;
|
||||
double currentSampleRate = 44100.0;
|
||||
};
|
||||
Reference in New Issue
Block a user