Skip to content

Commit

Permalink
Add AudioSourceInfo
Browse files Browse the repository at this point in the history
  • Loading branch information
Nytra committed Jan 5, 2025
1 parent 6ba0e44 commit 66881e2
Showing 1 changed file with 40 additions and 0 deletions.
40 changes: 40 additions & 0 deletions ProjectObsidian/ProtoFlux/Audio/AudioSourceInfo.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
using System;
using ProtoFlux.Core;
using ProtoFlux.Runtimes.Execution;
using FrooxEngine.ProtoFlux;
using FrooxEngine;

namespace ProtoFlux.Runtimes.Execution.Nodes.Obsidian.Audio
{
[NodeCategory("Obsidian/Audio")]
public class AudioSourceInfo : VoidNode<FrooxEngineContext>
{
public readonly ObjectInput<IAudioSource> Source;

[ContinuouslyChanging]
public readonly ValueOutput<bool> IsActive;

public readonly ValueOutput<int> ChannelCount;

protected override void ComputeOutputs(FrooxEngineContext context)
{
IAudioSource source = Source.Evaluate(context);
if (source != null)
{
IsActive.Write(source.IsActive, context);
ChannelCount.Write(source.ChannelCount, context);
}
else
{
IsActive.Write(false, context);
ChannelCount.Write(0, context);
}
}

public AudioSourceInfo()
{
IsActive = new ValueOutput<bool>(this);
ChannelCount = new ValueOutput<int>(this);
}
}
}

0 comments on commit 66881e2

Please sign in to comment.