Skip to content

Commit b51d539

Browse files
FMOD Audio support (#597)
Co-authored-by: LongerWarrior <LongerWarrior@gmail.com>
1 parent f366ad1 commit b51d539

File tree

3 files changed

+33
-2
lines changed

3 files changed

+33
-2
lines changed

CUE4Parse

Submodule CUE4Parse updated 160 files

FModel/ViewModels/AudioPlayerViewModel.cs

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -295,7 +295,13 @@ public void SavePlaylist()
295295
Save(a, true);
296296
}
297297

298-
FLogger.Append(ELog.Information, () => FLogger.Text($"Successfully saved {_audioFiles.Count} audio files", Constants.WHITE, true));
298+
FLogger.Append(ELog.Information, () =>
299+
{
300+
FLogger.Text("Successfully saved audio from ", Constants.WHITE);
301+
FLogger.Link(_audioFiles.First().FileName, _audioFiles.First().FilePath, true);
302+
});
303+
if (_audioFiles.Count > 1)
304+
FLogger.Append(ELog.Information, () => FLogger.Text($"Successfully saved {_audioFiles.Count} audio files", Constants.WHITE, true));
299305
});
300306
}
301307

FModel/ViewModels/CUE4ParseViewModel.cs

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -64,6 +64,8 @@
6464
using Application = System.Windows.Application;
6565
using FGuid = CUE4Parse.UE4.Objects.Core.Misc.FGuid;
6666
using CUE4Parse.UE4.Objects.UObject.Editor;
67+
using CUE4Parse.UE4.Assets.Exports.Fmod;
68+
using CUE4Parse.UE4.FMod;
6769

6870

6971
namespace FModel.ViewModels;
@@ -130,6 +132,8 @@ public Snooper SnooperViewer
130132
public ConfigIni IoStoreOnDemand { get; }
131133
private Lazy<WwiseProvider> _wwiseProviderLazy;
132134
public WwiseProvider WwiseProvider => _wwiseProviderLazy.Value;
135+
private Lazy<FModProvider> _fmodProviderLazy;
136+
public FModProvider FmodProvider => _fmodProviderLazy?.Value;
133137
public ConcurrentBag<string> UnknownExtensions = [];
134138

135139
public CUE4ParseViewModel()
@@ -283,6 +287,7 @@ await _threadWorkerView.Begin(cancellationToken =>
283287

284288
Provider.Initialize();
285289
_wwiseProviderLazy = new Lazy<WwiseProvider>(() => new WwiseProvider(Provider, UserSettings.Default.WwiseMaxBnkPrefetch));
290+
_fmodProviderLazy = new Lazy<FModProvider>(() => new FModProvider(Provider, UserSettings.Default.GameDirectory));
286291
Log.Information($"{Provider.Versions.Game} ({Provider.Versions.Platform}) | Archives: x{Provider.UnloadedVfs.Count} | AES: x{Provider.RequiredKeys.Count} | Loose Files: x{Provider.Files.Count}");
287292
});
288293
}
@@ -942,6 +947,26 @@ public void ExtractAndScroll(CancellationToken cancellationToken, string fullPat
942947
}
943948
return false;
944949
}
950+
case UFMODEvent when isNone && pointer.Object.Value is UFMODEvent fmodEvent:
951+
{
952+
var extractedSounds = FmodProvider.ExtractEventSounds(fmodEvent);
953+
var directory = Path.GetDirectoryName(fmodEvent.Owner?.Name) ?? "/FMOD/Desktop/";
954+
foreach (var sound in extractedSounds)
955+
{
956+
SaveAndPlaySound(Path.Combine(directory, sound.Name), sound.Extension, sound.Data);
957+
}
958+
return false;
959+
}
960+
case UFMODBank when isNone && pointer.Object.Value is UFMODBank fmodBank:
961+
{
962+
var extractedSounds = FmodProvider.ExtractBankSounds(fmodBank);
963+
var directory = Path.GetDirectoryName(fmodBank.Owner?.Name) ?? "/FMOD/Desktop/";
964+
foreach (var sound in extractedSounds)
965+
{
966+
SaveAndPlaySound(Path.Combine(directory, sound.Name), sound.Extension, sound.Data);
967+
}
968+
return false;
969+
}
945970
case UAkMediaAssetData when isNone:
946971
case USoundWave when isNone:
947972
{

0 commit comments

Comments
 (0)