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>
|
|
|
|
|
2024-10-29 23:32:02 +00:00
|
|
|
#include "FrequencyAnalyzer.hpp"
|
|
|
|
|
2024-10-12 22:18:42 +01:00
|
|
|
namespace Amuencha
|
|
|
|
{
|
2024-10-29 23:32:02 +00:00
|
|
|
class Model
|
2024-10-12 22:18:42 +01:00
|
|
|
{
|
|
|
|
public:
|
|
|
|
halp_meta(name, "Amuencha")
|
|
|
|
halp_meta(category, "Audio")
|
|
|
|
halp_meta(c_name, "amuencha")
|
|
|
|
halp_meta(uuid, "b37351b4-7b8d-4150-9e1c-708eec9182b2")
|
|
|
|
|
2024-10-27 18:13:58 +00:00
|
|
|
struct processor_to_ui
|
|
|
|
{
|
2024-10-29 00:07:57 +00:00
|
|
|
std::vector<float> reassigned_frequencies;
|
|
|
|
std::vector<float> power_spectrum;
|
2024-10-27 18:13:58 +00:00
|
|
|
};
|
|
|
|
|
2024-10-28 11:12:04 +00:00
|
|
|
std::function<void(processor_to_ui&&)> send_message;
|
2024-10-27 18:13:58 +00:00
|
|
|
|
2024-10-12 22:18:42 +01:00
|
|
|
// Define inputs and outputs ports.
|
|
|
|
// See the docs at https://github.com/celtera/avendish
|
|
|
|
struct ins
|
|
|
|
{
|
2024-10-29 00:07:57 +00:00
|
|
|
halp::fixed_audio_bus<"Input", float, 1> audio;
|
2024-11-01 00:01:20 +00:00
|
|
|
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;
|
|
|
|
halp::spinbox_i32<"Periods", halp::range{.min = 0, .max = 99, .init = 30}> periods;
|
2024-10-12 22:18:42 +01:00
|
|
|
} inputs;
|
|
|
|
|
|
|
|
struct outs
|
|
|
|
{
|
|
|
|
halp::midi_bus<"Output"> midi;
|
|
|
|
} outputs;
|
|
|
|
|
|
|
|
using setup = halp::setup;
|
2024-11-01 00:01:20 +00:00
|
|
|
void prepare(setup info);
|
2024-10-12 22:18:42 +01:00
|
|
|
|
|
|
|
// Do our processing for N samples
|
|
|
|
using tick = halp::tick;
|
|
|
|
// Defined in the .cpp
|
2024-11-01 00:01:20 +00:00
|
|
|
void operator()(tick t);
|
2024-10-12 22:18:42 +01:00
|
|
|
|
|
|
|
// UI is defined in another file to keep things clear.
|
|
|
|
struct ui;
|
2024-10-27 18:13:58 +00:00
|
|
|
|
|
|
|
private:
|
2024-10-29 23:32:02 +00:00
|
|
|
FrequencyAnalyzer analyzer;
|
2024-10-12 22:18:42 +01:00
|
|
|
};
|
|
|
|
|
|
|
|
}
|