rokojori_action_library/Runtime/App/Settings/NumberSetting/AudioBusSetting.cs

34 lines
670 B
C#
Raw Normal View History

2026-02-26 14:06:27 +00:00
using Godot;
using System.Collections.Generic;
2026-05-22 12:25:02 +00:00
using Rokojori.Extensions;
2026-02-26 14:06:27 +00:00
namespace Rokojori
{
[Tool]
[GlobalClass]
public partial class AudioBusSetting:NumberAppSetting
{
[Export]
public string busName = "";
public override void ApplyValue( App app )
{
var stringValue = app.GetSetting( id );
var floatValue = RegexUtility.ParseFloat( stringValue );
var busIndex = AudioServer.GetBusIndex( busName );
if ( busIndex == -1 )
{
this.LogError( "Audio bus not found:", busName );
return;
}
AudioServer.SetBusVolumeLinear( busIndex, NormalizeValue( floatValue ) );
}
}
}