kopia lustrzana https://github.com/jameshball/osci-render
Remove button for software oscilloscope, use MIDI key velocity to control gain
rodzic
b8a86f3655
commit
14607636ca
|
@ -151,8 +151,7 @@ void MainComponent::resized() {
|
||||||
frequencyLabel.setBounds(bounds.removeFromTop(20));
|
frequencyLabel.setBounds(bounds.removeFromTop(20));
|
||||||
|
|
||||||
bounds.removeFromTop(padding);
|
bounds.removeFromTop(padding);
|
||||||
openOscilloscope.setBounds(bounds.removeFromBottom(buttonHeight).withSizeKeepingCentre(160, buttonHeight));
|
// openOscilloscope.setBounds(bounds.removeFromBottom(buttonHeight).withSizeKeepingCentre(160, buttonHeight));
|
||||||
bounds.removeFromBottom(padding);
|
|
||||||
auto minDim = juce::jmin(bounds.getWidth(), bounds.getHeight());
|
auto minDim = juce::jmin(bounds.getWidth(), bounds.getHeight());
|
||||||
visualiser.setBounds(bounds.withSizeKeepingCentre(minDim, minDim));
|
visualiser.setBounds(bounds.withSizeKeepingCentre(minDim, minDim));
|
||||||
}
|
}
|
||||||
|
|
|
@ -578,11 +578,9 @@ void OscirenderAudioProcessor::processBlock(juce::AudioBuffer<float>& buffer, ju
|
||||||
for (auto i = 0; i < totalNumInputChannels; ++i) {
|
for (auto i = 0; i < totalNumInputChannels; ++i) {
|
||||||
buffer.clear(i, 0, buffer.getNumSamples());
|
buffer.clear(i, 0, buffer.getNumSamples());
|
||||||
}
|
}
|
||||||
if (volume > EPSILON) {
|
juce::SpinLock::ScopedLockType lock1(parsersLock);
|
||||||
juce::SpinLock::ScopedLockType lock1(parsersLock);
|
juce::SpinLock::ScopedLockType lock2(effectsLock);
|
||||||
juce::SpinLock::ScopedLockType lock2(effectsLock);
|
synth.renderNextBlock(buffer, midiMessages, 0, buffer.getNumSamples());
|
||||||
synth.renderNextBlock(buffer, midiMessages, 0, buffer.getNumSamples());
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -11,6 +11,7 @@ bool ShapeVoice::canPlaySound(juce::SynthesiserSound* sound) {
|
||||||
}
|
}
|
||||||
|
|
||||||
void ShapeVoice::startNote(int midiNoteNumber, float velocity, juce::SynthesiserSound* sound, int currentPitchWheelPosition) {
|
void ShapeVoice::startNote(int midiNoteNumber, float velocity, juce::SynthesiserSound* sound, int currentPitchWheelPosition) {
|
||||||
|
this->velocity = velocity;
|
||||||
auto* shapeSound = dynamic_cast<ShapeSound*>(sound);
|
auto* shapeSound = dynamic_cast<ShapeSound*>(sound);
|
||||||
|
|
||||||
currentlyPlaying = true;
|
currentlyPlaying = true;
|
||||||
|
@ -89,7 +90,6 @@ void ShapeVoice::renderNextBlock(juce::AudioSampleBuffer& outputBuffer, int star
|
||||||
double traceMax = traceMaxEnabled ? actualTraceMax : 1.0;
|
double traceMax = traceMaxEnabled ? actualTraceMax : 1.0;
|
||||||
double traceMin = traceMinEnabled ? actualTraceMin : 0.0;
|
double traceMin = traceMinEnabled ? actualTraceMin : 0.0;
|
||||||
double proportionalLength = (traceMax - traceMin) * frameLength;
|
double proportionalLength = (traceMax - traceMin) * frameLength;
|
||||||
// double frequency = audioProcessor.frequencyEffect->getActualValue();
|
|
||||||
lengthIncrement = juce::jmax(proportionalLength / (audioProcessor.currentSampleRate / frequency), MIN_LENGTH_INCREMENT);
|
lengthIncrement = juce::jmax(proportionalLength / (audioProcessor.currentSampleRate / frequency), MIN_LENGTH_INCREMENT);
|
||||||
|
|
||||||
Vector2 channels;
|
Vector2 channels;
|
||||||
|
@ -126,6 +126,7 @@ void ShapeVoice::renderNextBlock(juce::AudioSampleBuffer& outputBuffer, int star
|
||||||
}
|
}
|
||||||
|
|
||||||
double gain = audioProcessor.midiEnabled->getBoolValue() ? adsr.lookup(time) : 1.0;
|
double gain = audioProcessor.midiEnabled->getBoolValue() ? adsr.lookup(time) : 1.0;
|
||||||
|
gain *= velocity;
|
||||||
|
|
||||||
if (numChannels >= 2) {
|
if (numChannels >= 2) {
|
||||||
outputBuffer.addSample(0, sample, x * gain);
|
outputBuffer.addSample(0, sample, x * gain);
|
||||||
|
|
|
@ -36,6 +36,7 @@ private:
|
||||||
|
|
||||||
bool currentlyPlaying = false;
|
bool currentlyPlaying = false;
|
||||||
double frequency = 1.0;
|
double frequency = 1.0;
|
||||||
|
double velocity = 1.0;
|
||||||
|
|
||||||
lua_State* L = nullptr;
|
lua_State* L = nullptr;
|
||||||
long step = 1;
|
long step = 1;
|
||||||
|
|
|
@ -123,7 +123,7 @@ void VisualiserComponent::paintXY(juce::Graphics& g, juce::Rectangle<float> area
|
||||||
}
|
}
|
||||||
|
|
||||||
double strength = 15;
|
double strength = 15;
|
||||||
double widthDivisor = 130;
|
double widthDivisor = 160;
|
||||||
double lengthIntensityScale = 700;
|
double lengthIntensityScale = 700;
|
||||||
juce::Colour waveColor = waveformColour;
|
juce::Colour waveColor = waveformColour;
|
||||||
|
|
||||||
|
|
Ładowanie…
Reference in New Issue