Skip to content

Commit

Permalink
Minor
Browse files Browse the repository at this point in the history
  • Loading branch information
rampaa committed Dec 25, 2024
1 parent 592b873 commit 8619fa6
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 1 deletion.
4 changes: 3 additions & 1 deletion JL.Windows/SpeechSynthesis/SpeechSynthesisUtils.cs
Original file line number Diff line number Diff line change
Expand Up @@ -91,13 +91,15 @@ public static async Task TextToSpeech(string voiceName, string text)
_ = Synthesizer.SpeakAsync(text);
}

public static byte[]? GetAudioResponseFromTextToSpeech(string text)
public static async Task<byte[]?> GetAudioResponseFromTextToSpeech(string text)
{
if (InstalledVoiceWithHighestPriority is null)
{
return null;
}

await StopTextToSpeech().ConfigureAwait(false);

Synthesizer.SelectVoice(InstalledVoiceWithHighestPriority);
using MemoryStream audioDataStream = new();
Synthesizer.SetOutputToWaveStream(audioDataStream);
Expand Down
6 changes: 6 additions & 0 deletions JL.Windows/Utilities/MagpieUtils.cs
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ internal static class MagpieUtils
public static double MagpieWindowTopEdgePosition { get; set; }
public static double MagpieWindowBottomEdgePosition { get; set; }
public static double DpiAwareMagpieWindowWidth { get; set; }
// public static nint SourceWindowHandle { get; set; }

public static void RegisterToMagpieScalingChangedMessage(nint windowHandle)
{
Expand Down Expand Up @@ -46,6 +47,11 @@ public static double GetMagpieWindowBottomEdgePosition(nint windowHandle)
return WinApi.GetProp(windowHandle, "Magpie.DestBottom");
}

//public static nint GetSourceWindowHande(nint windowHandle)
//{
// return WinApi.GetProp(windowHandle, "Magpie.SrcHWND");
//}

// If Magpie crashes or is killed during the process of scaling a window,
// JL will not receive the MagpieScalingChangedWindowMessage.
// Consequently, IsMagpieScaling may not be set to false.
Expand Down
1 change: 1 addition & 0 deletions JL.Windows/WinApi.cs
Original file line number Diff line number Diff line change
Expand Up @@ -349,6 +349,7 @@ private nint WndProc(nint hwnd, int msg, nint wParam, nint lParam, ref bool hand
MagpieUtils.MagpieWindowBottomEdgePosition = MagpieUtils.GetMagpieWindowBottomEdgePosition(lParam);
MagpieUtils.MagpieWindowLeftEdgePosition = MagpieUtils.GetMagpieWindowLeftEdgePosition(lParam);
MagpieUtils.MagpieWindowRightEdgePosition = MagpieUtils.GetMagpieWindowRightEdgePosition(lParam);
// MagpieUtils.SourceWindowHandle = MagpieUtils.GetSourceWindowHande(lParam);
MagpieUtils.DpiAwareMagpieWindowWidth = (MagpieUtils.MagpieWindowRightEdgePosition - MagpieUtils.MagpieWindowLeftEdgePosition) / WindowsUtils.Dpi.DpiScaleX;
MainWindow.Instance.BringToFront();
}
Expand Down

0 comments on commit 8619fa6

Please sign in to comment.