fixed offline rendering bugs. more layout tweaks

This commit is contained in:
essej 2022-04-15 19:13:55 -04:00
parent 3510b0ee6f
commit 3c313e4f50
10 changed files with 182 additions and 49 deletions

View File

@ -82,7 +82,8 @@ public:
: settings (settingsToUse, takeOwnershipOfSettings), : settings (settingsToUse, takeOwnershipOfSettings),
channelConfiguration (channels), channelConfiguration (channels),
shouldMuteInput (! isInterAppAudioConnected()), shouldMuteInput(false),
//shouldMuteInput (! isInterAppAudioConnected()),
autoOpenMidiDevices (shouldAutoOpenMidiDevices) autoOpenMidiDevices (shouldAutoOpenMidiDevices)
{ {
createPlugin(); createPlugin();
@ -142,7 +143,7 @@ public:
int outChannels = (channelConfiguration.size() > 0 ? channelConfiguration[0].numOuts int outChannels = (channelConfiguration.size() > 0 ? channelConfiguration[0].numOuts
: processor->getMainBusNumOutputChannels()); : processor->getMainBusNumOutputChannels());
processorHasPotentialFeedbackLoop = (inChannels > 0 && outChannels > 0); // processorHasPotentialFeedbackLoop = (inChannels > 0 && outChannels > 0);
} }
virtual void deletePlugin() virtual void deletePlugin()
@ -441,7 +442,7 @@ public:
Array<PluginInOuts> channelConfiguration; Array<PluginInOuts> channelConfiguration;
// avoid feedback loop by default // avoid feedback loop by default
bool processorHasPotentialFeedbackLoop = true; bool processorHasPotentialFeedbackLoop = false; // or not
Value shouldMuteInput; Value shouldMuteInput;
AudioBuffer<float> emptyBuffer; AudioBuffer<float> emptyBuffer;
bool autoOpenMidiDevices = false; bool autoOpenMidiDevices = false;
@ -547,12 +548,14 @@ private:
player.audioDeviceAboutToStart (device); player.audioDeviceAboutToStart (device);
player.setMidiOutput (deviceManager.getDefaultMidiOutput()); player.setMidiOutput (deviceManager.getDefaultMidiOutput());
#if 0
#if JUCE_IOS #if JUCE_IOS
if (auto iosdevice = dynamic_cast<iOSAudioIODevice*> (deviceManager.getCurrentAudioDevice())) { if (auto iosdevice = dynamic_cast<iOSAudioIODevice*> (deviceManager.getCurrentAudioDevice())) {
processorHasPotentialFeedbackLoop = !iosdevice->isHeadphonesConnected() && device->getActiveInputChannels() > 0; processorHasPotentialFeedbackLoop = !iosdevice->isHeadphonesConnected() && device->getActiveInputChannels() > 0;
shouldMuteInput.setValue(processorHasPotentialFeedbackLoop); shouldMuteInput.setValue(processorHasPotentialFeedbackLoop);
} }
#endif
#endif #endif
} }

View File

