Unify Get/SetSoundOn across Lua and C# APIs (resolves #1817)
This commit is contained in:
parent
f7caa414b6
commit
9e514dcebd
|
@ -530,13 +530,10 @@ namespace BizHawk.Client.ApiHawk
|
|||
|
||||
public static void SetSoundOn(bool enable)
|
||||
{
|
||||
Global.Config.SoundEnabled = enable;
|
||||
if (enable != Global.Config.SoundEnabled) InvokeMainFormMethod("ToggleSound");
|
||||
}
|
||||
|
||||
public static bool GetSoundOn()
|
||||
{
|
||||
return Global.Config.SoundEnabled;
|
||||
}
|
||||
public static bool GetSoundOn() => Global.Config.SoundEnabled;
|
||||
|
||||
public static bool IsPaused()
|
||||
{
|
||||
|
|
|
@ -2374,7 +2374,7 @@ namespace BizHawk.Client.EmuHawk
|
|||
Config.DisplayInput ^= true;
|
||||
}
|
||||
|
||||
private void ToggleSound()
|
||||
public void ToggleSound()
|
||||
{
|
||||
Config.SoundEnabled ^= true;
|
||||
Sound.StopSound();
|
||||
|
|
|
@ -9,6 +9,7 @@ using System.Threading;
|
|||
using System.Diagnostics;
|
||||
|
||||
using BizHawk.Common;
|
||||
using BizHawk.Client.ApiHawk;
|
||||
|
||||
// ReSharper disable StringLiteralTypo
|
||||
// ReSharper disable UnusedMember.Global
|
||||
|
@ -173,19 +174,11 @@ namespace BizHawk.Client.EmuHawk
|
|||
|
||||
[LuaMethodExample("client.SetSoundOn( true );")]
|
||||
[LuaMethod("SetSoundOn", "Sets the state of the Sound On toggle")]
|
||||
public static void SetSoundOn(bool enable)
|
||||
{
|
||||
Global.Config.SoundEnabled = enable;
|
||||
GlobalWin.Sound.StopSound();
|
||||
GlobalWin.Sound.StartSound();
|
||||
}
|
||||
public static void SetSoundOn(bool enable) => ClientApi.SetSoundOn(enable);
|
||||
|
||||
[LuaMethodExample("if ( client.GetSoundOn( ) ) then\r\n\tconsole.log( \"Gets the state of the Sound On toggle\" );\r\nend;")]
|
||||
[LuaMethod("GetSoundOn", "Gets the state of the Sound On toggle")]
|
||||
public static bool GetSoundOn()
|
||||
{
|
||||
return Global.Config.SoundEnabled;
|
||||
}
|
||||
public static bool GetSoundOn() => ClientApi.GetSoundOn();
|
||||
|
||||
[LuaMethodExample("client.SetClientExtraPadding( 5, 10, 15, 20 );")]
|
||||
[LuaMethod("SetClientExtraPadding", "Sets the extra padding added to the 'native' surface so that you can draw HUD elements in predictable placements")]
|
||||
|
|
Loading…
Reference in New Issue