Trying to get atom:Path to work for model laoding

This commit is contained in:
Mike Oliphant
2023-03-11 10:53:05 -08:00
parent fc5853d8f7
commit 100d344e3d
5 changed files with 46 additions and 10 deletions
+1 -1
View File
@@ -1,6 +1,6 @@
cmake_minimum_required(VERSION 3.10) cmake_minimum_required(VERSION 3.10)
project(NeuralAmpModeler VERSION 0.0.1) project(NeuralAmpModelerLv2 VERSION 0.0.1)
set(CMAKE_MODULE_PATH "${CMAKE_SOURCE_DIR}/cmake") set(CMAKE_MODULE_PATH "${CMAKE_SOURCE_DIR}/cmake")
+22 -6
View File
@@ -35,18 +35,34 @@
patch:writable <@NAM_LV2_ID@#model>; patch:writable <@NAM_LV2_ID@#model>;
# Control
lv2:port [
a atom:AtomPort, lv2:InputPort;
atom:bufferType atom:Sequence;
atom:supports patch:Message;
lv2:designation lv2:control;
lv2:index 0;
lv2:symbol "control";
lv2:name "Control"
], [
a atom:AtomPort, lv2:OutputPort;
atom:bufferType atom:Sequence;
atom:supports patch:Message;
lv2:designation lv2:control;
lv2:index 1;
lv2:symbol "notify";
lv2:name "Notify"
];
# Audio Ports # Audio Ports
lv2:port [ lv2:port [
a lv2:InputPort, lv2:AudioPort; a lv2:InputPort, lv2:AudioPort;
lv2:index 0; lv2:index 2;
lv2:symbol "input"; lv2:symbol "input";
lv2:name "Input"; lv2:name "Input";
], [ ], [
a lv2:OutputPort, lv2:AudioPort; a lv2:OutputPort, lv2:AudioPort;
lv2:index 1; lv2:index 3;
lv2:symbol "output"; lv2:symbol "output";
lv2:name "Output"; lv2:name "Output";
]; ].
state:state [
<@NAM_LV2_ID@#model> <click.wav> ;
].
+1 -1
View File
@@ -67,7 +67,7 @@ static void cleanup(LV2_Handle instance) {
static const void* extension_data(const char*) { return nullptr; } static const void* extension_data(const char*) { return nullptr; }
static const LV2_Descriptor descriptor = { static const LV2_Descriptor descriptor = {
NAM::Plugin::URI.data(), "http://github.com/mikeoliphant/neural-amp-modeler-lv2",
instantiate, instantiate,
connect_port, connect_port,
activate, activate,
+10
View File
@@ -4,6 +4,7 @@
// Lv2 // Lv2
#include <lv2/atom/util.h> #include <lv2/atom/util.h>
#include <lv2/patch/patch.h>
#include "nam_plugin.hpp" #include "nam_plugin.hpp"
@@ -15,8 +16,17 @@ namespace NAM {
void Plugin::map_uris(LV2_URID_Map* map) noexcept { void Plugin::map_uris(LV2_URID_Map* map) noexcept {
lv2_atom_forge_init(&atom_forge, map); lv2_atom_forge_init(&atom_forge, map);
uris.atom_Object = map->map(map->handle, LV2_ATOM__Object); uris.atom_Object = map->map(map->handle, LV2_ATOM__Object);
uris.atom_Float = map->map(map->handle, LV2_ATOM__Float); uris.atom_Float = map->map(map->handle, LV2_ATOM__Float);
uris.atom_Int = map->map(map->handle, LV2_ATOM__Int);
uris.atom_Path = map->map(map->handle, LV2_ATOM__Path);
uris.atom_URID = map->map(map->handle, LV2_ATOM__URID);
uris.patch_Set = map->map(map->handle, LV2_PATCH__Set);
uris.patch_property = map->map(map->handle, LV2_PATCH__property);
uris.patch_value = map->map(map->handle, LV2_PATCH__value);
uris.model_Path = map->map(map->handle, MODEL_URI);
} }
void Plugin::process(uint32_t n_samples) noexcept { void Plugin::process(uint32_t n_samples) noexcept {
+12 -2
View File
@@ -13,13 +13,16 @@
#include "dsp.h" #include "dsp.h"
#define PlUGIN_URI "http://github.com/mikeoliphant/neural-amp-modeler-lv2"
#define MODEL_URI PlUGIN_URI "#model"
namespace NAM { namespace NAM {
class Plugin { class Plugin {
public: public:
static constexpr std::string_view URI = "http://github.com/mikeoliphant/neural-amp-modeler-lv2";
struct Ports { struct Ports {
const LV2_Atom_Sequence* control;
LV2_Atom_Sequence* notify;
const float* audio_in; const float* audio_in;
float* audio_out; float* audio_out;
}; };
@@ -49,6 +52,13 @@ namespace NAM {
struct URIs { struct URIs {
LV2_URID atom_Object; LV2_URID atom_Object;
LV2_URID atom_Float; LV2_URID atom_Float;
LV2_URID atom_Int;
LV2_URID atom_Path;
LV2_URID atom_URID;
LV2_URID patch_Set;
LV2_URID patch_property;
LV2_URID patch_value;
LV2_URID model_Path;
}; };
URIs uris = {}; URIs uris = {};