Implementing libspeechdwrapper for linux screen reader support.

master
Mohammad Shoaib 2022-01-30 20:20:56 +05:30
parent 0c6671a4f9
commit fe011b239e
7 changed files with 29 additions and 6 deletions

View File

@ -1 +0,0 @@
libspeechd.so.2.6.0

View File

@ -1 +0,0 @@
libspeechd.so.2.6.0

Binary file not shown.

View File

@ -9,6 +9,16 @@ using System.Runtime.InteropServices;
namespace stardew_access namespace stardew_access
{ {
public struct GoString
{
public string msg;
public long len;
public GoString(string msg, long len)
{
this.msg = msg;
this.len = len;
}
}
public class MainClass : Mod public class MainClass : Mod
{ {
@ -31,6 +41,17 @@ namespace stardew_access
get{return _modHelper;} get{return _modHelper;}
} }
[DllImport("libspeechdwrapper.so")]
private static extern void Initialize();
[DllImport("libspeechdwrapper.so")]
private static extern void Speak(GoString text, bool interrupt);
[DllImport("libspeechdwrapper.so")]
private static extern void Close();
/********* /*********
** Public methods ** Public methods
*********/ *********/
@ -63,6 +84,13 @@ namespace stardew_access
#endregion #endregion
Initialize();
string text = "Testing";
Speak(new GoString(text,text.Length), false);
Close();
helper.Events.Input.ButtonPressed += this.OnButtonPressed; helper.Events.Input.ButtonPressed += this.OnButtonPressed;
helper.Events.GameLoop.UpdateTicked += this.onUpdateTicked; helper.Events.GameLoop.UpdateTicked += this.onUpdateTicked;
} }

View File

@ -1,7 +1,6 @@
using AccessibleOutput; using AccessibleOutput;
using StardewModdingAPI; using StardewModdingAPI;
using System.Runtime.InteropServices; using System.Runtime.InteropServices;
using IronPython.Hosting;
namespace stardew_access namespace stardew_access
{ {
@ -13,7 +12,6 @@ namespace stardew_access
/// <summary>Initializes the screen reader.</summary> /// <summary>Initializes the screen reader.</summary>
public void InitializeScreenReader() public void InitializeScreenReader()
{ {
if (!RuntimeInformation.IsOSPlatform(OSPlatform.Windows)) if (!RuntimeInformation.IsOSPlatform(OSPlatform.Windows))
return; return;

View File

@ -1,7 +1,7 @@
{ {
"Name": "Stardew Access", "Name": "Stardew Access",
"Author": "Mohammad Shoaib", "Author": "Mohammad Shoaib",
"Version": "1.0.18-beta", "Version": "1.0.19-beta",
"Description": "An accessibility mod with screen reader support!", "Description": "An accessibility mod with screen reader support!",
"UniqueID": "shoaib.stardewaccess", "UniqueID": "shoaib.stardewaccess",
"EntryDll": "stardew-access.dll", "EntryDll": "stardew-access.dll",

View File

@ -13,7 +13,6 @@
<ItemGroup> <ItemGroup>
<PackageReference Include="AccessibleOutput" Version="1.0.0" /> <PackageReference Include="AccessibleOutput" Version="1.0.0" />
<PackageReference Include="AutoHotkey.Interop" Version="1.0.0.1" /> <PackageReference Include="AutoHotkey.Interop" Version="1.0.0.1" />
<PackageReference Include="IronPython" Version="2.7.12" />
<PackageReference Include="Lib.Harmony" Version="2.2.0" /> <PackageReference Include="Lib.Harmony" Version="2.2.0" />
<PackageReference Include="Pathoschild.Stardew.ModBuildConfig" Version="4.0.0" /> <PackageReference Include="Pathoschild.Stardew.ModBuildConfig" Version="4.0.0" />
</ItemGroup> </ItemGroup>