Skip to content

Commit

Permalink
C++ module version
Browse files Browse the repository at this point in the history
  • Loading branch information
jcelerier committed Nov 2, 2024
1 parent 85cab10 commit f51f6b5
Show file tree
Hide file tree
Showing 5 changed files with 32 additions and 60 deletions.
9 changes: 5 additions & 4 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -17,17 +17,18 @@ avnd_score_plugin_init(
avnd_score_plugin_add(
BASE_TARGET score_addon_my_avnd_effect
SOURCES
MyAvndEffect/MyAvndEffect.hpp
MyAvndEffect/MyAvndEffectModel.hpp
MyAvndEffect/MyAvndEffectModel.cpp
MyAvndEffect/MyAvndEffectUi.hpp
MyAvndEffect/MyAvndEffectModel.cppm
TARGET my_avnd_effect
MAIN_CLASS MyAvndEffect
NAMESPACE Example
MODULE
)

avnd_score_plugin_finalize(
MODULE
BASE_TARGET score_addon_my_avnd_effect
PLUGIN_VERSION 1
PLUGIN_UUID "00000000-0000-0000-0000-000000000000"
)

target_link_libraries(score_addon_my_avnd_effect PUBLIC avnd_halp_module)
4 changes: 0 additions & 4 deletions MyAvndEffect/MyAvndEffect.hpp

This file was deleted.

19 changes: 0 additions & 19 deletions MyAvndEffect/MyAvndEffectModel.cpp

This file was deleted.

Original file line number Diff line number Diff line change
@@ -1,19 +1,15 @@
#pragma once
export module my_avnd_effect;
import halp;

#include <halp/audio.hpp>
#include <halp/controls.hpp>
#include <halp/meta.hpp>

namespace Example
export namespace Example
{

class MyAvndEffect
{
public:
halp_meta(name, "My Avendish Gain")
halp_meta(category, "Audio")
halp_meta(c_name, "my_avnd_effect")
halp_meta(uuid, "00000000-0000-0000-0000-000000000000")
static consteval auto name() { return "My Avendish Gain"; }
static consteval auto c_name() { return "my_avnd_effect"; }
static consteval auto category() { return "Audio"; }
static consteval auto uuid() { return "00000000-0000-0000-0000-000000000000"; }

// Define inputs and outputs ports.
// See the docs at https://github.com/celtera/avendish
Expand All @@ -39,9 +35,26 @@ class MyAvndEffect

// Defined in the .cpp
void operator()(halp::tick t);

// UI is defined in another file to keep things clear.
struct ui;
};

}

module :private;

namespace Example
{
void MyAvndEffect::operator()(halp::tick t)
{
// Process the input buffer
for(int i = 0; i < inputs.audio.channels; i++)
{
auto* in = inputs.audio[i];
auto* out = outputs.audio[i];

for(int j = 0; j < t.frames; j++)
{
out[j] = inputs.gain * in[j] + 2;
}
}
}
}
19 changes: 0 additions & 19 deletions MyAvndEffect/MyAvndEffectUi.hpp

This file was deleted.

0 comments on commit f51f6b5

Please sign in to comment.