Skip to content

Commit

Permalink
reverted to old oscillators
Browse files Browse the repository at this point in the history
  • Loading branch information
hsetlik committed Jun 6, 2021
1 parent b742b49 commit ba0c024
Show file tree
Hide file tree
Showing 10 changed files with 234 additions and 335 deletions.
5 changes: 0 additions & 5 deletions HexFm.jucer
Original file line number Diff line number Diff line change
Expand Up @@ -37,10 +37,6 @@
<FILE id="mPIM9v" name="upOn.png" compile="0" resource="1" file="PNGs/upOn.png"/>
</GROUP>
<GROUP id="{DFABB24D-7FEA-FB8A-D3A7-677009A3C90E}" name="Components">
<FILE id="MlHj7Y" name="WaveTypeSelector.cpp" compile="1" resource="0"
file="Source/WaveTypeSelector.cpp"/>
<FILE id="fpxmtz" name="WaveTypeSelector.h" compile="0" resource="0"
file="Source/WaveTypeSelector.h"/>
<FILE id="FGThsI" name="FilterPanel.cpp" compile="1" resource="0" file="Source/FilterPanel.cpp"/>
<FILE id="GRqHRw" name="FilterPanel.h" compile="0" resource="0" file="Source/FilterPanel.h"/>
<FILE id="h7YqHj" name="GlobalColor.h" compile="0" resource="0" file="Source/GlobalColor.h"/>
Expand Down Expand Up @@ -80,7 +76,6 @@
file="Source/LfoGroupComponent.h"/>
</GROUP>
<GROUP id="{7E985CFD-2F8E-2A87-C0F5-C64EED65ED45}" name="Synthesis">
<FILE id="DgL1HF" name="FFT.h" compile="0" resource="0" file="Source/FFT.h"/>
<FILE id="D5olNn" name="WavetableData.h" compile="0" resource="0" file="Source/WavetableData.h"/>
<FILE id="DsuaAU" name="WavetableProcessor.cpp" compile="1" resource="0"
file="Source/WavetableProcessor.cpp"/>
Expand Down
8 changes: 3 additions & 5 deletions Source/FmVoice.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@



FmVoice::FmVoice(int numOperators, int index, juce::AudioProcessorValueTreeState* t) : tree(t), voiceIndex(index), numLoudSamples(0), operatorCount(numOperators), fundamental(1.0f)
FmVoice::FmVoice(int numOperators, int index, juce::AudioProcessorValueTreeState* t) : tree(t), voiceIndex(index), operatorCount(numOperators), fundamental(1.0f)
{
lfoMax = std::numeric_limits<float>::min();
lfoMin = std::numeric_limits<float>::max();
Expand Down Expand Up @@ -87,10 +87,8 @@ void FmVoice::renderNextBlock(juce::AudioBuffer<float> &outputBuffer, int startS
}
++op1Index;
}
if(fabs(sumL) > 0.3f)
++numLoudSamples;
outputBuffer.setSample(0, i, sumL);
outputBuffer.setSample(1, i, sumR);
outputBuffer.addSample(0, i, sumL);
outputBuffer.addSample(1, i, sumR);

if(fabs(opSum - lastOpSample) > 0.2f)
++numJumps;
Expand Down
3 changes: 1 addition & 2 deletions Source/FmVoice.h
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ class FmVoice : public juce::SynthesiserVoice
FmVoice(int numOperators, int index, juce::AudioProcessorValueTreeState* t);
~FmVoice()
{
printf("%ld loud samples\n", numLoudSamples);
//printf("Voice #: %d -- %d total jumps\n", voiceIndex, numJumps);
}
bool canPlaySound(juce::SynthesiserSound* sound) override
{
Expand Down Expand Up @@ -99,7 +99,6 @@ class FmVoice : public juce::SynthesiserVoice
}
void updateParams();
int voiceIndex;
long numLoudSamples;
int numJumps;
int operatorCount;
float fundamental;
Expand Down
40 changes: 15 additions & 25 deletions Source/OperatorComponent.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,6 @@
OperatorComponent::OperatorComponent(int index, juce::AudioProcessorValueTreeState* pTree) :
opIndex(index),
envGraph(&delaySlider, &attackSlider, &holdSlider, &decaySlider, &sustainSlider, &releaseSlider),
waveButtons(index, pTree),
levelSlider(index),
ratioSlider(index),
ratioLabel(&ratioSlider.slider, ""),
Expand Down Expand Up @@ -81,8 +80,6 @@ panLabel(&panSlider, "")
sustainLabel.setLookAndFeel(&look2);
releaseLabel.setLookAndFeel(&look2);

addAndMakeVisible(&waveButtons);

