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:
38
Source/WaveformDisplay.h
Normal file
38
Source/WaveformDisplay.h
Normal file
@@ -0,0 +1,38 @@
|
||||
#pragma once
|
||||
#include <JuceHeader.h>
|
||||
#include "GrainEngine.h"
|
||||
|
||||
class WaveformDisplay : public juce::Component
|
||||
{
|
||||
public:
|
||||
WaveformDisplay();
|
||||
|
||||
void setBuffer (const juce::AudioBuffer<float>* buffer);
|
||||
void setGrainPosition (float pos) { grainPosition = pos; repaint(); }
|
||||
void setScatterRange (float range) { scatterRange = range; repaint(); }
|
||||
void setActiveGrains (const std::vector<GrainEngine::ActiveGrainInfo>& grains);
|
||||
|
||||
std::function<void (float)> onPositionChanged;
|
||||
|
||||
void paint (juce::Graphics& g) override;
|
||||
void resized() override;
|
||||
void mouseDown (const juce::MouseEvent& e) override;
|
||||
void mouseDrag (const juce::MouseEvent& e) override;
|
||||
|
||||
private:
|
||||
const juce::AudioBuffer<float>* audioBuffer = nullptr;
|
||||
juce::Path cachedWaveformPath;
|
||||
bool pathDirty = true;
|
||||
int lastWidth = 0, lastHeight = 0;
|
||||
int lastBufferSize = 0;
|
||||
|
||||
float grainPosition = 0.5f;
|
||||
float scatterRange = 0.0f;
|
||||
std::vector<GrainEngine::ActiveGrainInfo> activeGrains;
|
||||
int totalSourceSamples = 0;
|
||||
|
||||
void rebuildWaveformPath (juce::Rectangle<float> bounds);
|
||||
void updatePositionFromMouse (const juce::MouseEvent& e);
|
||||
|
||||
JUCE_DECLARE_NON_COPYABLE_WITH_LEAK_DETECTOR (WaveformDisplay)
|
||||
};
|
||||
Reference in New Issue
Block a user