Skip to content

Commit

Permalink
Option to dump raw audio files instead of streaming
Browse files Browse the repository at this point in the history
  • Loading branch information
Razmoth committed Nov 9, 2023
1 parent 30325d1 commit bc60aac
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 6 deletions.
13 changes: 7 additions & 6 deletions Audio/ViewModels/MainViewModel.cs
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,7 @@ public double ProgressValue
public ObservableCollection<Folder> Folders { get; set; }
public FlatTreeDataGridSource<Entry> EntrySource { get; set; }
public string ClipboardText { get; set; }
public bool RawAudio { get; set; }
public MainViewModel()
{
SearchText = "";
Expand Down Expand Up @@ -330,7 +331,7 @@ private async void GenerateTXTPInternal(string wwiser, string file)
using var process = Process.Start(startInfo);
process.WaitForExit();

ExportTXTP(banks, txtpDir);
Export(banks, txtpDir, RawAudio ? DumpEntry : DumpTXTH);
}
}
else
Expand All @@ -352,15 +353,15 @@ private async void GenerateTXTPInternal(string wwiser, string file)
using var process = Process.Start(startInfo);
process.WaitForExit();

ExportTXTP(banks, txtpDir);

Export(banks, txtpDir, RawAudio ? DumpEntry : DumpTXTH);
}

Directory.Delete(tempDir, true);

StatusText = "TXTP generated successfully !!";
}

private void ExportTXTP(List<Bank> banks, string txtpDir)
private void Export(List<Bank> banks, string txtpDir, Action<Entry, string> exportAction)
{
var sounds = Packages.SelectMany(x => x.Sounds).Cast<Sound>().ToList();

Expand Down Expand Up @@ -392,7 +393,7 @@ private void ExportTXTP(List<Bank> banks, string txtpDir)
if (sound != null)
{
var outputPath = Path.Combine(wemDir, $"{soundID}.wem");
DumpTXTH(sound, outputPath);
exportAction(sound, outputPath);
continue;
}
}
Expand All @@ -407,7 +408,7 @@ private void ExportTXTP(List<Bank> banks, string txtpDir)
if (embeddedSound != null)
{
var outputPath = Path.Combine(wemDir, $"{embeddedID}.wem");
DumpTXTH(embeddedSound, outputPath);
exportAction(embeddedSound, outputPath);
continue;
}
}
Expand Down
1 change: 1 addition & 0 deletions Audio/Views/MainView.axaml
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@
<MenuItem Header="Options">
<MenuItem Header="Load VO" Click="LoadVO_Click"/>
<MenuItem Header="Generate TXTP" Click="GenerateTXTP_Click"/>
<CheckBox Content="Export raw audio" IsChecked="{Binding RawAudio}"/>
<Separator/>
<ItemsControl ItemsSource="{Binding Folders}">
<ItemsControl.ItemTemplate>
Expand Down

0 comments on commit bc60aac

Please sign in to comment.