rt-vamp-plugin-sdk 0.3.1
Real-time Vamp plugin SDK for C++20
Loading...
Searching...
No Matches
PluginHostAdapter.hpp
Go to the documentation of this file.
1#pragma once
2
3#include <cstdint>
4#include <filesystem>
5#include <memory>
6#include <optional>
7#include <string_view>
8#include <vector>
9
11
12// forward declarations
13struct _VampPluginDescriptor; // NOLINT
14typedef _VampPluginDescriptor VampPluginDescriptor; // NOLINT
15typedef void* VampPluginHandle; // NOLINT
16
17namespace rtvamp::hostsdk {
18
19class DynamicLibrary;
20
21class PluginHostAdapter : public Plugin {
22public:
24 const VampPluginDescriptor& descriptor,
25 float inputSampleRate,
26 std::shared_ptr<DynamicLibrary> library = nullptr // extend lifetime of dl handle
27 );
29
34
35 std::filesystem::path getLibraryPath() const noexcept override;
36
37 uint32_t getVampApiVersion() const noexcept override;
38
39 std::string_view getIdentifier() const noexcept override;
40 std::string_view getName() const noexcept override;
41 std::string_view getDescription() const noexcept override;
42 std::string_view getMaker() const noexcept override;
43 std::string_view getCopyright() const noexcept override;
44 int getPluginVersion() const noexcept override;
45 InputDomain getInputDomain() const noexcept override;
46
47 ParameterList getParameterDescriptors() const noexcept override;
48 std::optional<float> getParameter(std::string_view id) const override;
49 bool setParameter(std::string_view id, float value) override;
50
51 ProgramList getPrograms() const noexcept override;
53 bool selectProgram(std::string_view name) override;
54
55 uint32_t getPreferredStepSize() const override;
56 uint32_t getPreferredBlockSize() const override;
57
58 uint32_t getOutputCount() const override;
60
61 bool initialise(uint32_t stepSize, uint32_t blockSize) override;
62 void reset() override;
63 FeatureSet process(InputBuffer buffer, uint64_t nsec) override;
64
65private:
66 void checkRequirements();
67
68 const VampPluginDescriptor& descriptor_;
69 std::shared_ptr<DynamicLibrary> library_;
70 VampPluginHandle handle_{nullptr};
71 std::vector<ParameterDescriptor> parameters_;
72 std::vector<std::string_view> programs_;
73 std::vector<Feature> featureSet_;
74 uint32_t outputCount_{0};
75 bool initialised_{false};
76 uint32_t initialisedBlockSize_{0};
77};
78
79} // namespace rtvamp::hostsdk
_VampPluginDescriptor VampPluginDescriptor
Definition PluginHostAdapter.hpp:14
void * VampPluginHandle
Definition PluginHostAdapter.hpp:15
Definition PluginHostAdapter.hpp:21
bool initialise(uint32_t stepSize, uint32_t blockSize) override
std::string_view getIdentifier() const noexcept override
std::string_view getMaker() const noexcept override
std::filesystem::path getLibraryPath() const noexcept override
uint32_t getVampApiVersion() const noexcept override
PluginHostAdapter(const VampPluginDescriptor &descriptor, float inputSampleRate, std::shared_ptr< DynamicLibrary > library=nullptr)
PluginHostAdapter(PluginHostAdapter &&)=delete
FeatureSet process(InputBuffer buffer, uint64_t nsec) override
uint32_t getPreferredStepSize() const override
InputDomain getInputDomain() const noexcept override
OutputList getOutputDescriptors() const override
uint32_t getOutputCount() const override
PluginHostAdapter(const PluginHostAdapter &)=delete
bool selectProgram(std::string_view name) override
CurrentProgram getCurrentProgram() const override
ProgramList getPrograms() const noexcept override
PluginHostAdapter & operator=(const PluginHostAdapter &)=delete
uint32_t getPreferredBlockSize() const override
std::string_view getName() const noexcept override
bool setParameter(std::string_view id, float value) override
int getPluginVersion() const noexcept override
std::optional< float > getParameter(std::string_view id) const override
PluginHostAdapter & operator=(PluginHostAdapter &&)=delete
std::string_view getDescription() const noexcept override
ParameterList getParameterDescriptors() const noexcept override
std::string_view getCopyright() const noexcept override
Definition Plugin.hpp:14
std::optional< std::string_view > CurrentProgram
Current program (if programs avaiable)
Definition Plugin.hpp:54
std::variant< TimeDomainBuffer, FrequencyDomainBuffer > InputBuffer
Input buffer variant.
Definition Plugin.hpp:58
InputDomain
Input domain of the plugin.
Definition Plugin.hpp:25
std::vector< OutputDescriptor > OutputList
List of output descriptors.
Definition Plugin.hpp:55
std::span< const ParameterDescriptor > ParameterList
List of parameter descriptors.
Definition Plugin.hpp:52
std::span< const Feature > FeatureSet
Computed features for each output.
Definition Plugin.hpp:60
std::span< const std::string_view > ProgramList
List of programs.
Definition Plugin.hpp:53
Definition hostsdk.hpp:12