From f0a793bd3d3d318e42a22affe4bfaf9fbacf0a7a Mon Sep 17 00:00:00 2001 From: BM85-Hz <53278075+BM85-Hz@users.noreply.github.com> Date: Sun, 5 May 2024 18:34:28 -0700 Subject: [PATCH] added AudioClip loop point display to GUI --- AssetStudioGUI/AssetStudioGUIForm.Designer.cs | 14 ++++++++++++++ AssetStudioGUI/AssetStudioGUIForm.cs | 9 +++++++++ 2 files changed, 23 insertions(+) diff --git a/AssetStudioGUI/AssetStudioGUIForm.Designer.cs b/AssetStudioGUI/AssetStudioGUIForm.Designer.cs index ca2db88..ebda9c7 100644 --- a/AssetStudioGUI/AssetStudioGUIForm.Designer.cs +++ b/AssetStudioGUI/AssetStudioGUIForm.Designer.cs @@ -122,6 +122,7 @@ this.FMODcopyright = new System.Windows.Forms.Label(); this.FMODinfoLabel = new System.Windows.Forms.Label(); this.FMODtimerLabel = new System.Windows.Forms.Label(); + this.FMODloopLabel = new System.Windows.Forms.Label(); this.FMODstatusLabel = new System.Windows.Forms.Label(); this.FMODprogressBar = new System.Windows.Forms.TrackBar(); this.FMODvolumeBar = new System.Windows.Forms.TrackBar(); @@ -1020,6 +1021,7 @@ this.FMODpanel.Controls.Add(this.FMODcopyright); this.FMODpanel.Controls.Add(this.FMODinfoLabel); this.FMODpanel.Controls.Add(this.FMODtimerLabel); + this.FMODpanel.Controls.Add(this.FMODloopLabel); this.FMODpanel.Controls.Add(this.FMODstatusLabel); this.FMODpanel.Controls.Add(this.FMODprogressBar); this.FMODpanel.Controls.Add(this.FMODvolumeBar); @@ -1069,6 +1071,17 @@ this.FMODtimerLabel.TabIndex = 7; this.FMODtimerLabel.Text = "00:00.00 / 00:00.00"; // + // FMODloopLabel + // + this.FMODloopLabel.AutoSize = true; + this.FMODloopLabel.ForeColor = System.Drawing.SystemColors.HighlightText; + this.FMODloopLabel.ImeMode = System.Windows.Forms.ImeMode.NoControl; + this.FMODloopLabel.Location = new System.Drawing.Point(4, 24); + this.FMODloopLabel.Name = "FMODloopLabel"; + this.FMODloopLabel.Size = new System.Drawing.Size(102, 13); + this.FMODloopLabel.TabIndex = 10; + this.FMODloopLabel.Text = "00:00.00 / 00:00.00"; + // // FMODstatusLabel // this.FMODstatusLabel.Anchor = System.Windows.Forms.AnchorStyles.Top; @@ -1509,6 +1522,7 @@ private System.Windows.Forms.TrackBar FMODprogressBar; private System.Windows.Forms.Label FMODstatusLabel; private System.Windows.Forms.Label FMODtimerLabel; + private System.Windows.Forms.Label FMODloopLabel; private System.Windows.Forms.Label FMODinfoLabel; private System.Windows.Forms.Timer timer; private System.Windows.Forms.ToolStripMenuItem optionsToolStripMenuItem; diff --git a/AssetStudioGUI/AssetStudioGUIForm.cs b/AssetStudioGUI/AssetStudioGUIForm.cs index 9d552df..9aa530b 100644 --- a/AssetStudioGUI/AssetStudioGUIForm.cs +++ b/AssetStudioGUI/AssetStudioGUIForm.cs @@ -43,6 +43,8 @@ namespace AssetStudioGUI private FMOD.SoundGroup masterSoundGroup; private FMOD.MODE loopMode = FMOD.MODE.LOOP_OFF; private uint FMODlenms; + private uint FMODloopstartms; + private uint FMODloopendms; private float FMODVolume = 0.8f; #region SpriteControl @@ -1110,6 +1112,9 @@ namespace AssetStudioGUI result = sound.getLength(out FMODlenms, FMOD.TIMEUNIT.MS); if (ERRCHECK(result)) return; + result = sound.getLoopPoints(out FMODloopstartms, FMOD.TIMEUNIT.MS, out FMODloopendms, FMOD.TIMEUNIT.MS); + if (ERRCHECK(result)) return; + _ = system.getMasterChannelGroup(out var channelGroup); result = system.playSound(sound, channelGroup, true, out channel); if (ERRCHECK(result)) return; @@ -1121,6 +1126,8 @@ namespace AssetStudioGUI FMODinfoLabel.Text = frequency + " Hz"; FMODtimerLabel.Text = $"00:00.00 / {(FMODlenms / 1000 / 60):00}:{(FMODlenms / 1000 % 60):00}.{(FMODlenms / 10 % 100):00}"; + FMODloopLabel.Text = $"Loop Start: {(FMODloopstartms / 1000 / 60):00}:{(FMODloopstartms / 1000 % 60):00}.{(FMODloopstartms / 10 % 100):00} - " + + $"Loop End: {(FMODloopendms / 1000 / 60):00}:{(FMODloopendms / 1000 % 60):00}.{(FMODloopendms / 10 % 100):00}"; } private void PreviewVideoClip(AssetItem assetItem, VideoClip m_VideoClip) @@ -2377,6 +2384,7 @@ namespace AssetStudioGUI timer.Stop(); FMODprogressBar.Value = 0; FMODtimerLabel.Text = "00:00.00 / 00:00.00"; + FMODloopLabel.Text = $"Loop Start: 00:00.00 - Loop End: 00:00.00"; FMODstatusLabel.Text = "Stopped"; FMODinfoLabel.Text = ""; @@ -2483,6 +2491,7 @@ namespace AssetStudioGUI timer.Stop(); FMODprogressBar.Value = 0; FMODtimerLabel.Text = "00:00.00 / 00:00.00"; + FMODloopLabel.Text = $"Loop Start: 00:00.00 - Loop End: 00:00.00"; FMODstatusLabel.Text = "Stopped"; FMODpauseButton.Text = "Pause"; }