Update fmod to 0.2.0.22 (CLI Preparation)

This commit is contained in:
VaDiM 2023-01-27 12:35:21 +03:00
parent a96d1a5d5d
commit 39490d4e03
9 changed files with 2555 additions and 4080 deletions

View File

@ -79,7 +79,6 @@
this.splitContainer1 = new System.Windows.Forms.SplitContainer();
this.tabControl1 = new System.Windows.Forms.TabControl();
this.tabPage1 = new System.Windows.Forms.TabPage();
this.sceneTreeView = new AssetStudioGUI.GOHierarchy();
this.treeSearch = new System.Windows.Forms.TextBox();
this.tabPage2 = new System.Windows.Forms.TabPage();
this.assetListView = new System.Windows.Forms.ListView();
@ -127,6 +126,7 @@
this.dumpSelectedAssetsToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
this.goToSceneHierarchyToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
this.showOriginalFileToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
this.sceneTreeView = new AssetStudioGUI.GOHierarchy();
this.menuStrip1.SuspendLayout();
((System.ComponentModel.ISupportInitialize)(this.splitContainer1)).BeginInit();
this.splitContainer1.Panel1.SuspendLayout();
@ -572,17 +572,6 @@
this.tabPage1.Text = "Scene Hierarchy";
this.tabPage1.UseVisualStyleBackColor = true;
//
// sceneTreeView
//
this.sceneTreeView.CheckBoxes = true;
this.sceneTreeView.Dock = System.Windows.Forms.DockStyle.Fill;
this.sceneTreeView.HideSelection = false;
this.sceneTreeView.Location = new System.Drawing.Point(0, 20);
this.sceneTreeView.Name = "sceneTreeView";
this.sceneTreeView.Size = new System.Drawing.Size(472, 587);
this.sceneTreeView.TabIndex = 1;
this.sceneTreeView.AfterCheck += new System.Windows.Forms.TreeViewEventHandler(this.sceneTreeView_AfterCheck);
//
// treeSearch
//
this.treeSearch.Dock = System.Windows.Forms.DockStyle.Top;
@ -813,7 +802,7 @@
//
this.FMODinfoLabel.AutoSize = true;
this.FMODinfoLabel.ForeColor = System.Drawing.SystemColors.ControlLightLight;
this.FMODinfoLabel.Location = new System.Drawing.Point(269, 255);
this.FMODinfoLabel.Location = new System.Drawing.Point(275, 255);
this.FMODinfoLabel.Name = "FMODinfoLabel";
this.FMODinfoLabel.Size = new System.Drawing.Size(0, 13);
this.FMODinfoLabel.TabIndex = 8;
@ -832,7 +821,7 @@
//
this.FMODstatusLabel.AutoSize = true;
this.FMODstatusLabel.ForeColor = System.Drawing.SystemColors.ControlLightLight;
this.FMODstatusLabel.Location = new System.Drawing.Point(213, 255);
this.FMODstatusLabel.Location = new System.Drawing.Point(214, 255);
this.FMODstatusLabel.Name = "FMODstatusLabel";
this.FMODstatusLabel.Size = new System.Drawing.Size(47, 13);
this.FMODstatusLabel.TabIndex = 6;
@ -1072,6 +1061,17 @@
this.showOriginalFileToolStripMenuItem.Visible = false;
this.showOriginalFileToolStripMenuItem.Click += new System.EventHandler(this.showOriginalFileToolStripMenuItem_Click);
//
// sceneTreeView
//
this.sceneTreeView.CheckBoxes = true;
this.sceneTreeView.Dock = System.Windows.Forms.DockStyle.Fill;
this.sceneTreeView.HideSelection = false;
this.sceneTreeView.Location = new System.Drawing.Point(0, 20);
this.sceneTreeView.Name = "sceneTreeView";
this.sceneTreeView.Size = new System.Drawing.Size(472, 587);
this.sceneTreeView.TabIndex = 1;
this.sceneTreeView.AfterCheck += new System.Windows.Forms.TreeViewEventHandler(this.sceneTreeView_AfterCheck);
//
// AssetStudioGUIForm
//
this.AllowDrop = true;

View File

