33 lines
643 B
C#
33 lines
643 B
C#
|
|
|
||
|
|
using Godot;
|
||
|
|
using System.Collections.Generic;
|
||
|
|
|
||
|
|
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 ) );
|
||
|
|
}
|
||
|
|
|
||
|
|
|
||
|
|
}
|
||
|
|
}
|