Skip to content

Commit

Permalink
fix bug in display of threshold
Browse files Browse the repository at this point in the history
  • Loading branch information
ArdenButterfield committed Aug 26, 2023
1 parent 0a81373 commit 58b2535
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 7 deletions.
5 changes: 2 additions & 3 deletions Source/GUIelements/LineGraph.h
Original file line number Diff line number Diff line change
Expand Up @@ -41,9 +41,8 @@ template <class T> class LineGraph : public juce::Component, public juce::Async
return;
}
for (int i = 0; i < numPoints; ++i) {
if ((ymin <= data[i]) && (data[i] <= ymax)) {
yVals[i] = getHeight() - (data[i] - ymin) / (ymax - ymin) * getHeight();
}
auto d = std::max(ymin, std::min(data[i], ymax));
yVals[i] = getHeight() - (d - ymin) / (ymax - ymin) * getHeight();
}
triggerAsyncUpdate();
}
Expand Down
7 changes: 5 additions & 2 deletions Source/GUIelements/PsychoanalGraph.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -49,13 +49,16 @@ void PsychoanalGraph::valueTreePropertyChanged(juce::ValueTree &treeWhosePropert
if (property == juce::Identifier("energy")) {
juce::Array<juce::var>* e = treeWhosePropertyHasChanged[property].getArray();
for (int i = 0; i < 22; ++i) {
energyVals[i] = (*e)[i].operator double();
energyVals[i] = (float)(*e)[i].operator double();
}
} else if (property == juce::Identifier("threshold")) {
juce::Array<juce::var>* t = treeWhosePropertyHasChanged[property].getArray();
std::cout << "new threshold";
for (int i = 0; i < 22; ++i) {
thresholdVals[i] = (*t)[i].operator double();
thresholdVals[i] = (float)(*t)[i].operator double();
std::cout << thresholdVals[i] << " ";
}
std::cout << "\n";
}

energy.loadData(energyVals.data());
Expand Down
5 changes: 3 additions & 2 deletions Source/MP3Controller.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -109,13 +109,14 @@ bool MP3Controller::processFrame (float* leftIn, float* rightIn, float* leftOut,

void MP3Controller::setThresholdBias (float bias)
{
const float incr = 0.05;
/* const float incr = 0.05;
if (std::abs(bias - actualThresholdBias) < incr) {
actualThresholdBias = bias;
} else if (bias > actualThresholdBias) {
actualThresholdBias += incr;
} else {
actualThresholdBias -= incr;
}
_setThresholdBias(actualThresholdBias);
_setThresholdBias(actualThresholdBias);*/
_setThresholdBias(bias);
}

0 comments on commit 58b2535

Please sign in to comment.