@ -437,7 +437,7 @@ namespace AssetStudioGUI
{
FMODpanel.Visible = !FMODpanel.Visible;
if (sound != null && channel != null)
if (sound.hasHandle() && channel.hasHandle())
{
var result = channel.isPlaying(out var playing);
if (result == FMOD.RESULT.OK && playing)
@ -890,7 +890,7 @@ namespace AssetStudioGUI
assetItem.InfoText += "iPhone";
break;
default:
assetItem.InfoText += "Unknown";
assetItem.InfoText += $"Unknown ({m_AudioClip.m_Type})";
break;
}
}
@ -959,7 +959,8 @@ namespace AssetStudioGUI
result = sound.getLength(out FMODlenms, FMOD.TIMEUNIT.MS);
if (ERRCHECK(result)) return;
result = system.playSound(sound, null, true, out channel);
_ = system.getMasterChannelGroup(out var channelGroup);
result = system.playSound(sound, channelGroup, true, out channel);
if (ERRCHECK(result)) return;
FMODpanel.Visible = true;
@ -1703,22 +1704,23 @@ namespace AssetStudioGUI
{
timer.Stop();
FMODprogressBar.Value = 0;
FMODtimerLabel.Text = "0:00.0 / 0:00.0";
FMODtimerLabel.Text = "00:00.00 / 00:00.00";
FMODstatusLabel.Text = "Stopped";
FMODinfoLabel.Text = "";
if (sound != null && sound.isValid())
if (sound.hasHandle())
{
var result = sound.release();
ERRCHECK(result);
sound = null;
sound.clearHandle();
}
}
private void FMODplayButton_Click(object sender, EventArgs e)
{
if (sound != null && channel != null)
if (sound.hasHandle() && channel.hasHandle())
{
_ = system.getMasterChannelGroup(out var channelGroup);
timer.Start();
var result = channel.isPlaying(out var playing);
if ((result != FMOD.RESULT.OK) && (result != FMOD.RESULT.ERR_INVALID_HANDLE))
@ -1731,14 +1733,14 @@ namespace AssetStudioGUI
result = channel.stop();
if (ERRCHECK(result)) { return; }
result = system.playSound(sound, null, false, out channel);
result = system.playSound(sound, channelGroup, false, out channel);
if (ERRCHECK(result)) { return; }
FMODpauseButton.Text = "Pause";
}
else
{
result = system.playSound(sound, null, false, out channel);
result = system.playSound(sound, channelGroup, false, out channel);
if (ERRCHECK(result)) { return; }
FMODstatusLabel.Text = "Playing";
@ -1759,7 +1761,7 @@ namespace AssetStudioGUI
private void FMODpauseButton_Click(object sender, EventArgs e)
{
if (sound != null && channel != null)
if (sound.hasHandle() && channel.hasHandle())
{
var result = channel.isPlaying(out var playing);
if ((result != FMOD.RESULT.OK) && (result != FMOD.RESULT.ERR_INVALID_HANDLE))
@ -1792,7 +1794,7 @@ namespace AssetStudioGUI
private void FMODstopButton_Click(object sender, EventArgs e)
{
if (channel != null)
if (channel.hasHandle())
{
var result = channel.isPlaying(out var playing);
if ((result != FMOD.RESULT.OK) && (result != FMOD.RESULT.ERR_INVALID_HANDLE))
@ -1808,7 +1810,7 @@ namespace AssetStudioGUI
//don't FMODreset, it will nullify the sound
timer.Stop();
FMODprogressBar.Value = 0;
FMODtimerLabel.Text = "0:00.0 / 0:00.0";
FMODtimerLabel.Text = "00:00.00 / 00:00.00";
FMODstatusLabel.Text = "Stopped";
FMODpauseButton.Text = "Pause";
}
@ -1821,13 +1823,13 @@ namespace AssetStudioGUI
loopMode = FMODloopButton.Checked ? FMOD.MODE.LOOP_NORMAL : FMOD.MODE.LOOP_OFF;
if (sound != null)
if (sound.hasHandle())
{
result = sound.setMode(loopMode);
if (ERRCHECK(result)) { return; }
}
if (channel != null)
if (channel.hasHandle())
{
result = channel.isPlaying(out var playing);
if ((result != FMOD.RESULT.OK) && (result != FMOD.RESULT.ERR_INVALID_HANDLE))
@ -1859,10 +1861,10 @@ namespace AssetStudioGUI
private void FMODprogressBar_Scroll(object sender, EventArgs e)
{
if (channel != null)
if (channel.hasHandle())
{
uint newms = FMODlenms / 1000 * (uint)FMODprogressBar.Value;
FMODtimerLabel.Text = $"{newms / 1000 / 60}:{newms / 1000 % 60}.{newms / 10 % 100}/{FMODlenms / 1000 / 60}:{FMODlenms / 1000 % 60}.{FMODlenms / 10 % 100}";
FMODtimerLabel.Text = $"{newms / 1000 / 60:00}:{newms / 1000 % 60:00}.{newms / 10 % 100:00} / {FMODlenms / 1000 / 60:00}:{FMODlenms / 1000 % 60:00}.{FMODlenms / 10 % 100:00}";
}
}
@ -1873,7 +1875,7 @@ namespace AssetStudioGUI
private void FMODprogressBar_MouseUp(object sender, MouseEventArgs e)
{
if (channel != null)
if (channel.hasHandle())
{
uint newms = FMODlenms / 1000 * (uint)FMODprogressBar.Value;
@ -1900,7 +1902,7 @@ namespace AssetStudioGUI
bool playing = false;
bool paused = false;
if (channel != null)
if (channel.hasHandle())
{
var result = channel.getPosition(out ms, FMOD.TIMEUNIT.MS);
if ((result != FMOD.RESULT.OK) && (result != FMOD.RESULT.ERR_INVALID_HANDLE))
@ -1921,11 +1923,15 @@ namespace AssetStudioGUI
}
}
FMODtimerLabel.Text = $"{ms / 1000 / 60}:{ms / 1000 % 60}.{ms / 10 % 100} / {FMODlenms / 1000 / 60}:{FMODlenms / 1000 % 60}.{FMODlenms / 10 % 100}";
FMODprogressBar.Value = (int)(ms * 1000 / FMODlenms);
FMODtimerLabel.Text = $"{ms / 1000 / 60:00}:{ms / 1000 % 60:00}.{ms / 10 % 100:00} / {FMODlenms / 1000 / 60:00}:{FMODlenms / 1000 % 60:00}.{FMODlenms / 10 % 100:00}";
#if NETFRAMEWORK
FMODprogressBar.Value = (int)Math.Max(0, Math.Min(ms * 1000f / FMODlenms, 1000));
#else
FMODprogressBar.Value = (int)Math.Clamp(ms * 1000f / FMODlenms, 0, 1000);
#endif
FMODstatusLabel.Text = paused ? "Paused " : playing ? "Playing" : "Stopped";
if (system != null && channel != null)
if (system.hasHandle() && channel.hasHandle())
{
system.update();
}

View File

@ -49,7 +49,7 @@ namespace AssetStudioGUI
{
if (!TryExportFile(exportPath, item, ".wav", out var exportFullPath))
return false;
var buffer = converter.ConvertToWav();
var buffer = converter.ConvertToWav(m_AudioData);
if (buffer == null)
return false;
File.WriteAllBytes(exportFullPath, buffer);

View File

@ -14,11 +14,8 @@ namespace AssetStudio
m_AudioClip = audioClip;
}
public byte[] ConvertToWav()
public byte[] ConvertToWav(byte[] m_AudioData)
{
var m_AudioData = m_AudioClip.m_AudioData.GetData();
if (m_AudioData == null || m_AudioData.Length == 0)
return null;
var exinfo = new CREATESOUNDEXINFO();
var result = Factory.System_Create(out var system);
if (result != RESULT.OK)

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

View File

@ -1,10 +1,13 @@
/* =================================================================================================== */
/* FMOD Studio - Error string header file. Copyright (c), Firelight Technologies Pty, Ltd. 2004-2016. */
/* ============================================================================================== */
/* FMOD Core / Studio API - Error string header file. */
/* Copyright (c), Firelight Technologies Pty, Ltd. 2004-2020. */
/* */
/* Use this header if you want to store or display a string version / english explanation of */
/* the FMOD error codes. */
/* Use this header if you want to store or display a string version / english explanation */
/* of the FMOD error codes. */
/* */
/* =================================================================================================== */
/* For more detail visit: */
/* https://fmod.com/resources/documentation-api?version=2.0&page=core-api-common.html#fmod_result */
/* =============================================================================================== */
namespace FMOD
{