|
|
@@ -28,7 +28,10 @@ public: |
|
|
|
|
|
|
|
void valueChanged() override
|
|
|
|
{
|
|
|
|
param.setValue ((float) Slider::getValue());
|
|
|
|
if (isMouseButtonDown())
|
|
|
|
param.setValueNotifyingHost ((float) Slider::getValue());
|
|
|
|
else
|
|
|
|
param.setValue ((float) Slider::getValue());
|
|
|
|
}
|
|
|
|
|
|
|
|
void timerCallback() override { updateSliderPos(); }
|
|
|
@@ -56,9 +59,9 @@ public: |
|
|
|
JuceDemoPluginAudioProcessorEditor::JuceDemoPluginAudioProcessorEditor (JuceDemoPluginAudioProcessor& owner)
|
|
|
|
: AudioProcessorEditor (owner),
|
|
|
|
midiKeyboard (owner.keyboardState, MidiKeyboardComponent::horizontalKeyboard),
|
|
|
|
timecodeDisplayLabel (String::empty),
|
|
|
|
gainLabel (String::empty, "Throughput level:"),
|
|
|
|
delayLabel (String::empty, "Delay:")
|
|
|
|
timecodeDisplayLabel (String()),
|
|
|
|
gainLabel (String(), "Throughput level:"),
|
|
|
|
delayLabel (String(), "Delay:")
|
|
|
|
{
|
|
|
|
// add some sliders..
|
|
|
|
addAndMakeVisible (gainSlider = new ParameterSlider (*owner.gainParam));
|
|
|
@@ -82,9 +85,8 @@ JuceDemoPluginAudioProcessorEditor::JuceDemoPluginAudioProcessorEditor (JuceDemo |
|
|
|
timecodeDisplayLabel.setColour (Label::textColourId, Colours::blue);
|
|
|
|
timecodeDisplayLabel.setFont (Font (Font::getDefaultMonospacedFontName(), 15.0f, Font::plain));
|
|
|
|
|
|
|
|
// add the triangular resizer component for the bottom-right of the UI
|
|
|
|
addAndMakeVisible (resizer = new ResizableCornerComponent (this, &resizeLimits));
|
|
|
|
resizeLimits.setSizeLimits (150, 150, 800, 300);
|
|
|
|
// set resize limits for this plug-in
|
|
|
|
setResizeLimits (400, 200, 800, 300);
|
|
|
|
|
|
|
|
// set our component's initial size to be the last one that was stored in the filter's settings
|
|
|
|
setSize (owner.lastUIWidth,
|
|
|
@@ -120,8 +122,6 @@ void JuceDemoPluginAudioProcessorEditor::resized() |
|
|
|
gainSlider->setBounds (sliderArea.removeFromLeft (jmin (180, sliderArea.getWidth() / 2)));
|
|
|
|
delaySlider->setBounds (sliderArea.removeFromLeft (jmin (180, sliderArea.getWidth())));
|
|
|
|
|
|
|
|
resizer->setBounds (getWidth() - 16, getHeight() - 16, 16, 16);
|
|
|
|
|
|
|
|
getProcessor().lastUIWidth = getWidth();
|
|
|
|
getProcessor().lastUIHeight = getHeight();
|
|
|
|
}
|
|
|
@@ -136,14 +136,14 @@ void JuceDemoPluginAudioProcessorEditor::timerCallback() |
|
|
|
// quick-and-dirty function to format a timecode string
|
|
|
|
static String timeToTimecodeString (double seconds)
|
|
|
|
{
|
|
|
|
const int millisecs = roundToInt (std::abs (seconds * 1000.0));
|
|
|
|
const int millisecs = roundToInt (seconds * 1000.0);
|
|
|
|
const int absMillisecs = std::abs (millisecs);
|
|
|
|
|
|
|
|
return String::formatted ("%s%02d:%02d:%02d.%03d",
|
|
|
|
seconds < 0 ? "-" : "",
|
|
|
|
return String::formatted ("%02d:%02d:%02d.%03d",
|
|
|
|
millisecs / 360000,
|
|
|
|
(millisecs / 60000) % 60,
|
|
|
|
(millisecs / 1000) % 60,
|
|
|
|
millisecs % 1000);
|
|
|
|
(absMillisecs / 60000) % 60,
|
|
|
|
(absMillisecs / 1000) % 60,
|
|
|
|
absMillisecs % 1000);
|
|
|
|
}
|
|
|
|
|
|
|
|
// quick-and-dirty function to format a bars/beats string
|
|
|
@@ -165,25 +165,20 @@ static String quarterNotePositionToBarsBeatsString (double quarterNotes, int num |
|
|
|
// Updates the text in our position label.
|
|
|
|
void JuceDemoPluginAudioProcessorEditor::updateTimecodeDisplay (AudioPlayHead::CurrentPositionInfo pos)
|
|
|
|
{
|
|
|
|
if (lastDisplayedPosition != pos)
|
|
|
|
{
|
|
|
|
lastDisplayedPosition = pos;
|
|
|
|
|
|
|
|
MemoryOutputStream displayText;
|
|
|
|
|
|
|
|
displayText << "[" << SystemStats::getJUCEVersion() << "] "
|
|
|
|
<< String (pos.bpm, 2) << " bpm, "
|
|
|
|
<< pos.timeSigNumerator << '/' << pos.timeSigDenominator
|
|
|
|
<< " - " << timeToTimecodeString (pos.timeInSeconds)
|
|
|
|
<< " - " << quarterNotePositionToBarsBeatsString (pos.ppqPosition,
|
|
|
|
pos.timeSigNumerator,
|
|
|
|
pos.timeSigDenominator);
|
|
|
|
|
|
|
|
if (pos.isRecording)
|
|
|
|
displayText << " (recording)";
|
|
|
|
else if (pos.isPlaying)
|
|
|
|
displayText << " (playing)";
|
|
|
|
|
|
|
|
timecodeDisplayLabel.setText (displayText.toString(), dontSendNotification);
|
|
|
|
}
|
|
|
|
MemoryOutputStream displayText;
|
|
|
|
|
|
|
|
displayText << "[" << SystemStats::getJUCEVersion() << "] "
|
|
|
|
<< String (pos.bpm, 2) << " bpm, "
|
|
|
|
<< pos.timeSigNumerator << '/' << pos.timeSigDenominator
|
|
|
|
<< " - " << timeToTimecodeString (pos.timeInSeconds)
|
|
|
|
<< " - " << quarterNotePositionToBarsBeatsString (pos.ppqPosition,
|
|
|
|
pos.timeSigNumerator,
|
|
|
|
pos.timeSigDenominator);
|
|
|
|
|
|
|
|
if (pos.isRecording)
|
|
|
|
displayText << " (recording)";
|
|
|
|
else if (pos.isPlaying)
|
|
|
|
displayText << " (playing)";
|
|
|
|
|
|
|
|
timecodeDisplayLabel.setText (displayText.toString(), dontSendNotification);
|
|
|
|
}
|