#pragma once #include #include "ShapeSound.h" class OscirenderAudioProcessor; class ShapeVoice : public juce::SynthesiserVoice { public: ShapeVoice(OscirenderAudioProcessor& p); bool canPlaySound(juce::SynthesiserSound* sound) override; void startNote(int midiNoteNumber, float velocity, juce::SynthesiserSound* sound, int currentPitchWheelPosition) override; void renderNextBlock(juce::AudioSampleBuffer& outputBuffer, int startSample, int numSamples) override; void stopNote(float velocity, bool allowTailOff) override; void pitchWheelMoved(int newPitchWheelValue) override; void controllerMoved(int controllerNumber, int newControllerValue) override; void incrementShapeDrawing(); private: const double MIN_TRACE = 0.005; const double MIN_LENGTH_INCREMENT = 0.000001; OscirenderAudioProcessor& audioProcessor; std::vector> frame; ShapeSound* sound = nullptr; double actualTraceMin; double actualTraceMax; double frameLength = 0.0; int currentShape = 0; double shapeDrawn = 0.0; double frameDrawn = 0.0; double lengthIncrement = 0.0; double tailOff = 0.0; double frequency = 1.0; };