added AudioClip loop point display to GUI

This commit is contained in:
BM85-Hz 2024-05-05 18:34:28 -07:00
parent d886bf1c5d
commit f0a793bd3d
2 changed files with 23 additions and 0 deletions

View File

@ -122,6 +122,7 @@
this.FMODcopyright = new System.Windows.Forms.Label(); this.FMODcopyright = new System.Windows.Forms.Label();
this.FMODinfoLabel = new System.Windows.Forms.Label(); this.FMODinfoLabel = new System.Windows.Forms.Label();
this.FMODtimerLabel = 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.FMODstatusLabel = new System.Windows.Forms.Label();
this.FMODprogressBar = new System.Windows.Forms.TrackBar(); this.FMODprogressBar = new System.Windows.Forms.TrackBar();
this.FMODvolumeBar = 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.FMODcopyright);
this.FMODpanel.Controls.Add(this.FMODinfoLabel); this.FMODpanel.Controls.Add(this.FMODinfoLabel);
this.FMODpanel.Controls.Add(this.FMODtimerLabel); this.FMODpanel.Controls.Add(this.FMODtimerLabel);
this.FMODpanel.Controls.Add(this.FMODloopLabel);
this.FMODpanel.Controls.Add(this.FMODstatusLabel); this.FMODpanel.Controls.Add(this.FMODstatusLabel);
this.FMODpanel.Controls.Add(this.FMODprogressBar); this.FMODpanel.Controls.Add(this.FMODprogressBar);
this.FMODpanel.Controls.Add(this.FMODvolumeBar); this.FMODpanel.Controls.Add(this.FMODvolumeBar);
@ -1069,6 +1071,17 @@
this.FMODtimerLabel.TabIndex = 7; this.FMODtimerLabel.TabIndex = 7;
this.FMODtimerLabel.Text = "00:00.00 / 00:00.00"; 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 // FMODstatusLabel
// //
this.FMODstatusLabel.Anchor = System.Windows.Forms.AnchorStyles.Top; this.FMODstatusLabel.Anchor = System.Windows.Forms.AnchorStyles.Top;
@ -1509,6 +1522,7 @@
private System.Windows.Forms.TrackBar FMODprogressBar; private System.Windows.Forms.TrackBar FMODprogressBar;
private System.Windows.Forms.Label FMODstatusLabel; private System.Windows.Forms.Label FMODstatusLabel;
private System.Windows.Forms.Label FMODtimerLabel; private System.Windows.Forms.Label FMODtimerLabel;
private System.Windows.Forms.Label FMODloopLabel;
private System.Windows.Forms.Label FMODinfoLabel; private System.Windows.Forms.Label FMODinfoLabel;
private System.Windows.Forms.Timer timer; private System.Windows.Forms.Timer timer;
private System.Windows.Forms.ToolStripMenuItem optionsToolStripMenuItem; private System.Windows.Forms.ToolStripMenuItem optionsToolStripMenuItem;

View File

@ -43,6 +43,8 @@ namespace AssetStudioGUI
private FMOD.SoundGroup masterSoundGroup; private FMOD.SoundGroup masterSoundGroup;
private FMOD.MODE loopMode = FMOD.MODE.LOOP_OFF; private FMOD.MODE loopMode = FMOD.MODE.LOOP_OFF;
private uint FMODlenms; private uint FMODlenms;
private uint FMODloopstartms;
private uint FMODloopendms;
private float FMODVolume = 0.8f; private float FMODVolume = 0.8f;
#region SpriteControl #region SpriteControl
@ -1110,6 +1112,9 @@ namespace AssetStudioGUI
result = sound.getLength(out FMODlenms, FMOD.TIMEUNIT.MS); result = sound.getLength(out FMODlenms, FMOD.TIMEUNIT.MS);
if (ERRCHECK(result)) return; 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); _ = system.getMasterChannelGroup(out var channelGroup);
result = system.playSound(sound, channelGroup, true, out channel); result = system.playSound(sound, channelGroup, true, out channel);
if (ERRCHECK(result)) return; if (ERRCHECK(result)) return;
@ -1121,6 +1126,8 @@ namespace AssetStudioGUI
FMODinfoLabel.Text = frequency + " Hz"; FMODinfoLabel.Text = frequency + " Hz";
FMODtimerLabel.Text = $"00:00.00 / {(FMODlenms / 1000 / 60):00}:{(FMODlenms / 1000 % 60):00}.{(FMODlenms / 10 % 100):00}"; 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) private void PreviewVideoClip(AssetItem assetItem, VideoClip m_VideoClip)
@ -2377,6 +2384,7 @@ namespace AssetStudioGUI
timer.Stop(); timer.Stop();
FMODprogressBar.Value = 0; FMODprogressBar.Value = 0;
FMODtimerLabel.Text = "00:00.00 / 00:00.00"; FMODtimerLabel.Text = "00:00.00 / 00:00.00";
FMODloopLabel.Text = $"Loop Start: 00:00.00 - Loop End: 00:00.00";
FMODstatusLabel.Text = "Stopped"; FMODstatusLabel.Text = "Stopped";
FMODinfoLabel.Text = ""; FMODinfoLabel.Text = "";
@ -2483,6 +2491,7 @@ namespace AssetStudioGUI
timer.Stop(); timer.Stop();
FMODprogressBar.Value = 0; FMODprogressBar.Value = 0;
FMODtimerLabel.Text = "00:00.00 / 00:00.00"; FMODtimerLabel.Text = "00:00.00 / 00:00.00";
FMODloopLabel.Text = $"Loop Start: 00:00.00 - Loop End: 00:00.00";
FMODstatusLabel.Text = "Stopped"; FMODstatusLabel.Text = "Stopped";
FMODpauseButton.Text = "Pause"; FMODpauseButton.Text = "Pause";
} }