diff --git a/Source/PluginProcessor.cpp b/Source/PluginProcessor.cpp index 746ed11..ce0fcbe 100644 --- a/Source/PluginProcessor.cpp +++ b/Source/PluginProcessor.cpp @@ -845,6 +845,36 @@ void PaulstretchpluginAudioProcessor::timerCallback(int id) } } +pointer_sized_int PaulstretchpluginAudioProcessor::handleVstPluginCanDo(int32 index, pointer_sized_int value, void * ptr, float opt) +{ + if (strcmp((char*)ptr, "xenakios") == 0) + { + if (index == 0) + { + double t0 = *getFloatParameter(cpi_soundstart); + double t1 = *getFloatParameter(cpi_soundend); + m_outlen = (t1-t0)*m_stretch_source->getInfileLengthSeconds()*(*getFloatParameter(cpi_stretchamount)); + std::cout << "host requested output length, result " << m_outlen << "\n"; + return pointer_sized_int(&m_outlen); + } + if (index == 1 && (void*)value!=nullptr) + { + String fn(CharPointer_UTF8((char*)value)); + std::cout << "host requested to set audio file " << fn << "\n"; + auto err = setAudioFile(File(fn)); + std::cout << err << "\n"; + } + return 1; + } + + return pointer_sized_int(); +} + +pointer_sized_int PaulstretchpluginAudioProcessor::handleVstManufacturerSpecific(int32 index, pointer_sized_int value, void * ptr, float opt) +{ + return pointer_sized_int(); +} + void PaulstretchpluginAudioProcessor::finishRecording(int lenrecording) { m_is_recording = false; diff --git a/Source/PluginProcessor.h b/Source/PluginProcessor.h index bca768e..bf73124 100644 --- a/Source/PluginProcessor.h +++ b/Source/PluginProcessor.h @@ -115,7 +115,7 @@ public: class PaulstretchpluginAudioProcessorEditor; class PaulstretchpluginAudioProcessor : public AudioProcessor, - public MultiTimer + public MultiTimer, public VSTCallbackHandler { public: using EditorType = PaulstretchpluginAudioProcessorEditor; @@ -202,6 +202,16 @@ public: shared_envelope m_free_filter_envelope; bool m_import_dlg_open = false; + pointer_sized_int handleVstPluginCanDo(int32 index, + pointer_sized_int value, + void* ptr, + float opt) override; + + pointer_sized_int handleVstManufacturerSpecific(int32 index, + pointer_sized_int value, + void* ptr, + float opt) override; + private: @@ -244,6 +254,7 @@ private: float m_cur_playrangeoffset = 0.0; void updateStretchParametersFromPluginParameters(ProcessParameters& pars); std::array m_sm_enab_pars; + double m_outlen = 0.0; //============================================================================== JUCE_DECLARE_NON_COPYABLE_WITH_LEAK_DETECTOR (PaulstretchpluginAudioProcessor) };