MCPcopy Create free account
hub / github.com/jerryuhoo/Fire / FreqTextLabel

Method FreqTextLabel

Source/Panels/SpectrogramPanel/FreqTextLabel.cpp:15–40  ·  view source on GitHub ↗

==============================================================================

Source from the content-addressed store, hash-verified

13
14//==============================================================================
15FreqTextLabel::FreqTextLabel(VerticalLine& v) : verticalLine(v)
16{
17 mFrequency = -1;
18
19 // Add and configure the child juce::Label component.
20 addAndMakeVisible(freqLabel);
21 freqLabel.setEditable(true);
22
23 // --- One-time setup for the child Label ---
24 // These properties are set once here instead of inefficiently in paint().
25 freqLabel.setColour(juce::Label::textColourId, juce::Colours::white);
26 freqLabel.setJustificationType(juce::Justification::centred);
27
28 // Set the text editing callback once in the constructor.
29 freqLabel.onTextChange = [this]
30 {
31 mFrequency = freqLabel.getText().getIntValue();
32
33 // Update the associated VerticalLine component when the text changes.
34 verticalLine.setValue(mFrequency);
35
36 // Assumes transformToLog is defined in AudioHelpers.h
37 float xPercent = static_cast<float>(transformToLog(mFrequency));
38 verticalLine.setXPercent(xPercent);
39 };
40}
41
42FreqTextLabel::~FreqTextLabel()
43{

Callers

nothing calls this directly

Calls 2

transformToLogFunction · 0.85
setXPercentMethod · 0.80

Tested by

no test coverage detected