diff --git a/API/RenderSession.cs b/API/RenderSession.cs index 07bfa87..fea8d2c 100644 --- a/API/RenderSession.cs +++ b/API/RenderSession.cs @@ -180,7 +180,7 @@ public class RenderSession /// Sets the custom condition function that determines when the render session should end. /// /// - /// The condition is polled on the main thread once per frame from the start of the countdown until the render ends. + /// The condition is polled on the main Unity thread once per frame from the start of the countdown until the render ends. /// When it first returns true, the render continues for seconds of /// render time and then finishes successfully; it is not required to stay true. The default condition is /// that the level is cleared (scrController.instance.state == States.Won). Calling this method again @@ -231,7 +231,7 @@ public class RenderSession /// Adds a callback action to be invoked when the render session completes or fails. /// /// - /// Called once per render on the main thread: on success after the output file has been finished, on cancel or + /// Called once per render on the main Unity thread: on success after the output file has been finished, on cancel or /// failure after the unfinished file has been deleted, and before the game returns to the level editor. /// It is not called when the render stops because the game quits. Multiple calls combine the callbacks (invoked in /// the order added). The combined callback replaces the default one, which shows the desktop notification. @@ -249,7 +249,7 @@ public class RenderSession /// Adds a callback action to be invoked on the last update of each frame in the render session. /// /// - /// Called on the main thread every Unity frame after all other LateUpdate calls, from the moment the game scene + /// Called on the main Unity thread every Unity frame after all other LateUpdate calls, from the moment the game scene /// of the render has loaded until the render ends (including the countdown, before capture starts). /// Multiple calls combine the callbacks. An exception thrown by a callback is logged. /// diff --git a/Core/PresetManager.cs b/Core/PresetManager.cs index ba933ce..97725a7 100644 --- a/Core/PresetManager.cs +++ b/Core/PresetManager.cs @@ -39,7 +39,7 @@ public class RenderPreset public static class PresetManager { /// - /// Built-in presets (H.264 CBR, 48 kHz stereo AAC at 256 kbps, mkv): 1080p, 1440p and 2160p at 60 fps video. + /// Built-in presets (H.264 CBR, 48 kHz stereo AAC at 256 kbps, mkv): 1080p, 1440p and 2160p at 60 FPS video. /// "(4x)" presets render 240 game frames per second (4 per video frame); "(1x)" renders 60. /// Video bitrates are in kbps. /// diff --git a/Core/RenderManager.cs b/Core/RenderManager.cs index dbad697..43ced1e 100644 --- a/Core/RenderManager.cs +++ b/Core/RenderManager.cs @@ -92,7 +92,7 @@ internal static class RenderContext } }; /// - /// Called once on the main thread when the render finishes (success) or is cancelled or fails. + /// Called once on the main Unity thread when the render finishes (success) or is cancelled or fails. /// A session callback replaces the default one, so no notification is shown when a session sets OnComplete. /// Exceptions are caught and logged (RenderManager.TriggerOnComplete). /// @@ -101,7 +101,7 @@ internal static class RenderContext private static readonly Action OnLastUpdateDefault = () => { }; /// - /// Called on the main thread every frame after all other LateUpdate calls, through PostRenderHook (attached when the + /// Called on the main Unity thread every frame after all other LateUpdate calls, through PostRenderHook (attached when the /// game scene of the render has loaded) while the stage is Load or later. /// Exceptions are caught and logged (RenderManager.TriggerOnLastUpdate). /// @@ -154,7 +154,7 @@ internal class RenderManager : MonoBehaviour public static bool IsCapturingActive => Instance && Instance.stage >= RenderStage.Render; /// - /// Maximum number of frames in ImageQueue. The main thread waits (throttles) while the queue holds more frames. + /// Maximum number of frames in ImageQueue. The main Unity thread waits (throttles) while the queue holds more frames. /// public const int MaxQueuedFrames = 64; @@ -179,7 +179,7 @@ internal class RenderManager : MonoBehaviour /// /// Number of video frames sent to the encoder in this render. Incremented by the render thread (Interlocked), - /// read with Interlocked.Read by the main thread (result, debug monitor). Reset in SetupPlay. + /// read with Interlocked.Read by the main Unity thread (result, debug monitor). Reset in SetupPlay. /// public long framesSent; @@ -276,14 +276,14 @@ internal class RenderManager : MonoBehaviour /// /// Configuration of the current render: a copy made by RenderSession.Start, so values adjusted during the render - /// (the audio sample rate in SetupPlay) do not change the caller's object. Read by the main thread, the render + /// (the audio sample rate in SetupPlay) do not change the caller's object. Read by the main Unity thread, the render /// thread (audio settings) and the patches. Null until the first render starts. /// public RenderConfig Configuration = null!; // Render Sessions State (OOP Instance Fields) - /// Current stage of the render. Written on the main thread; read by the render thread in TryDequeueNextFrame. + /// Current stage of the render. Written on the main Unity thread; read by the render thread in TryDequeueNextFrame. public RenderStage stage = RenderStage.None; /// Time.timeAsDouble when capture started. The time patch returns timeBase + frameCount / RenderFPS. @@ -303,7 +303,7 @@ internal class RenderManager : MonoBehaviour /// /// Offline mixer of the song and sound effects of this render; null when audio is not rendered or no render runs. - /// Created in SetupPlay. Commands are added on the main thread (OnPostFrame, audio patches), mixing runs on the + /// Created in SetupPlay. Commands are added on the main Unity thread (OnPostFrame, audio patches), mixing runs on the /// render thread (WriteAudioForFrame); the mixer synchronizes the two internally. /// public OfflineAudioMixer? AudioMixer { get; private set; } @@ -392,10 +392,10 @@ internal class RenderManager : MonoBehaviour public long lastVideoFrameIndex = -1; /// - /// Video frame index of the last capture request (-1 before the first). Written on the main thread, read by the + /// Video frame index of the last capture request (-1 before the first). Written on the main Unity thread, read by the /// render thread to know when every requested frame has been sent after endRequested. /// - // long cannot be volatile: access via Volatile.Read/Write (written on main thread, read on render thread) + // long cannot be volatile: access via Volatile.Read/Write (written on main Unity thread, read on render thread) public long lastRequestedVideoFrameIndex = -1; /// @@ -404,10 +404,10 @@ internal class RenderManager : MonoBehaviour /// public int readbackFailureCount; - /// Number of frames on which the main thread had to wait for the render thread (throttle loop entries). + /// Number of frames on which the main Unity thread had to wait for the render thread (throttle loop entries). public int throttleCount; - /// True while the main thread is inside the throttle wait of OnPostFrame. + /// True while the main Unity thread is inside the throttle wait of OnPostFrame. public bool isThrottling; /// @@ -438,7 +438,7 @@ internal class RenderManager : MonoBehaviour /// /// Captured frames waiting for the render thread, keyed by video frame index. Readbacks may complete in any order; /// the render thread takes them in index order (passCount). Every access locks the list itself. - /// Frames are added by readback completions (main thread) and removed by the render thread, or released by the + /// Frames are added by readback completions (main Unity thread) and removed by the render thread, or released by the /// cleanup in StopFFmpeg / RestoreRenderEnvironment. /// internal SortedList ImageQueue = new(); @@ -788,7 +788,7 @@ internal class RenderManager : MonoBehaviour if (!texture) return; // [Backpressure Throttling] - // The main thread waits while ImageQueue holds more than QueueFrameLimit frames. Only the render thread + // The main Unity thread waits while ImageQueue holds more than QueueFrameLimit frames. Only the render thread // removes frames, and it signals FrameDequeuedEvent for each one. The wait has a timeout so that the loop // re-checks the render thread state and pumps pending readback completions (see ThrottleWaitMilliseconds). isThrottling = false; @@ -1249,7 +1249,7 @@ internal class RenderManager : MonoBehaviour /// /// Mixes the audio of the frame that was just sent (index passCount - 1) and writes it to the encoder. /// The sample count per frame comes from SyncCalculator (sample rate / effective video FPS, with the remainder - /// carried to later frames). Mixing waits until the main thread has committed the audio commands up to that time. + /// carried to later frames). Mixing waits until the main Unity thread has committed the audio commands up to that time. /// Does nothing when audio rendering is off. Render thread. /// /// The mixer was cancelled (render aborted) while waiting. diff --git a/Localization/LocalizationManager.cs b/Localization/LocalizationManager.cs index d449e91..e3c1db3 100644 --- a/Localization/LocalizationManager.cs +++ b/Localization/LocalizationManager.cs @@ -18,7 +18,7 @@ namespace ADOFAIRenderer.Localization; /// /// /// Lookup order in : active locale, then English, then the key itself. -/// Intended for the Unity main thread; the dictionaries are filled once during initialization and only read afterwards. +/// Intended for the main Unity thread; the dictionaries are filled once during initialization and only read afterwards. /// /// internal static class LocalizationManager diff --git a/Patch/Engine/AudioPatches.cs b/Patch/Engine/AudioPatches.cs index ba0d6db..5f33e9a 100644 --- a/Patch/Engine/AudioPatches.cs +++ b/Patch/Engine/AudioPatches.cs @@ -30,7 +30,7 @@ public static class AudioManagerFindOrLoadAudioClipExternalPatch } /// -/// AudioManager._Play (private; AudioManager.Play forwards to it): registers each scheduled effect sound (hit sounds, PlaySound +/// AudioManager._Play (private; AudioManager.Play forwards to it): registers each scheduled sound effect (hit sounds, PlaySound /// events, hold sounds without an end time) as an effect voice of the offline mixer and maps the returned AudioSource to it. /// Active while capturing (RenderManager.IsCapturingActive) with RenderAudio on. The original always runs: it creates the /// AudioSource the game keeps using (its PlayScheduled call is blocked during rendering by another patch), and the game sets @@ -46,7 +46,7 @@ public static class AudioManagerPlayPatch { if (RenderManager.IsCapturingActive && RenderManager.Instance.Configuration.AudioConfig.RenderAudio) { - // Cache the clip on the main thread + // Cache the clip on the main Unity thread RenderManager.Instance.AudioMixer?.CacheClip(snd); } return true; // Let the original method execute to prevent NullReferenceException @@ -104,7 +104,7 @@ public static class PlayWithEndTimePatch var mixer = RenderManager.Instance.AudioMixer; if (mixer != null) { - // Cache the clip on the main thread + // Cache the clip on the main Unity thread mixer.CacheClip(snd); // Convert absolute DSP times to relative times in seconds from render start diff --git a/Patch/Engine/RenderEnvironmentPatches.cs b/Patch/Engine/RenderEnvironmentPatches.cs index 7710632..d515ef9 100644 --- a/Patch/Engine/RenderEnvironmentPatches.cs +++ b/Patch/Engine/RenderEnvironmentPatches.cs @@ -18,7 +18,7 @@ namespace ADOFAIRenderer.Patch.Engine; /// (game and mod scripts). /// /// -/// All prefixes run on the thread that calls the getter (normally the Unity main thread) and read RenderManager state +/// All prefixes run on the thread that calls the getter (normally the main Unity thread) and read RenderManager state /// without locks. /// /// @@ -264,7 +264,7 @@ public static class RenderEnvironmentPatches /// that loads an external audio file of the level into audioLib): from stage Load with /// AdvancedConfig.ProcessAudio on, forces stream to false. The game passes stream to /// DownloadHandlerAudioClip.streamAudio for ogg/wav/aif/aiff files, so these clips are loaded as non-streaming - /// clips; the mp3 path uses mp3Streaming and ignores stream. + /// clips; the MP3 path uses mp3Streaming and ignores stream. /// Reference: https://docs.unity3d.com/ScriptReference/Networking.DownloadHandlerAudioClip-streamAudio.html /// [HarmonyPatch(typeof(AudioManager), "FindOrLoadAudioClipExternal", typeof(string), typeof(bool), typeof(float), typeof(bool))] diff --git a/Patch/Game/LanguageSyncPatch.cs b/Patch/Game/LanguageSyncPatch.cs index 8dd28ab..407509c 100644 --- a/Patch/Game/LanguageSyncPatch.cs +++ b/Patch/Game/LanguageSyncPatch.cs @@ -11,7 +11,7 @@ namespace ADOFAIRenderer.Patch.Game; /// Persistence.language (it returns immediately when already initialized); and RDString.ChangeLanguage(SystemLanguage), /// which stores the language in Persistence.language, clears the initialized flag and calls Setup again. /// -/// Always active (independent of the render stage). Runs on the Unity main thread. +/// Always active (independent of the render stage). Runs on the main Unity thread. /// [HarmonyPatch(typeof(RDString))] internal static class LanguageSyncPatch diff --git a/Patch/Game/scnEditorPatch.cs b/Patch/Game/scnEditorPatch.cs index d87bd1e..4092f3b 100644 --- a/Patch/Game/scnEditorPatch.cs +++ b/Patch/Game/scnEditorPatch.cs @@ -14,7 +14,7 @@ namespace ADOFAIRenderer.Patch.Game; /// /// /// Always active except when the mod features are disabled (, set from the -/// driver warning dialog). Runs on the Unity main thread each time the editor scene starts. +/// driver warning dialog). Runs on the main Unity thread each time the editor scene starts. /// /// [HarmonyPatch(typeof(scnEditor))] diff --git a/Patch/Game/scrCameraPatch.cs b/Patch/Game/scrCameraPatch.cs index 2af5313..a065741 100644 --- a/Patch/Game/scrCameraPatch.cs +++ b/Patch/Game/scrCameraPatch.cs @@ -8,7 +8,7 @@ namespace ADOFAIRenderer.Patch.Game; /// already off. /// /// Patched member: scrCamera.SetCustomFrameRate(bool enable, float frame) (level effect that updates the screen at a -/// lower frame rate). Enabling assigns a new RenderTexture to the camera quad material and refreshes it at frame fps. +/// lower frame rate). Enabling assigns a new RenderTexture to the camera quad material and refreshes it at frame FPS. /// Disabling calls Release() on the quad material's current mainTexture and assigns camRT back. When /// the effect was never enabled, mainTexture is camRT itself, so the original releases the live camera /// render texture. diff --git a/UI/CommonWarningDialogUI.cs b/UI/CommonWarningDialogUI.cs index 54a04c5..7c30c77 100644 --- a/UI/CommonWarningDialogUI.cs +++ b/UI/CommonWarningDialogUI.cs @@ -21,7 +21,7 @@ internal class DialogButton public string Text; /// - /// Action run on the Unity main thread when the button is clicked. The dialog is destroyed after the action + /// Action run on the main Unity thread when the button is clicked. The dialog is destroyed after the action /// returns, also when the action throws (the exception is logged). /// public Action OnClick; @@ -49,7 +49,7 @@ internal class DialogButton /// canvas: a translucent full-screen backdrop that blocks input to everything below, and an O5Kit window on top of it. /// While the dialog exists, every enabled UI Toolkit root () is disabled so that it cannot /// receive input; the roots are enabled again in . Clicking any button runs its action and then -/// destroys the dialog. All members run on the Unity main thread. +/// destroys the dialog. All members run on the main Unity thread. /// /// internal class CommonWarningDialogUI : MonoBehaviour @@ -97,7 +97,7 @@ internal class CommonWarningDialogUI : MonoBehaviour } /// - /// Creates and shows a new dialog. Must be called on the Unity main thread. + /// Creates and shows a new dialog. Must be called on the main Unity thread. /// /// Window title text. /// Body text, centered and word-wrapped; TextMeshPro rich text tags are allowed. diff --git a/UI/DebugMonitorUI.cs b/UI/DebugMonitorUI.cs index b2dd7e5..52e5009 100644 --- a/UI/DebugMonitorUI.cs +++ b/UI/DebugMonitorUI.cs @@ -14,7 +14,7 @@ namespace ADOFAIRenderer.UI; /// /// Created by RenderManager.StartFFmpegThread on a GameObject kept across scene loads, and reused for later /// renders. The overlay is drawn on the game screen only; it is not part of the encoded video frames. -/// rebuilds the text every frame on the Unity main thread. +/// rebuilds the text every frame on the main Unity thread. /// /// internal class DebugMonitorUI : MonoBehaviour @@ -194,7 +194,7 @@ internal class DebugMonitorUI : MonoBehaviour // Queue - frames waiting in ImageQueue for the render thread / queue frame limit // Rendered Frames - RenderManager.frameCount (frames produced by the game) // Frames Sent - RenderManager.framesSent (frames handed to the encoder; written by the render thread) - // Throttling - RenderManager.throttleCount (times the main thread started waiting because ImageQueue + // Throttling - RenderManager.throttleCount (times the main Unity thread started waiting because ImageQueue // held more frames than its limit) // Readback failures- RenderManager.readbackFailureCount (AsyncGPUReadback requests that completed with an error) // Mono heap - GC.GetTotalMemory(false), managed heap size in MiB without forcing a collection diff --git a/UI/EscapeHandlerUI.cs b/UI/EscapeHandlerUI.cs index b70d2ca..470e950 100644 --- a/UI/EscapeHandlerUI.cs +++ b/UI/EscapeHandlerUI.cs @@ -14,7 +14,7 @@ namespace ADOFAIRenderer.UI; /// (measured in real time with a , independent of the patched game time) calls /// RenderManager.CancelRender. Releasing Escape earlier hides the panel and resets the countdown. /// The component destroys its GameObject as soon as RenderManager.IsActive is false (stage below OnScene). -/// Runs on the Unity main thread. +/// Runs on the main Unity thread. /// /// internal class EscapeHandlerUI : MonoBehaviour diff --git a/UI/FFmpegDownloadUI.cs b/UI/FFmpegDownloadUI.cs index 2375dd4..6760d47 100644 --- a/UI/FFmpegDownloadUI.cs +++ b/UI/FFmpegDownloadUI.cs @@ -25,9 +25,9 @@ namespace ADOFAIRenderer.UI; /// RenderMod.OnInitializeMelon). /// /// -/// Threads: UI construction and all Unity object access happen on the Unity main thread. The download and extraction +/// Threads: UI construction and all Unity object access happen on the main Unity thread. The download and extraction /// run on thread-pool threads (); they post UI updates to -/// , which drains on the main thread. +/// , which drains on the main Unity thread. /// /// /// Flow: buttons -> (Download) progress bar + status text -> download to a temporary archive in UserLibs -> extract @@ -70,7 +70,7 @@ internal class FFmpegDownloadUI : MonoBehaviour /// Cancellation for the running download; created per download, cancelled by Cancel, disposed in OnDestroy. private System.Threading.CancellationTokenSource? _cts; - /// Actions posted from background threads, run in order on the main thread by . + /// Actions posted from background threads, run in order on the main Unity thread by . private readonly System.Collections.Concurrent.ConcurrentQueue _mainThreadQueue = new(); /// @@ -376,7 +376,7 @@ internal class FFmpegDownloadUI : MonoBehaviour /// Runs every action posted by the background download task, in posting order. private void Update() { - // Execute queued actions on main thread + // Execute queued actions on main Unity thread while (_mainThreadQueue.TryDequeue(out var action)) { action?.Invoke(); @@ -384,7 +384,7 @@ internal class FFmpegDownloadUI : MonoBehaviour } /// - /// Posts an action to run on the main thread during the next . Safe to call from any thread. + /// Posts an action to run on the main Unity thread during the next . Safe to call from any thread. /// Actions posted after the dialog is destroyed are never run. /// private void ExecuteOnMainThread(Action action) @@ -458,7 +458,7 @@ internal class FFmpegDownloadUI : MonoBehaviour // Keep the "complete" message visible for 1000 ms before closing await Task.Delay(1000); - // Destroy UI on main thread. FirstUpdateHook then sees Instance == null and checks the libraries again. + // Destroy UI on main Unity thread. FirstUpdateHook then sees Instance == null and checks the libraries again. ExecuteOnMainThread(() => { Destroy(gameObject); @@ -513,7 +513,7 @@ internal class FFmpegDownloadUI : MonoBehaviour Destroy(gameObject); } - /// Posts a status text and color change to the main thread. Callable from any thread. + /// Posts a status text and color change to the main Unity thread. Callable from any thread. private void UpdateStatus(string message, Color color) { ExecuteOnMainThread(() => @@ -526,7 +526,7 @@ internal class FFmpegDownloadUI : MonoBehaviour }); } - /// Posts a progress bar update to the main thread. Callable from any thread. + /// Posts a progress bar update to the main Unity thread. Callable from any thread. /// Filled fraction 0..1 (not 0..100); becomes the fill's anchorMax.x. /// Text shown on the bar. private void UpdateProgress(float percent, string text) diff --git a/UI/LocalizedText.cs b/UI/LocalizedText.cs index 65162a6..cc601aa 100644 --- a/UI/LocalizedText.cs +++ b/UI/LocalizedText.cs @@ -12,7 +12,7 @@ namespace ADOFAIRenderer.UI; /// The text is set when the binding is made (), when the component is enabled, /// and on every event. A key and a dynamic provider are mutually /// exclusive: setting one clears the other. With neither set, leaves the text unchanged. -/// Runs on the Unity main thread. +/// Runs on the main Unity thread. /// /// internal class LocalizedText : MonoBehaviour @@ -44,7 +44,7 @@ internal class LocalizedText : MonoBehaviour /// The provider is called on every refresh (enable and language change), so it can combine several keys or /// runtime values, e.g. a label that depends on UI state. /// - /// Function returning the text to display; called on the Unity main thread. + /// Function returning the text to display; called on the main Unity thread. public void SetDynamic(Func provider) { _dynamicProvider = provider; diff --git a/UI/Window/RenderConfigWindow.cs b/UI/Window/RenderConfigWindow.cs index a28e519..8a2ef1a 100644 --- a/UI/Window/RenderConfigWindow.cs +++ b/UI/Window/RenderConfigWindow.cs @@ -24,7 +24,7 @@ namespace ADOFAIRenderer.UI.Window; /// /// Opened from the level editor through RenderManager (after the unsaved-changes check) with /// . The window is built once and then hidden/shown; its state lives in static fields for the -/// whole game session. All members run on the Unity main thread. +/// whole game session. All members run on the main Unity thread. /// /// /// Data flow: @@ -658,7 +658,7 @@ internal static class RenderConfigWindow var (globalLeft, globalRight) = CreateTwoColumnPanel(globalContent); // Browse: opens the OS folder picker (FolderDialogUtil) at the current folder; a selected folder is written to // the input and saved to the global settings immediately. FolderDialogUtil runs the callback through the - // caller's SynchronizationContext, i.e. on the Unity main thread; cancel or failure passes null (ignored here). + // caller's SynchronizationContext, i.e. on the main Unity thread; cancel or failure passes null (ignored here). CreateButton( ctx, globalLeft, "ui.render_config.browse", diff --git a/Util/Audio/AudioSyncCalculator.cs b/Util/Audio/AudioSyncCalculator.cs index a4a1626..f6a7c31 100644 --- a/Util/Audio/AudioSyncCalculator.cs +++ b/Util/Audio/AudioSyncCalculator.cs @@ -8,7 +8,7 @@ namespace ADOFAIRenderer.Util.Audio; /// The frame rate is converted to an exact fraction Numerator / Denominator (). /// Frame k receives floor((k + 1) * sampleRate * Denominator / Numerator) - floor(k * sampleRate * Denominator / Numerator) samples: /// the remainder of each division is carried into the next frame, so the sum over any number of frames equals the exact -/// sample count of that duration rounded down (for example 44100 Hz at 60 fps gives 735 every frame; at 144 fps three frames of 306 +/// sample count of that duration rounded down (for example 44100 Hz at 60 FPS gives 735 every frame; at 144 FPS three frames of 306 /// are followed by one of 307, 306.25 on average). /// Used by the render thread only (RenderManager.WriteAudioForFrame, once per frame sent to the encoder). /// diff --git a/Util/Audio/Clip/AudioClipSource.cs b/Util/Audio/Clip/AudioClipSource.cs index 401bd3e..d545bb0 100644 --- a/Util/Audio/Clip/AudioClipSource.cs +++ b/Util/Audio/Clip/AudioClipSource.cs @@ -175,7 +175,7 @@ internal sealed class AudioClipSource /// /// Most decode streams (reader + resampler) a windowed source opens. A load continues the stream positioned at the chunk start, /// otherwise opens another stream up to this count, otherwise restarts the least recently used stream. - /// Each stream holds one open reader (file handle and decoder state, measured 0.3 ~ 2.7 MiB for ogg/flac/mp3 with the clip harness). + /// Each stream holds one open reader (file handle and decoder state, measured 0.3 ~ 2.7 MiB for ogg/flac/MP3 with the clip harness). /// public const int MaxDecodeStreams = 4; diff --git a/Util/Audio/Clip/AudioClipStore.cs b/Util/Audio/Clip/AudioClipStore.cs index c94f0db..35152ea 100644 --- a/Util/Audio/Clip/AudioClipStore.cs +++ b/Util/Audio/Clip/AudioClipStore.cs @@ -12,7 +12,7 @@ namespace ADOFAIRenderer.Util.Audio.Clip; /// - Decoder thread (): the only thread that decodes, resamples, loads and frees chunks. /// Each step loads one chunk, the one with the lowest priority value over all sources /// (a chunk a consumer waits for, then cursor windows by slot, then resident chunks in order). -/// - Consumers (render thread, main thread for the spectrum): waits for the decoder thread and never loads. +/// - Consumers (render thread, main Unity thread for the spectrum): waits for the decoder thread and never loads. /// - Main thread: creates readers (for Unity clips this copies the clip data). /// /// Memory has no limit; current and peak usage are tracked and logged by . diff --git a/Util/Audio/Clip/UnityClipLoader.cs b/Util/Audio/Clip/UnityClipLoader.cs index ab9dcc6..3ec2953 100644 --- a/Util/Audio/Clip/UnityClipLoader.cs +++ b/Util/Audio/Clip/UnityClipLoader.cs @@ -7,7 +7,7 @@ namespace ADOFAIRenderer.Util.Audio.Clip; /// /// Copies a Unity into memory for clips without a file on disk /// (built-in hit sounds from Resources, official/DLC level audio). -/// runs on the main thread only, so the whole clip is copied once on the main thread +/// runs on the main Unity thread only, so the whole clip is copied once on the main Unity thread /// and the decoder thread reads the copy through a . /// Streaming clips () are rejected because GetData does not read them. /// Reference: https://docs.unity3d.com/ScriptReference/AudioClip.GetData.html diff --git a/Util/Audio/Mixer/Voice.cs b/Util/Audio/Mixer/Voice.cs index faf6a9f..460d5d0 100644 --- a/Util/Audio/Mixer/Voice.cs +++ b/Util/Audio/Mixer/Voice.cs @@ -6,7 +6,7 @@ using ADOFAIRenderer.Util.Audio.Clip; namespace ADOFAIRenderer.Util.Audio.Mixer; /// -/// One playing sound of a (the song, or one effect sound), created by . +/// One playing sound of a (the song, or one sound effect), created by . /// /// Main thread: the Set methods queue a change that takes effect at a given time (seconds relative to the render start, /// the time at which the game made the change). Changes of one voice must be queued in non-decreasing time order. @@ -43,7 +43,7 @@ internal sealed class Voice Stop } - /// One timed change of a voice, queued by the main thread and applied by the render thread. + /// One timed change of a voice, queued by the main Unity thread and applied by the render thread. internal readonly struct Change { public readonly ChangeKind Kind; diff --git a/Util/Audio/Mixer/VoiceMixer.cs b/Util/Audio/Mixer/VoiceMixer.cs index 871ef69..5e8796e 100644 --- a/Util/Audio/Mixer/VoiceMixer.cs +++ b/Util/Audio/Mixer/VoiceMixer.cs @@ -35,7 +35,7 @@ internal sealed class VoiceMixer : IDisposable Change } - /// Command queued by the main thread and taken by the render thread at the start of . + /// Command queued by the main Unity thread and taken by the render thread at the start of . private readonly struct Command { public readonly CommandKind Kind; @@ -55,7 +55,7 @@ internal sealed class VoiceMixer : IDisposable private readonly AudioClipStore _store; private readonly CancellationToken _cancellationToken; - // Double-buffered command lists: the main thread appends to _commands under _commandLock; the render thread swaps the + // Double-buffered command lists: the main Unity thread appends to _commands under _commandLock; the render thread swaps the // two lists under the lock and processes _takenCommands outside it, then clears it for the next swap. private readonly object _commandLock = new(); private List _commands = new(); @@ -126,7 +126,7 @@ internal sealed class VoiceMixer : IDisposable /// /// Queues a change of that takes effect at sample (). - /// Called by the Voice Set methods on the main thread. + /// Called by the Voice Set methods on the main Unity thread. /// internal void Enqueue(Voice voice, Voice.ChangeKind kind, double time, double value) { diff --git a/Util/Audio/OfflineAudioMixer.cs b/Util/Audio/OfflineAudioMixer.cs index c32191f..d8af3b2 100644 --- a/Util/Audio/OfflineAudioMixer.cs +++ b/Util/Audio/OfflineAudioMixer.cs @@ -11,7 +11,7 @@ using UnityEngine; namespace ADOFAIRenderer.Util.Audio; /// -/// Audio of one render: the song and effect sounds as s of a , clips from an +/// Audio of one render: the song and sound effects as s of a , clips from an /// , followed by the filter chain (RMS compressor → look-ahead limiter → hard clip → -1 dB gain). /// /// Time: seconds relative to the render start (RenderManager.dspTimeBase); output sample n is at n / sample rate. @@ -21,15 +21,15 @@ namespace ADOFAIRenderer.Util.Audio; /// Threads: /// - Main thread: , , , , /// source/voice mapping, and after each frame (all commands with an earlier time have been queued). -/// - Render thread: waits until the main thread has committed the end of the samples it mixes, -/// so every command takes effect at its own sample. ends the waiting when the main thread stops. +/// - Render thread: waits until the main Unity thread has committed the end of the samples it mixes, +/// so every command takes effect at its own sample. ends the waiting when the main Unity thread stops. /// internal sealed class OfflineAudioMixer : IDisposable { /// Linear gain applied to every clip (song and effects), before the filter chain (0.5 ≈ -6 dB headroom). private const double ClipVolume = 0.5; - /// Additional gain of effect sounds (registered with ). + /// Additional gain of sound effects (registered with ). private const double EffectVolume = 2.0 / 3.0; /// @@ -62,7 +62,7 @@ internal sealed class OfflineAudioMixer : IDisposable // Main thread. /// - /// Mapping of game AudioSources to the state of the effect sound last started on them. Weak keys: a destroyed source + /// Mapping of game AudioSources to the state of the sound effect last started on them. Weak keys: a destroyed source /// does not keep its state alive. Replaced by a new table to drop every mapping at once. /// private ConditionalWeakTable _sourceStates = new(); @@ -240,7 +240,7 @@ internal sealed class OfflineAudioMixer : IDisposable } /// - /// Starts an effect sound at . An of 0 or more makes it loop until then. + /// Starts a sound effect at . An of 0 or more makes it loop until then. /// (when given) is mapped to the returned state, which reports and applies later changes through the AudioSource. /// /// Game AudioSource playing the sound, or null to map it later with . @@ -283,7 +283,7 @@ internal sealed class OfflineAudioMixer : IDisposable _sourceStates.Add(source, state); } - /// State of the effect sound last started for . The mapping stays after the sound ends or stops. + /// State of the sound effect last started for . The mapping stays after the sound ends or stops. public bool TryGetSourceState(AudioSource? source, out SourceState state) { state = null!; @@ -291,7 +291,7 @@ internal sealed class OfflineAudioMixer : IDisposable } /// - /// Stops every effect sound at , including ones scheduled to start later + /// Stops every sound effect at , including ones scheduled to start later /// (AudioManager.StopAllSounds destroys every AudioSource in liveSources, which holds the sources of /// AudioManager._Play and scrConductor.PlayWithEndTime). The song voice keeps playing. /// @@ -342,7 +342,7 @@ internal sealed class OfflineAudioMixer : IDisposable /// /// Writes the next output frames (interleaved float, continuing from the previous call). - /// Blocks until the main thread has committed the voice samples it needs (, ). + /// Blocks until the main Unity thread has committed the voice samples it needs (, ). /// /// Destination; must hold at least samplesNeeded * channels floats. Values beyond that are untouched. /// Frames (samples per channel) to write. @@ -377,7 +377,7 @@ internal sealed class OfflineAudioMixer : IDisposable } } - /// Mixes voices at samples [first, first + frames) into the reused double buffer, after the main thread committed them. + /// Mixes voices at samples [first, first + frames) into the reused double buffer, after the main Unity thread committed them. private Span MixBlock(long first, int frames) { WaitForCommit(first + frames); diff --git a/Util/FFmpeg/FFmpegNativeEncoder.cs b/Util/FFmpeg/FFmpegNativeEncoder.cs index 23ecec0..f669afd 100644 --- a/Util/FFmpeg/FFmpegNativeEncoder.cs +++ b/Util/FFmpeg/FFmpegNativeEncoder.cs @@ -34,7 +34,7 @@ namespace ADOFAIRenderer.Util.FFmpeg /// /// ── Threading ──────────────────────────────────────────────────────── /// Every public method takes _lock, so calls from different threads are serialized. - /// In the renderer, the main thread constructs and starts the encoder, and the render thread + /// In the renderer, the main Unity thread constructs and starts the encoder, and the render thread /// (RenderManager.RenderThread) sends the video frames and audio samples, calls End() and Dispose(). /// Dispose() may also be called from another thread to release an encoder whose render was stopped. /// After End() or Dispose(), the Write*/Send* methods return without doing anything. @@ -916,7 +916,7 @@ namespace ADOFAIRenderer.Util.FFmpeg // Stream time base: unit of the timestamps stored in the container. // Set to the codec time base (1 / framerate) so that every frame interval is a whole number of ticks. // When it is left unset, the muxer uses 1/90000, in which the interval of rates such as - // 59.94 fps (1501.5 ticks), 23.976 fps (3753.75 ticks) or 165 fps (545.45 ticks) is not an integer, + // 59.94 FPS (1501.5 ticks), 23.976 FPS (3753.75 ticks) or 165 FPS (545.45 ticks) is not an integer, // and the frame durations alternate between two values. // The muxer may still adjust the value in avformat_write_header (e.g. mp4 scales it to at least 10000); // packet timestamps are rescaled to the final value in SendFrameAndWritePackets. diff --git a/Util/FrameReader.cs b/Util/FrameReader.cs index 6c05f1c..3aaa414 100644 --- a/Util/FrameReader.cs +++ b/Util/FrameReader.cs @@ -26,7 +26,7 @@ namespace ADOFAIRenderer.Util /// (RenderManager.SendVideoFrame, then ) or the frame was dropped. /// /// - /// Threads: requests and readback completions run on the main thread; is also called by + /// Threads: requests and readback completions run on the main Unity thread; is also called by /// the render thread. The pool and the disposed flag are guarded by _poolLock. One instance per render, created in /// RenderManager.SetupPlay with the pixel format of the opened encoder. /// @@ -290,7 +290,7 @@ namespace ADOFAIRenderer.Util /// /// Returns a state to the pool after its frame was sent or dropped, or disposes it when the reader is disposed. - /// Called by the render thread (after sending) and by the main thread (abort, errors, queue cleanup). + /// Called by the render thread (after sending) and by the main Unity thread (abort, errors, queue cleanup). /// internal void RecycleState(ReadbackRequestState state) { diff --git a/Util/OS/FolderDialogUtil.cs b/Util/OS/FolderDialogUtil.cs index 3f6d4dc..ef6587e 100644 --- a/Util/OS/FolderDialogUtil.cs +++ b/Util/OS/FolderDialogUtil.cs @@ -22,7 +22,7 @@ namespace ADOFAIRenderer.Util.OS; /// cancelled or failed), kdialog --getexistingdirectory. /// /// -/// The dialog runs off the Unity main thread so the game keeps rendering frames while it is open. Only one dialog can be open +/// The dialog runs off the main Unity thread so the game keeps rendering frames while it is open. Only one dialog can be open /// at a time. Failures are reported to the callback as null (same as cancel); exceptions are logged as warnings, except a /// zenity start failure, which silently moves on to kdialog. /// @@ -43,7 +43,7 @@ internal static class FolderDialogUtil /// "FolderDialog-Win"; macOS/Linux: thread pool task) and receives the result. /// /// - /// Callback thread: when the caller has a (the Unity main thread has one), the callback + /// Callback thread: when the caller has a (the main Unity thread has one), the callback /// is posted to it and runs on the caller's thread; otherwise it runs on the dialog thread. Exceptions thrown by the /// callback are caught and logged. ///