Skip to content

Commit e054ff0

Browse files
committed
Update to latest LabSound interfaces
1 parent dcceac4 commit e054ff0

File tree

8 files changed

+35
-25
lines changed

8 files changed

+35
-25
lines changed

CMakeLists.txt

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -252,7 +252,7 @@ elseif("${CMAKE_CXX_COMPILER_ID}" MATCHES "Clang")
252252
Lab::Midi
253253
Tiny::OSC
254254
sokol
255-
-Wl,-force_load $<TARGET_FILE:Lab::Sound>
255+
Lab::Sound
256256
)
257257
else()
258258
target_link_libraries(LabSoundGraphToy
@@ -284,3 +284,14 @@ install(
284284
resources/fontaudio.ttf
285285
resources/preview.png
286286
DESTINATION bin/LabSoundGraphToy_rsrc/)
287+
288+
install(
289+
FILES
290+
resources/fontaudio.ttf
291+
resources/preview.png
292+
DESTINATION ${CMAKE_BINARY_DIR}/bin/Debug/LabSoundGraphToy_rsrc/)
293+
install(
294+
FILES
295+
resources/fontaudio.ttf
296+
resources/preview.png
297+
DESTINATION ${CMAKE_BINARY_DIR}/bin/Release/LabSoundGraphToy_rsrc/)

src/MidiNode.cpp

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -166,7 +166,3 @@ class MidiManager
166166

167167
};
168168

169-
bool MidiNode::s_registered = lab::NodeRegistry::Register(MidiNode::static_name(),
170-
[](lab::AudioContext& ac)->lab::AudioNode* { return new MidiNode(ac); },
171-
[](lab::AudioNode* n) { delete n; });
172-

src/MidiNode.hpp

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -12,8 +12,7 @@ struct MidiNode : public lab::AudioNode
1212
MidiNode(lab::AudioContext& ac)
1313
: AudioNode(ac)
1414
{
15-
if (s_registered)
16-
initialize();
15+
initialize();
1716
}
1817
virtual ~MidiNode() = default;
1918

@@ -88,6 +87,4 @@ struct MidiNode : public lab::AudioNode
8887
// processing delay which is an artifact of the processing algorithm chosen and is *not* part of the intrinsic desired effect. For
8988
// example, a "delay" effect is expected to delay the signal, and thus would not be considered latency.
9089
virtual double latencyTime(lab::ContextRenderLock& r) const override { return 0.; }
91-
92-
static bool s_registered;
9390
};

src/OSCNode.cpp

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1 @@
11
#include "OSCNode.hpp"
2-
#include "LabSound/extended/Registry.h"
3-
bool OSCNode::s_registered = lab::NodeRegistry::Register(OSCNode::static_name(),
4-
[](lab::AudioContext& ac)->lab::AudioNode* { return new OSCNode(ac); },
5-
[](lab::AudioNode* n) { delete n; });

src/OSCNode.hpp

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -12,8 +12,7 @@ struct OSCNode : public lab::AudioNode
1212
OSCNode(lab::AudioContext& ac)
1313
: AudioNode(ac)
1414
{
15-
if (s_registered)
16-
initialize();
15+
initialize();
1716
}
1817

1918
virtual ~OSCNode() = default;
@@ -89,6 +88,4 @@ struct OSCNode : public lab::AudioNode
8988
// processing delay which is an artifact of the processing algorithm chosen and is *not* part of the intrinsic desired effect. For
9089
// example, a "delay" effect is expected to delay the signal, and thus would not be considered latency.
9190
virtual double latencyTime(lab::ContextRenderLock& r) const override { return 0.; }
92-
93-
static bool s_registered;
9491
};

src/lab_noodle.cpp

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -2008,17 +2008,17 @@ namespace noodle {
20082008
ImGui::Separator();
20092009
ImGui::TextUnformatted("Hover");
20102010
ImGui::Text("node hovered: %s", hover.node_id.id != ln_Node_null().id ? "*" : ".");
2011-
ImGui::Text("group hovered: %d", hover.group_id.id);
2012-
ImGui::Text("originating pin id: %d", hover.originating_pin_id.id);
2013-
ImGui::Text("hovered pin id: %d", hover.pin_id.id);
2014-
ImGui::Text("hovered pin label: %d", hover.pin_label_id.id);
2015-
ImGui::Text("hovered connection: %d", hover.connection_id.id);
2011+
ImGui::Text("group hovered: %llu", hover.group_id.id);
2012+
ImGui::Text("originating pin id: %llu", hover.originating_pin_id.id);
2013+
ImGui::Text("hovered pin id: %llu", hover.pin_id.id);
2014+
ImGui::Text("hovered pin label: %llu", hover.pin_label_id.id);
2015+
ImGui::Text("hovered connection: %llu", hover.connection_id.id);
20162016
ImGui::Text("hovered node menu: %s", hover.node_menu ? "*" : ".");
2017-
ImGui::Text("hovered size widget: %d", hover.size_widget_node_id.id);
2017+
ImGui::Text("hovered size widget: %llu", hover.size_widget_node_id.id);
20182018

20192019
ImGui::Separator();
20202020
ImGui::TextUnformatted("Edit");
2021-
ImGui::Text("edit connection: %d", edit.selected_connection.id);
2021+
ImGui::Text("edit connection: %llu", edit.selected_connection.id);
20222022
ImGui::Separator();
20232023
ImGui::Text("quantum time: %f uS", total_profile_duration * 1e6f);
20242024

src/lab_noodle.h

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,11 +3,12 @@
33
#define included_noodle_h
44

55
#include <atomic>
6+
#include <cstdint>
67
#include <functional>
78
#include <string>
89
#include <map>
910
#include <set>
10-
#include <stdint.h>
11+
#include <vector>
1112

1213
typedef struct { uint64_t id; } ln_Context;
1314
typedef struct { uint64_t id; } ln_Connection;

src/main.cpp

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,10 @@
1111
#include "lab_imgui_ext.hpp"
1212
#include "LabSoundInterface.h"
1313
#include "lab_noodle.h"
14+
#include "MidiNode.hpp"
15+
#include "OSCNode.hpp"
16+
17+
#include <LabSound/LabSound.h>
1418

1519
#define MESHULA_LAB_DRY
1620
#include "meshula_lab.hpp"
@@ -25,6 +29,7 @@
2529
#include <iostream>
2630
#include <string>
2731
#include <thread>
32+
#include <unordered_map>
2833
#include <vector>
2934

3035
#include "OSCMsg.hpp"
@@ -144,6 +149,13 @@ void init(void) {
144149
open_udp_server();
145150
});
146151

152+
lab::NodeRegistry::Instance().Register(OSCNode::static_name(),
153+
[](lab::AudioContext& ac)->lab::AudioNode* { return new OSCNode(ac); },
154+
[](lab::AudioNode* n) { delete n; });
155+
lab::NodeRegistry::Instance().Register(MidiNode::static_name(),
156+
[](lab::AudioContext& ac)->lab::AudioNode* { return new MidiNode(ac); },
157+
[](lab::AudioNode* n) { delete n; });
158+
147159
// setup sokol-gfx, sokol-time and sokol-imgui
148160
sg_desc desc = { };
149161
desc.context = sapp_sgcontext();

0 commit comments

Comments
 (0)