mirror of
https://github.com/AxioDL/amuse.git
synced 2025-12-08 21:17:49 +00:00
Initial work on VST editor UI
This commit is contained in:
@@ -71,8 +71,8 @@ struct VSTVoiceEngine : boo::BaseAudioVoiceEngine
|
||||
|
||||
VSTVoiceEngine()
|
||||
{
|
||||
m_mixInfo.m_periodFrames = 512;
|
||||
m_mixInfo.m_sampleRate = 96000.0;
|
||||
m_mixInfo.m_periodFrames = 1024;
|
||||
m_mixInfo.m_sampleRate = 44100.0;
|
||||
m_mixInfo.m_sampleFormat = SOXR_FLOAT32_I;
|
||||
m_mixInfo.m_bitsPerSample = 32;
|
||||
_buildAudioRenderClient();
|
||||
@@ -131,17 +131,23 @@ static logvisor::Module Log("amuse::AudioUnitBackend");
|
||||
VSTBackend::VSTBackend(audioMasterCallback cb)
|
||||
: AudioEffectX(cb, 0, 0), m_editor(*this)
|
||||
{
|
||||
isSynth();
|
||||
setUniqueID(kBackendID);
|
||||
setNumInputs(0);
|
||||
setNumOutputs(2);
|
||||
canProcessReplacing();
|
||||
setEditor(&m_editor);
|
||||
sizeWindow(800, 520);
|
||||
|
||||
m_booBackend = std::make_unique<VSTVoiceEngine>();
|
||||
m_voxAlloc.emplace(*m_booBackend);
|
||||
m_engine.emplace(*m_voxAlloc);
|
||||
}
|
||||
|
||||
VSTBackend::~VSTBackend()
|
||||
{
|
||||
editor = nullptr;
|
||||
}
|
||||
|
||||
AEffEditor* VSTBackend::getEditor()
|
||||
{
|
||||
return &m_editor;
|
||||
@@ -151,6 +157,16 @@ VstInt32 VSTBackend::processEvents(VstEvents* events)
|
||||
{
|
||||
VSTVoiceEngine& engine = static_cast<VSTVoiceEngine&>(*m_booBackend);
|
||||
|
||||
/* Handle group load request */
|
||||
int reqGroup = engine.m_reqGroup;
|
||||
if (engine.m_curGroup != reqGroup)
|
||||
{
|
||||
engine.m_curGroup = reqGroup;
|
||||
if (engine.m_curSeq)
|
||||
engine.m_curSeq->kill();
|
||||
engine.m_curSeq = m_engine->seqPlay(reqGroup, -1, nullptr);
|
||||
}
|
||||
|
||||
if (engine.m_midiReceiver)
|
||||
{
|
||||
for (VstInt32 i=0 ; i<events->numEvents ; ++i)
|
||||
@@ -172,16 +188,6 @@ void VSTBackend::processReplacing(float**, float** outputs, VstInt32 sampleFrame
|
||||
{
|
||||
VSTVoiceEngine& engine = static_cast<VSTVoiceEngine&>(*m_booBackend);
|
||||
|
||||
/* Handle group load request */
|
||||
int reqGroup = engine.m_reqGroup;
|
||||
if (engine.m_curGroup != reqGroup)
|
||||
{
|
||||
engine.m_curGroup = reqGroup;
|
||||
if (engine.m_curSeq)
|
||||
engine.m_curSeq->kill();
|
||||
engine.m_curSeq = m_engine->seqPlay(reqGroup, -1, nullptr);
|
||||
}
|
||||
|
||||
/* Output buffers */
|
||||
engine.m_renderFrames = sampleFrames;
|
||||
engine.m_outputData = outputs;
|
||||
@@ -207,6 +213,12 @@ VstPlugCategory VSTBackend::getPlugCategory()
|
||||
return kPlugCategSynth;
|
||||
}
|
||||
|
||||
bool VSTBackend::getEffectName(char* text)
|
||||
{
|
||||
strcpy(text, "Amuse");
|
||||
return true;
|
||||
}
|
||||
|
||||
bool VSTBackend::getProductString(char* text)
|
||||
{
|
||||
strcpy(text, "Amuse");
|
||||
@@ -219,6 +231,12 @@ bool VSTBackend::getVendorString(char* text)
|
||||
return true;
|
||||
}
|
||||
|
||||
bool VSTBackend::getProgramNameIndexed(VstInt32 category, VstInt32 index, char* text)
|
||||
{
|
||||
strcpy(text, "Sampler");
|
||||
return true;
|
||||
}
|
||||
|
||||
bool VSTBackend::getOutputProperties(VstInt32 index, VstPinProperties* properties)
|
||||
{
|
||||
bool returnCode = false;
|
||||
@@ -226,6 +244,7 @@ bool VSTBackend::getOutputProperties(VstInt32 index, VstPinProperties* propertie
|
||||
{
|
||||
strcpy(properties->label, "Amuse Out");
|
||||
properties->flags = kVstPinIsStereo | kVstPinIsActive;
|
||||
properties->arrangementType = kSpeakerArrStereo;
|
||||
returnCode = true;
|
||||
}
|
||||
return returnCode;
|
||||
@@ -247,12 +266,13 @@ void VSTBackend::setBlockSize(VstInt32 blockSize)
|
||||
{
|
||||
AudioEffectX::setBlockSize(blockSize);
|
||||
VSTVoiceEngine& engine = static_cast<VSTVoiceEngine&>(*m_booBackend);
|
||||
engine.m_interleavedBuf.resize(blockSize * 2);
|
||||
engine._rebuildAudioRenderClient(engine.mixInfo().m_sampleRate, blockSize);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
AudioEffect* createEffectInstance(audioMasterCallback audioMaster)
|
||||
{
|
||||
return new VSTBackend(audioMaster);
|
||||
}
|
||||
|
||||
return new amuse::VSTBackend(audioMaster);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user