Skip to content

Commit

Permalink
Merge branch 'main' of https://github.com/vvvv/VL.Audio.VST
Browse files Browse the repository at this point in the history
  • Loading branch information
joreg committed Oct 30, 2024
2 parents 3d73e37 + 81707e0 commit 761e79c
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 4 deletions.
12 changes: 8 additions & 4 deletions src/EffectHost.cs
Original file line number Diff line number Diff line change
Expand Up @@ -213,11 +213,15 @@ private static bool Acknowledge<T>(ref T current, T value)

public void Update()
{
if (Acknowledge(ref state, ((StatePin)Inputs[0]).Value?.Value ?? PluginState.Default))
if (Acknowledge(ref state, ((StatePin)Inputs[0]).Value?.Value) && state != null)
{
component.setState(state.GetComponentStream());
controller?.IgnoreNotImplementedException(c => c.setComponentState(state.GetComponentStream()));
controller?.IgnoreNotImplementedException(c => c.setState(state.GetControllerStream()));
if (state.HasComponentData)
{
component.IgnoreNotImplementedException(c => c.setState(state.GetComponentStream()));
controller?.IgnoreNotImplementedException(c => c.setComponentState(state.GetComponentStream()));
}
if (state.HasControllerData)
controller?.IgnoreNotImplementedException(c => c.setState(state.GetControllerStream()));
}

if (Acknowledge(ref midiInput, midiInputPin.Value))
Expand Down
3 changes: 3 additions & 0 deletions src/PluginState.cs
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,9 @@ public record PluginState(ImmutableArray<byte> Component, ImmutableArray<byte> C
{
public static readonly PluginState Default = new PluginState(ImmutableArray<byte>.Empty, ImmutableArray<byte>.Empty);

internal bool HasComponentData => Component.Length > 0;
internal bool HasControllerData => Controller.Length > 0;

internal IBStream GetComponentStream() => GetStream(Component);

internal IBStream GetControllerStream() => GetStream(Controller);
Expand Down

0 comments on commit 761e79c

Please sign in to comment.