@ -282,9 +282,26 @@ void StretchAudioSource::setSpectralOrderPreset(int id)
void StretchAudioSource::getNextAudioBlock(const AudioSourceChannelInfo & bufferToFill) void StretchAudioSource::getNextAudioBlock(const AudioSourceChannelInfo & bufferToFill)
{ {
ScopedLock locker(m_cs); ScopedLock locker(m_cs);
if (m_preview_dry == true && m_inputfile!=nullptr && m_inputfile->info.nsamples>0) if ( m_preview_dry == true && m_inputfile!=nullptr && m_inputfile->info.nsamples>0)
{ {
playDrySound(bufferToFill); if (m_pause_state != 2)
playDrySound(bufferToFill);
if (m_pause_state == 1)
{
bufferToFill.buffer->applyGainRamp(bufferToFill.startSample, bufferToFill.numSamples, 1.0f, 0.0f);
m_pause_state = 2;
}
else if (m_pause_state == 2)
{
bufferToFill.buffer->clear(bufferToFill.startSample,bufferToFill.numSamples);
}
else if (m_pause_state == 3)
{
bufferToFill.buffer->applyGainRamp(bufferToFill.startSample, bufferToFill.numSamples, 0.0f, 1.0f);
m_pause_state = 0;
}
return; return;
} }
double maingain = Decibels::decibelsToGain(m_main_volume); double maingain = Decibels::decibelsToGain(m_main_volume);

View File

@ -142,7 +142,7 @@ private:
bool m_freezing = false; bool m_freezing = false;
int m_pause_state = 0; int m_pause_state = 2; // start paused
Range<double> m_playrange{ 0.0,1.0 }; Range<double> m_playrange{ 0.0,1.0 };
int64_t m_rand_count = 0; int64_t m_rand_count = 0;

View File

@ -41,6 +41,23 @@ enum ParameterGroupIds
CompressGroup = 8 CompressGroup = 8
}; };
enum SettingsMenuIds
{
SettingsPlayHostTransId = 1,
SettingsCaptureHostTransId = 2,
SettingsAboutId = 3,
SettingsResetParametersId = 4,
SettingsLoadFileWithStateId = 5,
SettingsDumpPresetClipboardId = 6,
SettingsShowTechInfoId = 7,
SettingsMutePassthruCaptureId = 8,
SettingsSaveCaptureDiskId = 9,
SettingsMuteProcessedCaptureId = 10,
SettingsAudioSettingsId = 11,
SettingsSliderSnapId = 12
};
//============================================================================== //==============================================================================
PaulstretchpluginAudioProcessorEditor::PaulstretchpluginAudioProcessorEditor(PaulstretchpluginAudioProcessor& p) PaulstretchpluginAudioProcessorEditor::PaulstretchpluginAudioProcessorEditor(PaulstretchpluginAudioProcessor& p)
: AudioProcessorEditor(&p), : AudioProcessorEditor(&p),
@ -510,7 +527,7 @@ void PaulstretchpluginAudioProcessorEditor::showRenderDialog()
{ {
auto contentraw = new RenderSettingsComponent(&processor); auto contentraw = new RenderSettingsComponent(&processor);
int prefw = jmin(contentraw->getPreferredWidth(), getWidth() - 20); int prefw = jmin(contentraw->getPreferredWidth(), getWidth() - 40);
int prefh = jmin(contentraw->getPreferredHeight(), getHeight() - 10); int prefh = jmin(contentraw->getPreferredHeight(), getHeight() - 10);
contentraw->setSize(prefw, prefh); contentraw->setSize(prefw, prefh);
std::unique_ptr<Component> content(contentraw); std::unique_ptr<Component> content(contentraw);
@ -526,49 +543,67 @@ void PaulstretchpluginAudioProcessorEditor::showAudioSetup()
void PaulstretchpluginAudioProcessorEditor::executeModalMenuAction(int menuid, int r) void PaulstretchpluginAudioProcessorEditor::executeModalMenuAction(int menuid, int r)
{ {
enum SettingsMenuIds
{
SettingsPlayHostTransId = 1,
SettingsCaptureHostTransId = 2,
SettingsAboutId = 3,
SettingsResetParametersId = 4,
SettingsLoadFileWithStateId = 5,
SettingsDumpPresetClipboardId = 6,
SettingsShowTechInfoId = 7,
SettingsMutePassthruCaptureId = 8,
SettingsSaveCaptureDiskId = 9,
SettingsMuteProcessedCaptureId = 10,
};
if (r >= 200 && r < 210) if (r >= 200 && r < 210)
{ {
int caplen = m_capturelens[r - 200]; int caplen = m_capturelens[r - 200];
*processor.getFloatParameter(cpi_max_capture_len) = (float)caplen; *processor.getFloatParameter(cpi_max_capture_len) = (float)caplen;
} }
else if (r == 1) else if (r == SettingsPlayHostTransId)
{ {
toggleBool(processor.m_play_when_host_plays); toggleBool(processor.m_play_when_host_plays);
} }
else if (r == 2) else if (r == SettingsCaptureHostTransId)
{ {
toggleBool(processor.m_capture_when_host_plays); toggleBool(processor.m_capture_when_host_plays);
} }
else if (r == 8) else if (r == SettingsMutePassthruCaptureId)
{ {
toggleBool(processor.m_mute_while_capturing); toggleBool(processor.m_mute_while_capturing);
} }
else if (r == 10) else if (r == SettingsMuteProcessedCaptureId)
{ {
toggleBool(processor.m_mute_processed_while_capturing); toggleBool(processor.m_mute_processed_while_capturing);
} }
else if (r == 4) else if (r == SettingsResetParametersId)
{ {
processor.resetParameters(); processor.resetParameters();
} }
else if (r == 5) else if (r == SettingsLoadFileWithStateId)
{ {
toggleBool(processor.m_load_file_with_state); toggleBool(processor.m_load_file_with_state);
} }
else if (r == 9) else if (r == SettingsSaveCaptureDiskId)
{ {
toggleBool(processor.m_save_captured_audio); toggleBool(processor.m_save_captured_audio);
} }
else if (r == 3) else if (r == SettingsSliderSnapId)
{
toggleBool(processor.m_use_jumpsliders);
}
else if (r == SettingsAboutId)
{ {
showAbout(); showAbout();
} }
else if (r == 11) else if (r == SettingsAudioSettingsId)
{ {
showAudioSetup(); showAudioSetup();
} }
else if (r == 6) else if (r == SettingsDumpPresetClipboardId)
{ {
ValueTree tree = processor.getStateTree(true, true); ValueTree tree = processor.getStateTree(true, true);
MemoryBlock destData; MemoryBlock destData;
@ -577,18 +612,31 @@ void PaulstretchpluginAudioProcessorEditor::executeModalMenuAction(int menuid, i
String txt = Base64::toBase64(destData.getData(), destData.getSize()); String txt = Base64::toBase64(destData.getData(), destData.getSize());
SystemClipboard::copyTextToClipboard(txt); SystemClipboard::copyTextToClipboard(txt);
} }
else if (r == 7) else if (r == SettingsShowTechInfoId)
{ {
toggleBool(processor.m_show_technical_info); toggleBool(processor.m_show_technical_info);
processor.m_propsfile->m_props_file->setValue("showtechnicalinfo", processor.m_show_technical_info); processor.m_propsfile->m_props_file->setValue("showtechnicalinfo", processor.m_show_technical_info);
} }
} }
void PaulstretchpluginAudioProcessorEditor::updateAllSliders()
{
for (auto& e : m_parcomps) {
if (!e) continue;
if (auto * slider = e->getSlider()) {
slider->setSliderSnapsToMousePosition(processor.m_use_jumpsliders);
}
}
m_free_filter_component.setSlidersSnap(processor.m_use_jumpsliders);
m_ratiomixeditor.setSlidersSnap(processor.m_use_jumpsliders);;
}
void PaulstretchpluginAudioProcessorEditor::paint (Graphics& g) void PaulstretchpluginAudioProcessorEditor::paint (Graphics& g)
{ {
g.fillAll(Colour(0xff404040)); // g.fillAll(Colour(0xff404040));
g.fillAll(Colour(0xff303030));
} }
void PaulstretchpluginAudioProcessorEditor::resized() void PaulstretchpluginAudioProcessorEditor::resized()
@ -1015,6 +1063,8 @@ void PaulstretchpluginAudioProcessorEditor::timerCallback(int id)
m_stretchgroup->replaceParameterComponent(m_parcomps[cpi_dryplayrate].get(), m_parcomps[cpi_stretchamount].get()); m_stretchgroup->replaceParameterComponent(m_parcomps[cpi_dryplayrate].get(), m_parcomps[cpi_stretchamount].get());
} }
updateAllSliders();
//m_parcomps[cpi_dryplayrate]->setVisible(*processor.getBoolParameter(cpi_bypass_stretch)); //m_parcomps[cpi_dryplayrate]->setVisible(*processor.getBoolParameter(cpi_bypass_stretch));
//m_parcomps[cpi_stretchamount]->setVisible(!*processor.getBoolParameter(cpi_bypass_stretch)); //m_parcomps[cpi_stretchamount]->setVisible(!*processor.getBoolParameter(cpi_bypass_stretch));
@ -1069,19 +1119,21 @@ bool PaulstretchpluginAudioProcessorEditor::keyPressed(const KeyPress & press)
void PaulstretchpluginAudioProcessorEditor::showSettingsMenu() void PaulstretchpluginAudioProcessorEditor::showSettingsMenu()
{ {
PopupMenu m_settings_menu; PopupMenu m_settings_menu;
if (JUCEApplicationBase::isStandaloneApp()) { if (JUCEApplicationBase::isStandaloneApp()) {
m_settings_menu.addItem(11, "Audio Setup...", true, false); m_settings_menu.addItem(11, "Audio Setup...", true, false);
} }
m_settings_menu.addItem(4, "Reset parameters", true, false); m_settings_menu.addItem(SettingsResetParametersId, "Reset parameters", true, false);
m_settings_menu.addSeparator(); m_settings_menu.addSeparator();
m_settings_menu.addItem(5, "Load file with plugin state", true, processor.m_load_file_with_state); m_settings_menu.addItem(SettingsLoadFileWithStateId, "Load file with plugin state", true, processor.m_load_file_with_state);
m_settings_menu.addItem(1, "Play when host transport running", true, processor.m_play_when_host_plays); m_settings_menu.addItem(SettingsPlayHostTransId, "Play when host transport running", true, processor.m_play_when_host_plays);
m_settings_menu.addItem(2, "Capture when host transport running", true, processor.m_capture_when_host_plays); m_settings_menu.addItem(SettingsCaptureHostTransId, "Capture when host transport running", true, processor.m_capture_when_host_plays);
m_settings_menu.addSeparator(); m_settings_menu.addSeparator();
m_settings_menu.addItem(8, "Mute passthrough while capturing", true, processor.m_mute_while_capturing); m_settings_menu.addItem(SettingsMutePassthruCaptureId, "Mute passthrough while capturing", true, processor.m_mute_while_capturing);
m_settings_menu.addItem(10, "Mute processed audio output while capturing", true, processor.m_mute_processed_while_capturing); m_settings_menu.addItem(SettingsMuteProcessedCaptureId, "Mute processed audio output while capturing", true, processor.m_mute_processed_while_capturing);
m_settings_menu.addItem(9, "Save captured audio to disk", true, processor.m_save_captured_audio); m_settings_menu.addItem(SettingsSaveCaptureDiskId, "Save captured audio to disk", true, processor.m_save_captured_audio);
int capturelen = *processor.getFloatParameter(cpi_max_capture_len); int capturelen = *processor.getFloatParameter(cpi_max_capture_len);
PopupMenu capturelenmenu; PopupMenu capturelenmenu;
@ -1090,11 +1142,12 @@ void PaulstretchpluginAudioProcessorEditor::showSettingsMenu()
m_settings_menu.addSubMenu("Capture buffer length", capturelenmenu); m_settings_menu.addSubMenu("Capture buffer length", capturelenmenu);
m_settings_menu.addSeparator(); m_settings_menu.addSeparator();
m_settings_menu.addItem(3, "About...", true, false); m_settings_menu.addItem(SettingsAboutId, "About...", true, false);
m_settings_menu.addItem(SettingsSliderSnapId, "Sliders jump to position ", true, processor.m_use_jumpsliders);
#ifdef JUCE_DEBUG #ifdef JUCE_DEBUG
m_settings_menu.addItem(6, "Dump preset to clipboard", true, false); m_settings_menu.addItem(SettingsDumpPresetClipboardId, "Dump preset to clipboard", true, false);
#endif #endif
m_settings_menu.addItem(7, "Show technical info", true, processor.m_show_technical_info); m_settings_menu.addItem(SettingsShowTechInfoId, "Show technical info", true, processor.m_show_technical_info);
auto options = PopupMenu::Options().withTargetComponent(&m_settings_button); auto options = PopupMenu::Options().withTargetComponent(&m_settings_button);
#if JUCE_IOS #if JUCE_IOS
@ -1967,6 +2020,8 @@ void ParameterComponent::resized()
} }
m_label.setBounds(0, 0, labw, h); m_label.setBounds(0, 0, labw, h);
m_slider->setBounds(m_label.getRight() + 1, 0, getWidth() - 2 - m_label.getWidth(), h); m_slider->setBounds(m_label.getRight() + 1, 0, getWidth() - 2 - m_label.getWidth(), h);
m_slider->setMouseDragSensitivity(jmax(128, m_slider->getWidth() - m_slider->getTextBoxWidth()));
} }
else if (m_togglebut) { else if (m_togglebut) {
m_togglebut->setBounds(1, 0, getWidth() - 1, h); m_togglebut->setBounds(1, 0, getWidth() - 1, h);
@ -2127,7 +2182,7 @@ void PerfMeterComponent::mouseDown(const MouseEvent & ev)
{ {
PopupMenu bufferingmenu; PopupMenu bufferingmenu;
int curbufamount = m_proc->getPreBufferAmount(); int curbufamount = m_proc->getPreBufferAmount();
bufferingmenu.addItem(100, "None", true, curbufamount == -1); bufferingmenu.addItem(100, "None (risky)", true, curbufamount == -1);
bufferingmenu.addItem(101, "Small", true, curbufamount == 1); bufferingmenu.addItem(101, "Small", true, curbufamount == 1);
bufferingmenu.addItem(102, "Medium", true, curbufamount == 2); bufferingmenu.addItem(102, "Medium", true, curbufamount == 2);
bufferingmenu.addItem(103, "Large", true, curbufamount == 3); bufferingmenu.addItem(103, "Large", true, curbufamount == 3);
@ -2349,6 +2404,8 @@ void RatioMixerEditor::resized()
for (int i = 0; i < nsliders; ++i) for (int i = 0; i < nsliders; ++i)
{ {
m_labels[i]->setBounds(m_ratio_level_sliders[i]->getX(), m_ratio_level_sliders[i]->getY() + 1, m_ratio_level_sliders[i]->getWidth() - 2 , 16); m_labels[i]->setBounds(m_ratio_level_sliders[i]->getX(), m_ratio_level_sliders[i]->getY() + 1, m_ratio_level_sliders[i]->getWidth() - 2 , 16);
m_ratio_level_sliders[i]->setMouseDragSensitivity(jmax(128, m_ratio_level_sliders[i]->getHeight()));
m_ratio_sliders[i]->setMouseDragSensitivity(jmax(128, m_ratio_sliders[i]->getWidth()));
} }
} }
@ -2367,6 +2424,15 @@ void RatioMixerEditor::timerCallback()
} }
} }
void RatioMixerEditor::setSlidersSnap(bool flag)
{
for (int i = 0; i < m_ratio_level_sliders.size(); ++i) {
m_ratio_level_sliders[i]->setSliderSnapsToMousePosition(flag);
m_ratio_sliders[i]->setSliderSnapsToMousePosition(flag);
}
}
void RatioMixerEditor::paint(Graphics & g) void RatioMixerEditor::paint(Graphics & g)
{ {
g.fillAll(Colour(0xff222222)); g.fillAll(Colour(0xff222222));
@ -2467,6 +2533,12 @@ void FreeFilterComponent::resized()
m_container.setBounds(contbounds); m_container.setBounds(contbounds);
slidbox.performLayout(contbounds); slidbox.performLayout(contbounds);
for (int i = 0; i < m_parcomps.size(); ++i)
{
if (auto * slid = m_parcomps[i]->getSlider()) {
slid->setMouseDragSensitivity(jmax(128, slid->getWidth() - slid->getTextBoxWidth()));
}
}
} }
void FreeFilterComponent::paint(Graphics & g) void FreeFilterComponent::paint(Graphics & g)
@ -2482,6 +2554,15 @@ void FreeFilterComponent::updateParameterComponents()
e->updateComponent(); e->updateComponent();
} }
void FreeFilterComponent::setSlidersSnap(bool flag)
{
for (auto& e : m_parcomps) {
if (auto * slid = e->getSlider())
slid->setSliderSnapsToMousePosition(flag);
}
}
ParameterGroupComponent::ParameterGroupComponent(const String & name_, int groupid, PaulstretchpluginAudioProcessor* proc, bool showtoggle) ParameterGroupComponent::ParameterGroupComponent(const String & name_, int groupid, PaulstretchpluginAudioProcessor* proc, bool showtoggle)
:name(name_), groupId(groupid), m_proc(proc), m_bgcolor(0xff1a1a1a), m_selbgcolor(0xff141f28) :name(name_), groupId(groupid), m_proc(proc), m_bgcolor(0xff1a1a1a), m_selbgcolor(0xff141f28)
{ {

View File

@ -297,6 +297,7 @@ public:
std::function<double(int which, int index)> GetParameterValue; std::function<double(int which, int index)> GetParameterValue;
void timerCallback() override; void timerCallback() override;
void paint(Graphics& g) override; void paint(Graphics& g) override;
void setSlidersSnap(bool flag);
private: private:
uptrvec<Slider> m_ratio_sliders; uptrvec<Slider> m_ratio_sliders;
uptrvec<Slider> m_ratio_level_sliders; uptrvec<Slider> m_ratio_level_sliders;
@ -311,6 +312,7 @@ public:
EnvelopeComponent* getEnvelopeComponent() { return &m_env; } EnvelopeComponent* getEnvelopeComponent() { return &m_env; }
void paint(Graphics &g) override; void paint(Graphics &g) override;
void updateParameterComponents(); void updateParameterComponents();
void setSlidersSnap(bool flag);
private: private:
EnvelopeComponent m_env; EnvelopeComponent m_env;
uptrvec<ParameterComponent> m_parcomps; uptrvec<ParameterComponent> m_parcomps;
@ -557,6 +559,8 @@ private:
bool isSpectrumProcGroupEnabled(int groupid); bool isSpectrumProcGroupEnabled(int groupid);
void setSpectrumProcGroupEnabled(int groupid, bool enabled); void setSpectrumProcGroupEnabled(int groupid, bool enabled);
void updateAllSliders();
CustomLookAndFeel m_lookandfeel; CustomLookAndFeel m_lookandfeel;
PaulstretchpluginAudioProcessor& processor; PaulstretchpluginAudioProcessor& processor;

View File

@ -91,7 +91,7 @@ m_bufferingthread("pspluginprebufferthread"), m_is_stand_alone_offline(is_stand_
m_free_filter_envelope->AddNode({ 0.0,0.75 }); m_free_filter_envelope->AddNode({ 0.0,0.75 });
m_free_filter_envelope->AddNode({ 1.0,0.75 }); m_free_filter_envelope->AddNode({ 1.0,0.75 });
m_free_filter_envelope->set_reset_nodes(m_free_filter_envelope->get_all_nodes()); m_free_filter_envelope->set_reset_nodes(m_free_filter_envelope->get_all_nodes());
m_recbuffer.setSize(2, 44100); m_recbuffer.setSize(2, 48000);
m_recbuffer.clear(); m_recbuffer.clear();
if (m_afm->getNumKnownFormats()==0) if (m_afm->getNumKnownFormats()==0)
m_afm->registerBasicFormats(); m_afm->registerBasicFormats();
@ -316,6 +316,7 @@ ValueTree PaulstretchpluginAudioProcessor::getStateTree(bool ignoreoptions, bool
storeToTreeProperties(paramtree, nullptr, "pluginwidth", mPluginWindowWidth); storeToTreeProperties(paramtree, nullptr, "pluginwidth", mPluginWindowWidth);
storeToTreeProperties(paramtree, nullptr, "pluginheight", mPluginWindowHeight); storeToTreeProperties(paramtree, nullptr, "pluginheight", mPluginWindowHeight);
storeToTreeProperties(paramtree, nullptr, "jumpsliders", m_use_jumpsliders);
return paramtree; return paramtree;
} }
@ -335,6 +336,7 @@ void PaulstretchpluginAudioProcessor::setStateFromTree(ValueTree tree)
getFromTreeProperties(tree, "tabaindex", m_cur_tab_index); getFromTreeProperties(tree, "tabaindex", m_cur_tab_index);
getFromTreeProperties(tree, "pluginwidth", mPluginWindowWidth); getFromTreeProperties(tree, "pluginwidth", mPluginWindowWidth);
getFromTreeProperties(tree, "pluginheight", mPluginWindowHeight); getFromTreeProperties(tree, "pluginheight", mPluginWindowHeight);
getFromTreeProperties(tree, "jumpsliders", m_use_jumpsliders);
if (tree.hasProperty("numspectralstagesb")) if (tree.hasProperty("numspectralstagesb"))
{ {
@ -561,17 +563,25 @@ void PaulstretchpluginAudioProcessor::saveCaptureBuffer()
{ {
auto task = [this]() auto task = [this]()
{ {
int inchans = *getIntParameter(cpi_num_inchans); int inchans = jmin(getMainBusNumInputChannels(), getIntParameter(cpi_num_inchans)->get());
if (inchans < 1) if (inchans < 1)
return; return;
Uuid uid; Uuid uid;
WavAudioFormat wavformat; WavAudioFormat wavformat;
String propsdir = m_propsfile->m_props_file->getFile().getParentDirectory().getFullPathName(); String outfn;
String outfn; if (m_capture_location.isEmpty()) {
if (m_capture_location.isEmpty()) File capdir;
outfn = propsdir + "/paulxstretchaudiocaptures/" + uid.toString() + ".wav"; #if JUCE_IOS
else capdir = File::getSpecialLocation(File::SpecialLocationType::userDocumentsDirectory);
outfn = m_capture_location + "/pxscapture_" + uid.toString() + ".wav"; outfn = capdir.getChildFile("Captures").getChildFile( uid.toString() + ".wav").getFullPathName();
#else
capdir = m_propsfile->m_props_file->getFile().getParentDirectory();
outfn = capdir.getChildFile("paulxstretchaudiocaptures").getChildFile( uid.toString() + ".wav").getFullPathName();
#endif
}
else {
outfn = File(m_capture_location).getChildFile("pxscapture_" + uid.toString() + ".wav").getFullPathName();
}
File outfile(outfn); File outfile(outfn);
outfile.create(); outfile.create();
if (outfile.existsAsFile()) if (outfile.existsAsFile())
@ -608,6 +618,8 @@ String PaulstretchpluginAudioProcessor::offlineRender(OfflineRenderParams render
{ {
File outputfiletouse = renderpars.outputfile.getNonexistentSibling(); File outputfiletouse = renderpars.outputfile.getNonexistentSibling();
ValueTree state{ getStateTree(false, false) }; ValueTree state{ getStateTree(false, false) };
// override this to always load file with state if possible
state.setProperty("loadfilewithstate", true, nullptr);
auto processor = std::make_shared<PaulstretchpluginAudioProcessor>(true); auto processor = std::make_shared<PaulstretchpluginAudioProcessor>(true);
processor->setNonRealtime(true); processor->setNonRealtime(true);
processor->setStateFromTree(state); processor->setStateFromTree(state);
@ -615,8 +627,9 @@ String PaulstretchpluginAudioProcessor::offlineRender(OfflineRenderParams render
double outsr{ renderpars.outsr }; double outsr{ renderpars.outsr };
if (outsr < 10.0) { if (outsr < 10.0) {
outsr = processor->getStretchSource()->getInfileSamplerate(); outsr = processor->getStretchSource()->getInfileSamplerate();
if (outsr < 10.0) if (outsr < 10.0) {
outsr = 44100; outsr = getSampleRateChecked();
}
} }
Logger::writeToLog(outputfiletouse.getFullPathName() + " " + String(outsr) + " " + String(renderpars.outputformat)); Logger::writeToLog(outputfiletouse.getFullPathName() + " " + String(outsr) + " " + String(renderpars.outputformat));
@ -633,9 +646,18 @@ String PaulstretchpluginAudioProcessor::offlineRender(OfflineRenderParams render
*(processor->getBoolParameter(cpi_pause_enabled)) = false; *(processor->getBoolParameter(cpi_pause_enabled)) = false;
if (m_using_memory_buffer) {
// copy it from the original
processor->m_recbuffer.makeCopyOf(m_recbuffer);
processor->m_using_memory_buffer = true;
}
sc->setMainVolume(*processor->getFloatParameter(cpi_main_volume)); sc->setMainVolume(*processor->getFloatParameter(cpi_main_volume));
sc->setRate(*processor->getFloatParameter(cpi_stretchamount)); sc->setRate(*processor->getFloatParameter(cpi_stretchamount));
sc->setPreviewDry(*processor->getBoolParameter(cpi_bypass_stretch));
sc->setDryPlayrate(*processor->getFloatParameter(cpi_dryplayrate)); sc->setDryPlayrate(*processor->getFloatParameter(cpi_dryplayrate));
sc->setPaused(false);
processor->setFFTSize(*processor->getFloatParameter(cpi_fftsize), true); processor->setFFTSize(*processor->getFloatParameter(cpi_fftsize), true);
processor->updateStretchParametersFromPluginParameters(processor->m_ppar); processor->updateStretchParametersFromPluginParameters(processor->m_ppar);
processor->setPlayConfigDetails(2, numoutchans, outsr, blocksize); processor->setPlayConfigDetails(2, numoutchans, outsr, blocksize);
@ -921,8 +943,8 @@ void PaulstretchpluginAudioProcessor::processBlock (AudioSampleBuffer& buffer, M
m_stretch_source->setFreezing(getParameter(cpi_freeze)); m_stretch_source->setFreezing(*getBoolParameter(cpi_freeze));
m_stretch_source->setPaused(getParameter(cpi_pause_enabled)); m_stretch_source->setPaused(*getBoolParameter(cpi_pause_enabled));
if (m_midinote_control == true) if (m_midinote_control == true)
{ {
MidiBuffer::Iterator midi_it(midiMessages); MidiBuffer::Iterator midi_it(midiMessages);
@ -1041,7 +1063,7 @@ void PaulstretchpluginAudioProcessor::setRecordingEnabled(bool b)
{ {
m_using_memory_buffer = true; m_using_memory_buffer = true;
m_current_file = URL(); m_current_file = URL();
int numchans = *m_inchansparam; int numchans = jmin(getMainBusNumInputChannels(), m_inchansparam->get());
m_recbuffer.setSize(numchans, m_max_reclen*getSampleRateChecked()+4096,false,false,true); m_recbuffer.setSize(numchans, m_max_reclen*getSampleRateChecked()+4096,false,false,true);
m_recbuffer.clear(); m_recbuffer.clear();
m_rec_pos = 0; m_rec_pos = 0;

View File

@ -249,6 +249,8 @@ public:
bool m_save_captured_audio = true; bool m_save_captured_audio = true;
String m_capture_location; String m_capture_location;
bool m_midinote_control = false; bool m_midinote_control = false;
bool m_use_jumpsliders = true;
std::function<void(const FileChooser&)> m_filechoose_callback; std::function<void(const FileChooser&)> m_filechoose_callback;
private: private:
bool m_prebuffering_inited = false; bool m_prebuffering_inited = false;

View File

@ -25,6 +25,7 @@ RenderSettingsComponent::RenderSettingsComponent (PaulstretchpluginAudioProcesso
m_proc = mc; m_proc = mc;
addAndMakeVisible(&m_labelMaxOutDuration); addAndMakeVisible(&m_labelMaxOutDuration);
m_labelMaxOutDuration.setText("Max output duration (hours) :", dontSendNotification); m_labelMaxOutDuration.setText("Max output duration (hours) :", dontSendNotification);
m_labelMaxOutDuration.setJustificationType(Justification::centredRight);
addAndMakeVisible(&m_editorMaxOutDuration); addAndMakeVisible(&m_editorMaxOutDuration);
m_editorMaxOutDuration.setText("1.0", dontSendNotification); m_editorMaxOutDuration.setText("1.0", dontSendNotification);
addAndMakeVisible(&m_toggleFloatClip); addAndMakeVisible(&m_toggleFloatClip);
@ -32,6 +33,7 @@ RenderSettingsComponent::RenderSettingsComponent (PaulstretchpluginAudioProcesso
m_toggleFloatClip.setToggleState(false, dontSendNotification); m_toggleFloatClip.setToggleState(false, dontSendNotification);
addAndMakeVisible(&labelSamplerate); addAndMakeVisible(&labelSamplerate);
labelSamplerate.setText("Sample rate :", dontSendNotification); labelSamplerate.setText("Sample rate :", dontSendNotification);
labelSamplerate.setJustificationType(Justification::centredRight);
addAndMakeVisible(&comboBoxSamplerate); addAndMakeVisible(&comboBoxSamplerate);
comboBoxSamplerate.addItem("Source sample rate", 1); comboBoxSamplerate.addItem("Source sample rate", 1);
comboBoxSamplerate.addItem("44100", 44100); comboBoxSamplerate.addItem("44100", 44100);
@ -43,6 +45,7 @@ RenderSettingsComponent::RenderSettingsComponent (PaulstretchpluginAudioProcesso
addAndMakeVisible(&labelBitDepth); addAndMakeVisible(&labelBitDepth);
labelBitDepth.setText("Format :", dontSendNotification); labelBitDepth.setText("Format :", dontSendNotification);
labelBitDepth.setJustificationType(Justification::centredRight);
addAndMakeVisible(&comboBoxBitDepth); addAndMakeVisible(&comboBoxBitDepth);
comboBoxBitDepth.addItem (TRANS("16 bit PCM"), 1); comboBoxBitDepth.addItem (TRANS("16 bit PCM"), 1);
comboBoxBitDepth.addItem (TRANS("24 bit PCM"), 2); comboBoxBitDepth.addItem (TRANS("24 bit PCM"), 2);
@ -64,7 +67,8 @@ RenderSettingsComponent::RenderSettingsComponent (PaulstretchpluginAudioProcesso
addAndMakeVisible(&label4); addAndMakeVisible(&label4);
label4.setText("Output file :\n", dontSendNotification); label4.setText("Output file :\n", dontSendNotification);
label4.setJustificationType(Justification::centredRight);
#if JUCE_IOS #if JUCE_IOS
addAndMakeVisible(&m_shareAfterRenderToggle); addAndMakeVisible(&m_shareAfterRenderToggle);
m_shareAfterRenderToggle.setButtonText("Share after render"); m_shareAfterRenderToggle.setButtonText("Share after render");
@ -120,7 +124,7 @@ void RenderSettingsComponent::paint (Graphics& g)
void RenderSettingsComponent::resized() void RenderSettingsComponent::resized()
{ {
int labelw = 100; int labelw = 100;
int medlabelw = 120; int medlabelw = 150;
int widelabelw = 210; int widelabelw = 210;
int itemh = 28; int itemh = 28;
int tallitemh = 40; int tallitemh = 40;
@ -168,7 +172,7 @@ void RenderSettingsComponent::resized()
FlexBox buttonbox; FlexBox buttonbox;
buttonbox.flexDirection = FlexBox::Direction::row; buttonbox.flexDirection = FlexBox::Direction::row;
buttonbox.items.add(FlexItem(minitemw, itemh).withFlex(1)); buttonbox.items.add(FlexItem(2, itemh).withFlex(1));
#if JUCE_IOS #if JUCE_IOS
buttonbox.items.add(FlexItem(labelw, itemh, m_shareAfterRenderToggle).withMargin(margin).withFlex(1)); buttonbox.items.add(FlexItem(labelw, itemh, m_shareAfterRenderToggle).withMargin(margin).withFlex(1));
buttonbox.items.add(FlexItem(4, itemh).withFlex(0.1).withMaxWidth(20)); buttonbox.items.add(FlexItem(4, itemh).withFlex(0.1).withMaxWidth(20));

View File

@ -56,7 +56,7 @@ private:
String ID_lastrenderpath{ "lastrenderpath" }; String ID_lastrenderpath{ "lastrenderpath" };
String ID_lastrendershare{ "lastrendershare" }; String ID_lastrendershare{ "lastrendershare" };
int prefHeight = 400; int prefHeight = 400;
int prefWidth = 420; int prefWidth = 480;
std::unique_ptr<FileChooser> m_filechooser; std::unique_ptr<FileChooser> m_filechooser;
bool pendingRender = false; bool pendingRender = false;
//============================================================================== //==============================================================================

View File

@ -88,7 +88,7 @@
</MAINGROUP> </MAINGROUP>
<EXPORTFORMATS> <EXPORTFORMATS>
<XCODE_IPHONE targetFolder="Builds/iOS" iosDevelopmentTeamID="XCS435894D" microphonePermissionNeeded="1" <XCODE_IPHONE targetFolder="Builds/iOS" iosDevelopmentTeamID="XCS435894D" microphonePermissionNeeded="1"
iosBackgroundAudio="1" buildNumber="103" iosScreenOrientation="UIInterfaceOrientationLandscapeLeft,UIInterfaceOrientationLandscapeRight,UIInterfaceOrientationPortrait,UIInterfaceOrientationPortraitUpsideDown" iosBackgroundAudio="1" buildNumber="104" iosScreenOrientation="UIInterfaceOrientationLandscapeLeft,UIInterfaceOrientationLandscapeRight,UIInterfaceOrientationPortrait,UIInterfaceOrientationPortraitUpsideDown"
iPadScreenOrientation="UIInterfaceOrientationLandscapeLeft,UIInterfaceOrientationLandscapeRight,UIInterfaceOrientationPortrait,UIInterfaceOrientationPortraitUpsideDown" iPadScreenOrientation="UIInterfaceOrientationLandscapeLeft,UIInterfaceOrientationLandscapeRight,UIInterfaceOrientationPortrait,UIInterfaceOrientationPortraitUpsideDown"
UIStatusBarHidden="0" UIRequiresFullScreen="0" customPList="&lt;plist version=&quot;1.0&quot;&gt;&#10;&lt;dict&gt;&#10;&#10;&#10;&lt;key&gt;ITSAppUsesNonExemptEncryption&lt;/key&gt;&#10;&#9;&lt;false/&gt;&#10;&#10;&lt;key&gt;UIStatusBarHidden&lt;/key&gt;&#10;&#9;&lt;false/&gt;&#10;&#9;&lt;key&gt;UIStatusBarStyle&lt;/key&gt;&#10;&#9;&lt;string&gt;UIStatusBarStyleLightContent&lt;/string&gt;&#10;&#10;&lt;key&gt;UIViewControllerBasedStatusBarAppearance&lt;/key&gt;&#10;&lt;false/&gt;&#10;&#10;&#10;&lt;key&gt;NSLocalNetworkUsageDescription&lt;/key&gt;&#10;&#9;&lt;string&gt;DrumJamPad uses networking to communicate with other local services&lt;/string&gt;&#10;&#10;&lt;key&gt;CFBundleDocumentTypes&lt;/key&gt;&#10;&#9;&lt;array&gt;&#10;&#9;&#9;&lt;dict&gt;&#10;&#9;&#9;&#9;&lt;key&gt;CFBundleTypeIconFiles&lt;/key&gt;&#10;&#9;&#9;&#9;&lt;array/&gt;&#10;&#9;&#9;&#9;&lt;key&gt;CFBundleTypeName&lt;/key&gt;&#10;&#9;&#9;&#9;&lt;string&gt;Audio File&lt;/string&gt;&#10;&#9;&#9;&#9;&lt;key&gt;CFBundleTypeRole&lt;/key&gt;&#10;&#9;&#9;&#9;&lt;string&gt;Viewer&lt;/string&gt;&#10;&#9;&#9;&#9;&lt;key&gt;LSHandlerRank&lt;/key&gt;&#10;&#9;&#9;&#9;&lt;string&gt;Owner&lt;/string&gt;&#10;&#9;&#9;&#9;&lt;key&gt;LSItemContentTypes&lt;/key&gt;&#10;&#9;&#9;&#9;&lt;array&gt;&#10;&#9;&#9;&#9;&#9;&lt;string&gt;com.microsoft.waveform-audio&lt;/string&gt;&#10;&#9;&#9;&#9;&#9;&lt;string&gt;public.aiff-audio&lt;/string&gt;&#10;&#9;&#9;&#9;&#9;&lt;string&gt;com.apple.coreaudio-format&lt;/string&gt;&#10;&#9;&#9;&#9;&#9;&lt;string&gt;public.mpeg-4-audio&lt;/string&gt;&#10;&#9;&#9;&#9;&#9;&lt;string&gt;public.mp3&lt;/string&gt;&#10;&#9;&#9;&#9;&lt;/array&gt;&#10;&#9;&#9;&lt;/dict&gt;&#10;&#9;&#9;&lt;/array&gt;&#10;&#10;&lt;/dict&gt;&#10;&lt;/plist&gt;" UIStatusBarHidden="0" UIRequiresFullScreen="0" customPList="&lt;plist version=&quot;1.0&quot;&gt;&#10;&lt;dict&gt;&#10;&#10;&#10;&lt;key&gt;ITSAppUsesNonExemptEncryption&lt;/key&gt;&#10;&#9;&lt;false/&gt;&#10;&#10;&lt;key&gt;UIStatusBarHidden&lt;/key&gt;&#10;&#9;&lt;false/&gt;&#10;&#9;&lt;key&gt;UIStatusBarStyle&lt;/key&gt;&#10;&#9;&lt;string&gt;UIStatusBarStyleLightContent&lt;/string&gt;&#10;&#10;&lt;key&gt;UIViewControllerBasedStatusBarAppearance&lt;/key&gt;&#10;&lt;false/&gt;&#10;&#10;&#10;&lt;key&gt;NSLocalNetworkUsageDescription&lt;/key&gt;&#10;&#9;&lt;string&gt;DrumJamPad uses networking to communicate with other local services&lt;/string&gt;&#10;&#10;&lt;key&gt;CFBundleDocumentTypes&lt;/key&gt;&#10;&#9;&lt;array&gt;&#10;&#9;&#9;&lt;dict&gt;&#10;&#9;&#9;&#9;&lt;key&gt;CFBundleTypeIconFiles&lt;/key&gt;&#10;&#9;&#9;&#9;&lt;array/&gt;&#10;&#9;&#9;&#9;&lt;key&gt;CFBundleTypeName&lt;/key&gt;&#10;&#9;&#9;&#9;&lt;string&gt;Audio File&lt;/string&gt;&#10;&#9;&#9;&#9;&lt;key&gt;CFBundleTypeRole&lt;/key&gt;&#10;&#9;&#9;&#9;&lt;string&gt;Viewer&lt;/string&gt;&#10;&#9;&#9;&#9;&lt;key&gt;LSHandlerRank&lt;/key&gt;&#10;&#9;&#9;&#9;&lt;string&gt;Owner&lt;/string&gt;&#10;&#9;&#9;&#9;&lt;key&gt;LSItemContentTypes&lt;/key&gt;&#10;&#9;&#9;&#9;&lt;array&gt;&#10;&#9;&#9;&#9;&#9;&lt;string&gt;com.microsoft.waveform-audio&lt;/string&gt;&#10;&#9;&#9;&#9;&#9;&lt;string&gt;public.aiff-audio&lt;/string&gt;&#10;&#9;&#9;&#9;&#9;&lt;string&gt;com.apple.coreaudio-format&lt;/string&gt;&#10;&#9;&#9;&#9;&#9;&lt;string&gt;public.mpeg-4-audio&lt;/string&gt;&#10;&#9;&#9;&#9;&#9;&lt;string&gt;public.mp3&lt;/string&gt;&#10;&#9;&#9;&#9;&lt;/array&gt;&#10;&#9;&#9;&lt;/dict&gt;&#10;&#9;&#9;&lt;/array&gt;&#10;&#10;&lt;/dict&gt;&#10;&lt;/plist&gt;"
UIFileSharingEnabled="1" UISupportsDocumentBrowser="1" extraDefs="PS_USE_VDSP_FFT=1" UIFileSharingEnabled="1" UISupportsDocumentBrowser="1" extraDefs="PS_USE_VDSP_FFT=1"