[GUI] Add option to autoplay audioClip assets

This commit is contained in:
VaDiM 2025-03-22 03:37:41 +03:00
parent 47d67e0a49
commit 3b10a808d3
4 changed files with 39 additions and 3 deletions

View File

@ -43,6 +43,7 @@
this.assetLoadingToolStripSeparator = new System.Windows.Forms.ToolStripSeparator();
this.enablePreview = new System.Windows.Forms.ToolStripMenuItem();
this.displayInfo = new System.Windows.Forms.ToolStripMenuItem();
this.autoPlayAudioAssetsToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
this.useDumpTreeViewToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
this.buildTreeStructureToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
this.customCompressionTypeToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
@ -266,6 +267,7 @@
this.assetLoadingToolStripSeparator,
this.enablePreview,
this.displayInfo,
this.autoPlayAudioAssetsToolStripMenuItem,
this.useDumpTreeViewToolStripMenuItem,
this.buildTreeStructureToolStripMenuItem,
this.customCompressionTypeToolStripMenuItem,
@ -326,6 +328,15 @@
"t, audio bitrate, etc.";
this.displayInfo.CheckedChanged += new System.EventHandler(this.displayAssetInfo_Check);
//
// autoPlayAudioAssetsToolStripMenuItem
//
this.autoPlayAudioAssetsToolStripMenuItem.CheckOnClick = true;
this.autoPlayAudioAssetsToolStripMenuItem.Name = "autoPlayAudioAssetsToolStripMenuItem";
this.autoPlayAudioAssetsToolStripMenuItem.Size = new System.Drawing.Size(241, 22);
this.autoPlayAudioAssetsToolStripMenuItem.Text = "Autoplay audio assets";
this.autoPlayAudioAssetsToolStripMenuItem.ToolTipText = "Autoplay AudioClip assets when selected";
this.autoPlayAudioAssetsToolStripMenuItem.CheckedChanged += new System.EventHandler(this.autoPlayAudioAssetsToolStripMenuItem_CheckedChanged);
//
// useDumpTreeViewToolStripMenuItem
//
this.useDumpTreeViewToolStripMenuItem.CheckOnClick = true;
@ -1751,6 +1762,7 @@
private System.Windows.Forms.ToolStripMenuItem colorThemeLightToolStripMenuItem;
private System.Windows.Forms.ToolStripMenuItem colorThemeDarkToolStripMenuItem;
private System.Windows.Forms.Label FMODaudioChannelsLabel;
private System.Windows.Forms.ToolStripMenuItem autoPlayAudioAssetsToolStripMenuItem;
}
}

View File

@ -143,6 +143,7 @@ namespace AssetStudioGUI
buildTreeStructureToolStripMenuItem.Checked = Properties.Settings.Default.buildTreeStructure;
useAssetLoadingViaTypetreeToolStripMenuItem.Checked = Properties.Settings.Default.useTypetreeLoading;
useDumpTreeViewToolStripMenuItem.Checked = Properties.Settings.Default.useDumpTreeView;
autoPlayAudioAssetsToolStripMenuItem.Checked = Properties.Settings.Default.autoplayAudio;
FMODinit();
listSearchFilterMode.SelectedIndex = 0;
@ -1159,10 +1160,12 @@ namespace AssetStudioGUI
assetItem.InfoText += $"\nLoop Start: {(FMODloopstartms / 1000 / 60):00}:{(FMODloopstartms / 1000 % 60):00}.{(FMODloopstartms / 10 % 100):00}";
assetItem.InfoText += $"\nLoop End: {(FMODloopendms / 1000 / 60):00}:{(FMODloopendms / 1000 % 60):00}.{(FMODloopendms / 10 % 100):00}";
}
var paused = !autoPlayAudioAssetsToolStripMenuItem.Checked;
_ = system.getMasterChannelGroup(out var channelGroup);
result = system.playSound(sound, channelGroup, true, out channel);
result = system.playSound(sound, channelGroup, paused, out channel);
if (ERRCHECK(result)) return;
if (!paused) { timer.Start(); }
FMODpanel.Visible = true;
@ -2573,6 +2576,12 @@ namespace AssetStudioGUI
}
}
private void autoPlayAudioAssetsToolStripMenuItem_CheckedChanged(object sender, EventArgs e)
{
Properties.Settings.Default.autoplayAudio = autoPlayAudioAssetsToolStripMenuItem.Checked;
Properties.Settings.Default.Save();
}
#region FMOD
private void FMODinit()
{

View File

@ -12,7 +12,7 @@ namespace AssetStudioGUI.Properties {
[global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()]
[global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.VisualStudio.Editors.SettingsDesigner.SettingsSingleFileGenerator", "17.12.0.0")]
[global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.VisualStudio.Editors.SettingsDesigner.SettingsSingleFileGenerator", "17.13.0.0")]
internal sealed partial class Settings : global::System.Configuration.ApplicationSettingsBase {
private static Settings defaultInstance = ((Settings)(global::System.Configuration.ApplicationSettingsBase.Synchronized(new Settings())));
@ -442,5 +442,17 @@ namespace AssetStudioGUI.Properties {
this["useDumpTreeView"] = value;
}
}
[global::System.Configuration.UserScopedSettingAttribute()]
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
[global::System.Configuration.DefaultSettingValueAttribute("False")]
public bool autoplayAudio {
get {
return ((bool)(this["autoplayAudio"]));
}
set {
this["autoplayAudio"] = value;
}
}
}
}

View File

@ -107,5 +107,8 @@
<Setting Name="useDumpTreeView" Type="System.Boolean" Scope="User">
<Value Profile="(Default)">False</Value>
</Setting>
<Setting Name="autoplayAudio" Type="System.Boolean" Scope="User">
<Value Profile="(Default)">False</Value>
</Setting>
</Settings>
</SettingsFile>