From 2706a1f894c1fab049c2221e134961901fe65056 Mon Sep 17 00:00:00 2001
From: Nytra <14206961+Nytra@users.noreply.github.com>
Date: Fri, 3 Oct 2025 20:06:16 +0100
Subject: [PATCH 01/12] tests
---
.gitmodules | 2 +-
ProjectObsidian.SourceGenerators | 2 +-
.../ProtoFlux/Audio/AudioBaseTest.cs | 114 ++++++++++++++++++
.../ProtoFlux/Audio/SawtoothGenerator.cs | 93 +-------------
4 files changed, 122 insertions(+), 89 deletions(-)
create mode 100644 ProjectObsidian/ProtoFlux/Audio/AudioBaseTest.cs
diff --git a/.gitmodules b/.gitmodules
index b4732f5..b35632d 100644
--- a/.gitmodules
+++ b/.gitmodules
@@ -1,4 +1,4 @@
[submodule "ProjectObsidian.SourceGenerators"]
path = ProjectObsidian.SourceGenerators
url = https://github.com/Custom-Extension-Works/Project-Obsidian.SourceGenerators
- branch = main
+ branch = tryFixAbstract
diff --git a/ProjectObsidian.SourceGenerators b/ProjectObsidian.SourceGenerators
index 61759b9..52f72c6 160000
--- a/ProjectObsidian.SourceGenerators
+++ b/ProjectObsidian.SourceGenerators
@@ -1 +1 @@
-Subproject commit 61759b92ed2b80729ddf3fd8041de5c14850189d
+Subproject commit 52f72c6941c63a3ee07dd7cfa4dacb4496ce3c43
diff --git a/ProjectObsidian/ProtoFlux/Audio/AudioBaseTest.cs b/ProjectObsidian/ProtoFlux/Audio/AudioBaseTest.cs
new file mode 100644
index 0000000..017b9f7
--- /dev/null
+++ b/ProjectObsidian/ProtoFlux/Audio/AudioBaseTest.cs
@@ -0,0 +1,114 @@
+using System;
+using ProtoFlux.Core;
+using ProtoFlux.Runtimes.Execution;
+using FrooxEngine.ProtoFlux;
+using FrooxEngine;
+using Elements.Assets;
+using Elements.Core;
+using System.Runtime.InteropServices;
+using Awwdio;
+
+namespace ProtoFlux.Runtimes.Execution.Nodes.Obsidian.Audio
+{
+ public abstract class AudioNodeProxyBase : ProtoFluxEngineProxy, IWorldAudioDataSource
+ {
+ public bool IsActive => Active;
+
+ public abstract int ChannelCount { get; }
+
+ public abstract bool Active { get; set; }
+
+ public abstract void Read(Span buffer, AudioSimulator system) where S : unmanaged, IAudioSample;
+ }
+ [NodeCategory("Obsidian/Audio/Generators")]
+ public abstract class AudioNodeBase
: ProxyVoidNode, IExecutionChangeListener where P : AudioNodeProxyBase, new()
+ {
+ public readonly ObjectOutput AudioOutput;
+
+ private ObjectStore> _enabledChangedHandler;
+
+ private ObjectStore _activeChangedHandler;
+
+ public bool ValueListensToChanges { get; private set; }
+
+ private bool ShouldListen(P proxy)
+ {
+ if (proxy.Enabled)
+ {
+ return proxy.Slot.IsActive;
+ }
+ return false;
+ }
+
+ protected override void ProxyAdded(P proxy, FrooxEngineContext context)
+ {
+ base.ProxyAdded(proxy, context);
+ NodeContextPath path = context.CaptureContextPath();
+ ProtoFluxNodeGroup group = context.Group;
+ context.GetEventDispatcher(out var dispatcher);
+ Action enabledHandler = delegate
+ {
+ dispatcher.ScheduleEvent(path, delegate (FrooxEngineContext c)
+ {
+ UpdateListenerState(c);
+ });
+ };
+ SlotEvent activeHandler = delegate
+ {
+ dispatcher.ScheduleEvent(path, delegate (FrooxEngineContext c)
+ {
+ UpdateListenerState(c);
+ });
+ };
+ proxy.EnabledField.Changed += enabledHandler;
+ proxy.Slot.ActiveChanged += activeHandler;
+ _enabledChangedHandler.Write(enabledHandler, context);
+ _activeChangedHandler.Write(activeHandler, context);
+ ValueListensToChanges = ShouldListen(proxy);
+ proxy.Active = ValueListensToChanges;
+ }
+
+ protected override void ProxyRemoved(P proxy, FrooxEngineContext context, bool inUseByAnotherInstance)
+ {
+ if (!inUseByAnotherInstance)
+ {
+ proxy.EnabledField.Changed -= _enabledChangedHandler.Read(context);
+ proxy.Slot.ActiveChanged -= _activeChangedHandler.Read(context);
+ _enabledChangedHandler.Clear(context);
+ _activeChangedHandler.Clear(context);
+ proxy.Active = false;
+ }
+ }
+
+ protected void UpdateListenerState(FrooxEngineContext context)
+ {
+ P proxy = GetProxy(context);
+ if (proxy != null)
+ {
+ bool shouldListen = ShouldListen(proxy);
+ if (shouldListen != ValueListensToChanges)
+ {
+ ValueListensToChanges = shouldListen;
+ context.Group.MarkChangeTrackingDirty();
+ proxy.Active = shouldListen;
+ }
+ }
+ }
+
+ public virtual void Changed(FrooxEngineContext context)
+ {
+
+ }
+
+ protected override void ComputeOutputs(FrooxEngineContext context)
+ {
+ P proxy = GetProxy(context);
+ AudioOutput.Write(proxy, context);
+ }
+
+ public AudioNodeBase()
+ {
+ AudioOutput = new ObjectOutput(this);
+ }
+ }
+}
\ No newline at end of file
diff --git a/ProjectObsidian/ProtoFlux/Audio/SawtoothGenerator.cs b/ProjectObsidian/ProtoFlux/Audio/SawtoothGenerator.cs
index 46e4c29..1025bb3 100644
--- a/ProjectObsidian/ProtoFlux/Audio/SawtoothGenerator.cs
+++ b/ProjectObsidian/ProtoFlux/Audio/SawtoothGenerator.cs
@@ -10,7 +10,7 @@
namespace ProtoFlux.Runtimes.Execution.Nodes.Obsidian.Audio
{
- public class SawtoothGeneratorProxy : ProtoFluxEngineProxy, Awwdio.IAudioDataSource, IWorldAudioDataSource
+ public class SawtoothGeneratorProxy : AudioNodeProxyBase
{
public float Frequency;
@@ -22,15 +22,13 @@ public class SawtoothGeneratorProxy : ProtoFluxEngineProxy, Awwdio.IAudioDataSou
private float[] tempBuffer = null;
- public bool Active;
+ public override int ChannelCount => 1;
- public bool IsActive => Active;
-
- public int ChannelCount => 1;
+ public override bool Active { get; set; }
private bool updateTime;
- public void Read(Span buffer, AudioSimulator simulator) where S : unmanaged, IAudioSample
+ public override void Read(Span buffer, AudioSimulator simulator)
{
if (!IsActive)
{
@@ -77,7 +75,7 @@ protected override void OnStart()
}
}
[NodeCategory("Obsidian/Audio/Generators")]
- public class SawtoothGenerator : ProxyVoidNode, IExecutionChangeListener
+ public class SawtoothGenerator : AudioNodeBase
{
[ChangeListener]
[DefaultValueAttribute(440f)]
@@ -96,79 +94,7 @@ public class SawtoothGenerator : ProxyVoidNode AudioOutput;
-
- private ObjectStore> _enabledChangedHandler;
-
- private ObjectStore _activeChangedHandler;
-
- public bool ValueListensToChanges { get; private set; }
-
- private bool ShouldListen(SawtoothGeneratorProxy proxy)
- {
- if (proxy.Enabled)
- {
- return proxy.Slot.IsActive;
- }
- return false;
- }
-
- protected override void ProxyAdded(SawtoothGeneratorProxy proxy, FrooxEngineContext context)
- {
- base.ProxyAdded(proxy, context);
- NodeContextPath path = context.CaptureContextPath();
- ProtoFluxNodeGroup group = context.Group;
- context.GetEventDispatcher(out var dispatcher);
- Action enabledHandler = delegate
- {
- dispatcher.ScheduleEvent(path, delegate (FrooxEngineContext c)
- {
- UpdateListenerState(c);
- });
- };
- SlotEvent activeHandler = delegate
- {
- dispatcher.ScheduleEvent(path, delegate (FrooxEngineContext c)
- {
- UpdateListenerState(c);
- });
- };
- proxy.EnabledField.Changed += enabledHandler;
- proxy.Slot.ActiveChanged += activeHandler;
- _enabledChangedHandler.Write(enabledHandler, context);
- _activeChangedHandler.Write(activeHandler, context);
- ValueListensToChanges = ShouldListen(proxy);
- proxy.Active = ValueListensToChanges;
- }
-
- protected override void ProxyRemoved(SawtoothGeneratorProxy proxy, FrooxEngineContext context, bool inUseByAnotherInstance)
- {
- if (!inUseByAnotherInstance)
- {
- proxy.EnabledField.Changed -= _enabledChangedHandler.Read(context);
- proxy.Slot.ActiveChanged -= _activeChangedHandler.Read(context);
- _enabledChangedHandler.Clear(context);
- _activeChangedHandler.Clear(context);
- proxy.Active = false;
- }
- }
-
- protected void UpdateListenerState(FrooxEngineContext context)
- {
- SawtoothGeneratorProxy proxy = GetProxy(context);
- if (proxy != null)
- {
- bool shouldListen = ShouldListen(proxy);
- if (shouldListen != ValueListensToChanges)
- {
- ValueListensToChanges = shouldListen;
- context.Group.MarkChangeTrackingDirty();
- proxy.Active = shouldListen;
- }
- }
- }
-
- public void Changed(FrooxEngineContext context)
+ public override void Changed(FrooxEngineContext context)
{
SawtoothGeneratorProxy proxy = GetProxy(context);
if (proxy == null)
@@ -180,12 +106,6 @@ public void Changed(FrooxEngineContext context)
proxy.Frequency = Frequency.Evaluate(context, 440f);
}
- protected override void ComputeOutputs(FrooxEngineContext context)
- {
- SawtoothGeneratorProxy proxy = GetProxy(context);
- AudioOutput.Write(proxy, context);
- }
-
private IOperation DoReset(FrooxEngineContext context)
{
SawtoothGeneratorProxy proxy = GetProxy(context);
@@ -199,7 +119,6 @@ private IOperation DoReset(FrooxEngineContext context)
public SawtoothGenerator()
{
- AudioOutput = new ObjectOutput(this);
Reset = new Operation(this, 0);
}
}
From 98444a0c19ec1fe539404e2ccebcd5def6a0a15a Mon Sep 17 00:00:00 2001
From: Nytra <14206961+Nytra@users.noreply.github.com>
Date: Sat, 4 Oct 2025 01:39:56 +0100
Subject: [PATCH 02/12] Store changes
---
.gitmodules | 2 +-
ProjectObsidian.SourceGenerators | 2 +-
.../Radiant UI/Data Feeds/Feeds/ComponentsDataFeedData.cs | 1 -
ProjectObsidian/ProjectObsidian.csproj | 5 +++++
ProjectObsidian/ProtoFlux/JSON/JsonAddObjectToObjectNode.cs | 2 +-
ProjectObsidian/ProtoFlux/JSON/JsonAddValueToObjectNode.cs | 3 +--
.../ProtoFlux/JSON/JsonAppendObjectToArrayNode.cs | 2 +-
ProjectObsidian/ProtoFlux/JSON/JsonAppendValueToArrayNode.cs | 3 +--
ProjectObsidian/ProtoFlux/JSON/JsonGetObjectFromArrayNode.cs | 2 +-
.../ProtoFlux/JSON/JsonGetObjectFromObjectNode.cs | 2 +-
ProjectObsidian/ProtoFlux/JSON/JsonGetValueFromArrayNode.cs | 3 +--
ProjectObsidian/ProtoFlux/JSON/JsonGetValueFromObjectNode.cs | 3 +--
.../ProtoFlux/JSON/JsonInsertObjectToArrayNode.cs | 2 +-
ProjectObsidian/ProtoFlux/JSON/JsonInsertValueToArrayNode.cs | 3 +--
.../ProtoFlux/JSON/JsonQuickGetObjectFromObjectNode.cs | 2 +-
.../ProtoFlux/JSON/JsonQuickGetValueFromObjectNode.cs | 3 +--
ProjectObsidian/ProtoFlux/JSON/JsonToStringNode.cs | 2 +-
17 files changed, 20 insertions(+), 22 deletions(-)
diff --git a/.gitmodules b/.gitmodules
index b35632d..22b76d8 100644
--- a/.gitmodules
+++ b/.gitmodules
@@ -1,4 +1,4 @@
[submodule "ProjectObsidian.SourceGenerators"]
path = ProjectObsidian.SourceGenerators
url = https://github.com/Custom-Extension-Works/Project-Obsidian.SourceGenerators
- branch = tryFixAbstract
+ branch = main
\ No newline at end of file
diff --git a/ProjectObsidian.SourceGenerators b/ProjectObsidian.SourceGenerators
index 52f72c6..93de28a 160000
--- a/ProjectObsidian.SourceGenerators
+++ b/ProjectObsidian.SourceGenerators
@@ -1 +1 @@
-Subproject commit 52f72c6941c63a3ee07dd7cfa4dacb4496ce3c43
+Subproject commit 93de28a02bd110c06764ea470ac74afadcebcdcf
diff --git a/ProjectObsidian/Components/Radiant UI/Data Feeds/Feeds/ComponentsDataFeedData.cs b/ProjectObsidian/Components/Radiant UI/Data Feeds/Feeds/ComponentsDataFeedData.cs
index 3df024a..c0e7bd6 100644
--- a/ProjectObsidian/Components/Radiant UI/Data Feeds/Feeds/ComponentsDataFeedData.cs
+++ b/ProjectObsidian/Components/Radiant UI/Data Feeds/Feeds/ComponentsDataFeedData.cs
@@ -1,7 +1,6 @@
using System.Collections.Generic;
using System;
using FrooxEngine;
-using Microsoft.CodeAnalysis.Operations;
namespace Obsidian;
diff --git a/ProjectObsidian/ProjectObsidian.csproj b/ProjectObsidian/ProjectObsidian.csproj
index 3438e94..711c4c2 100644
--- a/ProjectObsidian/ProjectObsidian.csproj
+++ b/ProjectObsidian/ProjectObsidian.csproj
@@ -85,6 +85,7 @@
$(ResonitePath)System.ValueTuple.dll
+
@@ -92,7 +93,11 @@
+
+
+
+
diff --git a/ProjectObsidian/ProtoFlux/JSON/JsonAddObjectToObjectNode.cs b/ProjectObsidian/ProtoFlux/JSON/JsonAddObjectToObjectNode.cs
index 81424cf..b5cb829 100644
--- a/ProjectObsidian/ProtoFlux/JSON/JsonAddObjectToObjectNode.cs
+++ b/ProjectObsidian/ProtoFlux/JSON/JsonAddObjectToObjectNode.cs
@@ -12,7 +12,7 @@ namespace ProtoFlux.Runtimes.Execution.Nodes.Obsidian.Json;
[NodeName("Add To Object")]
[NodeCategory("Obsidian/Json")]
-[GenericTypes(typeof(string), typeof(Uri), typeof(JsonToken), typeof(JsonObject), typeof(JsonArray), typeof(IJsonToken))]
+// [GenericTypes(GenericTypesAttribute.TypeMode.DirectTypes, typeof(string), typeof(Uri), typeof(JsonToken), typeof(JsonObject), typeof(JsonArray), typeof(IJsonToken))]
public class JsonAddObjectToObjectNode : ObjectFunctionNode where T : class
{
public readonly ObjectInput Input;
diff --git a/ProjectObsidian/ProtoFlux/JSON/JsonAddValueToObjectNode.cs b/ProjectObsidian/ProtoFlux/JSON/JsonAddValueToObjectNode.cs
index f658cd4..0bd477e 100644
--- a/ProjectObsidian/ProtoFlux/JSON/JsonAddValueToObjectNode.cs
+++ b/ProjectObsidian/ProtoFlux/JSON/JsonAddValueToObjectNode.cs
@@ -12,8 +12,7 @@ namespace ProtoFlux.Runtimes.Execution.Nodes.Obsidian.Json;
[NodeName("Add To Object")]
[NodeCategory("Obsidian/Json")]
-[GenericTypes(typeof(byte), typeof(sbyte), typeof(short), typeof(ushort), typeof(int), typeof(uint),
- typeof(long), typeof(ulong), typeof(float), typeof(double))]
+//[GenericTypes(GenericTypesAttribute.TypeMode.DirectTypes, typeof(byte), typeof(sbyte), typeof(short), typeof(ushort), typeof(int), typeof(uint), typeof(long), typeof(ulong), typeof(float), typeof(double))]
public class JsonAddValueToObjectNode : ObjectFunctionNode where T : unmanaged
{
public readonly ObjectInput Input;
diff --git a/ProjectObsidian/ProtoFlux/JSON/JsonAppendObjectToArrayNode.cs b/ProjectObsidian/ProtoFlux/JSON/JsonAppendObjectToArrayNode.cs
index 4cd02d5..6a88421 100644
--- a/ProjectObsidian/ProtoFlux/JSON/JsonAppendObjectToArrayNode.cs
+++ b/ProjectObsidian/ProtoFlux/JSON/JsonAppendObjectToArrayNode.cs
@@ -12,7 +12,7 @@ namespace ProtoFlux.Runtimes.Execution.Nodes.Obsidian.Json;
[NodeName("Append To Array")]
[NodeCategory("Obsidian/Json")]
-[GenericTypes(typeof(string), typeof(Uri), typeof(JsonToken), typeof(JsonObject), typeof(JsonArray), typeof(IJsonToken))]
+//[GenericTypes(GenericTypesAttribute.TypeMode.DirectTypes, typeof(string), typeof(Uri), typeof(JsonToken), typeof(JsonObject), typeof(JsonArray), typeof(IJsonToken))]
public class JsonAppendObjectToArrayNode : ObjectFunctionNode where T : class
{
public readonly ObjectInput Array;
diff --git a/ProjectObsidian/ProtoFlux/JSON/JsonAppendValueToArrayNode.cs b/ProjectObsidian/ProtoFlux/JSON/JsonAppendValueToArrayNode.cs
index c4b499c..ef9a667 100644
--- a/ProjectObsidian/ProtoFlux/JSON/JsonAppendValueToArrayNode.cs
+++ b/ProjectObsidian/ProtoFlux/JSON/JsonAppendValueToArrayNode.cs
@@ -12,8 +12,7 @@ namespace ProtoFlux.Runtimes.Execution.Nodes.Obsidian.Json;
[NodeName("Append To Array")]
[NodeCategory("Obsidian/Json")]
-[GenericTypes(typeof(byte), typeof(sbyte), typeof(short), typeof(ushort), typeof(int), typeof(uint), typeof(long),
- typeof(ulong), typeof(float), typeof(double))]
+//[GenericTypes(GenericTypesAttribute.TypeMode.DirectTypes, typeof(byte), typeof(sbyte), typeof(short), typeof(ushort), typeof(int), typeof(uint), typeof(long), typeof(ulong), typeof(float), typeof(double))]
public class JsonAppendValueToArrayNode : ObjectFunctionNode where T : unmanaged
{
public readonly ObjectInput Array;
diff --git a/ProjectObsidian/ProtoFlux/JSON/JsonGetObjectFromArrayNode.cs b/ProjectObsidian/ProtoFlux/JSON/JsonGetObjectFromArrayNode.cs
index 0f6a2f5..fae843e 100644
--- a/ProjectObsidian/ProtoFlux/JSON/JsonGetObjectFromArrayNode.cs
+++ b/ProjectObsidian/ProtoFlux/JSON/JsonGetObjectFromArrayNode.cs
@@ -12,7 +12,7 @@ namespace ProtoFlux.Runtimes.Execution.Nodes.Obsidian.Json;
[NodeName("Get From Array")]
[NodeCategory("Obsidian/Json")]
-[GenericTypes(typeof(string), typeof(Uri), typeof(JsonObject), typeof(JsonArray), typeof(JsonToken))]
+//[GenericTypes(GenericTypesAttribute.TypeMode.DirectTypes, typeof(string), typeof(Uri), typeof(JsonObject), typeof(JsonArray), typeof(JsonToken))]
public class JsonGetObjectFromArrayNode : ObjectFunctionNode where T : class
{
public readonly ObjectInput Input;
diff --git a/ProjectObsidian/ProtoFlux/JSON/JsonGetObjectFromObjectNode.cs b/ProjectObsidian/ProtoFlux/JSON/JsonGetObjectFromObjectNode.cs
index 274167e..0ce2ed5 100644
--- a/ProjectObsidian/ProtoFlux/JSON/JsonGetObjectFromObjectNode.cs
+++ b/ProjectObsidian/ProtoFlux/JSON/JsonGetObjectFromObjectNode.cs
@@ -12,7 +12,7 @@ namespace ProtoFlux.Runtimes.Execution.Nodes.Obsidian.Json;
[NodeName("Get From Object")]
[NodeCategory("Obsidian/Json")]
-[GenericTypes(typeof(string), typeof(Uri), typeof(JsonObject), typeof(JsonArray), typeof(JsonToken))]
+//[GenericTypes(GenericTypesAttribute.TypeMode.DirectTypes, typeof(string), typeof(Uri), typeof(JsonObject), typeof(JsonArray), typeof(JsonToken))]
public class JsonGetObjectFromObjectNode : ObjectFunctionNode where T : class
{
public readonly ObjectInput Input;
diff --git a/ProjectObsidian/ProtoFlux/JSON/JsonGetValueFromArrayNode.cs b/ProjectObsidian/ProtoFlux/JSON/JsonGetValueFromArrayNode.cs
index 5943a40..1a3a9c6 100644
--- a/ProjectObsidian/ProtoFlux/JSON/JsonGetValueFromArrayNode.cs
+++ b/ProjectObsidian/ProtoFlux/JSON/JsonGetValueFromArrayNode.cs
@@ -9,8 +9,7 @@ namespace ProtoFlux.Runtimes.Execution.Nodes.Obsidian.Json;
[NodeName("Get From Array")]
[NodeCategory("Obsidian/Json")]
-[GenericTypes(typeof(byte), typeof(sbyte), typeof(short), typeof(ushort), typeof(int), typeof(uint), typeof(long),
- typeof(ulong), typeof(float), typeof(double))]
+//[GenericTypes(GenericTypesAttribute.TypeMode.DirectTypes, typeof(byte), typeof(sbyte), typeof(short), typeof(ushort), typeof(int), typeof(uint), typeof(long), typeof(ulong), typeof(float), typeof(double))]
public class JsonGetValueFromArrayNode : ValueFunctionNode where T : unmanaged
{
public readonly ObjectInput Input;
diff --git a/ProjectObsidian/ProtoFlux/JSON/JsonGetValueFromObjectNode.cs b/ProjectObsidian/ProtoFlux/JSON/JsonGetValueFromObjectNode.cs
index 4d03085..35ca7d2 100644
--- a/ProjectObsidian/ProtoFlux/JSON/JsonGetValueFromObjectNode.cs
+++ b/ProjectObsidian/ProtoFlux/JSON/JsonGetValueFromObjectNode.cs
@@ -12,8 +12,7 @@ namespace ProtoFlux.Runtimes.Execution.Nodes.Obsidian.Json;
[NodeName("Get From Object")]
[NodeCategory("Obsidian/Json")]
-[GenericTypes(typeof(byte), typeof(sbyte), typeof(short), typeof(ushort), typeof(int), typeof(uint), typeof(long),
- typeof(ulong), typeof(float), typeof(double))]
+//[GenericTypes(GenericTypesAttribute.TypeMode.DirectTypes, typeof(byte), typeof(sbyte), typeof(short), typeof(ushort), typeof(int), typeof(uint), typeof(long), typeof(ulong), typeof(float), typeof(double))]
public class JsonGetValueFromObjectNode : ValueFunctionNode where T : unmanaged
{
public readonly ObjectInput Input;
diff --git a/ProjectObsidian/ProtoFlux/JSON/JsonInsertObjectToArrayNode.cs b/ProjectObsidian/ProtoFlux/JSON/JsonInsertObjectToArrayNode.cs
index 385e1a1..08fea9c 100644
--- a/ProjectObsidian/ProtoFlux/JSON/JsonInsertObjectToArrayNode.cs
+++ b/ProjectObsidian/ProtoFlux/JSON/JsonInsertObjectToArrayNode.cs
@@ -12,7 +12,7 @@ namespace ProtoFlux.Runtimes.Execution.Nodes.Obsidian.Json;
[NodeName("Insert To Array")]
[NodeCategory("Obsidian/Json")]
-[GenericTypes(typeof(string), typeof(Uri), typeof(JsonToken), typeof(JsonObject), typeof(JsonArray), typeof(IJsonToken))]
+//[GenericTypes(GenericTypesAttribute.TypeMode.DirectTypes, typeof(string), typeof(Uri), typeof(JsonToken), typeof(JsonObject), typeof(JsonArray), typeof(IJsonToken))]
public class JsonInsertObjectToArrayNode : ObjectFunctionNode where T : class
{
public readonly ObjectInput Array;
diff --git a/ProjectObsidian/ProtoFlux/JSON/JsonInsertValueToArrayNode.cs b/ProjectObsidian/ProtoFlux/JSON/JsonInsertValueToArrayNode.cs
index 35c89ab..5d015b0 100644
--- a/ProjectObsidian/ProtoFlux/JSON/JsonInsertValueToArrayNode.cs
+++ b/ProjectObsidian/ProtoFlux/JSON/JsonInsertValueToArrayNode.cs
@@ -12,8 +12,7 @@ namespace ProtoFlux.Runtimes.Execution.Nodes.Obsidian.Json;
[NodeName("Insert To Array")]
[NodeCategory("Obsidian/Json")]
-[GenericTypes(typeof(byte), typeof(sbyte), typeof(short), typeof(ushort), typeof(int), typeof(uint),
- typeof(long), typeof(ulong), typeof(float), typeof(double))]
+//[GenericTypes(GenericTypesAttribute.TypeMode.DirectTypes, typeof(byte), typeof(sbyte), typeof(short), typeof(ushort), typeof(int), typeof(uint), typeof(long), typeof(ulong), typeof(float), typeof(double))]
public class JsonInsertValueToArrayNode : ObjectFunctionNode where T : unmanaged
{
public readonly ObjectInput Array;
diff --git a/ProjectObsidian/ProtoFlux/JSON/JsonQuickGetObjectFromObjectNode.cs b/ProjectObsidian/ProtoFlux/JSON/JsonQuickGetObjectFromObjectNode.cs
index 5b2f987..27e16b2 100644
--- a/ProjectObsidian/ProtoFlux/JSON/JsonQuickGetObjectFromObjectNode.cs
+++ b/ProjectObsidian/ProtoFlux/JSON/JsonQuickGetObjectFromObjectNode.cs
@@ -12,7 +12,7 @@ namespace ProtoFlux.Runtimes.Execution.Nodes.Obsidian.Json;
[NodeName("Quick Get From Object")]
[NodeCategory("Obsidian/Json")]
-[GenericTypes(typeof(string), typeof(Uri), typeof(JsonObject), typeof(JsonArray), typeof(JsonToken))]
+//[GenericTypes(typeof(string), typeof(Uri), typeof(JsonObject), typeof(JsonArray), typeof(JsonToken))]
public class JsonQuickGetObjectFromObjectNode : ObjectFunctionNode where T : class
{
public readonly ObjectInput Input;
diff --git a/ProjectObsidian/ProtoFlux/JSON/JsonQuickGetValueFromObjectNode.cs b/ProjectObsidian/ProtoFlux/JSON/JsonQuickGetValueFromObjectNode.cs
index bba5e0d..2308e3f 100644
--- a/ProjectObsidian/ProtoFlux/JSON/JsonQuickGetValueFromObjectNode.cs
+++ b/ProjectObsidian/ProtoFlux/JSON/JsonQuickGetValueFromObjectNode.cs
@@ -12,8 +12,7 @@ namespace ProtoFlux.Runtimes.Execution.Nodes.Obsidian.Json;
[NodeName("Quick Get From Object")]
[NodeCategory("Obsidian/Json")]
-[GenericTypes(typeof(byte), typeof(sbyte), typeof(short), typeof(ushort), typeof(int), typeof(uint), typeof(long),
- typeof(ulong), typeof(float), typeof(double))]
+//[GenericTypes(GenericTypesAttribute.TypeMode.DirectTypes, typeof(byte), typeof(sbyte), typeof(short), typeof(ushort), typeof(int), typeof(uint), typeof(long), typeof(ulong), typeof(float), typeof(double))]
public class JsonQuickGetValueFromObjectNode : ValueFunctionNode where T : unmanaged
{
public readonly ObjectInput Input;
diff --git a/ProjectObsidian/ProtoFlux/JSON/JsonToStringNode.cs b/ProjectObsidian/ProtoFlux/JSON/JsonToStringNode.cs
index 59185e1..307d144 100644
--- a/ProjectObsidian/ProtoFlux/JSON/JsonToStringNode.cs
+++ b/ProjectObsidian/ProtoFlux/JSON/JsonToStringNode.cs
@@ -11,7 +11,7 @@ namespace ProtoFlux.Runtimes.Execution.Nodes.Obsidian.Json;
[NodeName("To String")]
[NodeCategory("Obsidian/Json")]
-[GenericTypes(typeof(JsonObject), typeof(JsonArray), typeof(JsonToken), typeof(IJsonToken))]
+//[GenericTypes(GenericTypesAttribute.TypeMode.DirectTypes, typeof(JsonObject), typeof(JsonArray), typeof(JsonToken), typeof(IJsonToken))]
public class JsonToStringNode : ObjectFunctionNode
{
public readonly ObjectInput Input;
From 87c294b59a36bb700dd1ff16ee045ddc3f048b59 Mon Sep 17 00:00:00 2001
From: Nytra <14206961+Nytra@users.noreply.github.com>
Date: Sat, 4 Oct 2025 13:31:01 +0100
Subject: [PATCH 03/12] update
---
.gitmodules | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/.gitmodules b/.gitmodules
index 22b76d8..fdf5dfd 100644
--- a/.gitmodules
+++ b/.gitmodules
@@ -1,4 +1,4 @@
[submodule "ProjectObsidian.SourceGenerators"]
path = ProjectObsidian.SourceGenerators
url = https://github.com/Custom-Extension-Works/Project-Obsidian.SourceGenerators
- branch = main
\ No newline at end of file
+ branch = tryFixAbstract3
From 6977ea54c7697791f8a936f95078f4aa73d3dc96 Mon Sep 17 00:00:00 2001
From: Nytra <14206961+Nytra@users.noreply.github.com>
Date: Sat, 4 Oct 2025 13:31:45 +0100
Subject: [PATCH 04/12] fix
---
ProjectObsidian.SourceGenerators | 2 +-
ProjectObsidian/ProjectObsidian.csproj | 1 -
2 files changed, 1 insertion(+), 2 deletions(-)
diff --git a/ProjectObsidian.SourceGenerators b/ProjectObsidian.SourceGenerators
index 93de28a..a181977 160000
--- a/ProjectObsidian.SourceGenerators
+++ b/ProjectObsidian.SourceGenerators
@@ -1 +1 @@
-Subproject commit 93de28a02bd110c06764ea470ac74afadcebcdcf
+Subproject commit a181977ea6658c6e01bcbd8424e1849b7132cf95
diff --git a/ProjectObsidian/ProjectObsidian.csproj b/ProjectObsidian/ProjectObsidian.csproj
index 711c4c2..963bd25 100644
--- a/ProjectObsidian/ProjectObsidian.csproj
+++ b/ProjectObsidian/ProjectObsidian.csproj
@@ -98,6 +98,5 @@
-
From 4fab01a2dbb7ae2d803be53536cce64b654119c3 Mon Sep 17 00:00:00 2001
From: Nytra <14206961+Nytra@users.noreply.github.com>
Date: Sat, 4 Oct 2025 15:42:50 +0100
Subject: [PATCH 05/12] works
---
ProjectObsidian.SourceGenerators | 2 +-
ProjectObsidian/ProjectObsidian.csproj | 3 +--
ProjectObsidian/ProtoFlux/Audio/AudioBaseTest.cs | 13 +++++--------
3 files changed, 7 insertions(+), 11 deletions(-)
diff --git a/ProjectObsidian.SourceGenerators b/ProjectObsidian.SourceGenerators
index a181977..caa0f93 160000
--- a/ProjectObsidian.SourceGenerators
+++ b/ProjectObsidian.SourceGenerators
@@ -1 +1 @@
-Subproject commit a181977ea6658c6e01bcbd8424e1849b7132cf95
+Subproject commit caa0f930c3e41ea30d2eb109ea2a20435946a522
diff --git a/ProjectObsidian/ProjectObsidian.csproj b/ProjectObsidian/ProjectObsidian.csproj
index 963bd25..f25c411 100644
--- a/ProjectObsidian/ProjectObsidian.csproj
+++ b/ProjectObsidian/ProjectObsidian.csproj
@@ -85,10 +85,9 @@
$(ResonitePath)System.ValueTuple.dll
-
-
+
diff --git a/ProjectObsidian/ProtoFlux/Audio/AudioBaseTest.cs b/ProjectObsidian/ProtoFlux/Audio/AudioBaseTest.cs
index 017b9f7..95bc1f7 100644
--- a/ProjectObsidian/ProtoFlux/Audio/AudioBaseTest.cs
+++ b/ProjectObsidian/ProtoFlux/Audio/AudioBaseTest.cs
@@ -1,12 +1,9 @@
using System;
-using ProtoFlux.Core;
-using ProtoFlux.Runtimes.Execution;
-using FrooxEngine.ProtoFlux;
-using FrooxEngine;
-using Elements.Assets;
-using Elements.Core;
-using System.Runtime.InteropServices;
using Awwdio;
+using Elements.Assets;
+using FrooxEngine;
+using FrooxEngine.ProtoFlux;
+using ProtoFlux.Core;
namespace ProtoFlux.Runtimes.Execution.Nodes.Obsidian.Audio
{
@@ -20,7 +17,7 @@ public abstract class AudioNodeProxyBase : ProtoFluxEngineProxy, IWorldAudioData
public abstract void Read(Span buffer, AudioSimulator system) where S : unmanaged, IAudioSample;
}
- [NodeCategory("Obsidian/Audio/Generators")]
+ [NodeCategory("Obsidian/Audio")]
public abstract class AudioNodeBase : ProxyVoidNode, IExecutionChangeListener where P : AudioNodeProxyBase, new()
{
public readonly ObjectOutput AudioOutput;
From 3c96efd2681e2b56d0f021d888bec953159eb62b Mon Sep 17 00:00:00 2001
From: Nytra <14206961+Nytra@users.noreply.github.com>
Date: Sat, 4 Oct 2025 16:05:46 +0100
Subject: [PATCH 06/12] make it better
---
.../ProtoFlux/Audio/AudioBaseTest.cs | 111 ------------------
.../ProtoFlux/Audio/AudioGeneratorBaseTest.cs | 111 ++++++++++++++++++
.../ProtoFlux/Audio/AudioProcessorBaseTest.cs | 30 +++++
.../ProtoFlux/Audio/BandPassFilterNode.cs | 104 +---------------
.../ProtoFlux/Audio/SawtoothGenerator.cs | 6 +-
5 files changed, 149 insertions(+), 213 deletions(-)
delete mode 100644 ProjectObsidian/ProtoFlux/Audio/AudioBaseTest.cs
create mode 100644 ProjectObsidian/ProtoFlux/Audio/AudioGeneratorBaseTest.cs
create mode 100644 ProjectObsidian/ProtoFlux/Audio/AudioProcessorBaseTest.cs
diff --git a/ProjectObsidian/ProtoFlux/Audio/AudioBaseTest.cs b/ProjectObsidian/ProtoFlux/Audio/AudioBaseTest.cs
deleted file mode 100644
index 95bc1f7..0000000
--- a/ProjectObsidian/ProtoFlux/Audio/AudioBaseTest.cs
+++ /dev/null
@@ -1,111 +0,0 @@
-using System;
-using Awwdio;
-using Elements.Assets;
-using FrooxEngine;
-using FrooxEngine.ProtoFlux;
-using ProtoFlux.Core;
-
-namespace ProtoFlux.Runtimes.Execution.Nodes.Obsidian.Audio
-{
- public abstract class AudioNodeProxyBase : ProtoFluxEngineProxy, IWorldAudioDataSource
- {
- public bool IsActive => Active;
-
- public abstract int ChannelCount { get; }
-
- public abstract bool Active { get; set; }
-
- public abstract void Read(Span buffer, AudioSimulator system) where S : unmanaged, IAudioSample;
- }
- [NodeCategory("Obsidian/Audio")]
- public abstract class AudioNodeBase : ProxyVoidNode, IExecutionChangeListener where P : AudioNodeProxyBase, new()
- {
- public readonly ObjectOutput AudioOutput;
-
- private ObjectStore> _enabledChangedHandler;
-
- private ObjectStore _activeChangedHandler;
-
- public bool ValueListensToChanges { get; private set; }
-
- private bool ShouldListen(P proxy)
- {
- if (proxy.Enabled)
- {
- return proxy.Slot.IsActive;
- }
- return false;
- }
-
- protected override void ProxyAdded(P proxy, FrooxEngineContext context)
- {
- base.ProxyAdded(proxy, context);
- NodeContextPath path = context.CaptureContextPath();
- ProtoFluxNodeGroup group = context.Group;
- context.GetEventDispatcher(out var dispatcher);
- Action enabledHandler = delegate
- {
- dispatcher.ScheduleEvent(path, delegate (FrooxEngineContext c)
- {
- UpdateListenerState(c);
- });
- };
- SlotEvent activeHandler = delegate
- {
- dispatcher.ScheduleEvent(path, delegate (FrooxEngineContext c)
- {
- UpdateListenerState(c);
- });
- };
- proxy.EnabledField.Changed += enabledHandler;
- proxy.Slot.ActiveChanged += activeHandler;
- _enabledChangedHandler.Write(enabledHandler, context);
- _activeChangedHandler.Write(activeHandler, context);
- ValueListensToChanges = ShouldListen(proxy);
- proxy.Active = ValueListensToChanges;
- }
-
- protected override void ProxyRemoved(P proxy, FrooxEngineContext context, bool inUseByAnotherInstance)
- {
- if (!inUseByAnotherInstance)
- {
- proxy.EnabledField.Changed -= _enabledChangedHandler.Read(context);
- proxy.Slot.ActiveChanged -= _activeChangedHandler.Read(context);
- _enabledChangedHandler.Clear(context);
- _activeChangedHandler.Clear(context);
- proxy.Active = false;
- }
- }
-
- protected void UpdateListenerState(FrooxEngineContext context)
- {
- P proxy = GetProxy(context);
- if (proxy != null)
- {
- bool shouldListen = ShouldListen(proxy);
- if (shouldListen != ValueListensToChanges)
- {
- ValueListensToChanges = shouldListen;
- context.Group.MarkChangeTrackingDirty();
- proxy.Active = shouldListen;
- }
- }
- }
-
- public virtual void Changed(FrooxEngineContext context)
- {
-
- }
-
- protected override void ComputeOutputs(FrooxEngineContext context)
- {
- P proxy = GetProxy(context);
- AudioOutput.Write(proxy, context);
- }
-
- public AudioNodeBase()
- {
- AudioOutput = new ObjectOutput(this);
- }
- }
-}
\ No newline at end of file
diff --git a/ProjectObsidian/ProtoFlux/Audio/AudioGeneratorBaseTest.cs b/ProjectObsidian/ProtoFlux/Audio/AudioGeneratorBaseTest.cs
new file mode 100644
index 0000000..179f132
--- /dev/null
+++ b/ProjectObsidian/ProtoFlux/Audio/AudioGeneratorBaseTest.cs
@@ -0,0 +1,111 @@
+using System;
+using Awwdio;
+using Elements.Assets;
+using FrooxEngine;
+using FrooxEngine.ProtoFlux;
+using ProtoFlux.Core;
+
+namespace ProtoFlux.Runtimes.Execution.Nodes.Obsidian.Audio;
+
+public abstract class AudioGeneratorNodeProxyBase : ProtoFluxEngineProxy, IWorldAudioDataSource
+{
+ public bool IsActive => Active;
+
+ public abstract int ChannelCount { get; }
+
+ public bool Active;
+
+ public abstract void Read(Span buffer, AudioSimulator system) where S : unmanaged, IAudioSample;
+}
+
+[NodeCategory("Obsidian/Audio")]
+public abstract class AudioGeneratorNodeBase : ProxyVoidNode, IExecutionChangeListener where P : AudioGeneratorNodeProxyBase, new()
+{
+ public readonly ObjectOutput AudioOutput;
+
+ private ObjectStore> _enabledChangedHandler;
+
+ private ObjectStore _activeChangedHandler;
+
+ public bool ValueListensToChanges { get; private set; }
+
+ private bool ShouldListen(P proxy)
+ {
+ if (proxy.Enabled)
+ {
+ return proxy.Slot.IsActive;
+ }
+ return false;
+ }
+
+ protected override void ProxyAdded(P proxy, FrooxEngineContext context)
+ {
+ base.ProxyAdded(proxy, context);
+ NodeContextPath path = context.CaptureContextPath();
+ ProtoFluxNodeGroup group = context.Group;
+ context.GetEventDispatcher(out var dispatcher);
+ Action enabledHandler = delegate
+ {
+ dispatcher.ScheduleEvent(path, delegate (FrooxEngineContext c)
+ {
+ UpdateListenerState(c);
+ });
+ };
+ SlotEvent activeHandler = delegate
+ {
+ dispatcher.ScheduleEvent(path, delegate (FrooxEngineContext c)
+ {
+ UpdateListenerState(c);
+ });
+ };
+ proxy.EnabledField.Changed += enabledHandler;
+ proxy.Slot.ActiveChanged += activeHandler;
+ _enabledChangedHandler.Write(enabledHandler, context);
+ _activeChangedHandler.Write(activeHandler, context);
+ ValueListensToChanges = ShouldListen(proxy);
+ proxy.Active = ValueListensToChanges;
+ }
+
+ protected override void ProxyRemoved(P proxy, FrooxEngineContext context, bool inUseByAnotherInstance)
+ {
+ if (!inUseByAnotherInstance)
+ {
+ proxy.EnabledField.Changed -= _enabledChangedHandler.Read(context);
+ proxy.Slot.ActiveChanged -= _activeChangedHandler.Read(context);
+ _enabledChangedHandler.Clear(context);
+ _activeChangedHandler.Clear(context);
+ proxy.Active = false;
+ }
+ }
+
+ protected void UpdateListenerState(FrooxEngineContext context)
+ {
+ P proxy = GetProxy(context);
+ if (proxy != null)
+ {
+ bool shouldListen = ShouldListen(proxy);
+ if (shouldListen != ValueListensToChanges)
+ {
+ ValueListensToChanges = shouldListen;
+ context.Group.MarkChangeTrackingDirty();
+ proxy.Active = shouldListen;
+ }
+ }
+ }
+
+ public virtual void Changed(FrooxEngineContext context)
+ {
+
+ }
+
+ protected override void ComputeOutputs(FrooxEngineContext context)
+ {
+ P proxy = GetProxy(context);
+ AudioOutput.Write(proxy, context);
+ }
+
+ public AudioGeneratorNodeBase()
+ {
+ AudioOutput = new ObjectOutput(this);
+ }
+}
\ No newline at end of file
diff --git a/ProjectObsidian/ProtoFlux/Audio/AudioProcessorBaseTest.cs b/ProjectObsidian/ProtoFlux/Audio/AudioProcessorBaseTest.cs
new file mode 100644
index 0000000..63f7d78
--- /dev/null
+++ b/ProjectObsidian/ProtoFlux/Audio/AudioProcessorBaseTest.cs
@@ -0,0 +1,30 @@
+using System;
+using Awwdio;
+using Elements.Assets;
+using FrooxEngine;
+using FrooxEngine.ProtoFlux;
+using ProtoFlux.Core;
+
+namespace ProtoFlux.Runtimes.Execution.Nodes.Obsidian.Audio
+{
+ public abstract class AudioProcessorNodeProxyBase : AudioGeneratorNodeProxyBase
+ {
+ public IWorldAudioDataSource AudioInput;
+ }
+ [NodeCategory("Obsidian/Audio")]
+ public abstract class AudioProcessorNodeBase : AudioGeneratorNodeBase
where P : AudioProcessorNodeProxyBase, new()
+ {
+ [ChangeListener]
+ public readonly ObjectInput AudioInput;
+
+ public override void Changed(FrooxEngineContext context)
+ {
+ P proxy = GetProxy(context);
+ if (proxy == null)
+ {
+ return;
+ }
+ proxy.AudioInput = AudioInput.Evaluate(context);
+ }
+ }
+}
\ No newline at end of file
diff --git a/ProjectObsidian/ProtoFlux/Audio/BandPassFilterNode.cs b/ProjectObsidian/ProtoFlux/Audio/BandPassFilterNode.cs
index 3fed7e7..f30d3c0 100644
--- a/ProjectObsidian/ProtoFlux/Audio/BandPassFilterNode.cs
+++ b/ProjectObsidian/ProtoFlux/Audio/BandPassFilterNode.cs
@@ -9,25 +9,19 @@
namespace ProtoFlux.Runtimes.Execution.Nodes.Obsidian.Audio
{
- public class BandPassFilterProxy : ProtoFluxEngineProxy, Awwdio.IAudioDataSource, IWorldAudioDataSource
+ public class BandPassFilterProxy : AudioProcessorNodeProxyBase
{
- public IWorldAudioDataSource AudioInput;
-
public float LowFrequency;
public float HighFrequency;
public float Resonance;
- public bool Active;
-
- public bool IsActive => Active;
-
- public int ChannelCount => AudioInput?.ChannelCount ?? 0;
+ public override int ChannelCount => AudioInput?.ChannelCount ?? 0;
private BandPassFilterController _controller = new();
- public void Read(Span buffer, AudioSimulator simulator) where S : unmanaged, IAudioSample
+ public override void Read(Span buffer, AudioSimulator simulator)
{
lock (_controller)
{
@@ -49,11 +43,8 @@ public void Read(Span buffer, AudioSimulator simulator) where S : unmanage
}
}
[NodeCategory("Obsidian/Audio/Filters")]
- public class BandPassFilter : ProxyVoidNode, IExecutionChangeListener
+ public class BandPassFilter : AudioProcessorNodeBase
{
- [ChangeListener]
- public readonly ObjectInput AudioInput;
-
[ChangeListener]
[DefaultValueAttribute(20f)]
public readonly ValueInput LowFrequency;
@@ -66,100 +57,17 @@ public class BandPassFilter : ProxyVoidNode Resonance;
- public readonly ObjectOutput AudioOutput;
-
- private ObjectStore> _enabledChangedHandler;
-
- private ObjectStore _activeChangedHandler;
-
- public bool ValueListensToChanges { get; private set; }
-
- private bool ShouldListen(BandPassFilterProxy proxy)
- {
- if (proxy.Enabled)
- {
- return proxy.Slot.IsActive;
- }
- return false;
- }
-
- protected override void ProxyAdded(BandPassFilterProxy proxy, FrooxEngineContext context)
- {
- base.ProxyAdded(proxy, context);
- NodeContextPath path = context.CaptureContextPath();
- ProtoFluxNodeGroup group = context.Group;
- context.GetEventDispatcher(out var dispatcher);
- Action enabledHandler = delegate
- {
- dispatcher.ScheduleEvent(path, delegate (FrooxEngineContext c)
- {
- UpdateListenerState(c);
- });
- };
- SlotEvent activeHandler = delegate
- {
- dispatcher.ScheduleEvent(path, delegate (FrooxEngineContext c)
- {
- UpdateListenerState(c);
- });
- };
- proxy.EnabledField.Changed += enabledHandler;
- proxy.Slot.ActiveChanged += activeHandler;
- _enabledChangedHandler.Write(enabledHandler, context);
- _activeChangedHandler.Write(activeHandler, context);
- ValueListensToChanges = ShouldListen(proxy);
- proxy.Active = ValueListensToChanges;
- }
-
- protected override void ProxyRemoved(BandPassFilterProxy proxy, FrooxEngineContext context, bool inUseByAnotherInstance)
- {
- if (!inUseByAnotherInstance)
- {
- proxy.EnabledField.Changed -= _enabledChangedHandler.Read(context);
- proxy.Slot.ActiveChanged -= _activeChangedHandler.Read(context);
- _enabledChangedHandler.Clear(context);
- _activeChangedHandler.Clear(context);
- proxy.Active = false;
- }
- }
-
- protected void UpdateListenerState(FrooxEngineContext context)
- {
- BandPassFilterProxy proxy = GetProxy(context);
- if (proxy != null)
- {
- bool shouldListen = ShouldListen(proxy);
- if (shouldListen != ValueListensToChanges)
- {
- ValueListensToChanges = shouldListen;
- context.Group.MarkChangeTrackingDirty();
- proxy.Active = shouldListen;
- }
- }
- }
-
- public void Changed(FrooxEngineContext context)
+ public override void Changed(FrooxEngineContext context)
{
+ base.Changed(context);
BandPassFilterProxy proxy = GetProxy(context);
if (proxy == null)
{
return;
}
- proxy.AudioInput = AudioInput.Evaluate(context);
proxy.LowFrequency = LowFrequency.Evaluate(context, 20f);
proxy.HighFrequency = HighFrequency.Evaluate(context, 20000f);
proxy.Resonance = Resonance.Evaluate(context, 1.41f);
}
-
- protected override void ComputeOutputs(FrooxEngineContext context)
- {
- BandPassFilterProxy proxy = GetProxy(context);
- AudioOutput.Write(proxy, context);
- }
-
- public BandPassFilter()
- {
- AudioOutput = new ObjectOutput(this);
- }
}
}
\ No newline at end of file
diff --git a/ProjectObsidian/ProtoFlux/Audio/SawtoothGenerator.cs b/ProjectObsidian/ProtoFlux/Audio/SawtoothGenerator.cs
index 1025bb3..610d9dc 100644
--- a/ProjectObsidian/ProtoFlux/Audio/SawtoothGenerator.cs
+++ b/ProjectObsidian/ProtoFlux/Audio/SawtoothGenerator.cs
@@ -10,7 +10,7 @@
namespace ProtoFlux.Runtimes.Execution.Nodes.Obsidian.Audio
{
- public class SawtoothGeneratorProxy : AudioNodeProxyBase
+ public class SawtoothGeneratorProxy : AudioGeneratorNodeProxyBase
{
public float Frequency;
@@ -24,8 +24,6 @@ public class SawtoothGeneratorProxy : AudioNodeProxyBase
public override int ChannelCount => 1;
- public override bool Active { get; set; }
-
private bool updateTime;
public override void Read(Span buffer, AudioSimulator simulator)
@@ -75,7 +73,7 @@ protected override void OnStart()
}
}
[NodeCategory("Obsidian/Audio/Generators")]
- public class SawtoothGenerator : AudioNodeBase
+ public class SawtoothGenerator : AudioGeneratorNodeBase
{
[ChangeListener]
[DefaultValueAttribute(440f)]
From 5799d9e4c5dc4afa2aeb006b55a7a3e1f3484632 Mon Sep 17 00:00:00 2001
From: Nytra <14206961+Nytra@users.noreply.github.com>
Date: Sat, 4 Oct 2025 16:08:51 +0100
Subject: [PATCH 07/12] restore generic types attributes on json nodes
---
ProjectObsidian/ProtoFlux/JSON/JsonAddValueToObjectNode.cs | 2 +-
ProjectObsidian/ProtoFlux/JSON/JsonAppendObjectToArrayNode.cs | 2 +-
ProjectObsidian/ProtoFlux/JSON/JsonAppendValueToArrayNode.cs | 2 +-
ProjectObsidian/ProtoFlux/JSON/JsonGetObjectFromArrayNode.cs | 2 +-
ProjectObsidian/ProtoFlux/JSON/JsonGetObjectFromObjectNode.cs | 2 +-
ProjectObsidian/ProtoFlux/JSON/JsonGetValueFromArrayNode.cs | 2 +-
ProjectObsidian/ProtoFlux/JSON/JsonGetValueFromObjectNode.cs | 2 +-
ProjectObsidian/ProtoFlux/JSON/JsonInsertObjectToArrayNode.cs | 2 +-
ProjectObsidian/ProtoFlux/JSON/JsonInsertValueToArrayNode.cs | 2 +-
.../ProtoFlux/JSON/JsonQuickGetObjectFromObjectNode.cs | 2 +-
.../ProtoFlux/JSON/JsonQuickGetValueFromObjectNode.cs | 2 +-
ProjectObsidian/ProtoFlux/JSON/JsonToStringNode.cs | 2 +-
12 files changed, 12 insertions(+), 12 deletions(-)
diff --git a/ProjectObsidian/ProtoFlux/JSON/JsonAddValueToObjectNode.cs b/ProjectObsidian/ProtoFlux/JSON/JsonAddValueToObjectNode.cs
index 0bd477e..d26a7e0 100644
--- a/ProjectObsidian/ProtoFlux/JSON/JsonAddValueToObjectNode.cs
+++ b/ProjectObsidian/ProtoFlux/JSON/JsonAddValueToObjectNode.cs
@@ -12,7 +12,7 @@ namespace ProtoFlux.Runtimes.Execution.Nodes.Obsidian.Json;
[NodeName("Add To Object")]
[NodeCategory("Obsidian/Json")]
-//[GenericTypes(GenericTypesAttribute.TypeMode.DirectTypes, typeof(byte), typeof(sbyte), typeof(short), typeof(ushort), typeof(int), typeof(uint), typeof(long), typeof(ulong), typeof(float), typeof(double))]
+[GenericTypes(GenericTypesAttribute.TypeMode.DirectTypes, typeof(byte), typeof(sbyte), typeof(short), typeof(ushort), typeof(int), typeof(uint), typeof(long), typeof(ulong), typeof(float), typeof(double))]
public class JsonAddValueToObjectNode : ObjectFunctionNode where T : unmanaged
{
public readonly ObjectInput Input;
diff --git a/ProjectObsidian/ProtoFlux/JSON/JsonAppendObjectToArrayNode.cs b/ProjectObsidian/ProtoFlux/JSON/JsonAppendObjectToArrayNode.cs
index 6a88421..910e736 100644
--- a/ProjectObsidian/ProtoFlux/JSON/JsonAppendObjectToArrayNode.cs
+++ b/ProjectObsidian/ProtoFlux/JSON/JsonAppendObjectToArrayNode.cs
@@ -12,7 +12,7 @@ namespace ProtoFlux.Runtimes.Execution.Nodes.Obsidian.Json;
[NodeName("Append To Array")]
[NodeCategory("Obsidian/Json")]
-//[GenericTypes(GenericTypesAttribute.TypeMode.DirectTypes, typeof(string), typeof(Uri), typeof(JsonToken), typeof(JsonObject), typeof(JsonArray), typeof(IJsonToken))]
+[GenericTypes(GenericTypesAttribute.TypeMode.DirectTypes, typeof(string), typeof(Uri), typeof(JsonToken), typeof(JsonObject), typeof(JsonArray), typeof(IJsonToken))]
public class JsonAppendObjectToArrayNode : ObjectFunctionNode where T : class
{
public readonly ObjectInput Array;
diff --git a/ProjectObsidian/ProtoFlux/JSON/JsonAppendValueToArrayNode.cs b/ProjectObsidian/ProtoFlux/JSON/JsonAppendValueToArrayNode.cs
index ef9a667..ca46ee8 100644
--- a/ProjectObsidian/ProtoFlux/JSON/JsonAppendValueToArrayNode.cs
+++ b/ProjectObsidian/ProtoFlux/JSON/JsonAppendValueToArrayNode.cs
@@ -12,7 +12,7 @@ namespace ProtoFlux.Runtimes.Execution.Nodes.Obsidian.Json;
[NodeName("Append To Array")]
[NodeCategory("Obsidian/Json")]
-//[GenericTypes(GenericTypesAttribute.TypeMode.DirectTypes, typeof(byte), typeof(sbyte), typeof(short), typeof(ushort), typeof(int), typeof(uint), typeof(long), typeof(ulong), typeof(float), typeof(double))]
+[GenericTypes(GenericTypesAttribute.TypeMode.DirectTypes, typeof(byte), typeof(sbyte), typeof(short), typeof(ushort), typeof(int), typeof(uint), typeof(long), typeof(ulong), typeof(float), typeof(double))]
public class JsonAppendValueToArrayNode : ObjectFunctionNode where T : unmanaged
{
public readonly ObjectInput Array;
diff --git a/ProjectObsidian/ProtoFlux/JSON/JsonGetObjectFromArrayNode.cs b/ProjectObsidian/ProtoFlux/JSON/JsonGetObjectFromArrayNode.cs
index fae843e..efeabed 100644
--- a/ProjectObsidian/ProtoFlux/JSON/JsonGetObjectFromArrayNode.cs
+++ b/ProjectObsidian/ProtoFlux/JSON/JsonGetObjectFromArrayNode.cs
@@ -12,7 +12,7 @@ namespace ProtoFlux.Runtimes.Execution.Nodes.Obsidian.Json;
[NodeName("Get From Array")]
[NodeCategory("Obsidian/Json")]
-//[GenericTypes(GenericTypesAttribute.TypeMode.DirectTypes, typeof(string), typeof(Uri), typeof(JsonObject), typeof(JsonArray), typeof(JsonToken))]
+[GenericTypes(GenericTypesAttribute.TypeMode.DirectTypes, typeof(string), typeof(Uri), typeof(JsonObject), typeof(JsonArray), typeof(JsonToken))]
public class JsonGetObjectFromArrayNode : ObjectFunctionNode where T : class
{
public readonly ObjectInput Input;
diff --git a/ProjectObsidian/ProtoFlux/JSON/JsonGetObjectFromObjectNode.cs b/ProjectObsidian/ProtoFlux/JSON/JsonGetObjectFromObjectNode.cs
index 0ce2ed5..24da777 100644
--- a/ProjectObsidian/ProtoFlux/JSON/JsonGetObjectFromObjectNode.cs
+++ b/ProjectObsidian/ProtoFlux/JSON/JsonGetObjectFromObjectNode.cs
@@ -12,7 +12,7 @@ namespace ProtoFlux.Runtimes.Execution.Nodes.Obsidian.Json;
[NodeName("Get From Object")]
[NodeCategory("Obsidian/Json")]
-//[GenericTypes(GenericTypesAttribute.TypeMode.DirectTypes, typeof(string), typeof(Uri), typeof(JsonObject), typeof(JsonArray), typeof(JsonToken))]
+[GenericTypes(GenericTypesAttribute.TypeMode.DirectTypes, typeof(string), typeof(Uri), typeof(JsonObject), typeof(JsonArray), typeof(JsonToken))]
public class JsonGetObjectFromObjectNode : ObjectFunctionNode where T : class
{
public readonly ObjectInput Input;
diff --git a/ProjectObsidian/ProtoFlux/JSON/JsonGetValueFromArrayNode.cs b/ProjectObsidian/ProtoFlux/JSON/JsonGetValueFromArrayNode.cs
index 1a3a9c6..6dc1592 100644
--- a/ProjectObsidian/ProtoFlux/JSON/JsonGetValueFromArrayNode.cs
+++ b/ProjectObsidian/ProtoFlux/JSON/JsonGetValueFromArrayNode.cs
@@ -9,7 +9,7 @@ namespace ProtoFlux.Runtimes.Execution.Nodes.Obsidian.Json;
[NodeName("Get From Array")]
[NodeCategory("Obsidian/Json")]
-//[GenericTypes(GenericTypesAttribute.TypeMode.DirectTypes, typeof(byte), typeof(sbyte), typeof(short), typeof(ushort), typeof(int), typeof(uint), typeof(long), typeof(ulong), typeof(float), typeof(double))]
+[GenericTypes(GenericTypesAttribute.TypeMode.DirectTypes, typeof(byte), typeof(sbyte), typeof(short), typeof(ushort), typeof(int), typeof(uint), typeof(long), typeof(ulong), typeof(float), typeof(double))]
public class JsonGetValueFromArrayNode : ValueFunctionNode where T : unmanaged
{
public readonly ObjectInput Input;
diff --git a/ProjectObsidian/ProtoFlux/JSON/JsonGetValueFromObjectNode.cs b/ProjectObsidian/ProtoFlux/JSON/JsonGetValueFromObjectNode.cs
index 35ca7d2..553416b 100644
--- a/ProjectObsidian/ProtoFlux/JSON/JsonGetValueFromObjectNode.cs
+++ b/ProjectObsidian/ProtoFlux/JSON/JsonGetValueFromObjectNode.cs
@@ -12,7 +12,7 @@ namespace ProtoFlux.Runtimes.Execution.Nodes.Obsidian.Json;
[NodeName("Get From Object")]
[NodeCategory("Obsidian/Json")]
-//[GenericTypes(GenericTypesAttribute.TypeMode.DirectTypes, typeof(byte), typeof(sbyte), typeof(short), typeof(ushort), typeof(int), typeof(uint), typeof(long), typeof(ulong), typeof(float), typeof(double))]
+[GenericTypes(GenericTypesAttribute.TypeMode.DirectTypes, typeof(byte), typeof(sbyte), typeof(short), typeof(ushort), typeof(int), typeof(uint), typeof(long), typeof(ulong), typeof(float), typeof(double))]
public class JsonGetValueFromObjectNode : ValueFunctionNode where T : unmanaged
{
public readonly ObjectInput Input;
diff --git a/ProjectObsidian/ProtoFlux/JSON/JsonInsertObjectToArrayNode.cs b/ProjectObsidian/ProtoFlux/JSON/JsonInsertObjectToArrayNode.cs
index 08fea9c..4b3ca16 100644
--- a/ProjectObsidian/ProtoFlux/JSON/JsonInsertObjectToArrayNode.cs
+++ b/ProjectObsidian/ProtoFlux/JSON/JsonInsertObjectToArrayNode.cs
@@ -12,7 +12,7 @@ namespace ProtoFlux.Runtimes.Execution.Nodes.Obsidian.Json;
[NodeName("Insert To Array")]
[NodeCategory("Obsidian/Json")]
-//[GenericTypes(GenericTypesAttribute.TypeMode.DirectTypes, typeof(string), typeof(Uri), typeof(JsonToken), typeof(JsonObject), typeof(JsonArray), typeof(IJsonToken))]
+[GenericTypes(GenericTypesAttribute.TypeMode.DirectTypes, typeof(string), typeof(Uri), typeof(JsonToken), typeof(JsonObject), typeof(JsonArray), typeof(IJsonToken))]
public class JsonInsertObjectToArrayNode : ObjectFunctionNode where T : class
{
public readonly ObjectInput Array;
diff --git a/ProjectObsidian/ProtoFlux/JSON/JsonInsertValueToArrayNode.cs b/ProjectObsidian/ProtoFlux/JSON/JsonInsertValueToArrayNode.cs
index 5d015b0..9c1ce62 100644
--- a/ProjectObsidian/ProtoFlux/JSON/JsonInsertValueToArrayNode.cs
+++ b/ProjectObsidian/ProtoFlux/JSON/JsonInsertValueToArrayNode.cs
@@ -12,7 +12,7 @@ namespace ProtoFlux.Runtimes.Execution.Nodes.Obsidian.Json;
[NodeName("Insert To Array")]
[NodeCategory("Obsidian/Json")]
-//[GenericTypes(GenericTypesAttribute.TypeMode.DirectTypes, typeof(byte), typeof(sbyte), typeof(short), typeof(ushort), typeof(int), typeof(uint), typeof(long), typeof(ulong), typeof(float), typeof(double))]
+[GenericTypes(GenericTypesAttribute.TypeMode.DirectTypes, typeof(byte), typeof(sbyte), typeof(short), typeof(ushort), typeof(int), typeof(uint), typeof(long), typeof(ulong), typeof(float), typeof(double))]
public class JsonInsertValueToArrayNode : ObjectFunctionNode where T : unmanaged
{
public readonly ObjectInput Array;
diff --git a/ProjectObsidian/ProtoFlux/JSON/JsonQuickGetObjectFromObjectNode.cs b/ProjectObsidian/ProtoFlux/JSON/JsonQuickGetObjectFromObjectNode.cs
index 27e16b2..5b2f987 100644
--- a/ProjectObsidian/ProtoFlux/JSON/JsonQuickGetObjectFromObjectNode.cs
+++ b/ProjectObsidian/ProtoFlux/JSON/JsonQuickGetObjectFromObjectNode.cs
@@ -12,7 +12,7 @@ namespace ProtoFlux.Runtimes.Execution.Nodes.Obsidian.Json;
[NodeName("Quick Get From Object")]
[NodeCategory("Obsidian/Json")]
-//[GenericTypes(typeof(string), typeof(Uri), typeof(JsonObject), typeof(JsonArray), typeof(JsonToken))]
+[GenericTypes(typeof(string), typeof(Uri), typeof(JsonObject), typeof(JsonArray), typeof(JsonToken))]
public class JsonQuickGetObjectFromObjectNode : ObjectFunctionNode where T : class
{
public readonly ObjectInput Input;
diff --git a/ProjectObsidian/ProtoFlux/JSON/JsonQuickGetValueFromObjectNode.cs b/ProjectObsidian/ProtoFlux/JSON/JsonQuickGetValueFromObjectNode.cs
index 2308e3f..d18f519 100644
--- a/ProjectObsidian/ProtoFlux/JSON/JsonQuickGetValueFromObjectNode.cs
+++ b/ProjectObsidian/ProtoFlux/JSON/JsonQuickGetValueFromObjectNode.cs
@@ -12,7 +12,7 @@ namespace ProtoFlux.Runtimes.Execution.Nodes.Obsidian.Json;
[NodeName("Quick Get From Object")]
[NodeCategory("Obsidian/Json")]
-//[GenericTypes(GenericTypesAttribute.TypeMode.DirectTypes, typeof(byte), typeof(sbyte), typeof(short), typeof(ushort), typeof(int), typeof(uint), typeof(long), typeof(ulong), typeof(float), typeof(double))]
+[GenericTypes(GenericTypesAttribute.TypeMode.DirectTypes, typeof(byte), typeof(sbyte), typeof(short), typeof(ushort), typeof(int), typeof(uint), typeof(long), typeof(ulong), typeof(float), typeof(double))]
public class JsonQuickGetValueFromObjectNode : ValueFunctionNode where T : unmanaged
{
public readonly ObjectInput Input;
diff --git a/ProjectObsidian/ProtoFlux/JSON/JsonToStringNode.cs b/ProjectObsidian/ProtoFlux/JSON/JsonToStringNode.cs
index 307d144..d511b39 100644
--- a/ProjectObsidian/ProtoFlux/JSON/JsonToStringNode.cs
+++ b/ProjectObsidian/ProtoFlux/JSON/JsonToStringNode.cs
@@ -11,7 +11,7 @@ namespace ProtoFlux.Runtimes.Execution.Nodes.Obsidian.Json;
[NodeName("To String")]
[NodeCategory("Obsidian/Json")]
-//[GenericTypes(GenericTypesAttribute.TypeMode.DirectTypes, typeof(JsonObject), typeof(JsonArray), typeof(JsonToken), typeof(IJsonToken))]
+[GenericTypes(GenericTypesAttribute.TypeMode.DirectTypes, typeof(JsonObject), typeof(JsonArray), typeof(JsonToken), typeof(IJsonToken))]
public class JsonToStringNode : ObjectFunctionNode
{
public readonly ObjectInput Input;
From f75c8dbc49d73fa63f09ec613af1107fc7f23a92 Mon Sep 17 00:00:00 2001
From: Nytra <14206961+Nytra@users.noreply.github.com>
Date: Fri, 10 Oct 2025 23:13:18 +0100
Subject: [PATCH 08/12] Restore json nodes and update submodule
---
.gitmodules | 2 +-
ProjectObsidian.SourceGenerators | 2 +-
ProjectObsidian/ProtoFlux/JSON/JsonAddObjectToObjectNode.cs | 2 +-
ProjectObsidian/ProtoFlux/JSON/JsonAddValueToObjectNode.cs | 2 +-
ProjectObsidian/ProtoFlux/JSON/JsonAppendObjectToArrayNode.cs | 2 +-
ProjectObsidian/ProtoFlux/JSON/JsonAppendValueToArrayNode.cs | 2 +-
ProjectObsidian/ProtoFlux/JSON/JsonGetObjectFromArrayNode.cs | 2 +-
ProjectObsidian/ProtoFlux/JSON/JsonGetObjectFromObjectNode.cs | 2 +-
ProjectObsidian/ProtoFlux/JSON/JsonGetValueFromArrayNode.cs | 2 +-
ProjectObsidian/ProtoFlux/JSON/JsonGetValueFromObjectNode.cs | 2 +-
ProjectObsidian/ProtoFlux/JSON/JsonInsertObjectToArrayNode.cs | 2 +-
ProjectObsidian/ProtoFlux/JSON/JsonInsertValueToArrayNode.cs | 2 +-
.../ProtoFlux/JSON/JsonQuickGetValueFromObjectNode.cs | 2 +-
ProjectObsidian/ProtoFlux/JSON/JsonToStringNode.cs | 2 +-
14 files changed, 14 insertions(+), 14 deletions(-)
diff --git a/.gitmodules b/.gitmodules
index fdf5dfd..b4732f5 100644
--- a/.gitmodules
+++ b/.gitmodules
@@ -1,4 +1,4 @@
[submodule "ProjectObsidian.SourceGenerators"]
path = ProjectObsidian.SourceGenerators
url = https://github.com/Custom-Extension-Works/Project-Obsidian.SourceGenerators
- branch = tryFixAbstract3
+ branch = main
diff --git a/ProjectObsidian.SourceGenerators b/ProjectObsidian.SourceGenerators
index caa0f93..e073aba 160000
--- a/ProjectObsidian.SourceGenerators
+++ b/ProjectObsidian.SourceGenerators
@@ -1 +1 @@
-Subproject commit caa0f930c3e41ea30d2eb109ea2a20435946a522
+Subproject commit e073aba49148a23d952902a851b9839d3a8950c0
diff --git a/ProjectObsidian/ProtoFlux/JSON/JsonAddObjectToObjectNode.cs b/ProjectObsidian/ProtoFlux/JSON/JsonAddObjectToObjectNode.cs
index b5cb829..81424cf 100644
--- a/ProjectObsidian/ProtoFlux/JSON/JsonAddObjectToObjectNode.cs
+++ b/ProjectObsidian/ProtoFlux/JSON/JsonAddObjectToObjectNode.cs
@@ -12,7 +12,7 @@ namespace ProtoFlux.Runtimes.Execution.Nodes.Obsidian.Json;
[NodeName("Add To Object")]
[NodeCategory("Obsidian/Json")]
-// [GenericTypes(GenericTypesAttribute.TypeMode.DirectTypes, typeof(string), typeof(Uri), typeof(JsonToken), typeof(JsonObject), typeof(JsonArray), typeof(IJsonToken))]
+[GenericTypes(typeof(string), typeof(Uri), typeof(JsonToken), typeof(JsonObject), typeof(JsonArray), typeof(IJsonToken))]
public class JsonAddObjectToObjectNode : ObjectFunctionNode where T : class
{
public readonly ObjectInput Input;
diff --git a/ProjectObsidian/ProtoFlux/JSON/JsonAddValueToObjectNode.cs b/ProjectObsidian/ProtoFlux/JSON/JsonAddValueToObjectNode.cs
index d26a7e0..607de1b 100644
--- a/ProjectObsidian/ProtoFlux/JSON/JsonAddValueToObjectNode.cs
+++ b/ProjectObsidian/ProtoFlux/JSON/JsonAddValueToObjectNode.cs
@@ -12,7 +12,7 @@ namespace ProtoFlux.Runtimes.Execution.Nodes.Obsidian.Json;
[NodeName("Add To Object")]
[NodeCategory("Obsidian/Json")]
-[GenericTypes(GenericTypesAttribute.TypeMode.DirectTypes, typeof(byte), typeof(sbyte), typeof(short), typeof(ushort), typeof(int), typeof(uint), typeof(long), typeof(ulong), typeof(float), typeof(double))]
+[GenericTypes(typeof(byte), typeof(sbyte), typeof(short), typeof(ushort), typeof(int), typeof(uint), typeof(long), typeof(ulong), typeof(float), typeof(double))]
public class JsonAddValueToObjectNode : ObjectFunctionNode where T : unmanaged
{
public readonly ObjectInput Input;
diff --git a/ProjectObsidian/ProtoFlux/JSON/JsonAppendObjectToArrayNode.cs b/ProjectObsidian/ProtoFlux/JSON/JsonAppendObjectToArrayNode.cs
index 910e736..4cd02d5 100644
--- a/ProjectObsidian/ProtoFlux/JSON/JsonAppendObjectToArrayNode.cs
+++ b/ProjectObsidian/ProtoFlux/JSON/JsonAppendObjectToArrayNode.cs
@@ -12,7 +12,7 @@ namespace ProtoFlux.Runtimes.Execution.Nodes.Obsidian.Json;
[NodeName("Append To Array")]
[NodeCategory("Obsidian/Json")]
-[GenericTypes(GenericTypesAttribute.TypeMode.DirectTypes, typeof(string), typeof(Uri), typeof(JsonToken), typeof(JsonObject), typeof(JsonArray), typeof(IJsonToken))]
+[GenericTypes(typeof(string), typeof(Uri), typeof(JsonToken), typeof(JsonObject), typeof(JsonArray), typeof(IJsonToken))]
public class JsonAppendObjectToArrayNode : ObjectFunctionNode where T : class
{
public readonly ObjectInput Array;
diff --git a/ProjectObsidian/ProtoFlux/JSON/JsonAppendValueToArrayNode.cs b/ProjectObsidian/ProtoFlux/JSON/JsonAppendValueToArrayNode.cs
index ca46ee8..4f9979e 100644
--- a/ProjectObsidian/ProtoFlux/JSON/JsonAppendValueToArrayNode.cs
+++ b/ProjectObsidian/ProtoFlux/JSON/JsonAppendValueToArrayNode.cs
@@ -12,7 +12,7 @@ namespace ProtoFlux.Runtimes.Execution.Nodes.Obsidian.Json;
[NodeName("Append To Array")]
[NodeCategory("Obsidian/Json")]
-[GenericTypes(GenericTypesAttribute.TypeMode.DirectTypes, typeof(byte), typeof(sbyte), typeof(short), typeof(ushort), typeof(int), typeof(uint), typeof(long), typeof(ulong), typeof(float), typeof(double))]
+[GenericTypes(typeof(byte), typeof(sbyte), typeof(short), typeof(ushort), typeof(int), typeof(uint), typeof(long), typeof(ulong), typeof(float), typeof(double))]
public class JsonAppendValueToArrayNode : ObjectFunctionNode where T : unmanaged
{
public readonly ObjectInput Array;
diff --git a/ProjectObsidian/ProtoFlux/JSON/JsonGetObjectFromArrayNode.cs b/ProjectObsidian/ProtoFlux/JSON/JsonGetObjectFromArrayNode.cs
index efeabed..0f6a2f5 100644
--- a/ProjectObsidian/ProtoFlux/JSON/JsonGetObjectFromArrayNode.cs
+++ b/ProjectObsidian/ProtoFlux/JSON/JsonGetObjectFromArrayNode.cs
@@ -12,7 +12,7 @@ namespace ProtoFlux.Runtimes.Execution.Nodes.Obsidian.Json;
[NodeName("Get From Array")]
[NodeCategory("Obsidian/Json")]
-[GenericTypes(GenericTypesAttribute.TypeMode.DirectTypes, typeof(string), typeof(Uri), typeof(JsonObject), typeof(JsonArray), typeof(JsonToken))]
+[GenericTypes(typeof(string), typeof(Uri), typeof(JsonObject), typeof(JsonArray), typeof(JsonToken))]
public class JsonGetObjectFromArrayNode : ObjectFunctionNode where T : class
{
public readonly ObjectInput Input;
diff --git a/ProjectObsidian/ProtoFlux/JSON/JsonGetObjectFromObjectNode.cs b/ProjectObsidian/ProtoFlux/JSON/JsonGetObjectFromObjectNode.cs
index 24da777..274167e 100644
--- a/ProjectObsidian/ProtoFlux/JSON/JsonGetObjectFromObjectNode.cs
+++ b/ProjectObsidian/ProtoFlux/JSON/JsonGetObjectFromObjectNode.cs
@@ -12,7 +12,7 @@ namespace ProtoFlux.Runtimes.Execution.Nodes.Obsidian.Json;
[NodeName("Get From Object")]
[NodeCategory("Obsidian/Json")]
-[GenericTypes(GenericTypesAttribute.TypeMode.DirectTypes, typeof(string), typeof(Uri), typeof(JsonObject), typeof(JsonArray), typeof(JsonToken))]
+[GenericTypes(typeof(string), typeof(Uri), typeof(JsonObject), typeof(JsonArray), typeof(JsonToken))]
public class JsonGetObjectFromObjectNode : ObjectFunctionNode where T : class
{
public readonly ObjectInput Input;
diff --git a/ProjectObsidian/ProtoFlux/JSON/JsonGetValueFromArrayNode.cs b/ProjectObsidian/ProtoFlux/JSON/JsonGetValueFromArrayNode.cs
index 6dc1592..a85c3cf 100644
--- a/ProjectObsidian/ProtoFlux/JSON/JsonGetValueFromArrayNode.cs
+++ b/ProjectObsidian/ProtoFlux/JSON/JsonGetValueFromArrayNode.cs
@@ -9,7 +9,7 @@ namespace ProtoFlux.Runtimes.Execution.Nodes.Obsidian.Json;
[NodeName("Get From Array")]
[NodeCategory("Obsidian/Json")]
-[GenericTypes(GenericTypesAttribute.TypeMode.DirectTypes, typeof(byte), typeof(sbyte), typeof(short), typeof(ushort), typeof(int), typeof(uint), typeof(long), typeof(ulong), typeof(float), typeof(double))]
+[GenericTypes(typeof(byte), typeof(sbyte), typeof(short), typeof(ushort), typeof(int), typeof(uint), typeof(long), typeof(ulong), typeof(float), typeof(double))]
public class JsonGetValueFromArrayNode : ValueFunctionNode where T : unmanaged
{
public readonly ObjectInput Input;
diff --git a/ProjectObsidian/ProtoFlux/JSON/JsonGetValueFromObjectNode.cs b/ProjectObsidian/ProtoFlux/JSON/JsonGetValueFromObjectNode.cs
index 553416b..682ca79 100644
--- a/ProjectObsidian/ProtoFlux/JSON/JsonGetValueFromObjectNode.cs
+++ b/ProjectObsidian/ProtoFlux/JSON/JsonGetValueFromObjectNode.cs
@@ -12,7 +12,7 @@ namespace ProtoFlux.Runtimes.Execution.Nodes.Obsidian.Json;
[NodeName("Get From Object")]
[NodeCategory("Obsidian/Json")]
-[GenericTypes(GenericTypesAttribute.TypeMode.DirectTypes, typeof(byte), typeof(sbyte), typeof(short), typeof(ushort), typeof(int), typeof(uint), typeof(long), typeof(ulong), typeof(float), typeof(double))]
+[GenericTypes(typeof(byte), typeof(sbyte), typeof(short), typeof(ushort), typeof(int), typeof(uint), typeof(long), typeof(ulong), typeof(float), typeof(double))]
public class JsonGetValueFromObjectNode : ValueFunctionNode where T : unmanaged
{
public readonly ObjectInput Input;
diff --git a/ProjectObsidian/ProtoFlux/JSON/JsonInsertObjectToArrayNode.cs b/ProjectObsidian/ProtoFlux/JSON/JsonInsertObjectToArrayNode.cs
index 4b3ca16..385e1a1 100644
--- a/ProjectObsidian/ProtoFlux/JSON/JsonInsertObjectToArrayNode.cs
+++ b/ProjectObsidian/ProtoFlux/JSON/JsonInsertObjectToArrayNode.cs
@@ -12,7 +12,7 @@ namespace ProtoFlux.Runtimes.Execution.Nodes.Obsidian.Json;
[NodeName("Insert To Array")]
[NodeCategory("Obsidian/Json")]
-[GenericTypes(GenericTypesAttribute.TypeMode.DirectTypes, typeof(string), typeof(Uri), typeof(JsonToken), typeof(JsonObject), typeof(JsonArray), typeof(IJsonToken))]
+[GenericTypes(typeof(string), typeof(Uri), typeof(JsonToken), typeof(JsonObject), typeof(JsonArray), typeof(IJsonToken))]
public class JsonInsertObjectToArrayNode : ObjectFunctionNode where T : class
{
public readonly ObjectInput Array;
diff --git a/ProjectObsidian/ProtoFlux/JSON/JsonInsertValueToArrayNode.cs b/ProjectObsidian/ProtoFlux/JSON/JsonInsertValueToArrayNode.cs
index 9c1ce62..b9550c0 100644
--- a/ProjectObsidian/ProtoFlux/JSON/JsonInsertValueToArrayNode.cs
+++ b/ProjectObsidian/ProtoFlux/JSON/JsonInsertValueToArrayNode.cs
@@ -12,7 +12,7 @@ namespace ProtoFlux.Runtimes.Execution.Nodes.Obsidian.Json;
[NodeName("Insert To Array")]
[NodeCategory("Obsidian/Json")]
-[GenericTypes(GenericTypesAttribute.TypeMode.DirectTypes, typeof(byte), typeof(sbyte), typeof(short), typeof(ushort), typeof(int), typeof(uint), typeof(long), typeof(ulong), typeof(float), typeof(double))]
+[GenericTypes(typeof(byte), typeof(sbyte), typeof(short), typeof(ushort), typeof(int), typeof(uint), typeof(long), typeof(ulong), typeof(float), typeof(double))]
public class JsonInsertValueToArrayNode : ObjectFunctionNode where T : unmanaged
{
public readonly ObjectInput Array;
diff --git a/ProjectObsidian/ProtoFlux/JSON/JsonQuickGetValueFromObjectNode.cs b/ProjectObsidian/ProtoFlux/JSON/JsonQuickGetValueFromObjectNode.cs
index d18f519..4a81ca4 100644
--- a/ProjectObsidian/ProtoFlux/JSON/JsonQuickGetValueFromObjectNode.cs
+++ b/ProjectObsidian/ProtoFlux/JSON/JsonQuickGetValueFromObjectNode.cs
@@ -12,7 +12,7 @@ namespace ProtoFlux.Runtimes.Execution.Nodes.Obsidian.Json;
[NodeName("Quick Get From Object")]
[NodeCategory("Obsidian/Json")]
-[GenericTypes(GenericTypesAttribute.TypeMode.DirectTypes, typeof(byte), typeof(sbyte), typeof(short), typeof(ushort), typeof(int), typeof(uint), typeof(long), typeof(ulong), typeof(float), typeof(double))]
+[GenericTypes(typeof(byte), typeof(sbyte), typeof(short), typeof(ushort), typeof(int), typeof(uint), typeof(long), typeof(ulong), typeof(float), typeof(double))]
public class JsonQuickGetValueFromObjectNode : ValueFunctionNode where T : unmanaged
{
public readonly ObjectInput Input;
diff --git a/ProjectObsidian/ProtoFlux/JSON/JsonToStringNode.cs b/ProjectObsidian/ProtoFlux/JSON/JsonToStringNode.cs
index d511b39..59185e1 100644
--- a/ProjectObsidian/ProtoFlux/JSON/JsonToStringNode.cs
+++ b/ProjectObsidian/ProtoFlux/JSON/JsonToStringNode.cs
@@ -11,7 +11,7 @@ namespace ProtoFlux.Runtimes.Execution.Nodes.Obsidian.Json;
[NodeName("To String")]
[NodeCategory("Obsidian/Json")]
-[GenericTypes(GenericTypesAttribute.TypeMode.DirectTypes, typeof(JsonObject), typeof(JsonArray), typeof(JsonToken), typeof(IJsonToken))]
+[GenericTypes(typeof(JsonObject), typeof(JsonArray), typeof(JsonToken), typeof(IJsonToken))]
public class JsonToStringNode : ObjectFunctionNode
{
public readonly ObjectInput Input;
From 07a3bf6b5bb241cac1b859bbd96754691bae014f Mon Sep 17 00:00:00 2001
From: Nytra <14206961+Nytra@users.noreply.github.com>
Date: Sat, 11 Oct 2025 08:32:41 +0100
Subject: [PATCH 09/12] Use base classes for audio nodes
---
ProjectObsidian/ProtoFlux/Audio/AudioAdder.cs | 115 +-----------------
ProjectObsidian/ProtoFlux/Audio/AudioClamp.cs | 109 +----------------
ProjectObsidian/ProtoFlux/Audio/AudioDelay.cs | 104 +---------------
...rBaseTest.cs => AudioGeneratorNodeBase.cs} | 0
.../ProtoFlux/Audio/AudioMultiply.cs | 103 +---------------
...BaseTest.cs => AudioProcessorNode1Base.cs} | 5 +-
.../Audio/AudioProcessorNode2Base .cs | 31 +++++
.../ProtoFlux/Audio/AudioSubtractor.cs | 115 +-----------------
.../ProtoFlux/Audio/BandPassFilterNode.cs | 6 +-
.../ProtoFlux/Audio/ButterworthFilterNode.cs | 104 +---------------
.../ProtoFlux/Audio/ChannelSplitter.cs | 104 +---------------
.../Audio/EMA_IIR_SmoothSignalNode.cs | 104 +---------------
ProjectObsidian/ProtoFlux/Audio/FIR_Filter.cs | 106 +---------------
.../ProtoFlux/Audio/OneSampleDelay.cs | 104 +---------------
.../ProtoFlux/Audio/PhaseModulatorNode.cs | 110 +----------------
.../ProtoFlux/Audio/QuadCombiner.cs | 97 +--------------
ProjectObsidian/ProtoFlux/Audio/Reverb.cs | 104 +---------------
.../ProtoFlux/Audio/RingModulatorNode.cs | 110 +----------------
.../ProtoFlux/Audio/SawtoothGenerator.cs | 1 +
.../ProtoFlux/Audio/SineGenerator.cs | 94 +-------------
.../Audio/SineShapedRingModulatorNode.cs | 111 ++---------------
.../ProtoFlux/Audio/SquareGenerator.cs | 94 +-------------
.../ProtoFlux/Audio/StereoCombiner.cs | 97 +--------------
.../ProtoFlux/Audio/Surround51_Combiner.cs | 97 +--------------
.../ProtoFlux/Audio/TriangleGenerator.cs | 94 +-------------
25 files changed, 148 insertions(+), 1971 deletions(-)
rename ProjectObsidian/ProtoFlux/Audio/{AudioGeneratorBaseTest.cs => AudioGeneratorNodeBase.cs} (100%)
rename ProjectObsidian/ProtoFlux/Audio/{AudioProcessorBaseTest.cs => AudioProcessorNode1Base.cs} (72%)
create mode 100644 ProjectObsidian/ProtoFlux/Audio/AudioProcessorNode2Base .cs
diff --git a/ProjectObsidian/ProtoFlux/Audio/AudioAdder.cs b/ProjectObsidian/ProtoFlux/Audio/AudioAdder.cs
index 2615507..0ce00c1 100644
--- a/ProjectObsidian/ProtoFlux/Audio/AudioAdder.cs
+++ b/ProjectObsidian/ProtoFlux/Audio/AudioAdder.cs
@@ -8,19 +8,11 @@
namespace ProtoFlux.Runtimes.Execution.Nodes.Obsidian.Audio
{
- public class AudioAdderProxy : ProtoFluxEngineProxy, Awwdio.IAudioDataSource, IWorldAudioDataSource
+ public class AudioAdderProxy : AudioProcessorNode2ProxyBase
{
- public IWorldAudioDataSource AudioInput;
+ public override int ChannelCount => AudioInput?.ChannelCount ?? AudioInput2?.ChannelCount ?? 0;
- public IWorldAudioDataSource AudioInput2;
-
- public bool Active;
-
- public bool IsActive => Active;
-
- public int ChannelCount => AudioInput?.ChannelCount ?? AudioInput2?.ChannelCount ?? 0;
-
- public void Read(Span buffer, AudioSimulator simulator) where S : unmanaged, IAudioSample
+ public override void Read(Span buffer, AudioSimulator simulator)
{
if (!IsActive)
{
@@ -49,106 +41,7 @@ public void Read(Span buffer, AudioSimulator simulator) where S : unmanage
}
}
[NodeCategory("Obsidian/Audio")]
- public class AudioAdder : ProxyVoidNode, IExecutionChangeListener
+ public class AudioAdder : AudioProcessorNode2Base
{
- [ChangeListener]
- public readonly ObjectInput AudioInput;
-
- [ChangeListener]
- public readonly ObjectInput AudioInput2;
-
- public readonly ObjectOutput AudioOutput;
-
- private ObjectStore> _enabledChangedHandler;
-
- private ObjectStore _activeChangedHandler;
-
- public bool ValueListensToChanges { get; private set; }
-
- private bool ShouldListen(AudioAdderProxy proxy)
- {
- if (proxy.Enabled)
- {
- return proxy.Slot.IsActive;
- }
- return false;
- }
-
- protected override void ProxyAdded(AudioAdderProxy proxy, FrooxEngineContext context)
- {
- base.ProxyAdded(proxy, context);
- NodeContextPath path = context.CaptureContextPath();
- ProtoFluxNodeGroup group = context.Group;
- context.GetEventDispatcher(out var dispatcher);
- Action enabledHandler = delegate
- {
- dispatcher.ScheduleEvent(path, delegate (FrooxEngineContext c)
- {
- UpdateListenerState(c);
- });
- };
- SlotEvent activeHandler = delegate
- {
- dispatcher.ScheduleEvent(path, delegate (FrooxEngineContext c)
- {
- UpdateListenerState(c);
- });
- };
- proxy.EnabledField.Changed += enabledHandler;
- proxy.Slot.ActiveChanged += activeHandler;
- _enabledChangedHandler.Write(enabledHandler, context);
- _activeChangedHandler.Write(activeHandler, context);
- ValueListensToChanges = ShouldListen(proxy);
- proxy.Active = ValueListensToChanges;
- }
-
- protected override void ProxyRemoved(AudioAdderProxy proxy, FrooxEngineContext context, bool inUseByAnotherInstance)
- {
- if (!inUseByAnotherInstance)
- {
- proxy.EnabledField.Changed -= _enabledChangedHandler.Read(context);
- proxy.Slot.ActiveChanged -= _activeChangedHandler.Read(context);
- _enabledChangedHandler.Clear(context);
- _activeChangedHandler.Clear(context);
- proxy.Active = false;
- }
- }
-
- protected void UpdateListenerState(FrooxEngineContext context)
- {
- AudioAdderProxy proxy = GetProxy(context);
- if (proxy != null)
- {
- bool shouldListen = ShouldListen(proxy);
- if (shouldListen != ValueListensToChanges)
- {
- ValueListensToChanges = shouldListen;
- context.Group.MarkChangeTrackingDirty();
- proxy.Active = shouldListen;
- }
- }
- }
-
- public void Changed(FrooxEngineContext context)
- {
- AudioAdderProxy proxy = GetProxy(context);
- if (proxy == null)
- {
- return;
- }
- proxy.AudioInput = AudioInput.Evaluate(context);
- proxy.AudioInput2 = AudioInput2.Evaluate(context);
- }
-
- protected override void ComputeOutputs(FrooxEngineContext context)
- {
- AudioAdderProxy proxy = GetProxy(context);
- AudioOutput.Write(proxy, context);
- }
-
- public AudioAdder()
- {
- AudioOutput = new ObjectOutput(this);
- }
}
}
\ No newline at end of file
diff --git a/ProjectObsidian/ProtoFlux/Audio/AudioClamp.cs b/ProjectObsidian/ProtoFlux/Audio/AudioClamp.cs
index 19eac3e..b477d5c 100644
--- a/ProjectObsidian/ProtoFlux/Audio/AudioClamp.cs
+++ b/ProjectObsidian/ProtoFlux/Audio/AudioClamp.cs
@@ -8,17 +8,11 @@
namespace ProtoFlux.Runtimes.Execution.Nodes.Obsidian.Audio
{
- public class AudioClampProxy : ProtoFluxEngineProxy, Awwdio.IAudioDataSource, IWorldAudioDataSource
+ public class AudioClampProxy : AudioProcessorNode1ProxyBase
{
- public IWorldAudioDataSource AudioInput;
+ public override int ChannelCount => AudioInput?.ChannelCount ?? 0;
- public bool Active;
-
- public bool IsActive => Active;
-
- public int ChannelCount => AudioInput?.ChannelCount ?? 0;
-
- public void Read(Span buffer, AudioSimulator simulator) where S : unmanaged, IAudioSample
+ public override void Read(Span buffer, AudioSimulator simulator)
{
if (!IsActive || AudioInput == null || !AudioInput.IsActive)
{
@@ -39,102 +33,7 @@ public void Read(Span buffer, AudioSimulator simulator) where S : unmanage
}
}
[NodeCategory("Obsidian/Audio")]
- public class AudioClamp : ProxyVoidNode, IExecutionChangeListener
+ public class AudioClamp : AudioProcessorNode1Base
{
- [ChangeListener]
- public readonly ObjectInput AudioInput;
-
- public readonly ObjectOutput AudioOutput;
-
- private ObjectStore> _enabledChangedHandler;
-
- private ObjectStore _activeChangedHandler;
-
- public bool ValueListensToChanges { get; private set; }
-
- private bool ShouldListen(AudioClampProxy proxy)
- {
- if (proxy.Enabled)
- {
- return proxy.Slot.IsActive;
- }
- return false;
- }
-
- protected override void ProxyAdded(AudioClampProxy proxy, FrooxEngineContext context)
- {
- base.ProxyAdded(proxy, context);
- NodeContextPath path = context.CaptureContextPath();
- ProtoFluxNodeGroup group = context.Group;
- context.GetEventDispatcher(out var dispatcher);
- Action enabledHandler = delegate
- {
- dispatcher.ScheduleEvent(path, delegate (FrooxEngineContext c)
- {
- UpdateListenerState(c);
- });
- };
- SlotEvent activeHandler = delegate
- {
- dispatcher.ScheduleEvent(path, delegate (FrooxEngineContext c)
- {
- UpdateListenerState(c);
- });
- };
- proxy.EnabledField.Changed += enabledHandler;
- proxy.Slot.ActiveChanged += activeHandler;
- _enabledChangedHandler.Write(enabledHandler, context);
- _activeChangedHandler.Write(activeHandler, context);
- ValueListensToChanges = ShouldListen(proxy);
- proxy.Active = ValueListensToChanges;
- }
-
- protected override void ProxyRemoved(AudioClampProxy proxy, FrooxEngineContext context, bool inUseByAnotherInstance)
- {
- if (!inUseByAnotherInstance)
- {
- proxy.EnabledField.Changed -= _enabledChangedHandler.Read(context);
- proxy.Slot.ActiveChanged -= _activeChangedHandler.Read(context);
- _enabledChangedHandler.Clear(context);
- _activeChangedHandler.Clear(context);
- proxy.Active = false;
- }
- }
-
- protected void UpdateListenerState(FrooxEngineContext context)
- {
- AudioClampProxy proxy = GetProxy(context);
- if (proxy != null)
- {
- bool shouldListen = ShouldListen(proxy);
- if (shouldListen != ValueListensToChanges)
- {
- ValueListensToChanges = shouldListen;
- context.Group.MarkChangeTrackingDirty();
- proxy.Active = shouldListen;
- }
- }
- }
-
- public void Changed(FrooxEngineContext context)
- {
- AudioClampProxy proxy = GetProxy(context);
- if (proxy == null)
- {
- return;
- }
- proxy.AudioInput = AudioInput.Evaluate(context);
- }
-
- protected override void ComputeOutputs(FrooxEngineContext context)
- {
- AudioClampProxy proxy = GetProxy(context);
- AudioOutput.Write(proxy, context);
- }
-
- public AudioClamp()
- {
- AudioOutput = new ObjectOutput(this);
- }
}
}
\ No newline at end of file
diff --git a/ProjectObsidian/ProtoFlux/Audio/AudioDelay.cs b/ProjectObsidian/ProtoFlux/Audio/AudioDelay.cs
index 03e920a..3c7dd1f 100644
--- a/ProjectObsidian/ProtoFlux/Audio/AudioDelay.cs
+++ b/ProjectObsidian/ProtoFlux/Audio/AudioDelay.cs
@@ -12,25 +12,19 @@
namespace ProtoFlux.Runtimes.Execution.Nodes.Obsidian.Audio
{
- public class AudioDelayProxy : ProtoFluxEngineProxy, Awwdio.IAudioDataSource, IWorldAudioDataSource
+ public class AudioDelayProxy : AudioProcessorNode1ProxyBase
{
- public IWorldAudioDataSource AudioInput;
-
public int delayMilliseconds;
public float feedback;
public float DryWet;
- public bool Active;
-
- public bool IsActive => Active;
-
- public int ChannelCount => AudioInput?.ChannelCount ?? 0;
+ public override int ChannelCount => AudioInput?.ChannelCount ?? 0;
public DelayController _controller = new();
- public void Read(Span buffer, AudioSimulator simulator) where S : unmanaged, IAudioSample
+ public override void Read(Span buffer, AudioSimulator simulator)
{
lock (_controller)
{
@@ -66,11 +60,8 @@ protected override void OnStart()
}
[NodeName("Delay")]
[NodeCategory("Obsidian/Audio/Effects")]
- public class AudioDelay : ProxyVoidNode, IExecutionChangeListener
+ public class AudioDelay : AudioProcessorNode1Base
{
- [ChangeListener]
- public readonly ObjectInput AudioInput;
-
[ChangeListener]
public readonly ValueInput DelayMilliseconds;
@@ -80,86 +71,14 @@ public class AudioDelay : ProxyVoidNode, IE
[ChangeListener]
public readonly ValueInput DryWet;
- public readonly ObjectOutput AudioOutput;
-
- private ObjectStore> _enabledChangedHandler;
-
- private ObjectStore _activeChangedHandler;
-
- public bool ValueListensToChanges { get; private set; }
-
- private bool ShouldListen(AudioDelayProxy proxy)
- {
- if (proxy.Enabled)
- {
- return proxy.Slot.IsActive;
- }
- return false;
- }
-
- protected override void ProxyAdded(AudioDelayProxy proxy, FrooxEngineContext context)
- {
- base.ProxyAdded(proxy, context);
- NodeContextPath path = context.CaptureContextPath();
- ProtoFluxNodeGroup group = context.Group;
- context.GetEventDispatcher(out var dispatcher);
- Action enabledHandler = delegate
- {
- dispatcher.ScheduleEvent(path, delegate (FrooxEngineContext c)
- {
- UpdateListenerState(c);
- });
- };
- SlotEvent activeHandler = delegate
- {
- dispatcher.ScheduleEvent(path, delegate (FrooxEngineContext c)
- {
- UpdateListenerState(c);
- });
- };
- proxy.EnabledField.Changed += enabledHandler;
- proxy.Slot.ActiveChanged += activeHandler;
- _enabledChangedHandler.Write(enabledHandler, context);
- _activeChangedHandler.Write(activeHandler, context);
- ValueListensToChanges = ShouldListen(proxy);
- proxy.Active = ValueListensToChanges;
- }
-
- protected override void ProxyRemoved(AudioDelayProxy proxy, FrooxEngineContext context, bool inUseByAnotherInstance)
- {
- if (!inUseByAnotherInstance)
- {
- proxy.EnabledField.Changed -= _enabledChangedHandler.Read(context);
- proxy.Slot.ActiveChanged -= _activeChangedHandler.Read(context);
- _enabledChangedHandler.Clear(context);
- _activeChangedHandler.Clear(context);
- proxy.Active = false;
- }
- }
-
- protected void UpdateListenerState(FrooxEngineContext context)
- {
- AudioDelayProxy proxy = GetProxy(context);
- if (proxy != null)
- {
- bool shouldListen = ShouldListen(proxy);
- if (shouldListen != ValueListensToChanges)
- {
- ValueListensToChanges = shouldListen;
- context.Group.MarkChangeTrackingDirty();
- proxy.Active = shouldListen;
- }
- }
- }
-
- public void Changed(FrooxEngineContext context)
+ public override void Changed(FrooxEngineContext context)
{
AudioDelayProxy proxy = GetProxy(context);
if (proxy == null)
{
return;
}
- proxy.AudioInput = AudioInput.Evaluate(context);
+ base.Changed(context);
proxy.delayMilliseconds = DelayMilliseconds.Evaluate(context);
lock (proxy._controller)
{
@@ -171,16 +90,5 @@ public void Changed(FrooxEngineContext context)
proxy.feedback = Feedback.Evaluate(context);
proxy.DryWet = DryWet.Evaluate(context);
}
-
- protected override void ComputeOutputs(FrooxEngineContext context)
- {
- AudioDelayProxy proxy = GetProxy(context);
- AudioOutput.Write(proxy, context);
- }
-
- public AudioDelay()
- {
- AudioOutput = new ObjectOutput(this);
- }
}
}
\ No newline at end of file
diff --git a/ProjectObsidian/ProtoFlux/Audio/AudioGeneratorBaseTest.cs b/ProjectObsidian/ProtoFlux/Audio/AudioGeneratorNodeBase.cs
similarity index 100%
rename from ProjectObsidian/ProtoFlux/Audio/AudioGeneratorBaseTest.cs
rename to ProjectObsidian/ProtoFlux/Audio/AudioGeneratorNodeBase.cs
diff --git a/ProjectObsidian/ProtoFlux/Audio/AudioMultiply.cs b/ProjectObsidian/ProtoFlux/Audio/AudioMultiply.cs
index 0ae4eab..e63e026 100644
--- a/ProjectObsidian/ProtoFlux/Audio/AudioMultiply.cs
+++ b/ProjectObsidian/ProtoFlux/Audio/AudioMultiply.cs
@@ -8,19 +8,14 @@
namespace ProtoFlux.Runtimes.Execution.Nodes.Obsidian.Audio
{
- public class AudioMultiplyProxy : ProtoFluxEngineProxy, Awwdio.IAudioDataSource, IWorldAudioDataSource
+ public class AudioMultiplyProxy : AudioProcessorNode1ProxyBase
{
- public IWorldAudioDataSource AudioInput;
public float Value;
- public bool Active;
+ public override int ChannelCount => AudioInput?.ChannelCount ?? 0;
- public bool IsActive => Active;
-
- public int ChannelCount => AudioInput?.ChannelCount ?? 0;
-
- public void Read(Span buffer, AudioSimulator simulator) where S : unmanaged, IAudioSample
+ public override void Read(Span buffer, AudioSimulator simulator)
{
if (!IsActive || AudioInput == null)
{
@@ -44,106 +39,20 @@ public void Read(Span buffer, AudioSimulator simulator) where S : unmanage
}
}
[NodeCategory("Obsidian/Audio")]
- public class AudioMultiply : ProxyVoidNode, IExecutionChangeListener
+ public class AudioMultiply : AudioProcessorNode1Base
{
- [ChangeListener]
- public readonly ObjectInput AudioInput;
-
[ChangeListener]
public readonly ValueInput Value;
- public readonly ObjectOutput AudioOutput;
-
- private ObjectStore> _enabledChangedHandler;
-
- private ObjectStore _activeChangedHandler;
-
- public bool ValueListensToChanges { get; private set; }
-
- private bool ShouldListen(AudioMultiplyProxy proxy)
- {
- if (proxy.Enabled)
- {
- return proxy.Slot.IsActive;
- }
- return false;
- }
-
- protected override void ProxyAdded(AudioMultiplyProxy proxy, FrooxEngineContext context)
- {
- base.ProxyAdded(proxy, context);
- NodeContextPath path = context.CaptureContextPath();
- ProtoFluxNodeGroup group = context.Group;
- context.GetEventDispatcher(out var dispatcher);
- Action enabledHandler = delegate
- {
- dispatcher.ScheduleEvent(path, delegate (FrooxEngineContext c)
- {
- UpdateListenerState(c);
- });
- };
- SlotEvent activeHandler = delegate
- {
- dispatcher.ScheduleEvent(path, delegate (FrooxEngineContext c)
- {
- UpdateListenerState(c);
- });
- };
- proxy.EnabledField.Changed += enabledHandler;
- proxy.Slot.ActiveChanged += activeHandler;
- _enabledChangedHandler.Write(enabledHandler, context);
- _activeChangedHandler.Write(activeHandler, context);
- ValueListensToChanges = ShouldListen(proxy);
- proxy.Active = ValueListensToChanges;
- }
-
- protected override void ProxyRemoved(AudioMultiplyProxy proxy, FrooxEngineContext context, bool inUseByAnotherInstance)
- {
- if (!inUseByAnotherInstance)
- {
- proxy.EnabledField.Changed -= _enabledChangedHandler.Read(context);
- proxy.Slot.ActiveChanged -= _activeChangedHandler.Read(context);
- _enabledChangedHandler.Clear(context);
- _activeChangedHandler.Clear(context);
- proxy.Active = false;
- }
- }
-
- protected void UpdateListenerState(FrooxEngineContext context)
- {
- AudioMultiplyProxy proxy = GetProxy(context);
- if (proxy != null)
- {
- bool shouldListen = ShouldListen(proxy);
- if (shouldListen != ValueListensToChanges)
- {
- ValueListensToChanges = shouldListen;
- context.Group.MarkChangeTrackingDirty();
- proxy.Active = shouldListen;
- }
- }
- }
-
- public void Changed(FrooxEngineContext context)
+ public override void Changed(FrooxEngineContext context)
{
AudioMultiplyProxy proxy = GetProxy(context);
if (proxy == null)
{
return;
}
- proxy.AudioInput = AudioInput.Evaluate(context);
+ base.Changed(context);
proxy.Value = Value.Evaluate(context);
}
-
- protected override void ComputeOutputs(FrooxEngineContext context)
- {
- AudioMultiplyProxy proxy = GetProxy(context);
- AudioOutput.Write(proxy, context);
- }
-
- public AudioMultiply()
- {
- AudioOutput = new ObjectOutput(this);
- }
}
}
\ No newline at end of file
diff --git a/ProjectObsidian/ProtoFlux/Audio/AudioProcessorBaseTest.cs b/ProjectObsidian/ProtoFlux/Audio/AudioProcessorNode1Base.cs
similarity index 72%
rename from ProjectObsidian/ProtoFlux/Audio/AudioProcessorBaseTest.cs
rename to ProjectObsidian/ProtoFlux/Audio/AudioProcessorNode1Base.cs
index 63f7d78..c239447 100644
--- a/ProjectObsidian/ProtoFlux/Audio/AudioProcessorBaseTest.cs
+++ b/ProjectObsidian/ProtoFlux/Audio/AudioProcessorNode1Base.cs
@@ -7,12 +7,12 @@
namespace ProtoFlux.Runtimes.Execution.Nodes.Obsidian.Audio
{
- public abstract class AudioProcessorNodeProxyBase : AudioGeneratorNodeProxyBase
+ public abstract class AudioProcessorNode1ProxyBase : AudioGeneratorNodeProxyBase
{
public IWorldAudioDataSource AudioInput;
}
[NodeCategory("Obsidian/Audio")]
- public abstract class AudioProcessorNodeBase : AudioGeneratorNodeBase
where P : AudioProcessorNodeProxyBase, new()
+ public abstract class AudioProcessorNode1Base
: AudioGeneratorNodeBase
where P : AudioProcessorNode1ProxyBase, new()
{
[ChangeListener]
public readonly ObjectInput AudioInput;
@@ -24,6 +24,7 @@ public override void Changed(FrooxEngineContext context)
{
return;
}
+ base.Changed(context);
proxy.AudioInput = AudioInput.Evaluate(context);
}
}
diff --git a/ProjectObsidian/ProtoFlux/Audio/AudioProcessorNode2Base .cs b/ProjectObsidian/ProtoFlux/Audio/AudioProcessorNode2Base .cs
new file mode 100644
index 0000000..113986c
--- /dev/null
+++ b/ProjectObsidian/ProtoFlux/Audio/AudioProcessorNode2Base .cs
@@ -0,0 +1,31 @@
+using System;
+using Awwdio;
+using Elements.Assets;
+using FrooxEngine;
+using FrooxEngine.ProtoFlux;
+using ProtoFlux.Core;
+
+namespace ProtoFlux.Runtimes.Execution.Nodes.Obsidian.Audio
+{
+ public abstract class AudioProcessorNode2ProxyBase : AudioProcessorNode1ProxyBase
+ {
+ public IWorldAudioDataSource AudioInput2;
+ }
+ [NodeCategory("Obsidian/Audio")]
+ public abstract class AudioProcessorNode2Base : AudioProcessorNode1Base
where P : AudioProcessorNode2ProxyBase, new()
+ {
+ [ChangeListener]
+ public readonly ObjectInput AudioInput2;
+
+ public override void Changed(FrooxEngineContext context)
+ {
+ P proxy = GetProxy(context);
+ if (proxy == null)
+ {
+ return;
+ }
+ base.Changed(context);
+ proxy.AudioInput2 = AudioInput2.Evaluate(context);
+ }
+ }
+}
\ No newline at end of file
diff --git a/ProjectObsidian/ProtoFlux/Audio/AudioSubtractor.cs b/ProjectObsidian/ProtoFlux/Audio/AudioSubtractor.cs
index da8c999..2c23cc3 100644
--- a/ProjectObsidian/ProtoFlux/Audio/AudioSubtractor.cs
+++ b/ProjectObsidian/ProtoFlux/Audio/AudioSubtractor.cs
@@ -8,19 +8,11 @@
namespace ProtoFlux.Runtimes.Execution.Nodes.Obsidian.Audio
{
- public class AudioSubtractorProxy : ProtoFluxEngineProxy, Awwdio.IAudioDataSource, IWorldAudioDataSource
+ public class AudioSubtractorProxy : AudioProcessorNode2ProxyBase
{
- public IWorldAudioDataSource AudioInput;
+ public override int ChannelCount => AudioInput?.ChannelCount ?? AudioInput2?.ChannelCount ?? 0;
- public IWorldAudioDataSource AudioInput2;
-
- public bool Active;
-
- public bool IsActive => Active;
-
- public int ChannelCount => AudioInput?.ChannelCount ?? AudioInput2?.ChannelCount ?? 0;
-
- public void Read(Span buffer, AudioSimulator simulator) where S : unmanaged, IAudioSample
+ public override void Read(Span buffer, AudioSimulator simulator)
{
if (!IsActive)
{
@@ -55,106 +47,7 @@ public void Read