mirror of
https://github.com/blueskythlikesclouds/SonicAudioTools.git
synced 2024-11-23 22:50:58 +01:00
Fix delay time playback
This commit is contained in:
parent
6f0437eaf7
commit
218f1b8f37
@ -1,3 +1,9 @@
|
||||
Dependency Copyright Notices:
|
||||
|
||||
======
|
||||
NAudio
|
||||
======
|
||||
|
||||
Microsoft Public License (Ms-PL)
|
||||
|
||||
This license governs use of the accompanying software. If you use the software, you accept this license. If you do not accept the license, do not use the software.
|
||||
@ -28,4 +34,29 @@ A "contributor" is any person that distributes its contribution under this licen
|
||||
|
||||
(D) If you distribute any portion of the software in source code form, you may do so only under this license by including a complete copy of this license with your distribution. If you distribute any portion of the software in compiled or object code form, you may only do so under a license that complies with this license.
|
||||
|
||||
(E) The software is licensed "as-is." You bear the risk of using it. The contributors give no express warranties, guarantees or conditions. You may have additional consumer rights under your local laws which this license cannot change. To the extent permitted under your local laws, the contributors exclude the implied warranties of merchantability, fitness for a particular purpose and non-infringement.
|
||||
(E) The software is licensed "as-is." You bear the risk of using it. The contributors give no express warranties, guarantees or conditions. You may have additional consumer rights under your local laws which this license cannot change. To the extent permitted under your local laws, the contributors exclude the implied warranties of merchantability, fitness for a particular purpose and non-infringement.
|
||||
|
||||
=========
|
||||
vgmstream
|
||||
=========
|
||||
|
||||
Copyright (c) 2008-2010 Adam Gashlin, Fastelbja, Ronny Elfert
|
||||
|
||||
Portions Copyright (c) 2004-2008, Marko Kreen
|
||||
Portions Copyright 2001-2007 jagarl / Kazunori Ueno <jagarl@creator.club.ne.jp>
|
||||
Portions Copyright (c) 1998, Justin Frankel/Nullsoft Inc.
|
||||
Portions Copyright (C) 2006 Nullsoft, Inc.
|
||||
Portions Copyright (c) 2005-2007 Paul Hsieh
|
||||
Portions Public Domain originating with Sun Microsystems
|
||||
|
||||
Permission to use, copy, modify, and distribute this software for any
|
||||
purpose with or without fee is hereby granted, provided that the above
|
||||
copyright notice and this permission notice appear in all copies.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
|
||||
WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
|
||||
MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
|
||||
ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
|
||||
WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
|
||||
ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
|
||||
OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
|
@ -1,20 +0,0 @@
|
||||
Copyright (c) 2008-2010 Adam Gashlin, Fastelbja, Ronny Elfert
|
||||
|
||||
Portions Copyright (c) 2004-2008, Marko Kreen
|
||||
Portions Copyright 2001-2007 jagarl / Kazunori Ueno <jagarl@creator.club.ne.jp>
|
||||
Portions Copyright (c) 1998, Justin Frankel/Nullsoft Inc.
|
||||
Portions Copyright (C) 2006 Nullsoft, Inc.
|
||||
Portions Copyright (c) 2005-2007 Paul Hsieh
|
||||
Portions Public Domain originating with Sun Microsystems
|
||||
|
||||
Permission to use, copy, modify, and distribute this software for any
|
||||
purpose with or without fee is hereby granted, provided that the above
|
||||
copyright notice and this permission notice appear in all copies.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
|
||||
WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
|
||||
MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
|
||||
ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
|
||||
WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
|
||||
ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
|
||||
OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
|
29
README.md
29
README.md
@ -1,24 +1,29 @@
|
||||
# Sonic Audio Tools
|
||||
Sonic Audio Tools is a set of tools for editing the audio formats seen in Sonic the Hedgehog games. Currently, it's mostly focused on CRIWARE's audio formats, this means that these tools can be used to edit files from any game, as long as they are CSB, CPK, ACB or AWB.
|
||||
Tools for editing CriMw / CriWare file formats. (CSB / CPK / ACB / AWB)
|
||||
## Releases
|
||||
[Here.](https://ci.appveyor.com/project/blueskythlikesclouds/sonicaudiotools/build/artifacts)
|
||||
[On the AppVeyor page.](https://ci.appveyor.com/project/blueskythlikesclouds/sonicaudiotools/build/artifacts)
|
||||
AppVeyor builds every commit automatically, so you can get the executables from the link above.
|
||||
Stable builds are planned to be published [here.](https://github.com/blueskythlikesclouds/SonicAudioTools/releases)
|
||||
|
||||
## Building
|
||||
If you still wish to build the solution yourself, this is what you should do:
|
||||
1. Clone from [GitHub](https://github.com/blueskythlikesclouds/SonicAudioTools.git) `git clone https://github.com/blueskythlikesclouds/SonicAudioTools.git`
|
||||
2. Open the solution in Visual Studio. (Visual Studio 2017 or later is required.)
|
||||
3. Install the missing NuGet packages.
|
||||
4. Build the solution.
|
||||
|
||||
## Projects
|
||||
For more information about the projects, visit the [wiki](https://github.com/blueskythlikesclouds/SonicAudioTools/wiki) page.
|
||||
### [SonicAudioLib](https://github.com/blueskythlikesclouds/SonicAudioTools/tree/master/Source/SonicAudioLib)
|
||||
Core class library of the solution. Handles the IO work of the other projects.
|
||||
### [AcbEditor](https://github.com/blueskythlikesclouds/SonicAudioTools/tree/master/Source/AcbEditor)
|
||||
A tool to replace audio data in ACB files. Handles both ACBs and AWBs. Old ACB versions which had CPKs for storage are also supported.
|
||||
### [CsbBuilder](https://github.com/blueskythlikesclouds/SonicAudioTools/tree/master/Source/CsbBuilder)
|
||||
A fully functional CSB creator. It's currently able to load any CSB file as long as they contain ADX files. It also always builds in the latest CSB version, which appeared probably around 2010.
|
||||
### [CsbEditor](https://github.com/blueskythlikesclouds/SonicAudioTools/tree/master/Source/CsbEditor)
|
||||
A tool to replace audio data in CSB files. Handles both CSBs and CPKs.
|
||||
To see more information about projects, visit the [wiki](https://github.com/blueskythlikesclouds/SonicAudioTools/wiki).
|
||||
### [Sonic Audio Library](https://github.com/blueskythlikesclouds/SonicAudioTools/tree/master/Source/SonicAudioLib)
|
||||
Main class library of the solution. Contains classes for IO and file formats.
|
||||
### [ACB Editor](https://github.com/blueskythlikesclouds/SonicAudioTools/tree/master/Source/AcbEditor)
|
||||
Audio data replacer for ACB / AWB files. Supports really old ACB files as well, which stored CPK files instead of currently used AWB files. Usage is explained in the program.
|
||||
NOTE: It doesn't extract cue names so every audio will have its id on extracted file name.
|
||||
### [CSB Builder](https://github.com/blueskythlikesclouds/SonicAudioTools/tree/master/Source/CsbBuilder)
|
||||
CSB file importer/builder. Allows you to fully edit CSB files, preview your changes, add/remove cues, etc.
|
||||
### [CSB Editor](https://github.com/blueskythlikesclouds/SonicAudioTools/tree/master/Source/CsbEditor)
|
||||
Audio data replacer for CSB / CPK files. It works like ACB Editor and is a lot simpler than CSB Builder.
|
||||
|
||||
## License
|
||||
See [LICENSE.txt](https://github.com/blueskythlikesclouds/SonicAudioTools/blob/master/LICENSE.txt)
|
||||
Sonic Audio Tools uses the MIT license, meaning you're able to use and modify the code freely, as long as you include the copyright notice.
|
||||
For more details, see [LICENSE](https://github.com/blueskythlikesclouds/SonicAudioTools/blob/master/LICENSE)
|
||||
|
@ -9,7 +9,7 @@
|
||||
<AppDesignerFolder>Properties</AppDesignerFolder>
|
||||
<RootNamespace>AcbEditor</RootNamespace>
|
||||
<AssemblyName>AcbEditor</AssemblyName>
|
||||
<TargetFrameworkVersion>v4.6.1</TargetFrameworkVersion>
|
||||
<TargetFrameworkVersion>v4.5.2</TargetFrameworkVersion>
|
||||
<FileAlignment>512</FileAlignment>
|
||||
<AutoGenerateBindingRedirects>true</AutoGenerateBindingRedirects>
|
||||
<TargetFrameworkProfile />
|
||||
|
@ -6,7 +6,7 @@
|
||||
</sectionGroup>
|
||||
</configSections>
|
||||
<startup>
|
||||
<supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.6.1"/>
|
||||
<supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.5.2"/>
|
||||
</startup>
|
||||
<userSettings>
|
||||
<AcbEditor.Properties.Settings>
|
||||
|
@ -1,6 +1,6 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<configuration>
|
||||
<startup>
|
||||
<supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.6.1"/>
|
||||
<supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.5.2"/>
|
||||
</startup>
|
||||
</configuration>
|
||||
|
@ -15,15 +15,13 @@ namespace CsbBuilder.Audio
|
||||
|
||||
private double volume = 1;
|
||||
private double pitch = 0;
|
||||
private long delayTime = 0;
|
||||
private DateTime startTime;
|
||||
private long delayBytes = 0;
|
||||
|
||||
public override WaveFormat WaveFormat
|
||||
{
|
||||
get
|
||||
{
|
||||
WaveFormat waveFormat = streams[currentStreamIndex].WaveFormat;
|
||||
|
||||
return new WaveFormat(waveFormat.SampleRate + (int)(waveFormat.SampleRate * pitch), waveFormat.Channels);
|
||||
}
|
||||
}
|
||||
@ -77,12 +75,16 @@ namespace CsbBuilder.Audio
|
||||
}
|
||||
}
|
||||
|
||||
public int DelayTime
|
||||
public long DelayTime
|
||||
{
|
||||
set
|
||||
{
|
||||
startTime = DateTime.Now;
|
||||
delayTime = value * 10000;
|
||||
delayBytes = (long)((value / 1000.0) * WaveFormat.AverageBytesPerSecond);
|
||||
|
||||
if ((delayBytes % 2) != 0)
|
||||
{
|
||||
delayBytes++;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -90,14 +92,20 @@ namespace CsbBuilder.Audio
|
||||
|
||||
public override int Read(byte[] buffer, int offset, int count)
|
||||
{
|
||||
if (delayTime > 0)
|
||||
if (delayBytes > 0)
|
||||
{
|
||||
if ((DateTime.Now - startTime).Ticks < delayTime)
|
||||
if (delayBytes - count < 0)
|
||||
{
|
||||
return count;
|
||||
offset += (int)delayBytes;
|
||||
count -= (int)delayBytes;
|
||||
delayBytes = 0;
|
||||
}
|
||||
|
||||
delayTime = 0;
|
||||
else
|
||||
{
|
||||
delayBytes -= count;
|
||||
return count;
|
||||
}
|
||||
}
|
||||
|
||||
int num = streams[currentStreamIndex].Read(buffer, 0, count);
|
||||
|
@ -9,7 +9,7 @@
|
||||
<AppDesignerFolder>Properties</AppDesignerFolder>
|
||||
<RootNamespace>CsbBuilder</RootNamespace>
|
||||
<AssemblyName>CsbBuilder</AssemblyName>
|
||||
<TargetFrameworkVersion>v4.6.1</TargetFrameworkVersion>
|
||||
<TargetFrameworkVersion>v4.5.2</TargetFrameworkVersion>
|
||||
<FileAlignment>512</FileAlignment>
|
||||
<AutoGenerateBindingRedirects>true</AutoGenerateBindingRedirects>
|
||||
<TargetFrameworkProfile />
|
||||
@ -228,7 +228,6 @@
|
||||
<None Include="Resources\Template_16x.png" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Content Include="NAudio.LICENSE.txt" />
|
||||
<None Include="Resources\Redo_grey_16x.png" />
|
||||
<None Include="Resources\Undo_grey_16x.png" />
|
||||
<None Include="Resources\Settings_16x.png" />
|
||||
@ -236,7 +235,7 @@
|
||||
<ItemGroup />
|
||||
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
|
||||
<PropertyGroup>
|
||||
<PostBuildEvent>copy "$(SolutionDir)Libraries\*.dll" "$(TargetDir)"</PostBuildEvent>
|
||||
<PostBuildEvent>copy "$(SolutionDir)Dependencies\*.dll" "$(TargetDir)"</PostBuildEvent>
|
||||
</PropertyGroup>
|
||||
<!-- To modify your build process, add your task inside one of the targets below and uncomment it.
|
||||
Other similar extension points exist, see Microsoft.Common.targets.
|
||||
|
@ -6,7 +6,7 @@
|
||||
</sectionGroup>
|
||||
</configSections>
|
||||
<startup>
|
||||
<supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.6.1"/>
|
||||
<supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.5.2"/>
|
||||
</startup>
|
||||
<userSettings>
|
||||
<CsbEditor.Properties.Settings>
|
||||
|
@ -9,7 +9,7 @@
|
||||
<AppDesignerFolder>Properties</AppDesignerFolder>
|
||||
<RootNamespace>CsbEditor</RootNamespace>
|
||||
<AssemblyName>CsbEditor</AssemblyName>
|
||||
<TargetFrameworkVersion>v4.6.1</TargetFrameworkVersion>
|
||||
<TargetFrameworkVersion>v4.5.2</TargetFrameworkVersion>
|
||||
<FileAlignment>512</FileAlignment>
|
||||
<AutoGenerateBindingRedirects>true</AutoGenerateBindingRedirects>
|
||||
<TargetFrameworkProfile />
|
||||
|
@ -1,6 +1,6 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<configuration>
|
||||
<startup>
|
||||
<supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.6.1"/>
|
||||
<supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.5.2"/>
|
||||
</startup>
|
||||
</configuration>
|
||||
|
@ -9,7 +9,7 @@
|
||||
<AppDesignerFolder>Properties</AppDesignerFolder>
|
||||
<RootNamespace>SonicAudioCmd</RootNamespace>
|
||||
<AssemblyName>SonicAudioCmd</AssemblyName>
|
||||
<TargetFrameworkVersion>v4.6.1</TargetFrameworkVersion>
|
||||
<TargetFrameworkVersion>v4.5.2</TargetFrameworkVersion>
|
||||
<FileAlignment>512</FileAlignment>
|
||||
<AutoGenerateBindingRedirects>true</AutoGenerateBindingRedirects>
|
||||
<TargetFrameworkProfile />
|
||||
|
@ -9,7 +9,7 @@
|
||||
<AppDesignerFolder>Properties</AppDesignerFolder>
|
||||
<RootNamespace>SonicAudioLib</RootNamespace>
|
||||
<AssemblyName>SonicAudioLib</AssemblyName>
|
||||
<TargetFrameworkVersion>v4.6.1</TargetFrameworkVersion>
|
||||
<TargetFrameworkVersion>v4.5.2</TargetFrameworkVersion>
|
||||
<FileAlignment>512</FileAlignment>
|
||||
<TargetFrameworkProfile />
|
||||
</PropertyGroup>
|
||||
|
Loading…
Reference in New Issue
Block a user