Skip to content

Commit

Permalink
Add loop messages
Browse files Browse the repository at this point in the history
  • Loading branch information
skawo committed Jan 26, 2022
1 parent e7d69d7 commit 3f6d41c
Show file tree
Hide file tree
Showing 7 changed files with 16 additions and 3 deletions.
10 changes: 8 additions & 2 deletions BRSTM Encoder/Form1.cs
Original file line number Diff line number Diff line change
Expand Up @@ -65,12 +65,12 @@ public void LoadFile(string FileName)

public void Convert(int LoopSt, int LoopEn, bool Loop, string Out)
{
VGAudio.Containers.NintendoWare.BrstmWriter Writer = new VGAudio.Containers.NintendoWare.BrstmWriter();

if (File.Exists(Out))
File.Delete(Out);

FileStream Stream = new FileStream(Out, FileMode.CreateNew);
VGAudio.Containers.NintendoWare.BrstmWriter Writer = new VGAudio.Containers.NintendoWare.BrstmWriter();

Writer.WriteToStream(Audio.AudioFormat.WithLoop(Loop, LoopSt, LoopEn == 0 ? Audio.AudioFormat.SampleCount : LoopEn), Stream, Audio.Configuration);
Stream.Close();
}
Expand All @@ -95,6 +95,12 @@ private void Button_Save_Click(object sender, EventArgs e)
Label_Status.Text = "Saving BRSTM...";
Label_Status.Update();

if (CheckBox_IsLooped.Checked && (int)NumUpDown_LoopStart.Value > (int)NumUpDown_LoopEnd.Value)
{
MessageBox.Show("Loop start cannot be smaller than the loop end");
return;
}

Convert((int)NumUpDown_LoopStart.Value, (int)NumUpDown_LoopEnd.Value, CheckBox_IsLooped.Checked, Dialog.FileName);

Label_Status.Text = "Done!";
Expand Down
7 changes: 7 additions & 0 deletions BRSTM Encoder/Program.cs
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,13 @@ static int Main(string[] args)

Console.WriteLine("");
Console.WriteLine($"Convert {args[0]} to {args[0].Replace(".wav", "")}_out.brstm");

if (Loop && LoopEn != 0 && LoopSt > LoopEn)
{
Console.WriteLine("Loop start cannot be smaller than the loop end");
return -1;
}

f.Convert(LoopSt, LoopEn, Loop, $"{args[0].Replace(".wav", "")}_out.brstm");
Console.WriteLine("Done!");
}
Expand Down
Binary file modified BRSTM Encoder/bin/Debug/BRSTM Encoder.exe
Binary file not shown.
Binary file modified BRSTM Encoder/bin/Debug/BRSTM Encoder.pdb
Binary file not shown.
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,6 @@ D:\GIT\brstm-encoder\BRSTM Encoder\obj\Debug\BRSTM Encoder.csproj.CoreCompileInp
D:\GIT\brstm-encoder\BRSTM Encoder\obj\Debug\BRSTM Encoder.exe
D:\GIT\brstm-encoder\BRSTM Encoder\obj\Debug\BRSTM Encoder.pdb
D:\GIT\brstm-encoder\BRSTM Encoder\obj\Debug\BRSTM Encoder.csproj.SuggestedBindingRedirects.cache
D:\GIT\brstm-encoder\BRSTM Encoder\obj\Debug\BRSTM Encoder.csproj.AssemblyReference.cache
D:\GIT\brstm-encoder\BRSTM Encoder\bin\Debug\VGAudio.dll
D:\GIT\brstm-encoder\BRSTM Encoder\bin\Debug\VGAudio.xml
D:\GIT\brstm-encoder\BRSTM Encoder\obj\Debug\BRSTM Encoder.csproj.CopyComplete
Binary file modified BRSTM Encoder/obj/Debug/BRSTM Encoder.exe
Binary file not shown.
Binary file modified BRSTM Encoder/obj/Debug/BRSTM Encoder.pdb
Binary file not shown.

0 comments on commit 3f6d41c

Please sign in to comment.