fixed offline rendering bugs. more layout tweaks
This commit is contained in:
		@@ -82,7 +82,8 @@ public:
 | 
			
		||||
 | 
			
		||||
        : settings (settingsToUse, takeOwnershipOfSettings),
 | 
			
		||||
          channelConfiguration (channels),
 | 
			
		||||
          shouldMuteInput (! isInterAppAudioConnected()),
 | 
			
		||||
    shouldMuteInput(false),
 | 
			
		||||
    //shouldMuteInput (! isInterAppAudioConnected()),
 | 
			
		||||
          autoOpenMidiDevices (shouldAutoOpenMidiDevices)
 | 
			
		||||
    {
 | 
			
		||||
        createPlugin();
 | 
			
		||||
@@ -142,7 +143,7 @@ public:
 | 
			
		||||
        int outChannels = (channelConfiguration.size() > 0 ? channelConfiguration[0].numOuts
 | 
			
		||||
                                                           : processor->getMainBusNumOutputChannels());
 | 
			
		||||
 | 
			
		||||
        processorHasPotentialFeedbackLoop = (inChannels > 0 && outChannels > 0);
 | 
			
		||||
        // processorHasPotentialFeedbackLoop = (inChannels > 0 && outChannels > 0);
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    virtual void deletePlugin()
 | 
			
		||||
@@ -441,7 +442,7 @@ public:
 | 
			
		||||
    Array<PluginInOuts> channelConfiguration;
 | 
			
		||||
 | 
			
		||||
    // avoid feedback loop by default
 | 
			
		||||
    bool processorHasPotentialFeedbackLoop = true;
 | 
			
		||||
    bool processorHasPotentialFeedbackLoop = false; // or not
 | 
			
		||||
    Value shouldMuteInput;
 | 
			
		||||
    AudioBuffer<float> emptyBuffer;
 | 
			
		||||
    bool autoOpenMidiDevices = false;
 | 
			
		||||
@@ -547,12 +548,14 @@ private:
 | 
			
		||||
 | 
			
		||||
        player.audioDeviceAboutToStart (device);
 | 
			
		||||
        player.setMidiOutput (deviceManager.getDefaultMidiOutput());
 | 
			
		||||
        
 | 
			
		||||
 | 
			
		||||
#if 0
 | 
			
		||||
#if JUCE_IOS
 | 
			
		||||
        if (auto iosdevice = dynamic_cast<iOSAudioIODevice*> (deviceManager.getCurrentAudioDevice())) {
 | 
			
		||||
            processorHasPotentialFeedbackLoop = !iosdevice->isHeadphonesConnected() && device->getActiveInputChannels() > 0;
 | 
			
		||||
            shouldMuteInput.setValue(processorHasPotentialFeedbackLoop);
 | 
			
		||||
        }
 | 
			
		||||
#endif
 | 
			
		||||
#endif
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
 
 | 
			
		||||
@@ -282,9 +282,26 @@ void StretchAudioSource::setSpectralOrderPreset(int id)
 | 
			
		||||
void StretchAudioSource::getNextAudioBlock(const AudioSourceChannelInfo & bufferToFill)
 | 
			
		||||
{
 | 
			
		||||
	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;
 | 
			
		||||
	}
 | 
			
		||||
	double maingain = Decibels::decibelsToGain(m_main_volume);
 | 
			
		||||
 
 | 
			
		||||
@@ -142,7 +142,7 @@ private:
 | 
			
		||||
	
 | 
			
		||||
	bool m_freezing = false;
 | 
			
		||||
	
 | 
			
		||||
	int m_pause_state = 0;
 | 
			
		||||
	int m_pause_state = 2; // start paused
 | 
			
		||||
	Range<double> m_playrange{ 0.0,1.0 };
 | 
			
		||||
	int64_t m_rand_count = 0;
 | 
			
		||||
	
 | 
			
		||||
 
 | 
			
		||||
@@ -41,6 +41,23 @@ enum ParameterGroupIds
 | 
			
		||||
    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)
 | 
			
		||||
	: AudioProcessorEditor(&p),
 | 
			
		||||
