score-avnd-amuencha/Amuencha/AmuenchaModel.hpp

72 lines
1.7 KiB
C++
Raw Normal View History

2024-10-12 22:18:42 +01:00
#pragma once
#include <halp/audio.hpp>
#include <halp/midi.hpp>
#include <halp/controls.hpp>
#include <halp/meta.hpp>
namespace Amuencha
{
class Analyser
{
public:
halp_meta(name, "Amuencha")
halp_meta(category, "Audio")
halp_meta(c_name, "amuencha")
halp_meta(uuid, "b37351b4-7b8d-4150-9e1c-708eec9182b2")
// Define inputs and outputs ports.
// See the docs at https://github.com/celtera/avendish
struct ins
{
halp::fixed_audio_bus<"Input", double, 1> audio;
2024-10-25 20:09:59 +01:00
struct : halp::hslider_i32<"Min", halp::range{.min = 0, .max = 127, .init = 24}>
{
void update(Analyser& self)
{
self.send_message({.min = this->value, .max = self.inputs.max.value});
}
} min;
struct : halp::hslider_i32<"Min", halp::range{.min = 0, .max = 127, .init = 72}>
{
void update(Analyser& self)
{
self.send_message({.min = self.inputs.min.value, .max = this->value});
}
} max;
// halp::hslider_i32<"Min", halp::range{.min = 0, .max = 127, .init = 24}> min;
// halp::hslider_i32<"Max", halp::range{.min = 0, .max = 127, .init = 72}> max;
2024-10-12 22:18:42 +01:00
} inputs;
2024-10-23 00:22:31 +01:00
// This one will be memcpy'd as it is a trivial type
struct processor_to_ui
{
int min;
int max;
};
std::function<void(processor_to_ui)> send_message;
2024-10-12 22:18:42 +01:00
struct outs
{
halp::midi_bus<"Output"> midi;
} outputs;
using setup = halp::setup;
void prepare(halp::setup info)
{
// Initialization, this method will be called with buffer size, etc.
}
// Do our processing for N samples
using tick = halp::tick;
// Defined in the .cpp
void operator()(halp::tick t);
// UI is defined in another file to keep things clear.
struct ui;
};
}