Remove button for software oscilloscope, use MIDI key velocity to control gain

pull/170/head
James Ball 2023-12-21 19:58:00 +00:00
rodzic b8a86f3655
commit 14607636ca
5 zmienionych plików z 8 dodań i 9 usunięć

Wyświetl plik

@ -151,8 +151,7 @@ void MainComponent::resized() {
frequencyLabel.setBounds(bounds.removeFromTop(20));
bounds.removeFromTop(padding);
openOscilloscope.setBounds(bounds.removeFromBottom(buttonHeight).withSizeKeepingCentre(160, buttonHeight));
bounds.removeFromBottom(padding);
// openOscilloscope.setBounds(bounds.removeFromBottom(buttonHeight).withSizeKeepingCentre(160, buttonHeight));
auto minDim = juce::jmin(bounds.getWidth(), bounds.getHeight());
visualiser.setBounds(bounds.withSizeKeepingCentre(minDim, minDim));
}

Wyświetl plik

@ -578,11 +578,9 @@ void OscirenderAudioProcessor::processBlock(juce::AudioBuffer<float>& buffer, ju
for (auto i = 0; i < totalNumInputChannels; ++i) {
buffer.clear(i, 0, buffer.getNumSamples());
}
if (volume > EPSILON) {
juce::SpinLock::ScopedLockType lock1(parsersLock);
juce::SpinLock::ScopedLockType lock2(effectsLock);
synth.renderNextBlock(buffer, midiMessages, 0, buffer.getNumSamples());
}
juce::SpinLock::ScopedLockType lock1(parsersLock);
juce::SpinLock::ScopedLockType lock2(effectsLock);
synth.renderNextBlock(buffer, midiMessages, 0, buffer.getNumSamples());
}

Wyświetl plik

@ -11,6 +11,7 @@ bool ShapeVoice::canPlaySound(juce::SynthesiserSound* sound) {
}
void ShapeVoice::startNote(int midiNoteNumber, float velocity, juce::SynthesiserSound* sound, int currentPitchWheelPosition) {
this->velocity = velocity;
auto* shapeSound = dynamic_cast<ShapeSound*>(sound);
currentlyPlaying = true;
@ -89,7 +90,6 @@ void ShapeVoice::renderNextBlock(juce::AudioSampleBuffer& outputBuffer, int star
double traceMax = traceMaxEnabled ? actualTraceMax : 1.0;
double traceMin = traceMinEnabled ? actualTraceMin : 0.0;
double proportionalLength = (traceMax - traceMin) * frameLength;
// double frequency = audioProcessor.frequencyEffect->getActualValue();
lengthIncrement = juce::jmax(proportionalLength / (audioProcessor.currentSampleRate / frequency), MIN_LENGTH_INCREMENT);
Vector2 channels;
@ -126,6 +126,7 @@ void ShapeVoice::renderNextBlock(juce::AudioSampleBuffer& outputBuffer, int star
}
double gain = audioProcessor.midiEnabled->getBoolValue() ? adsr.lookup(time) : 1.0;
gain *= velocity;
if (numChannels >= 2) {
outputBuffer.addSample(0, sample, x * gain);

Wyświetl plik

@ -36,6 +36,7 @@ private:
bool currentlyPlaying = false;
double frequency = 1.0;
double velocity = 1.0;
lua_State* L = nullptr;
long step = 1;

Wyświetl plik

@ -123,7 +123,7 @@ void VisualiserComponent::paintXY(juce::Graphics& g, juce::Rectangle<float> area
}
double strength = 15;
double widthDivisor = 130;
double widthDivisor = 160;
double lengthIntensityScale = 700;
juce::Colour waveColor = waveformColour;