Skip to content

Commit 358ffdd

Browse files
Fixed bug in Playground when re-constructing graph.
1 parent fb87fab commit 358ffdd

File tree

2 files changed

+8
-1
lines changed

2 files changed

+8
-1
lines changed

samples/KristofferStrube.Blazor.WebAudio.WasmExample/AudioEditor/Connector.cs

+4-1
Original file line numberDiff line numberDiff line change
@@ -81,7 +81,10 @@ public Connector(IElement element, SVGEditor.SVGEditor svg) : base(element, svg)
8181
var toNode = (Node?)SVG.Elements.FirstOrDefault(e => e is Node && e.Id == Element.GetAttribute("data-to-node"));
8282
ulong toPort = (ulong)Element.GetAttributeOrZero("data-to-port");
8383
AudioParam? toAudioParam = null;
84-
_ = toNode?.AudioParams.TryGetValue(Element.GetAttribute("data-to-audioparam")!, out toAudioParam);
84+
if (Element.GetAttribute("data-to-audioparam") is { } toAttribute)
85+
{
86+
_ = (toNode?.AudioParams.TryGetValue(toAttribute, out toAudioParam));
87+
}
8588
_ = toNode?.OutgoingConnectors.Add((this, toPort));
8689
to = toNode is null ? null : (toNode, toPort, toAudioParam);
8790
}

samples/KristofferStrube.Blazor.WebAudio.WasmExample/AudioEditor/Nodes/Oscillator.cs

+4
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,10 @@ public Oscillator(IElement element, SVGEditor.SVGEditor svg) : base(element, svg
1919
{
2020
options.Frequency = f;
2121
}
22+
if (Type is { } t)
23+
{
24+
options.Type = t;
25+
}
2226
OscillatorNode oscillator = await OscillatorNode.CreateAsync(context.JSRuntime, context, options);
2327
await oscillator.StartAsync();
2428
audioNode = oscillator;

0 commit comments

Comments
 (0)