While probably not REALLY necessary, implemented the Settings popup menu as an async version
This commit is contained in:
parent
93cebcdcd2
commit
6de7d3fd14
@ -21,6 +21,19 @@ www.gnu.org/licenses
|
|||||||
#include <array>
|
#include <array>
|
||||||
#include "RenderSettingsComponent.h"
|
#include "RenderSettingsComponent.h"
|
||||||
|
|
||||||
|
class MyPopmenuCallback : public ModalComponentManager::Callback
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
MyPopmenuCallback(PaulstretchpluginAudioProcessorEditor* owner) : m_owner(owner) {}
|
||||||
|
void modalStateFinished(int returnValue) override
|
||||||
|
{
|
||||||
|
jassert(m_owner != nullptr);
|
||||||
|
m_owner->executeModalMenuAction(0, returnValue);
|
||||||
|
}
|
||||||
|
PaulstretchpluginAudioProcessorEditor* m_owner = nullptr;
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
//==============================================================================
|
//==============================================================================
|
||||||
PaulstretchpluginAudioProcessorEditor::PaulstretchpluginAudioProcessorEditor(PaulstretchpluginAudioProcessor& p)
|
PaulstretchpluginAudioProcessorEditor::PaulstretchpluginAudioProcessorEditor(PaulstretchpluginAudioProcessor& p)
|
||||||
: AudioProcessorEditor(&p),
|
: AudioProcessorEditor(&p),
|
||||||
@ -260,6 +273,54 @@ void PaulstretchpluginAudioProcessorEditor::showRenderDialog()
|
|||||||
/*CallOutBox& myBox =*/ CallOutBox::launchAsynchronously(content, m_render_button.getBounds(), this);
|
/*CallOutBox& myBox =*/ CallOutBox::launchAsynchronously(content, m_render_button.getBounds(), this);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void PaulstretchpluginAudioProcessorEditor::executeModalMenuAction(int menuid, int r)
|
||||||
|
{
|
||||||
|
if (r >= 200 && r < 210)
|
||||||
|
{
|
||||||
|
int caplen = m_capturelens[r - 200];
|
||||||
|
*processor.getFloatParameter(cpi_max_capture_len) = (float)caplen;
|
||||||
|
}
|
||||||
|
if (r == 1)
|
||||||
|
{
|
||||||
|
toggleBool(processor.m_play_when_host_plays);
|
||||||
|
}
|
||||||
|
if (r == 2)
|
||||||
|
{
|
||||||
|
toggleBool(processor.m_capture_when_host_plays);
|
||||||
|
}
|
||||||
|
if (r == 8)
|
||||||
|
{
|
||||||
|
toggleBool(processor.m_mute_while_capturing);
|
||||||
|
}
|
||||||
|
if (r == 4)
|
||||||
|
{
|
||||||
|
processor.resetParameters();
|
||||||
|
}
|
||||||
|
if (r == 5)
|
||||||
|
{
|
||||||
|
toggleBool(processor.m_load_file_with_state);
|
||||||
|
}
|
||||||
|
if (r == 3)
|
||||||
|
{
|
||||||
|
showAbout();
|
||||||
|
}
|
||||||
|
|
||||||
|
if (r == 6)
|
||||||
|
{
|
||||||
|
ValueTree tree = processor.getStateTree(true, true);
|
||||||
|
MemoryBlock destData;
|
||||||
|
MemoryOutputStream stream(destData, true);
|
||||||
|
tree.writeToStream(stream);
|
||||||
|
String txt = Base64::toBase64(destData.getData(), destData.getSize());
|
||||||
|
SystemClipboard::copyTextToClipboard(txt);
|
||||||
|
}
|
||||||
|
if (r == 7)
|
||||||
|
{
|
||||||
|
toggleBool(processor.m_show_technical_info);
|
||||||
|
processor.m_propsfile->m_props_file->setValue("showtechnicalinfo", processor.m_show_technical_info);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
void PaulstretchpluginAudioProcessorEditor::paint (Graphics& g)
|
void PaulstretchpluginAudioProcessorEditor::paint (Graphics& g)
|
||||||
{
|
{
|
||||||
g.fillAll(Colours::darkgrey);
|
g.fillAll(Colours::darkgrey);
|
||||||
@ -501,70 +562,28 @@ void PaulstretchpluginAudioProcessorEditor::chooseFile()
|
|||||||
|
|
||||||
void PaulstretchpluginAudioProcessorEditor::showSettingsMenu()
|
void PaulstretchpluginAudioProcessorEditor::showSettingsMenu()
|
||||||
{
|
{
|
||||||
PopupMenu menu;
|
m_test_menu = PopupMenu();
|
||||||
menu.addItem(4, "Reset parameters", true, false);
|
m_test_menu.addItem(4, "Reset parameters", true, false);
|
||||||
menu.addItem(5, "Load file with plugin state", true, processor.m_load_file_with_state);
|
m_test_menu.addItem(5, "Load file with plugin state", true, processor.m_load_file_with_state);
|
||||||
menu.addItem(1, "Play when host transport running", true, processor.m_play_when_host_plays);
|
m_test_menu.addItem(1, "Play when host transport running", true, processor.m_play_when_host_plays);
|
||||||
menu.addItem(2, "Capture when host transport running", true, processor.m_capture_when_host_plays);
|
m_test_menu.addItem(2, "Capture when host transport running", true, processor.m_capture_when_host_plays);
|
||||||
menu.addItem(8, "Mute audio while capturing", true, processor.m_mute_while_capturing);
|
m_test_menu.addItem(8, "Mute audio while capturing", true, processor.m_mute_while_capturing);
|
||||||
int capturelen = *processor.getFloatParameter(cpi_max_capture_len);
|
int capturelen = *processor.getFloatParameter(cpi_max_capture_len);
|
||||||
PopupMenu capturelenmenu;
|
PopupMenu capturelenmenu;
|
||||||
std::vector<int> capturelens{ 2,5,10,30,60,120 };
|
|
||||||
for (int i=0;i<capturelens.size();++i)
|
|
||||||
capturelenmenu.addItem(200+i, String(capturelens[i])+" seconds", true, capturelen == capturelens[i]);
|
|
||||||
menu.addSubMenu("Capture buffer length", capturelenmenu);
|
|
||||||
|
|
||||||
menu.addItem(3, "About...", true, false);
|
for (int i=0;i<m_capturelens.size();++i)
|
||||||
|
capturelenmenu.addItem(200+i, String(m_capturelens[i])+" seconds", true, capturelen == m_capturelens[i]);
|
||||||
|
m_test_menu.addSubMenu("Capture buffer length", capturelenmenu);
|
||||||
|
|
||||||
|
m_test_menu.addItem(3, "About...", true, false);
|
||||||
#ifdef JUCE_DEBUG
|
#ifdef JUCE_DEBUG
|
||||||
menu.addItem(6, "Dump preset to clipboard", true, false);
|
m_test_menu.addItem(6, "Dump preset to clipboard", true, false);
|
||||||
#endif
|
#endif
|
||||||
menu.addItem(7, "Show technical info", true, processor.m_show_technical_info);
|
m_test_menu.addItem(7, "Show technical info", true, processor.m_show_technical_info);
|
||||||
int r = menu.show();
|
//int r = menu.show();
|
||||||
if (r >= 200 && r < 210)
|
|
||||||
{
|
|
||||||
int caplen = capturelens[r - 200];
|
|
||||||
*processor.getFloatParameter(cpi_max_capture_len) = (float)caplen;
|
|
||||||
}
|
|
||||||
if (r == 1)
|
|
||||||
{
|
|
||||||
toggleBool(processor.m_play_when_host_plays);
|
|
||||||
}
|
|
||||||
if (r == 2)
|
|
||||||
{
|
|
||||||
toggleBool(processor.m_capture_when_host_plays);
|
|
||||||
}
|
|
||||||
if (r == 8)
|
|
||||||
{
|
|
||||||
toggleBool(processor.m_mute_while_capturing);
|
|
||||||
}
|
|
||||||
if (r == 4)
|
|
||||||
{
|
|
||||||
processor.resetParameters();
|
|
||||||
}
|
|
||||||
if (r == 5)
|
|
||||||
{
|
|
||||||
toggleBool(processor.m_load_file_with_state);
|
|
||||||
}
|
|
||||||
if (r == 3)
|
|
||||||
{
|
|
||||||
showAbout();
|
|
||||||
}
|
|
||||||
|
|
||||||
if (r == 6)
|
|
||||||
{
|
|
||||||
ValueTree tree = processor.getStateTree(true,true);
|
|
||||||
MemoryBlock destData;
|
|
||||||
MemoryOutputStream stream(destData, true);
|
|
||||||
tree.writeToStream(stream);
|
|
||||||
String txt = Base64::toBase64(destData.getData(), destData.getSize());
|
|
||||||
SystemClipboard::copyTextToClipboard(txt);
|
|
||||||
}
|
|
||||||
if (r == 7)
|
|
||||||
{
|
|
||||||
toggleBool(processor.m_show_technical_info);
|
|
||||||
processor.m_propsfile->m_props_file->setValue("showtechnicalinfo", processor.m_show_technical_info);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
m_test_menu.showMenuAsync(PopupMenu::Options(), new MyPopmenuCallback(this));
|
||||||
}
|
}
|
||||||
|
|
||||||
void PaulstretchpluginAudioProcessorEditor::showAbout()
|
void PaulstretchpluginAudioProcessorEditor::showAbout()
|
||||||
|
@ -310,7 +310,6 @@ public:
|
|||||||
void resized() override;
|
void resized() override;
|
||||||
void timerCallback(int id) override;
|
void timerCallback(int id) override;
|
||||||
|
|
||||||
|
|
||||||
bool isInterestedInFileDrag(const StringArray &files) override;
|
bool isInterestedInFileDrag(const StringArray &files) override;
|
||||||
void filesDropped(const StringArray &files, int x, int y) override;
|
void filesDropped(const StringArray &files, int x, int y) override;
|
||||||
|
|
||||||
@ -319,7 +318,9 @@ public:
|
|||||||
WaveformComponent m_wavecomponent;
|
WaveformComponent m_wavecomponent;
|
||||||
void chooseFile();
|
void chooseFile();
|
||||||
void showRenderDialog();
|
void showRenderDialog();
|
||||||
|
void executeModalMenuAction(int menuid, int actionid);
|
||||||
private:
|
private:
|
||||||
|
PopupMenu m_test_menu;
|
||||||
PaulstretchpluginAudioProcessor& processor;
|
PaulstretchpluginAudioProcessor& processor;
|
||||||
uptrvec<ParameterComponent> m_parcomps;
|
uptrvec<ParameterComponent> m_parcomps;
|
||||||
//SpectralVisualizer m_specvis;
|
//SpectralVisualizer m_specvis;
|
||||||
@ -339,6 +340,7 @@ private:
|
|||||||
MyTabComponent m_wavefilter_tab;
|
MyTabComponent m_wavefilter_tab;
|
||||||
Component* m_wave_container=nullptr;
|
Component* m_wave_container=nullptr;
|
||||||
void showAbout();
|
void showAbout();
|
||||||
|
std::vector<int> m_capturelens{ 2,5,10,30,60,120 };
|
||||||
JUCE_DECLARE_NON_COPYABLE_WITH_LEAK_DETECTOR (PaulstretchpluginAudioProcessorEditor)
|
JUCE_DECLARE_NON_COPYABLE_WITH_LEAK_DETECTOR (PaulstretchpluginAudioProcessorEditor)
|
||||||
};
|
};
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user