2016-06-09 21:33:26 +00:00
|
|
|
#ifndef __AMUSE_VSTBACKEND_HPP__
|
|
|
|
#define __AMUSE_VSTBACKEND_HPP__
|
|
|
|
|
2016-06-11 00:47:02 +00:00
|
|
|
#include "audioeffectx.h"
|
2016-06-09 21:33:26 +00:00
|
|
|
#include "VSTEditor.hpp"
|
|
|
|
#include <memory>
|
|
|
|
#include "optional.hpp"
|
|
|
|
|
|
|
|
#include "amuse/BooBackend.hpp"
|
|
|
|
#include "amuse/Engine.hpp"
|
|
|
|
#include "amuse/IBackendVoice.hpp"
|
|
|
|
#include "amuse/IBackendSubmix.hpp"
|
|
|
|
#include "amuse/IBackendVoiceAllocator.hpp"
|
2016-06-13 05:47:07 +00:00
|
|
|
#include "AudioGroupFilePresenter.hpp"
|
2016-06-09 21:33:26 +00:00
|
|
|
|
|
|
|
namespace amuse
|
|
|
|
{
|
|
|
|
class VSTBackend;
|
|
|
|
|
|
|
|
/** Backend voice allocator implementation for AudioUnit mixer */
|
|
|
|
class VSTBackendVoiceAllocator : public BooBackendVoiceAllocator
|
|
|
|
{
|
|
|
|
public:
|
|
|
|
VSTBackendVoiceAllocator(boo::IAudioVoiceEngine& booEngine)
|
|
|
|
: BooBackendVoiceAllocator(booEngine) {}
|
|
|
|
};
|
|
|
|
|
|
|
|
/** Actual plugin implementation class */
|
|
|
|
class VSTBackend : public AudioEffectX
|
|
|
|
{
|
2016-06-15 00:36:25 +00:00
|
|
|
std::mutex m_lock;
|
2016-06-09 21:33:26 +00:00
|
|
|
std::unique_ptr<boo::IAudioVoiceEngine> m_booBackend;
|
|
|
|
std::experimental::optional<amuse::VSTBackendVoiceAllocator> m_voxAlloc;
|
|
|
|
std::experimental::optional<amuse::Engine> m_engine;
|
2016-06-14 01:54:24 +00:00
|
|
|
std::shared_ptr<amuse::Sequencer> m_curSeq;
|
2016-06-15 00:36:25 +00:00
|
|
|
int m_reqGroup = -1;
|
|
|
|
int m_curGroup = -1;
|
2016-06-14 01:54:24 +00:00
|
|
|
const AudioGroupDataCollection* m_curData = nullptr;
|
2016-06-09 21:33:26 +00:00
|
|
|
size_t m_curFrame = 0;
|
2016-06-12 04:52:40 +00:00
|
|
|
std::wstring m_userDir;
|
2016-06-16 22:18:17 +00:00
|
|
|
int m_routeChannel = -1;
|
2016-06-13 05:47:07 +00:00
|
|
|
AudioGroupFilePresenter m_filePresenter;
|
2016-06-09 21:33:26 +00:00
|
|
|
VSTEditor m_editor;
|
|
|
|
public:
|
|
|
|
VSTBackend(audioMasterCallback cb);
|
2016-06-11 00:47:02 +00:00
|
|
|
~VSTBackend();
|
2016-06-09 21:33:26 +00:00
|
|
|
AEffEditor* getEditor();
|
|
|
|
VstInt32 processEvents(VstEvents* events);
|
|
|
|
void processReplacing(float** inputs, float** outputs, VstInt32 sampleFrames);
|
|
|
|
VstInt32 canDo(char* text);
|
|
|
|
VstPlugCategory getPlugCategory();
|
2016-06-11 00:47:02 +00:00
|
|
|
bool getEffectName(char* text);
|
2016-06-09 21:33:26 +00:00
|
|
|
bool getProductString(char* text);
|
|
|
|
bool getVendorString(char* text);
|
2016-06-11 00:47:02 +00:00
|
|
|
bool getProgramNameIndexed(VstInt32 category, VstInt32 index, char* text);
|
2016-06-09 21:33:26 +00:00
|
|
|
bool getOutputProperties(VstInt32 index, VstPinProperties* properties);
|
|
|
|
VstInt32 getNumMidiInputChannels();
|
|
|
|
void setSampleRate(float sampleRate);
|
|
|
|
void setBlockSize(VstInt32 blockSize);
|
2016-06-12 04:52:40 +00:00
|
|
|
|
|
|
|
amuse::Engine& getAmuseEngine() {return *m_engine;}
|
|
|
|
const std::wstring& getUserDir() const {return m_userDir;}
|
2016-06-13 05:47:07 +00:00
|
|
|
AudioGroupFilePresenter& getFilePresenter() {return m_filePresenter;}
|
2016-06-14 01:54:24 +00:00
|
|
|
|
2016-06-15 00:36:25 +00:00
|
|
|
void loadGroupFile(int collectionIdx, int fileIdx);
|
|
|
|
void setGroup(int groupIdx, bool immediate);
|
2016-06-16 22:18:17 +00:00
|
|
|
void _setNormalProgram(int programNo);
|
2016-06-14 01:54:24 +00:00
|
|
|
void setNormalProgram(int programNo);
|
2016-06-16 22:18:17 +00:00
|
|
|
void _setDrumProgram(int programNo);
|
2016-06-14 01:54:24 +00:00
|
|
|
void setDrumProgram(int programNo);
|
2016-06-14 08:04:37 +00:00
|
|
|
|
|
|
|
VstInt32 getChunk(void** data, bool isPreset);
|
|
|
|
VstInt32 setChunk(void* data, VstInt32 byteSize, bool isPreset);
|
2016-06-09 21:33:26 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
#endif // __AMUSE_VSTBACKEND_HPP__
|