panSlider.setVisible(false);
panSlider.setEnabled(false);
panLabel.setVisible(false);
Expand Down Expand Up @@ -142,28 +139,21 @@ void OperatorComponent::resized()
int n = getWidth() / 24;
auto fBounds = getBounds().toFloat().reduced(3.0f);
auto dN = fBounds.getWidth() / 48.0f;
auto envSliderY = 62;
auto envLabelY = envSliderY + 6;
delaySlider.setBounds(dN / 2, envSliderY * dN, 7.5 * dN, 7.5 * dN);
attackSlider.setBounds(8.5 * dN, envSliderY * dN, 7.5 * dN, 7.5 * dN);
holdSlider.setBounds(17 * dN, envSliderY * dN, 7.5 * dN, 7.5 * dN);
decaySlider.setBounds(25 * dN, envSliderY * dN, 7.5 * dN, 7.5 * dN);
sustainSlider.setBounds(33 * dN, envSliderY * dN, 7.5 * dN, 7.5 * dN);
releaseSlider.setBounds(41 * dN, envSliderY * dN, 7.5 * dN, 7.5 * dN);

delayLabel.setBounds(dN / 2, envLabelY * dN, 7.5 * dN, 3 * dN);
attackLabel.setBounds(8.5 * dN, envLabelY * dN, 7.5 * dN, 3 * dN);
holdLabel.setBounds(16.5 * dN, envLabelY * dN, 7.5 * dN, 3 * dN);
decayLabel.setBounds(24.5 * dN, envLabelY * dN, 7.5 * dN, 3 * dN);
sustainLabel.setBounds(32.5 * dN, envLabelY * dN, 7.5 * dN, 3 * dN);
releaseLabel.setBounds(40.5 * dN, envLabelY * dN, 7.5 * dN, 3 * dN);

envGraph.setBounds(n, 19 * n, 15 * n, 10 * n);
/*
printf("n = %d\n", n);
printf("button width = %d\n", 3 * n);
*/
waveButtons.setBounds(n, 14 * n, 160, 40);
delaySlider.setBounds(dN / 2, 50 * dN, 7.5 * dN, 7.5 * dN);
attackSlider.setBounds(8.5 * dN, 50 * dN, 7.5 * dN, 7.5 * dN);
holdSlider.setBounds(17 * dN, 50 * dN, 7.5 * dN, 7.5 * dN);
decaySlider.setBounds(25 * dN, 50 * dN, 7.5 * dN, 7.5 * dN);
sustainSlider.setBounds(33 * dN, 50 * dN, 7.5 * dN, 7.5 * dN);
releaseSlider.setBounds(41 * dN, 50 * dN, 7.5 * dN, 7.5 * dN);

delayLabel.setBounds(dN / 2, 56 * dN, 7.5 * dN, 3 * dN);
attackLabel.setBounds(8.5 * dN, 56 * dN, 7.5 * dN, 3 * dN);
holdLabel.setBounds(16.5 * dN, 56 * dN, 7.5 * dN, 3 * dN);
decayLabel.setBounds(24.5 * dN, 56 * dN, 7.5 * dN, 3 * dN);
sustainLabel.setBounds(32.5 * dN, 56 * dN, 7.5 * dN, 3 * dN);
releaseLabel.setBounds(40.5 * dN, 56 * dN, 7.5 * dN, 3 * dN);

envGraph.setBounds(n, 13 * n, 15 * n, 10 * n);

outputButton.setBounds(16 * n, 1.5 * n, 5.5 * n, 2.5 * n);
outputButton.changeWidthToFitText();
Expand Down
3 changes: 1 addition & 2 deletions Source/OperatorComponent.h
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@
#include "SliderSubclasses.h"
#include "DAHDSRGraph.h"
#include "RGBColor.h"
#include "WaveTypeSelector.h"

//==============================================================================
/*
Expand Down Expand Up @@ -45,7 +44,7 @@ class OperatorComponent : public juce::Component, public juce::Button::Listener
int opIndex;
private:
DAHDSRGraph envGraph;
WaveButtonSet waveButtons;
Color color;
juce::Colour background;
LevelSlider levelSlider;
RatioSlider ratioSlider;
Expand Down
4 changes: 2 additions & 2 deletions Source/OperatorProcessor.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,8 @@
float Operator::sample(float fund)
{
fundamental = fund;
rawSample = wtOsc.getSample((fund * workingRatio) + (modOffset * modIndex));
lastOutputSample = envelope.process(rawSample) * ( 1.0f - amplitudeMod) * level;
rawSample = wtOsc.getSample((fund * workingRatio) + (modOffset * modIndex)) * level;
lastOutputSample = envelope.process(rawSample) * ( 1.0f - amplitudeMod);
updatePan();
return lastOutputSample;
}
Expand Down
2 changes: 1 addition & 1 deletion Source/OperatorProcessor.h
Original file line number Diff line number Diff line change
Expand Up @@ -105,7 +105,7 @@ class Operator
float panValue;
private:
int index;
VoiceOscillator wtOsc;
SineTableOscillator wtOsc;
juce::String panId;
juce::String modIndexId;
juce::String levelId;
Expand Down
Loading

0 comments on commit ba0c024

Please sign in to comment.