Add support for some custom VST opcodes

This commit is contained in:
xenakios 2018-04-25 15:25:29 +03:00
parent 2f3a526291
commit 2d493d6d81
2 changed files with 42 additions and 1 deletions

View File

@ -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;

View File

@ -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<AudioParameterBool*, 9> m_sm_enab_pars;
double m_outlen = 0.0;
//==============================================================================
JUCE_DECLARE_NON_COPYABLE_WITH_LEAK_DETECTOR (PaulstretchpluginAudioProcessor)
};