Do some clean-up and migrate to the latest JUCE
This commit is contained in:
@ -208,7 +208,7 @@ Rectangle<int> CustomLookAndFeel::getTabButtonExtraComponentBounds (const TabBar
|
||||
default: jassertfalse; break;
|
||||
}
|
||||
}
|
||||
else if (button.getExtraComponentPlacement() == TabBarButton::aboveText)
|
||||
else if (button.getExtraComponentPlacement() == TabBarButton::beforeText)
|
||||
{
|
||||
switch (orientation)
|
||||
{
|
||||
@ -224,7 +224,7 @@ Rectangle<int> CustomLookAndFeel::getTabButtonExtraComponentBounds (const TabBar
|
||||
//DBG("After Extra comp bounds: " << extraComp.toString())
|
||||
|
||||
}
|
||||
else if (button.getExtraComponentPlacement() == TabBarButton::belowText)
|
||||
else if (button.getExtraComponentPlacement() == TabBarButton::afterText)
|
||||
{
|
||||
switch (orientation)
|
||||
{
|
||||
@ -1182,9 +1182,9 @@ void CustomLookAndFeel::drawDrawableButton (Graphics& g, DrawableButton& button,
|
||||
// imageratio = sonobutt->getForegroundImageRatio();
|
||||
//}
|
||||
|
||||
if (button.getStyle() == DrawableButton::ImageAboveTextLabel || button.getStyle() == DrawableButton::ImageBelowTextLabel) {
|
||||
if (button.getStyle() == DrawableButton::ImageAboveTextLabel || button.getStyle() == DrawableButton::ImageAboveTextLabel) {
|
||||
textH = jmin (14, button.proportionOfHeight (0.2f));
|
||||
} else if (button.getStyle() == DrawableButton::ImageLeftOfTextLabel || button.getStyle() == DrawableButton::ImageRightOfTextLabel) {
|
||||
} else if (button.getStyle() == DrawableButton::ImageAboveTextLabel || button.getStyle() == DrawableButton::ImageAboveTextLabel) {
|
||||
textH = jmin (14, button.proportionOfHeight (0.8f));
|
||||
textW = jmax (20, button.proportionOfWidth (1.0f - imageratio));
|
||||
}
|
||||
@ -1205,19 +1205,19 @@ void CustomLookAndFeel::drawDrawableButton (Graphics& g, DrawableButton& button,
|
||||
button.getWidth() - 4, textH,
|
||||
Justification::centred, 1);
|
||||
}
|
||||
else if (button.getStyle() == DrawableButton::ImageBelowTextLabel) {
|
||||
else if (button.getStyle() == DrawableButton::ImageAboveTextLabel) {
|
||||
g.drawFittedText (button.getButtonText(),
|
||||
2, 1,
|
||||
button.getWidth() - 4, textH,
|
||||
Justification::centred, 1);
|
||||
}
|
||||
else if (button.getStyle() == DrawableButton::ImageRightOfTextLabel) {
|
||||
else if (button.getStyle() == DrawableButton::ImageAboveTextLabel) {
|
||||
g.drawFittedText (button.getButtonText(),
|
||||
2, 1,
|
||||
textW , button.getHeight() - 2,
|
||||
Justification::centred, 2, 0.6f);
|
||||
}
|
||||
else if (button.getStyle() == DrawableButton::ImageLeftOfTextLabel) {
|
||||
else if (button.getStyle() == DrawableButton::ImageAboveTextLabel) {
|
||||
g.drawFittedText (button.getButtonText(),
|
||||
button.getWidth() - textW - 4 , 1,
|
||||
textW , button.getHeight() - 2,
|
||||
|
@ -3,12 +3,11 @@
|
||||
#include "../JuceLibraryCode/JuceHeader.h"
|
||||
|
||||
#include "juce_core/system/juce_TargetPlatform.h"
|
||||
#include "juce_audio_plugin_client/utility/juce_CheckSettingMacros.h"
|
||||
#include "juce_audio_plugin_client/detail/juce_CheckSettingMacros.h"
|
||||
|
||||
#include "juce_audio_plugin_client/utility/juce_IncludeSystemHeaders.h"
|
||||
#include "juce_audio_plugin_client/utility/juce_IncludeModuleHeaders.h"
|
||||
#include "juce_audio_plugin_client/utility/juce_FakeMouseMoveGenerator.h"
|
||||
#include "juce_audio_plugin_client/utility/juce_WindowsHooks.h"
|
||||
#include "juce_audio_plugin_client/detail/juce_IncludeSystemHeaders.h"
|
||||
#include "juce_audio_plugin_client/detail/juce_IncludeModuleHeaders.h"
|
||||
#include "juce_gui_basics/native/juce_WindowsHooks_windows.h"
|
||||
|
||||
#include <juce_audio_devices/juce_audio_devices.h>
|
||||
#include <juce_gui_extra/juce_gui_extra.h>
|
||||
@ -51,7 +50,7 @@ public:
|
||||
appProperties.setStorageParameters (options);
|
||||
|
||||
LookAndFeel::setDefaultLookAndFeel(&sonoLNF);
|
||||
|
||||
|
||||
}
|
||||
|
||||
const String getApplicationName() override { return JucePlugin_Name; }
|
||||
@ -63,7 +62,7 @@ public:
|
||||
|
||||
}
|
||||
|
||||
void urlOpened(const URL& url) override {
|
||||
void urlOpened(const URL& url) {
|
||||
|
||||
DBG("URL opened: " << url.toString(false));
|
||||
if (mainWindow.get() != nullptr)
|
||||
@ -72,7 +71,7 @@ public:
|
||||
|
||||
CustomLookAndFeel sonoLNF;
|
||||
|
||||
|
||||
|
||||
virtual StandaloneFilterWindow* createWindow()
|
||||
{
|
||||
#ifdef JucePlugin_PreferredChannelConfigurations
|
||||
@ -81,7 +80,7 @@ public:
|
||||
|
||||
AudioDeviceManager::AudioDeviceSetup setupOptions;
|
||||
setupOptions.bufferSize = 512;
|
||||
|
||||
|
||||
return new StandaloneFilterWindow (getApplicationName(),
|
||||
LookAndFeel::getDefaultLookAndFeel().findColour (ResizableWindow::backgroundColourId),
|
||||
appProperties.getUserSettings(),
|
||||
@ -107,7 +106,7 @@ public:
|
||||
#endif
|
||||
|
||||
mainWindow->setVisible (true);
|
||||
|
||||
|
||||
Desktop::getInstance().setScreenSaverEnabled(false);
|
||||
}
|
||||
|
||||
@ -118,7 +117,7 @@ public:
|
||||
mainWindow->pluginHolder->savePluginState();
|
||||
mainWindow->pluginHolder->saveAudioDeviceState();
|
||||
}
|
||||
|
||||
|
||||
mainWindow = nullptr;
|
||||
appProperties.saveIfNeeded();
|
||||
}
|
||||
@ -143,9 +142,9 @@ public:
|
||||
|
||||
appProperties.saveIfNeeded();
|
||||
|
||||
Desktop::getInstance().setScreenSaverEnabled(true);
|
||||
Desktop::getInstance().setScreenSaverEnabled(true);
|
||||
}
|
||||
|
||||
|
||||
void resumed() override
|
||||
{
|
||||
Desktop::getInstance().setScreenSaverEnabled(false);
|
||||
@ -160,7 +159,7 @@ public:
|
||||
mainWindow->getDeviceManager().restartLastAudioDevice();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
//==============================================================================
|
||||
void systemRequestedQuit() override
|
||||
{
|
||||
@ -190,7 +189,7 @@ public:
|
||||
{
|
||||
DBG("Memory warning");
|
||||
}
|
||||
|
||||
|
||||
protected:
|
||||
ApplicationProperties appProperties;
|
||||
std::unique_ptr<StandaloneFilterWindow> mainWindow;
|
||||
|
@ -102,7 +102,7 @@ public:
|
||||
virtual void createPlugin()
|
||||
{
|
||||
#if JUCE_MODULE_AVAILABLE_juce_audio_plugin_client
|
||||
processor.reset (::createPluginFilterOfType (AudioProcessor::wrapperType_Standalone));
|
||||
processor = createPluginFilterOfType (AudioProcessor::wrapperType_Standalone);
|
||||
#else
|
||||
AudioProcessor::setTypeOfNextNewPlugin (AudioProcessor::wrapperType_Standalone);
|
||||
processor.reset (createPluginFilter());
|
||||
@ -524,11 +524,9 @@ private:
|
||||
};
|
||||
|
||||
//==============================================================================
|
||||
void audioDeviceIOCallback (const float** inputChannelData,
|
||||
int numInputChannels,
|
||||
float** outputChannelData,
|
||||
int numOutputChannels,
|
||||
int numSamples) override
|
||||
void audioDeviceIOCallbackWithContext (const float* const* inputChannelData, int numInputChannels,
|
||||
float* const* outputChannelData, int numOutputChannels,
|
||||
int numSamples, const AudioIODeviceCallbackContext& context) override
|
||||
{
|
||||
const bool inputMuted = shouldMuteInput.getValue();
|
||||
|
||||
@ -538,8 +536,8 @@ private:
|
||||
inputChannelData = emptyBuffer.getArrayOfReadPointers();
|
||||
}
|
||||
|
||||
player.audioDeviceIOCallback (inputChannelData, numInputChannels,
|
||||
outputChannelData, numOutputChannels, numSamples);
|
||||
player.audioDeviceIOCallbackWithContext (inputChannelData, numInputChannels,
|
||||
outputChannelData, numOutputChannels, numSamples, context);
|
||||
}
|
||||
|
||||
void audioDeviceAboutToStart (AudioIODevice* device) override
|
||||
@ -644,8 +642,8 @@ public:
|
||||
: DocumentWindow (title, backgroundColour, DocumentWindow::minimiseButton | DocumentWindow::closeButton),
|
||||
optionsButton ("Options")
|
||||
{
|
||||
|
||||
|
||||
|
||||
|
||||
#if JUCE_IOS || JUCE_ANDROID
|
||||
setTitleBarHeight (0);
|
||||
#else
|
||||
@ -658,7 +656,7 @@ public:
|
||||
#endif
|
||||
|
||||
setResizable (true, false);
|
||||
|
||||
|
||||
pluginHolder.reset (new StandalonePluginHolder (settingsToUse, takeOwnershipOfSettings,
|
||||
preferredDefaultDeviceName, preferredSetupOptions,
|
||||
constrainToConfiguration, autoOpenMidiDevices));
|
||||
@ -770,7 +768,7 @@ public:
|
||||
|
||||
std::unique_ptr<StandalonePluginHolder> pluginHolder;
|
||||
|
||||
|
||||
|
||||
private:
|
||||
//==============================================================================
|
||||
class MainContentComponent : public Component,
|
||||
@ -829,7 +827,7 @@ private:
|
||||
}
|
||||
|
||||
void resized() override
|
||||
{
|
||||
{
|
||||
auto r = getLocalBounds();
|
||||
|
||||
bool portrait = getWidth() < getHeight();
|
||||
@ -847,7 +845,7 @@ private:
|
||||
// call resized again if on iOS, due to dumb stuff related to safe area insets not being updated
|
||||
#if JUCE_IOS
|
||||
Timer::callAfterDelay(150, [this]() {
|
||||
this->resized();
|
||||
this->resized();
|
||||
});
|
||||
//return;
|
||||
#endif
|
||||
@ -862,18 +860,18 @@ private:
|
||||
r.removeFromBottom(bottomInset);
|
||||
r.removeFromLeft(leftInset);
|
||||
r.removeFromRight(rightInset);
|
||||
|
||||
|
||||
|
||||
|
||||
if (shouldShowNotification) {
|
||||
notification.setBounds (r.removeFromTop (NotificationArea::height));
|
||||
topInset += NotificationArea::height;
|
||||
notification.setBounds (r.removeFromTop (NotificationArea::height));
|
||||
topInset += NotificationArea::height;
|
||||
}
|
||||
|
||||
editor->setBounds (r);
|
||||
}
|
||||
|
||||
private:
|
||||
|
||||
|
||||
bool isPortrait = false;
|
||||
bool isTall = false;
|
||||
int orientation = 0;
|
||||
@ -968,7 +966,7 @@ private:
|
||||
int bottomInset = 0;
|
||||
int leftInset = 0;
|
||||
int rightInset = 0;
|
||||
|
||||
|
||||
JUCE_DECLARE_NON_COPYABLE_WITH_LEAK_DETECTOR (MainContentComponent)
|
||||
};
|
||||
|
||||
|
@ -98,7 +98,6 @@ GenericItemChooser::GenericItemChooser(const Array<GenericItemChooserItem> & ite
|
||||
table.getViewport()->setScrollBarsShown(true, false);
|
||||
table.getViewport()->setScrollOnDragEnabled(true);
|
||||
table.setRowSelectedOnMouseDown(true);
|
||||
table.setRowClickedOnMouseDown(false);
|
||||
table.setMultipleSelectionEnabled (false);
|
||||
table.setRowHeight(rowHeight);
|
||||
|
||||
|
@ -123,7 +123,7 @@ public:
|
||||
return m_readbuf.getSample(ch, int(pos - m_cached_file_range.getStart()));
|
||||
else
|
||||
{
|
||||
Range<int64_t> activerange((int64_t)(m_activerange.getStart()*info.nsamples),
|
||||
Range<int64_t> activerange((int64_t)(m_activerange.getStart()*info.nsamples),
|
||||
(int64_t)(m_activerange.getEnd()*info.nsamples+1));
|
||||
Range<int64_t> possiblerange(pos, pos + m_readbuf.getNumSamples() + 0);
|
||||
m_cached_file_range = activerange.getIntersectionWith(possiblerange);
|
||||
@ -154,7 +154,7 @@ public:
|
||||
++m_silenceoutputted;
|
||||
return 0.0f;
|
||||
};
|
||||
float** smps = abuf.getArrayOfWritePointers();
|
||||
float* const* smps = abuf.getArrayOfWritePointers();
|
||||
int readinc = 1;
|
||||
if (m_reverseplay)
|
||||
readinc = -1;
|
||||
@ -212,7 +212,7 @@ public:
|
||||
for (int j = 0; j < numchans; ++j)
|
||||
{
|
||||
int inchantouse = j % inchans;
|
||||
smps[j][i] = seekfadegain*getCrossFadedSampleLambda(m_currentsample, inchantouse,
|
||||
smps[j][i] = seekfadegain*getCrossFadedSampleLambda(m_currentsample, inchantouse,
|
||||
subsect_t0, subsect_t1,xfadelen);
|
||||
}
|
||||
|
||||
@ -224,7 +224,7 @@ public:
|
||||
{
|
||||
m_currentsample = subsect_t0+xfadelen;
|
||||
++m_loopcount;
|
||||
}
|
||||
}
|
||||
else if (m_reverseplay == true && m_currentsample < subsect_t0)
|
||||
{
|
||||
m_currentsample = subsect_t1 - 1;
|
||||
@ -237,7 +237,7 @@ public:
|
||||
PlayRangeEndCallback(this);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
return nsmps;
|
||||
}
|
||||
void seekImpl(double pos)
|
||||
@ -282,7 +282,7 @@ public:
|
||||
}
|
||||
m_seekfade.length = 16384;
|
||||
m_seekfade.requestedpos = pos;
|
||||
|
||||
|
||||
}
|
||||
|
||||
std::pair<Range<double>,Range<double>> getCachedRangesNormalized()
|
||||
@ -322,7 +322,7 @@ public:
|
||||
void setActiveRange(Range<double> rng) override
|
||||
{
|
||||
ScopedLock locker(m_mutex);
|
||||
|
||||
|
||||
/*
|
||||
if (rng.contains(getCurrentPositionPercent()))
|
||||
{
|
||||
@ -373,7 +373,7 @@ public:
|
||||
}
|
||||
bool isReversed() { return m_reverseplay; }
|
||||
int64_t getLoopCount() { return m_loopcount; }
|
||||
|
||||
|
||||
private:
|
||||
std::function<void(AInputS*)> PlayRangeEndCallback;
|
||||
std::unique_ptr<AudioFormatReader> m_afreader;
|
||||
|
@ -316,7 +316,7 @@ void StretchAudioSource::getNextAudioBlock(const AudioSourceChannelInfo & buffer
|
||||
if (m_vol_smoother.getTargetValue() != maingain)
|
||||
m_vol_smoother.setTargetValue(maingain);
|
||||
FloatVectorOperations::disableDenormalisedNumberSupport();
|
||||
float** outarrays = bufferToFill.buffer->getArrayOfWritePointers();
|
||||
float* const* outarrays = bufferToFill.buffer->getArrayOfWritePointers();
|
||||
int outbufchans = jmin(m_num_outchans, bufferToFill.buffer->getNumChannels());
|
||||
int offset = bufferToFill.startSample;
|
||||
if (m_stretchers.size() == 0)
|
||||
|
@ -573,7 +573,7 @@ void PaulstretchpluginAudioProcessorEditor::showRenderDialog()
|
||||
int prefh = jmin(contentraw->getPreferredHeight(), getHeight() - 10);
|
||||
contentraw->setSize(prefw, prefh);
|
||||
std::unique_ptr<Component> content(contentraw);
|
||||
auto & cb = CallOutBox::launchAsynchronously(std::move(content), m_render_button.getBounds(), this, false);
|
||||
auto & cb = CallOutBox::launchAsynchronously(std::move(content), m_render_button.getBounds(), this);
|
||||
cb.setDismissalMouseClicksAreAlwaysConsumed(true);
|
||||
}
|
||||
|
||||
@ -635,7 +635,7 @@ void PaulstretchpluginAudioProcessorEditor::showSettings(bool flag)
|
||||
|
||||
Rectangle<int> bounds = dw->getLocalArea(nullptr, m_settings_button.getScreenBounds().reduced(10));
|
||||
DBG("callout bounds: " << bounds.toString());
|
||||
settingsCalloutBox = & CallOutBox::launchAsynchronously (std::move(wrap), bounds , dw, false);
|
||||
settingsCalloutBox = & CallOutBox::launchAsynchronously(std::move(wrap), bounds , dw);
|
||||
if (CallOutBox * box = dynamic_cast<CallOutBox*>(settingsCalloutBox.get())) {
|
||||
box->setDismissalMouseClicksAreAlwaysConsumed(true);
|
||||
}
|
||||
|
@ -52,7 +52,7 @@ public:
|
||||
SpectralVisualizer();
|
||||
void setState(const ProcessParameters& pars, int nfreqs, double samplerate);
|
||||
void paint(Graphics& g) override;
|
||||
|
||||
|
||||
private:
|
||||
Image m_img;
|
||||
std::vector<REALTYPE> m_insamples,m_freqs1, m_freqs2, m_freqs3;
|
||||
@ -174,10 +174,10 @@ private:
|
||||
class MyThumbCache : public AudioThumbnailCache
|
||||
{
|
||||
public:
|
||||
MyThumbCache() : AudioThumbnailCache(200)
|
||||
{
|
||||
MyThumbCache() : AudioThumbnailCache(200)
|
||||
{
|
||||
// The default priority of 2 is a bit too low in some cases, it seems...
|
||||
getTimeSliceThread().setPriority(3);
|
||||
//getTimeSliceThread().setPriority(juce::Thread::Priority::highest);
|
||||
}
|
||||
~MyThumbCache() {}
|
||||
};
|
||||
@ -328,11 +328,11 @@ public:
|
||||
void currentTabChanged(int newCurrentTabIndex, const String&) override
|
||||
{
|
||||
//m_cur_tab = newCurrentTabIndex;
|
||||
|
||||
|
||||
}
|
||||
private:
|
||||
int& m_cur_tab;
|
||||
|
||||
|
||||
};
|
||||
|
||||
class SimpleFFTComponent : public Component,
|
||||
@ -346,15 +346,15 @@ public:
|
||||
{
|
||||
setOpaque(true);
|
||||
startTimerHz(60);
|
||||
|
||||
|
||||
}
|
||||
|
||||
~SimpleFFTComponent()
|
||||
{
|
||||
|
||||
|
||||
}
|
||||
|
||||
void addAudioBlock(const AudioBuffer<float>& bufferToFill)
|
||||
void addAudioBlock(const AudioBuffer<float>& bufferToFill)
|
||||
{
|
||||
if (bufferToFill.getNumChannels() > 0)
|
||||
{
|
||||
@ -447,7 +447,7 @@ private:
|
||||
int fifoIndex = 0;
|
||||
bool nextFFTBlockReady = false;
|
||||
|
||||
|
||||
|
||||
};
|
||||
|
||||
|
||||
@ -511,7 +511,7 @@ private:
|
||||
LookAndFeel_V3 m_filebwlookandfeel;
|
||||
};
|
||||
|
||||
class PaulstretchpluginAudioProcessorEditor : public AudioProcessorEditor,
|
||||
class PaulstretchpluginAudioProcessorEditor : public AudioProcessorEditor,
|
||||
public MultiTimer, public FileDragAndDropTarget, public DragAndDropContainer, public ComponentListener
|
||||
|
||||
{
|
||||
@ -535,7 +535,7 @@ public:
|
||||
void paint (Graphics&) override;
|
||||
void resized() override;
|
||||
void timerCallback(int id) override;
|
||||
|
||||
|
||||
bool isInterestedInFileDrag(const StringArray &files) override;
|
||||
void filesDropped(const StringArray &files, int x, int y) override;
|
||||
|
||||
@ -543,9 +543,9 @@ public:
|
||||
|
||||
void componentParentHierarchyChanged (Component& component) override;
|
||||
|
||||
|
||||
|
||||
WaveformComponent m_wavecomponent;
|
||||
|
||||
|
||||
void showRenderDialog();
|
||||
//SimpleFFTComponent m_sonogram;
|
||||
String m_last_err;
|
||||
@ -566,7 +566,7 @@ private:
|
||||
|
||||
void showPopTip(const String & message, int timeoutMs, Component * target, int maxwidth=100);
|
||||
|
||||
|
||||
|
||||
CustomLookAndFeel m_lookandfeel;
|
||||
|
||||
PaulstretchpluginAudioProcessor& processor;
|
||||
@ -600,18 +600,18 @@ private:
|
||||
WeakReference<Component> settingsCalloutBox;
|
||||
std::unique_ptr<OptionsView> m_optionsView;
|
||||
|
||||
|
||||
|
||||
zoom_scrollbar m_zs;
|
||||
RatioMixerEditor m_ratiomixeditor{ 8 };
|
||||
FreeFilterComponent m_free_filter_component;
|
||||
|
||||
|
||||
MyTabComponent m_wavefilter_tab;
|
||||
Component* m_wave_container=nullptr;
|
||||
void showAudioSetup();
|
||||
void showSettings(bool flag);
|
||||
void toggleFileBrowser();
|
||||
std::vector<int> m_capturelens{ 2,5,10,30,60,120 };
|
||||
|
||||
|
||||
std::unique_ptr<MyFileBrowserComponent> m_filechooser;
|
||||
std::unique_ptr<FileChooser> fileChooser;
|
||||
WildcardFileFilter m_filefilter;
|
||||
@ -645,7 +645,7 @@ private:
|
||||
// keep this down here, so it gets destroyed early
|
||||
std::unique_ptr<BubbleMessageComponent> popTip;
|
||||
|
||||
|
||||
|
||||
JUCE_DECLARE_NON_COPYABLE_WITH_LEAK_DETECTOR (PaulstretchpluginAudioProcessorEditor)
|
||||
};
|
||||
|
||||
|
@ -616,8 +616,8 @@ void PaulstretchpluginAudioProcessor::startplay(Range<double> playrange, int num
|
||||
m_recreate_buffering_source = false;
|
||||
}
|
||||
if (m_bufferingthread.isThreadRunning() == false) {
|
||||
m_bufferingthread.setPriority(8);
|
||||
m_bufferingthread.startThread();
|
||||
// m_bufferingthread.setPriority(juce::Thread::Priority::high);
|
||||
}
|
||||
m_stretch_source->setNumOutChannels(numoutchans);
|
||||
m_stretch_source->setFFTSize(m_fft_size_to_use, true);
|
||||
|
Reference in New Issue
Block a user