Skip to content

Commit

Permalink
version 1.27
Browse files Browse the repository at this point in the history
  • Loading branch information
XyLe-GBP committed Nov 9, 2022
1 parent f13762f commit 6124210
Show file tree
Hide file tree
Showing 6 changed files with 183 additions and 52 deletions.
4 changes: 2 additions & 2 deletions ATRACTool-Reloaded.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,8 @@
<Nullable>enable</Nullable>
<UseWindowsForms>true</UseWindowsForms>
<ImplicitUsings>enable</ImplicitUsings>
<AssemblyVersion>1.26.2220.1027</AssemblyVersion>
<FileVersion>1.26.2220.1027</FileVersion>
<AssemblyVersion>1.27.2220.1109</AssemblyVersion>
<FileVersion>1.27.2220.1109</FileVersion>
<RepositoryType>git</RepositoryType>
<Company>XyLe</Company>
<Description>Open source ATRAC conversion utility</Description>
Expand Down
5 changes: 5 additions & 0 deletions Program.cs
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,11 @@ static void Main()
MessageBox.Show("The required file 'ps4_at9tool.exe' does not exist.\nClose the application.", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
return;
}
if (!File.Exists(Directory.GetCurrentDirectory() + @"\res\updater.exe"))
{
MessageBox.Show("The required file 'updater.exe' does not exist.\nClose the application.", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
return;
}

Application.SetHighDpiMode(HighDpiMode.SystemAware);
Application.EnableVisualStyles();
Expand Down
2 changes: 1 addition & 1 deletion VERSIONINFO
Original file line number Diff line number Diff line change
@@ -1 +1 @@
version:1.26.2220.1027
version:1.27.2220.1109
50 changes: 50 additions & 0 deletions src/Common.cs
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,10 @@ public class Generic
public static bool IsWave = false;
public static bool IsATRAC = false;
/// <summary>
/// ファイルをWaveに変換したかどうかを判別するための変数
/// </summary>
public static bool IsATW = false;
/// <summary>
/// 変換先の形式を判別するための変数
/// </summary>
public static int WTAFlag = -1;
Expand Down Expand Up @@ -229,6 +233,52 @@ public static void ShowFolder(string Fullpath, bool Flag = true)
}
}

/// <summary>
/// 該当ファイルが存在する場合は削除
/// </summary>
/// <param name="path">ファイルの場所</param>
public static void CheckExistsFile(string path)
{
if (File.Exists(path))
{
File.Delete(path);
return;
}
else
{
return;
}
}

/// <summary>
/// IsATWがtrueならWaveに変換したファイルを削除
/// </summary>
/// <param name="flag">Generic.IsATW</param>
public static void ATWCheck(bool flag)
{
switch (flag)
{
case true:
{
foreach (var file in Generic.OpenFilePaths)
{
if (File.Exists(file))
{
File.Delete(file);
}

}
break;
}
case false:
{
break;
}
}
Generic.IsATW = false;
return;
}

/// <summary>
/// 設定ファイルに全てを書き出す
/// </summary>
Expand Down
12 changes: 10 additions & 2 deletions src/Forms/FormLPC.cs
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,15 @@
using ATRACTool_Reloaded.Localizable;
using System.Text;
using static ATRACTool_Reloaded.Common;
using NAudio.Wave.SampleProviders;

namespace ATRACTool_Reloaded
{
public partial class FormLPC : Form
{
private readonly WaveIn wi = new();
private readonly WaveOut wo = new();
private NotifyingSampleProvider osp = null!;
private AudioFileReader reader = null!;
long Sample, Start = 0, End = 0;
int bytePerSec, position, length, btnpos;
Expand Down Expand Up @@ -66,7 +68,7 @@ private void FormLPC_Load(object sender, EventArgs e)
{
reader = new(Common.Generic.OpenFilePaths[0]);
FileInfo fi = new(Common.Generic.OpenFilePaths[0]);
label_File.Text = fi.Name;
label_File.Text = fi.Name + "[ " + reader.WaveFormat.BitsPerSample + "-bit, " + reader.WaveFormat.SampleRate + "Hz ]";
button_Prev.Enabled = false;
button_Next.Enabled = false;
}
Expand Down Expand Up @@ -194,6 +196,7 @@ private void Playback()
{
while (wo.PlaybackState != PlaybackState.Stopped)
{

position = (int)reader.Position / reader.WaveFormat.AverageBytesPerSecond;
time = new(0, 0, position);
Sample = reader.Position / reader.WaveFormat.BlockAlign;
Expand All @@ -218,10 +221,13 @@ private void Button_SetStart_Click(object sender, EventArgs e)

private void FormLPC_FormClosed(object sender, FormClosedEventArgs e)
{
if (timer_Reload.Enabled == true) timer_Reload.Enabled = false;
reader.Position = 0;
wi.Dispose();
wo.Stop();
wo.Dispose();
reader.Close();
reader.Dispose();
reader = null!;
}

private void Button_Prev_Click(object sender, EventArgs e)
Expand All @@ -233,6 +239,7 @@ private void Button_Prev_Click(object sender, EventArgs e)
wo.Stop();
button_Play.Text = Localization.PlayCaption;
reader.Position = 0;
reader.Close();
button_Stop.Enabled = false;

if (btnpos == 1)
Expand Down Expand Up @@ -262,6 +269,7 @@ private void Button_Next_Click(object sender, EventArgs e)
wo.Stop();
button_Play.Text = Localization.PlayCaption;
reader.Position = 0;
reader.Close();
button_Stop.Enabled = false;

if (btnpos == Common.Generic.OpenFilePaths.Length)
Expand Down
Loading

0 comments on commit 6124210

Please sign in to comment.