@@ -510,7 +527,7 @@ void PaulstretchpluginAudioProcessorEditor::showRenderDialog()
 | 
			
		||||
{
 | 
			
		||||
	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);
 | 
			
		||||
	contentraw->setSize(prefw, prefh);
 | 
			
		||||
	std::unique_ptr<Component> content(contentraw);
 | 
			
		||||
@@ -526,49 +543,67 @@ void PaulstretchpluginAudioProcessorEditor::showAudioSetup()
 | 
			
		||||
 | 
			
		||||
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)
 | 
			
		||||
	{
 | 
			
		||||
		int caplen = m_capturelens[r - 200];
 | 
			
		||||
		*processor.getFloatParameter(cpi_max_capture_len) = (float)caplen;
 | 
			
		||||
	}
 | 
			
		||||
	else if (r == 1)
 | 
			
		||||
	else if (r == SettingsPlayHostTransId)
 | 
			
		||||
	{
 | 
			
		||||
		toggleBool(processor.m_play_when_host_plays);
 | 
			
		||||
	}
 | 
			
		||||
	else if (r == 2)
 | 
			
		||||
	else if (r == SettingsCaptureHostTransId)
 | 
			
		||||
	{
 | 
			
		||||
		toggleBool(processor.m_capture_when_host_plays);
 | 
			
		||||
	}
 | 
			
		||||
	else if (r == 8)
 | 
			
		||||
	else if (r == SettingsMutePassthruCaptureId)
 | 
			
		||||
	{
 | 
			
		||||
		toggleBool(processor.m_mute_while_capturing);
 | 
			
		||||
	}
 | 
			
		||||
    else if (r == 10)
 | 
			
		||||
    else if (r == SettingsMuteProcessedCaptureId)
 | 
			
		||||
    {
 | 
			
		||||
        toggleBool(processor.m_mute_processed_while_capturing);
 | 
			
		||||
    }
 | 
			
		||||
	else if (r == 4)
 | 
			
		||||
	else if (r == SettingsResetParametersId)
 | 
			
		||||
	{
 | 
			
		||||
		processor.resetParameters();
 | 
			
		||||
	}
 | 
			
		||||
	else if (r == 5)
 | 
			
		||||
	else if (r == SettingsLoadFileWithStateId)
 | 
			
		||||
	{
 | 
			
		||||
		toggleBool(processor.m_load_file_with_state);
 | 
			
		||||
	}
 | 
			
		||||
	else if (r == 9)
 | 
			
		||||
	else if (r == SettingsSaveCaptureDiskId)
 | 
			
		||||
	{
 | 
			
		||||
		toggleBool(processor.m_save_captured_audio);
 | 
			
		||||
	}
 | 
			
		||||
	else if (r == 3)
 | 
			
		||||
    else if (r == SettingsSliderSnapId)
 | 
			
		||||
    {
 | 
			
		||||
        toggleBool(processor.m_use_jumpsliders);
 | 
			
		||||
    }
 | 
			
		||||
	else if (r == SettingsAboutId)
 | 
			
		||||
	{
 | 
			
		||||
		showAbout();
 | 
			
		||||
	}
 | 
			
		||||
    else if (r == 11)
 | 
			
		||||
    else if (r == SettingsAudioSettingsId)
 | 
			
		||||
    {
 | 
			
		||||
        showAudioSetup();
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
	else if (r == 6)
 | 
			
		||||
	else if (r == SettingsDumpPresetClipboardId)
 | 
			
		||||
	{
 | 
			
		||||
		ValueTree tree = processor.getStateTree(true, true);
 | 
			
		||||
		MemoryBlock destData;
 | 
			
		||||
@@ -577,18 +612,31 @@ void PaulstretchpluginAudioProcessorEditor::executeModalMenuAction(int menuid, i
 | 
			
		||||
		String txt = Base64::toBase64(destData.getData(), destData.getSize());
 | 
			
		||||
		SystemClipboard::copyTextToClipboard(txt);
 | 
			
		||||
	}
 | 
			
		||||
	else if (r == 7)
 | 
			
		||||
	else if (r == SettingsShowTechInfoId)
 | 
			
		||||
	{
 | 
			
		||||
		toggleBool(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)
 | 
			
		||||
{
 | 
			
		||||
	g.fillAll(Colour(0xff404040));
 | 
			
		||||
    // g.fillAll(Colour(0xff404040));
 | 
			
		||||
    g.fillAll(Colour(0xff303030));
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
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());
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
        updateAllSliders();
 | 
			
		||||
 | 
			
		||||
		//m_parcomps[cpi_dryplayrate]->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()
 | 
			
		||||
{
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
    PopupMenu m_settings_menu;
 | 
			
		||||
    if (JUCEApplicationBase::isStandaloneApp()) {
 | 
			
		||||
        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.addItem(5, "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(2, "Capture when host transport running", true, processor.m_capture_when_host_plays);
 | 
			
		||||
	m_settings_menu.addItem(SettingsLoadFileWithStateId, "Load file with plugin state", true, processor.m_load_file_with_state);
 | 
			
		||||
	m_settings_menu.addItem(SettingsPlayHostTransId, "Play when host transport running", true, processor.m_play_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.addItem(8, "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(9, "Save captured audio to disk", true, processor.m_save_captured_audio);
 | 
			
		||||
	m_settings_menu.addItem(SettingsMutePassthruCaptureId, "Mute passthrough while capturing", true, processor.m_mute_while_capturing);
 | 
			
		||||
    m_settings_menu.addItem(SettingsMuteProcessedCaptureId, "Mute processed audio output while capturing", true, processor.m_mute_processed_while_capturing);
 | 
			
		||||
	m_settings_menu.addItem(SettingsSaveCaptureDiskId, "Save captured audio to disk", true, processor.m_save_captured_audio);
 | 
			
		||||
	int capturelen = *processor.getFloatParameter(cpi_max_capture_len);
 | 
			
		||||
	PopupMenu capturelenmenu;
 | 
			
		||||
	
 | 
			
		||||
@@ -1090,11 +1142,12 @@ void PaulstretchpluginAudioProcessorEditor::showSettingsMenu()
 | 
			
		||||
	m_settings_menu.addSubMenu("Capture buffer length", capturelenmenu);
 | 
			
		||||
	
 | 
			
		||||
    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
 | 
			
		||||
	m_settings_menu.addItem(6, "Dump preset to clipboard", true, false);
 | 
			
		||||
	m_settings_menu.addItem(SettingsDumpPresetClipboardId, "Dump preset to clipboard", true, false);
 | 
			
		||||
#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);
 | 
			
		||||
#if JUCE_IOS
 | 
			
		||||
@@ -1967,6 +2020,8 @@ void ParameterComponent::resized()
 | 
			
		||||
        }
 | 
			
		||||
		m_label.setBounds(0, 0, labw, 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) {
 | 
			
		||||
		m_togglebut->setBounds(1, 0, getWidth() - 1, h);
 | 
			
		||||
@@ -2127,7 +2182,7 @@ void PerfMeterComponent::mouseDown(const MouseEvent & ev)
 | 
			
		||||
{
 | 
			
		||||
	PopupMenu bufferingmenu;
 | 
			
		||||
	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(102, "Medium", true, curbufamount == 2);
 | 
			
		||||
	bufferingmenu.addItem(103, "Large", true, curbufamount == 3);
 | 
			
		||||
@@ -2349,6 +2404,8 @@ void RatioMixerEditor::resized()
 | 
			
		||||
    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_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)
 | 
			
		||||
{
 | 
			
		||||
	g.fillAll(Colour(0xff222222));
 | 
			
		||||
@@ -2467,6 +2533,12 @@ void FreeFilterComponent::resized()
 | 
			
		||||
    m_container.setBounds(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)
 | 
			
		||||
@@ -2482,6 +2554,15 @@ void FreeFilterComponent::updateParameterComponents()
 | 
			
		||||
		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)
 | 
			
		||||
:name(name_), groupId(groupid), m_proc(proc), m_bgcolor(0xff1a1a1a), m_selbgcolor(0xff141f28)
 | 
			
		||||
{
 | 
			
		||||
 
 | 
			
		||||
@@ -297,6 +297,7 @@ public:
 | 
			
		||||
	std::function<double(int which, int index)> GetParameterValue;
 | 
			
		||||
	void timerCallback() override;
 | 
			
		||||
	void paint(Graphics& g) override;
 | 
			
		||||
    void setSlidersSnap(bool flag);
 | 
			
		||||
private:
 | 
			
		||||
	uptrvec<Slider> m_ratio_sliders;
 | 
			
		||||
	uptrvec<Slider> m_ratio_level_sliders;
 | 
			
		||||
@@ -311,6 +312,7 @@ public:
 | 
			
		||||
	EnvelopeComponent* getEnvelopeComponent() { return &m_env; }
 | 
			
		||||
	void paint(Graphics &g) override;
 | 
			
		||||
	void updateParameterComponents();
 | 
			
		||||
    void setSlidersSnap(bool flag);
 | 
			
		||||
private:
 | 
			
		||||
	EnvelopeComponent m_env;
 | 
			
		||||
	uptrvec<ParameterComponent> m_parcomps;
 | 
			
		||||
@@ -557,6 +559,8 @@ private:
 | 
			
		||||
    bool isSpectrumProcGroupEnabled(int groupid);
 | 
			
		||||
    void setSpectrumProcGroupEnabled(int groupid, bool enabled);
 | 
			
		||||
 | 
			
		||||
    void updateAllSliders();
 | 
			
		||||
 | 
			
		||||
    CustomLookAndFeel m_lookandfeel;
 | 
			
		||||
 | 
			
		||||
	PaulstretchpluginAudioProcessor& processor;
 | 
			
		||||
 
 | 
			
		||||
@@ -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({ 1.0,0.75 });
 | 
			
		||||
	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();
 | 
			
		||||
	if (m_afm->getNumKnownFormats()==0)
 | 
			
		||||
		m_afm->registerBasicFormats();
 | 
			
		||||
@@ -316,6 +316,7 @@ ValueTree PaulstretchpluginAudioProcessor::getStateTree(bool ignoreoptions, bool
 | 
			
		||||
 | 
			
		||||
    storeToTreeProperties(paramtree, nullptr, "pluginwidth", mPluginWindowWidth);
 | 
			
		||||
    storeToTreeProperties(paramtree, nullptr, "pluginheight", mPluginWindowHeight);
 | 
			
		||||
    storeToTreeProperties(paramtree, nullptr, "jumpsliders", m_use_jumpsliders);
 | 
			
		||||
 | 
			
		||||
    return paramtree;
 | 
			
		||||
}
 | 
			
		||||
@@ -335,6 +336,7 @@ void PaulstretchpluginAudioProcessor::setStateFromTree(ValueTree tree)
 | 
			
		||||
			getFromTreeProperties(tree, "tabaindex", m_cur_tab_index);
 | 
			
		||||
            getFromTreeProperties(tree, "pluginwidth", mPluginWindowWidth);
 | 
			
		||||
            getFromTreeProperties(tree, "pluginheight", mPluginWindowHeight);
 | 
			
		||||
            getFromTreeProperties(tree, "jumpsliders", m_use_jumpsliders);
 | 
			
		||||
 | 
			
		||||
			if (tree.hasProperty("numspectralstagesb"))
 | 
			
		||||
			{
 | 
			
		||||
@@ -561,17 +563,25 @@ void PaulstretchpluginAudioProcessor::saveCaptureBuffer()
 | 
			
		||||
{
 | 
			
		||||
	auto task = [this]()
 | 
			
		||||
	{
 | 
			
		||||
		int inchans = *getIntParameter(cpi_num_inchans);
 | 
			
		||||
		int inchans = jmin(getMainBusNumInputChannels(), getIntParameter(cpi_num_inchans)->get());
 | 
			
		||||
		if (inchans < 1)
 | 
			
		||||
			return;
 | 
			
		||||
		Uuid uid;
 | 
			
		||||
		WavAudioFormat wavformat;
 | 
			
		||||
		String propsdir = m_propsfile->m_props_file->getFile().getParentDirectory().getFullPathName();
 | 
			
		||||
		String outfn;
 | 
			
		||||
		if (m_capture_location.isEmpty())
 | 
			
		||||
			outfn = propsdir + "/paulxstretchaudiocaptures/" + uid.toString() + ".wav";
 | 
			
		||||
		else
 | 
			
		||||
			outfn = m_capture_location + "/pxscapture_" + uid.toString() + ".wav";
 | 
			
		||||
        String outfn;
 | 
			
		||||
        if (m_capture_location.isEmpty()) {
 | 
			
		||||
            File capdir;
 | 
			
		||||
#if JUCE_IOS
 | 
			
		||||
            capdir = File::getSpecialLocation(File::SpecialLocationType::userDocumentsDirectory);
 | 
			
		||||
            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);
 | 
			
		||||
		outfile.create();
 | 
			
		||||
		if (outfile.existsAsFile())
 | 
			
		||||
@@ -608,6 +618,8 @@ String PaulstretchpluginAudioProcessor::offlineRender(OfflineRenderParams render
 | 
			
		||||
{
 | 
			
		||||
	File outputfiletouse = renderpars.outputfile.getNonexistentSibling();
 | 
			
		||||
	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);
 | 
			
		||||
	processor->setNonRealtime(true);
 | 
			
		||||
	processor->setStateFromTree(state);
 | 
			
		||||
@@ -615,8 +627,9 @@ String PaulstretchpluginAudioProcessor::offlineRender(OfflineRenderParams render
 | 
			
		||||
    double outsr{ renderpars.outsr };
 | 
			
		||||
    if (outsr < 10.0) {
 | 
			
		||||
        outsr = processor->getStretchSource()->getInfileSamplerate();
 | 
			
		||||
        if (outsr < 10.0)
 | 
			
		||||
            outsr = 44100;
 | 
			
		||||
        if (outsr < 10.0) {
 | 
			
		||||
            outsr = getSampleRateChecked();
 | 
			
		||||
        }
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    Logger::writeToLog(outputfiletouse.getFullPathName() + " " + String(outsr) + " " + String(renderpars.outputformat));
 | 
			
		||||
@@ -633,9 +646,18 @@ String PaulstretchpluginAudioProcessor::offlineRender(OfflineRenderParams render
 | 
			
		||||
 | 
			
		||||
    *(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->setRate(*processor->getFloatParameter(cpi_stretchamount));
 | 
			
		||||
    sc->setPreviewDry(*processor->getBoolParameter(cpi_bypass_stretch));
 | 
			
		||||
	sc->setDryPlayrate(*processor->getFloatParameter(cpi_dryplayrate));
 | 
			
		||||
    sc->setPaused(false);
 | 
			
		||||
 | 
			
		||||
	processor->setFFTSize(*processor->getFloatParameter(cpi_fftsize), true);
 | 
			
		||||
	processor->updateStretchParametersFromPluginParameters(processor->m_ppar);
 | 
			
		||||
	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->setPaused(getParameter(cpi_pause_enabled));
 | 
			
		||||
	m_stretch_source->setFreezing(*getBoolParameter(cpi_freeze));
 | 
			
		||||
	m_stretch_source->setPaused(*getBoolParameter(cpi_pause_enabled));
 | 
			
		||||
	if (m_midinote_control == true)
 | 
			
		||||
	{
 | 
			
		||||
		MidiBuffer::Iterator midi_it(midiMessages);
 | 
			
		||||
@@ -1041,7 +1063,7 @@ void PaulstretchpluginAudioProcessor::setRecordingEnabled(bool b)
 | 
			
		||||
	{
 | 
			
		||||
		m_using_memory_buffer = true;
 | 
			
		||||
		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.clear();
 | 
			
		||||
		m_rec_pos = 0;
 | 
			
		||||
 
 | 
			
		||||
@@ -249,6 +249,8 @@ public:
 | 
			
		||||
	bool m_save_captured_audio = true;
 | 
			
		||||
	String m_capture_location;
 | 
			
		||||
	bool m_midinote_control = false;
 | 
			
		||||
    bool m_use_jumpsliders = true;
 | 
			
		||||
 | 
			
		||||
	std::function<void(const FileChooser&)> m_filechoose_callback;
 | 
			
		||||
private:
 | 
			
		||||
	bool m_prebuffering_inited = false;
 | 
			
		||||
 
 | 
			
		||||
@@ -25,6 +25,7 @@ RenderSettingsComponent::RenderSettingsComponent (PaulstretchpluginAudioProcesso
 | 
			
		||||
    m_proc = mc;
 | 
			
		||||
	addAndMakeVisible(&m_labelMaxOutDuration);
 | 
			
		||||
	m_labelMaxOutDuration.setText("Max output duration (hours) :", dontSendNotification);
 | 
			
		||||
    m_labelMaxOutDuration.setJustificationType(Justification::centredRight);
 | 
			
		||||
	addAndMakeVisible(&m_editorMaxOutDuration);
 | 
			
		||||
	m_editorMaxOutDuration.setText("1.0", dontSendNotification);
 | 
			
		||||
	addAndMakeVisible(&m_toggleFloatClip);
 | 
			
		||||
@@ -32,6 +33,7 @@ RenderSettingsComponent::RenderSettingsComponent (PaulstretchpluginAudioProcesso
 | 
			
		||||
	m_toggleFloatClip.setToggleState(false, dontSendNotification);
 | 
			
		||||
	addAndMakeVisible(&labelSamplerate);
 | 
			
		||||
	labelSamplerate.setText("Sample rate :", dontSendNotification);
 | 
			
		||||
    labelSamplerate.setJustificationType(Justification::centredRight);
 | 
			
		||||
	addAndMakeVisible(&comboBoxSamplerate);
 | 
			
		||||
    comboBoxSamplerate.addItem("Source sample rate", 1);
 | 
			
		||||
	comboBoxSamplerate.addItem("44100", 44100);
 | 
			
		||||
@@ -43,6 +45,7 @@ RenderSettingsComponent::RenderSettingsComponent (PaulstretchpluginAudioProcesso
 | 
			
		||||
 | 
			
		||||
	addAndMakeVisible(&labelBitDepth);
 | 
			
		||||
	labelBitDepth.setText("Format :", dontSendNotification);
 | 
			
		||||
    labelBitDepth.setJustificationType(Justification::centredRight);
 | 
			
		||||
	addAndMakeVisible(&comboBoxBitDepth);
 | 
			
		||||
    comboBoxBitDepth.addItem (TRANS("16 bit PCM"), 1);
 | 
			
		||||
    comboBoxBitDepth.addItem (TRANS("24 bit PCM"), 2);
 | 
			
		||||
@@ -64,7 +67,8 @@ RenderSettingsComponent::RenderSettingsComponent (PaulstretchpluginAudioProcesso
 | 
			
		||||
 | 
			
		||||
	addAndMakeVisible(&label4);
 | 
			
		||||
	label4.setText("Output file :\n", dontSendNotification);
 | 
			
		||||
    
 | 
			
		||||
    label4.setJustificationType(Justification::centredRight);
 | 
			
		||||
 | 
			
		||||
#if JUCE_IOS
 | 
			
		||||
    addAndMakeVisible(&m_shareAfterRenderToggle);
 | 
			
		||||
    m_shareAfterRenderToggle.setButtonText("Share after render");
 | 
			
		||||
@@ -120,7 +124,7 @@ void RenderSettingsComponent::paint (Graphics& g)
 | 
			
		||||
void RenderSettingsComponent::resized()
 | 
			
		||||
{
 | 
			
		||||
	int labelw = 100;
 | 
			
		||||
    int medlabelw = 120;
 | 
			
		||||
    int medlabelw = 150;
 | 
			
		||||
    int widelabelw = 210;
 | 
			
		||||
	int itemh = 28;
 | 
			
		||||
    int tallitemh = 40;
 | 
			
		||||
@@ -168,7 +172,7 @@ void RenderSettingsComponent::resized()
 | 
			
		||||
 | 
			
		||||
    FlexBox buttonbox;
 | 
			
		||||
    buttonbox.flexDirection = FlexBox::Direction::row;
 | 
			
		||||
    buttonbox.items.add(FlexItem(minitemw, itemh).withFlex(1));
 | 
			
		||||
    buttonbox.items.add(FlexItem(2, itemh).withFlex(1));
 | 
			
		||||
#if JUCE_IOS
 | 
			
		||||
    buttonbox.items.add(FlexItem(labelw, itemh, m_shareAfterRenderToggle).withMargin(margin).withFlex(1));
 | 
			
		||||
    buttonbox.items.add(FlexItem(4, itemh).withFlex(0.1).withMaxWidth(20));
 | 
			
		||||
 
 | 
			
		||||
@@ -56,7 +56,7 @@ private:
 | 
			
		||||
	String ID_lastrenderpath{ "lastrenderpath" };
 | 
			
		||||
    String ID_lastrendershare{ "lastrendershare" };
 | 
			
		||||
    int prefHeight = 400;
 | 
			
		||||
    int prefWidth = 420;
 | 
			
		||||
    int prefWidth = 480;
 | 
			
		||||
    std::unique_ptr<FileChooser> m_filechooser;
 | 
			
		||||
    bool pendingRender = false;
 | 
			
		||||
	//==============================================================================
 | 
			
		||||
 
 | 
			
		||||
@@ -88,7 +88,7 @@
 | 
			
		||||
  </MAINGROUP>
 | 
			
		||||
  <EXPORTFORMATS>
 | 
			
		||||
    <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"
 | 
			
		||||
                  UIStatusBarHidden="0" UIRequiresFullScreen="0" customPList="<plist version="1.0">
<dict>


<key>ITSAppUsesNonExemptEncryption</key>
	<false/>

<key>UIStatusBarHidden</key>
	<false/>
	<key>UIStatusBarStyle</key>
	<string>UIStatusBarStyleLightContent</string>

<key>UIViewControllerBasedStatusBarAppearance</key>
<false/>


<key>NSLocalNetworkUsageDescription</key>
	<string>DrumJamPad uses networking to communicate with other local services</string>

<key>CFBundleDocumentTypes</key>
	<array>
		<dict>
			<key>CFBundleTypeIconFiles</key>
			<array/>
			<key>CFBundleTypeName</key>
			<string>Audio File</string>
			<key>CFBundleTypeRole</key>
			<string>Viewer</string>
			<key>LSHandlerRank</key>
			<string>Owner</string>
			<key>LSItemContentTypes</key>
			<array>
				<string>com.microsoft.waveform-audio</string>
				<string>public.aiff-audio</string>
				<string>com.apple.coreaudio-format</string>
				<string>public.mpeg-4-audio</string>
				<string>public.mp3</string>
			</array>
		</dict>
		</array>

</dict>
</plist>"
 | 
			
		||||
                  UIFileSharingEnabled="1" UISupportsDocumentBrowser="1" extraDefs="PS_USE_VDSP_FFT=1"
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user