Change font for osci-render, improve recording button

pull/261/head
James H Ball 2024-10-12 21:19:39 +01:00
rodzic e7f018932d
commit 3db7dcaff4
8 zmienionych plików z 25 dodań i 27 usunięć

Wyświetl plik

@ -146,22 +146,10 @@ MainComponent::MainComponent(OscirenderAudioProcessor& p, OscirenderAudioProcess
repaint();
});
addAndMakeVisible(frequencyLabel);
callbackIndex = audioProcessor.pitchDetector.addCallback(
[this](float frequency) {
// round to nearest integer
int roundedFrequency = static_cast<int>(frequency + 0.5f);
frequencyLabel.setText(juce::String(roundedFrequency) + "Hz", juce::dontSendNotification);
}
);
addAndMakeVisible(recorder);
}
MainComponent::~MainComponent() {
audioProcessor.pitchDetector.removeCallback(callbackIndex);
}
MainComponent::~MainComponent() {}
void MainComponent::updateFileLabel() {
showLeftArrow = audioProcessor.getCurrentFileIndex() > 0;
@ -226,9 +214,6 @@ void MainComponent::resized() {
row.removeFromLeft(rowPadding);
createFile.setBounds(row.removeFromLeft(buttonWidth));
bounds.removeFromTop(padding);
frequencyLabel.setBounds(bounds.removeFromTop(20));
bounds.removeFromTop(padding);
if (!audioProcessor.visualiserParameters.visualiserFullScreen->getBoolValue()) {
auto minDim = juce::jmin(bounds.getWidth(), bounds.getHeight());

Wyświetl plik

@ -38,9 +38,6 @@ private:
juce::ComboBox fileType;
juce::TextButton createFile{"Create File"};
juce::Label frequencyLabel;
int callbackIndex = -1;
AudioRecordingComponent recorder{audioProcessor};
JUCE_DECLARE_NON_COPYABLE_WITH_LEAK_DETECTOR(MainComponent)

Wyświetl plik

@ -120,9 +120,9 @@ OscirenderAudioProcessorEditor::OscirenderAudioProcessorEditor(OscirenderAudioPr
visualiserSettingsWindow.setUsingNativeTitleBar(true);
#endif
visualiserSettings.setLookAndFeel(&getLookAndFeel());
visualiserSettings.setSize(550, 280);
visualiserSettings.setSize(550, 310);
visualiserSettingsWindow.setContentNonOwned(&visualiserSettings, true);
visualiserSettingsWindow.centreWithSize(550, 280);
visualiserSettingsWindow.centreWithSize(550, 310);
tooltipDropShadow.setOwner(&tooltipWindow);
}

Wyświetl plik

@ -64,7 +64,7 @@ void SettingsComponent::resized() {
}
void SettingsComponent::fileUpdated(juce::String fileName) {
juce::String extension = fileName.fromLastOccurrenceOf(".", true, false);
juce::String extension = fileName.fromLastOccurrenceOf(".", true, false).toLowerCase();
txt.setVisible(false);
frame.setVisible(false);
bool isImage = extension == ".gif" || extension == ".png" || extension == ".jpg" || extension == ".jpeg";

Wyświetl plik

@ -208,6 +208,7 @@ public:
recordLength.setValue(1);
recordButton.setPulseAnimation(true);
recordButton.onClick = [this] {
if (recordButton.getToggleState()) {
startRecording();
@ -255,7 +256,7 @@ private:
RecordingThumbnail recordingThumbnail;
AudioRecorder recorder{ audioProcessor, recordingThumbnail.getAudioThumbnail() };
SvgButton recordButton{ "record", BinaryData::record_svg, juce::Colours::white, juce::Colours::red };
SvgButton recordButton{ "record", BinaryData::record_2_svg, juce::Colours::red, juce::Colours::red.withAlpha(0.01f) };
juce::File lastRecording;
juce::FileChooser chooser { "Output file...", juce::File::getCurrentWorkingDirectory().getChildFile("recording.wav"), "*.wav" };
SvgButton timedRecord{ "timedRecord", BinaryData::timer_svg, juce::Colours::white, juce::Colours::red };

Wyświetl plik

@ -23,7 +23,7 @@ EffectComponent::EffectComponent(Effect& effect, int index) : effect(effect), in
lfoSlider.setTextValueSuffix("Hz");
lfoSlider.setColour(sliderThumbOutlineColourId, juce::Colour(0xff00ff00));
label.setFont(juce::Font(13.0f));
label.setFont(juce::Font(14.0f));
lfo.addItem("Static", static_cast<int>(LfoType::Static));
lfo.addItem("Sine", static_cast<int>(LfoType::Sine));

Wyświetl plik

@ -25,7 +25,7 @@ class SvgButton : public juce::DrawableButton, public juce::AudioProcessorParame
changeSvgColour(doc.get(), colourOn.withBrightness(0.3f));
disabledImageOn = juce::Drawable::createFromSVG(*doc);
path = normalImage->getOutlineAsPath();
basePath = normalImage->getOutlineAsPath();
getLookAndFeel().setColour(juce::DrawableButton::backgroundOnColourId, juce::Colours::transparentWhite);
@ -78,10 +78,20 @@ class SvgButton : public juce::DrawableButton, public juce::AudioProcessorParame
this->pulseUsed = pulseUsed;
}
void resized() override {
juce::DrawableButton::resized();
if (pulseUsed) {
resizedPath = basePath;
// scale path to fit image
resizedPath.applyTransform(resizedPath.getTransformToScaleToFit(getImageBounds(), true));
repaint();
}
}
void paintOverChildren(juce::Graphics& g) override {
if (pulseUsed && getToggleState()) {
g.setColour(juce::Colours::black.withAlpha(colourFade / 1.5f));
g.fillPath(path);
g.fillPath(resizedPath);
}
}
@ -115,7 +125,8 @@ private:
float colourFade = 0.0;
bool pulseUsed = false;
bool prevToggleState = false;
juce::Path path;
juce::Path basePath;
juce::Path resizedPath;
juce::Animator pulse = juce::ValueAnimatorBuilder {}
.withEasing([] (float t) { return std::sin(3.14159 * t) / 2 + 0.5; })
.withDurationMs(500)

Wyświetl plik

@ -8,6 +8,9 @@
companyEmail="james@ball.sh" defines="NOMINMAX=1" pluginAUMainType="'aumf'">
<MAINGROUP id="j5Ge2T" name="osci-render">
<GROUP id="{5ABCED88-0059-A7AF-9596-DBF91DDB0292}" name="Resources">
<GROUP id="{8930EC48-30FD-646B-9DC5-0861171F8B2E}" name="fonts">
<FILE id="sqtSiu" name="font.ttf" compile="0" resource="1" file="Resources/fonts/font.ttf"/>
</GROUP>
<GROUP id="{F3815953-00C0-3876-5552-BDE98F3233D9}" name="gpla">
<FILE id="euGQq0" name="fallback.gpla" compile="0" resource="1" file="Resources/gpla/fallback.gpla"/>
<FILE id="G2dMtI" name="invalid.gpla" compile="0" resource="1" file="Resources/gpla/invalid.gpla"/>
@ -51,6 +54,7 @@
<FILE id="PFc2q2" name="random.svg" compile="0" resource="1" file="Resources/svg/random.svg"/>
<FILE id="CE6di2" name="range.svg" compile="0" resource="1" file="Resources/svg/range.svg"/>
<FILE id="n79IAy" name="record.svg" compile="0" resource="1" file="Resources/svg/record.svg"/>
<FILE id="A3lJ5F" name="record_2.svg" compile="0" resource="1" file="Resources/svg/record_2.svg"/>
<FILE id="OaqZb1" name="right_arrow.svg" compile="0" resource="1" file="Resources/svg/right_arrow.svg"/>
<FILE id="rXjNlx" name="threshold.svg" compile="0" resource="1" file="Resources/svg/threshold.svg"/>
<FILE id="rFYmV8" name="timer.svg" compile="0" resource="1" file="Resources/svg/timer.svg"/>