Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions CommunityBugFixCollection/CommunityBugFixCollection.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@
<ResoniteReference Include="Elements.Quantity" />
<ResoniteReference Include="FrooxEngine" />
<ResoniteReference Include="FrooxEngine.Store" />
<ResoniteReference Include="Awwdio" />
<ResoniteReference Include="ProtoFlux.Core" />
<ResoniteReference Include="ProtoFlux.Nodes.Core" />
<ResoniteReference Include="ProtoFluxBindings" />
Expand Down
97 changes: 97 additions & 0 deletions CommunityBugFixCollection/LinuxStreamingAudioFix.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,97 @@
using Elements.Core;
using FrooxEngine;
using HarmonyLib;
using MonkeyLoader;
using MonkeyLoader.Meta;

namespace CommunityBugFixCollection
{
[HarmonyPatch]
[HarmonyPatchCategory(nameof(LinuxStreamingAudioFix))]
internal sealed class LinuxStreamingAudioFix : ResoniteBugFixMonkey<LinuxStreamingAudioFix>
{
private static readonly Version _requiredShowmanToolsVersion = new(0, 2, 0);
public override IEnumerable<string> Authors => Contributors.Banane9;

protected override bool OnEngineReady()
{
if (Mod.Loader.TryGet<Mod>().ById("ShowmanTools", out var mod) && mod.Version.Version >= _requiredShowmanToolsVersion)
{
Logger.Info(() => "Skipping in favor of the ShowmanTools fix.");
return false;
}

return base.OnEngineReady();
}

[HarmonyPrefix]
[HarmonyPatch(typeof(AudioSystem), nameof(AudioSystem.UpdateDefaultAudioOutput))]
private static bool UpdateDefaultAudioOutputPrefix(AudioSystem __instance, Action<AudioOutputDriver>? ___DefaultAudioOutputChanged)

Check warning on line 29 in CommunityBugFixCollection/LinuxStreamingAudioFix.cs

View workflow job for this annotation

GitHub Actions / Build

Parameter 'System.Action<FrooxEngine.AudioOutputDriver>? ___DefaultAudioOutputChanged' does not match any field for type FrooxEngine.AudioSystem (https://github.com/microsoftenator2022/MicroUtils.HarmonyAnalyzers/tree/master/docs/reference/MHA013_PatchMethodParameterDoesNotMatchTarget.md)

Check warning on line 29 in CommunityBugFixCollection/LinuxStreamingAudioFix.cs

View workflow job for this annotation

GitHub Actions / Build

Parameter 'System.Action<FrooxEngine.AudioOutputDriver>? ___DefaultAudioOutputChanged' does not match any field for type FrooxEngine.AudioSystem (https://github.com/microsoftenator2022/MicroUtils.HarmonyAnalyzers/tree/master/docs/reference/MHA013_PatchMethodParameterDoesNotMatchTarget.md)
{
if (__instance._outputDevice is null)
return false;

var preferredDevice = __instance._outputDevice.FindPreferredDevice(d => __instance._audioOutputDeviceIDs.Contains(d.EntryID));
var preferredStreamingDevice = __instance._outputDevice.FindStreamingPreferredDevice(d => __instance._audioOutputDeviceIDs.Contains(d.EntryID));

var preferredDeviceID = preferredDevice is not null
? (string)preferredDevice.EntryID
: (__instance.AudioOutputs.FirstOrDefault(o => o.IsSystemDefault && o.IsConnected)?.DeviceID);

if (preferredDeviceID is null)
{
UniLog.Warning("Cannot find a preferred device ID");
return false;
}

var preferredStreamingDeviceID = preferredStreamingDevice?.EntryID.Value;

if (preferredDeviceID == __instance.DefaultAudioOutput?.DeviceID && preferredStreamingDeviceID == __instance.StreamingAudioOutput?.DeviceID)
return false;

__instance.PrimaryOutput.Device = null;
__instance.StreamingOutput.Device = null;

var oldDefault = __instance.DefaultAudioOutput;
var oldStreaming = __instance.StreamingAudioOutput;

if (oldDefault is not null)
{
oldDefault.Stop();
oldDefault.RenderAudio = null;
}

if (oldStreaming is not null)
{
oldStreaming.Stop();
oldStreaming.RenderAudio = null;
}

__instance._defaultAudioOutputIndex = __instance.AudioOutputs.FindIndex(i => i.DeviceID == preferredDeviceID);
__instance._streamingAudioOutputIndex = __instance.AudioOutputs.FindIndex(i => i.DeviceID == preferredStreamingDeviceID);

if (__instance._streamingAudioOutputIndex >= 0 && __instance._streamingAudioOutputIndex == __instance._defaultAudioOutputIndex)
__instance._streamingAudioOutputIndex = -1;

var newDefault = __instance.DefaultAudioOutput!;
var newStreaming = __instance.StreamingAudioOutput;

__instance.audioThreadLoop.Supress = true;

newDefault.RenderAudio = __instance.RenderAudio;
newDefault.Start("Default Output");

if (newStreaming is not null)
{
newStreaming.RenderAudio = __instance.RenderAudio;
newStreaming.Start("Streaming Camera");
}

__instance.PrimaryOutput.Device = newDefault;
__instance.StreamingOutput.Device = newStreaming;

___DefaultAudioOutputChanged?.Invoke(newDefault);
return false;
}
}
}
4 changes: 4 additions & 0 deletions CommunityBugFixCollection/Locale/de.json
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,10 @@
"CommunityBugFixCollection.HighlightHomeWorldInInventory.Description": "Sorgt dafür, dass die ausgewählte Heimatwelt im Inventar korrekt hervorgehoben wird.",
"CommunityBugFixCollection.ImportMultipleAudioFiles.Description": "Macht es möglich mehrere Audiodateien auf einmal zu importieren.",
"CommunityBugFixCollection.ImportWebFilesAsUrls.Description": "Sorgt dafür, dass URLs zu Textdateien oder Resonite Packages nicht importiert werden, statt als Hyperlink aufzutauchen.",

"ShowmanTools.LinuxStreamingAudioFix.Name": "Linux Streaming Audio Fix",
"ShowmanTools.LinuxStreamingAudioFix.Description": "Stellt sicher, dass das separate Audio-Output der Streamingkamera auf Linux funktioniert.",

"CommunityBugFixCollection.LocalizedByteFormatting.Description": "Lokalisiert die Speichereinheiten (MiB, GiB, etc.), inbsesondere bei der StorageUsageStatus-Komponente. Es gibt eine Einstellung dafür, die Bytes nach IEC (Faktor 1024) statt dezimal (Faktor 1000) zu formatieren.",
"CommunityBugFixCollection.LongerWorldLoadingFailIndication.Description": "Lässt den Welt-Ladefortschritts-Indikator frühestens nach 20s verschwinden, falls der Vorgang fehlgeschlagen ist.",
"CommunityBugFixCollection.NaNtEqual.Description": "Sorgt dafür, dass NaN float / double Werte sich bei den == und != ProtoFlux Nodes sowie bei der ValueEqualityDriver-Komponente niemals gleichen.",
Expand Down
4 changes: 4 additions & 0 deletions CommunityBugFixCollection/Locale/en.json
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,10 @@
"CommunityBugFixCollection.HighlightHomeWorldInInventory.Description": "Fixes the selected Home World in the Inventory not being highlighted as a favorite.",
"CommunityBugFixCollection.ImportMultipleAudioFiles.Description": "Fixes it not being possible to import multiple audio clips at once.",
"CommunityBugFixCollection.ImportWebFilesAsUrls.Description": "Fixes URLs to text files or Resonite Packages failing to import instead of appearing as a hyperlink.",

"ShowmanTools.LinuxStreamingAudioFix.Name": "Linux Streaming Audio Fix",
"ShowmanTools.LinuxStreamingAudioFix.Description": "Ensures that the streaming camera's separate audio output works on Linux.",

"CommunityBugFixCollection.LocalizedByteFormatting.Description": "Localizes the storage units (MiB, GiB, etc.), in particular for the StorageUsageStatus component. There's an option to use IEC format (factor 1024) over decimal (factor 1000).",
"CommunityBugFixCollection.LongerWorldLoadingFailIndication.Description": "Only lets the World Load Progress Indicator disappear after 20s or more if the process failed.",
"CommunityBugFixCollection.NaNtEqual.Description": "Makes NaN floats / doubles never equal to each other for the ProtoFlux == and != nodes, as well as the ValueEqualityDriver component.",
Expand Down
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,7 @@ just disable them in the settings in the meantime.
* DuplicateSlot ProtoFlux node crashes game when if OverrideParent is identical to Template (https://github.com/Yellow-Dog-Man/Resonite-Issues/issues/3950)
* April Fools content is active for users in Universes (commercial usage) (https://github.com/Yellow-Dog-Man/Resonite-Issues/issues/4016)
* Instantly removing an AudioOutput component crashes the session (https://github.com/Yellow-Dog-Man/Resonite-Issues/issues/4286)
* Separate audio output for streaming camera doesn't work on Linux (https://github.com/Yellow-Dog-Man/Resonite-Issues/issues/6211)

Fixes with no issue (that could be found).
* Content of notification being off-center.
Expand Down
Loading