-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
8 changed files
with
460 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
.vs/ | ||
bin/ | ||
obj/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1,6 @@ | ||
# wwise_pd3 | ||
Open source tool to encode/decode PCM WAV files to WEM and vice versa. Intended for use in PAYDAY 3 | ||
|
||
Usage: `wwise_pd3 -decode/-encode <input> <output>` | ||
|
||
**Currently does not support localised voice lines** |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
|
||
Microsoft Visual Studio Solution File, Format Version 12.00 | ||
# Visual Studio Version 17 | ||
VisualStudioVersion = 17.7.34024.191 | ||
MinimumVisualStudioVersion = 10.0.40219.1 | ||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "wwise_pd3", "wwise_pd3\wwise_pd3.csproj", "{1BB43D41-ACCB-45AC-B962-A49507DEE616}" | ||
EndProject | ||
Global | ||
GlobalSection(SolutionConfigurationPlatforms) = preSolution | ||
Debug|Any CPU = Debug|Any CPU | ||
Release|Any CPU = Release|Any CPU | ||
EndGlobalSection | ||
GlobalSection(ProjectConfigurationPlatforms) = postSolution | ||
{1BB43D41-ACCB-45AC-B962-A49507DEE616}.Debug|Any CPU.ActiveCfg = Debug|Any CPU | ||
{1BB43D41-ACCB-45AC-B962-A49507DEE616}.Debug|Any CPU.Build.0 = Debug|Any CPU | ||
{1BB43D41-ACCB-45AC-B962-A49507DEE616}.Release|Any CPU.ActiveCfg = Release|Any CPU | ||
{1BB43D41-ACCB-45AC-B962-A49507DEE616}.Release|Any CPU.Build.0 = Release|Any CPU | ||
EndGlobalSection | ||
GlobalSection(SolutionProperties) = preSolution | ||
HideSolutionNode = FALSE | ||
EndGlobalSection | ||
GlobalSection(ExtensibilityGlobals) = postSolution | ||
SolutionGuid = {BE90FE6C-DA03-4882-BB98-AE7F813D52B5} | ||
EndGlobalSection | ||
EndGlobal |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
<?xml version="1.0" encoding="utf-8"?> | ||
<configuration> | ||
<startup> | ||
<supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.8"/> | ||
</startup> | ||
</configuration> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,182 @@ | ||
using System; | ||
using System.Collections.Generic; | ||
using System.IO; | ||
using System.Linq; | ||
using System.Runtime.InteropServices; | ||
using System.Text; | ||
using System.Threading.Tasks; | ||
|
||
namespace wwise_pd3 | ||
{ | ||
public class Program | ||
{ | ||
public static void PrintHelp() | ||
{ | ||
Console.WriteLine("Usage: wwise_pd3 -decode/-encode <input> <output>"); | ||
} | ||
|
||
static void EncodeToWem(string[] args) | ||
{ | ||
var input = args[1]; | ||
var output = args[2]; | ||
|
||
BinaryReader br = new BinaryReader(File.OpenRead(input)); | ||
|
||
var header = WAVE.ReadHeaderFromWAV(br); | ||
|
||
if (header.type != 1) | ||
{ | ||
Console.WriteLine(String.Format("PAYDAY 3 only supports PCM, not type {0}", header.type)); | ||
} | ||
|
||
Console.WriteLine(String.Format("Format Length: {0}", header.lengthofformatdata)); | ||
|
||
Console.WriteLine(String.Format("Type: {0}", header.type == 1 ? "PCM" : "OTHER")); | ||
|
||
Console.WriteLine(String.Format("Channels: {0}", header.channels)); | ||
|
||
Console.WriteLine(String.Format("Sample Rate: {0}", header.samplerate)); | ||
|
||
Console.WriteLine(String.Format("Avg. Bytes per second: {0}", header.averagebytespersecond)); | ||
|
||
Console.WriteLine(String.Format("Block Align: {0}", header.blockalign)); | ||
|
||
Console.WriteLine(String.Format("Bits per Sample: {0}", header.bitspersample)); | ||
|
||
//br.Read(data, (int)br.BaseStream.Position, (int)(br.BaseStream.Length - br.BaseStream.Position)); | ||
byte[] data = br.ReadBytes((int)(File.ReadAllBytes(input).LongLength - br.BaseStream.Position)); | ||
Console.WriteLine(File.ReadAllBytes(input).LongLength); | ||
Console.WriteLine(br.BaseStream.Length); | ||
|
||
Console.WriteLine(data.Length); | ||
|
||
br.Close(); | ||
|
||
BinaryWriter bw = new BinaryWriter(File.OpenWrite(output)); | ||
|
||
WAVE.WriteWAVHeader(bw, header, wem: true); | ||
|
||
bw.Write(data); | ||
|
||
// write file size | ||
|
||
var size = bw.BaseStream.Length; | ||
|
||
Console.WriteLine($"{size} bytes written"); | ||
|
||
bw.BaseStream.Position = 0; | ||
|
||
bw.Write((byte)0x52); | ||
bw.Write((byte)0x49); | ||
bw.Write((byte)0x46); | ||
bw.Write((byte)0x46); | ||
|
||
bw.Write(size); | ||
|
||
bw.BaseStream.Position -= 4; | ||
|
||
bw.Write((byte)0x57); | ||
bw.Write((byte)0x41); | ||
bw.Write((byte)0x56); | ||
bw.Write((byte)0x45); | ||
|
||
bw.Close(); | ||
} | ||
|
||
static void DecodeFromWEM(string[] args) | ||
{ | ||
var input = args[1]; | ||
var output = args[2]; | ||
|
||
BinaryReader br = new BinaryReader(File.OpenRead(input)); | ||
|
||
var header = WAVE.ReadWEMHeaderToWAVHeader(br); | ||
|
||
Console.WriteLine(String.Format("Format Length: {0}", header.lengthofformatdata)); | ||
|
||
Console.WriteLine(String.Format("Type: {0}", header.type == 1 ? "PCM" : "OTHER")); | ||
|
||
Console.WriteLine(String.Format("Channels: {0}", header.channels)); | ||
|
||
Console.WriteLine(String.Format("Sample Rate: {0}", header.samplerate)); | ||
|
||
Console.WriteLine(String.Format("Avg. Bytes per second: {0}", header.averagebytespersecond)); | ||
|
||
Console.WriteLine(String.Format("Block Align: {0}", header.blockalign)); | ||
|
||
Console.WriteLine(String.Format("Bits per Sample: {0}", header.bitspersample)); | ||
|
||
byte[] data = br.ReadBytes((int)(File.ReadAllBytes(input).LongLength - br.BaseStream.Position)); | ||
Console.WriteLine(File.ReadAllBytes(input).LongLength); | ||
Console.WriteLine(br.BaseStream.Length); | ||
|
||
Console.WriteLine(data.Length); | ||
|
||
br.Close(); | ||
|
||
BinaryWriter bw = new BinaryWriter(File.OpenWrite(output)); | ||
|
||
WAVE.WriteWAVHeader(bw, header, wem: false); | ||
|
||
bw.Write(data); | ||
|
||
// write file size | ||
|
||
var size = bw.BaseStream.Length; | ||
|
||
Console.WriteLine($"{size} bytes written"); | ||
|
||
bw.BaseStream.Position = 0; | ||
|
||
bw.Write((byte)0x52); | ||
bw.Write((byte)0x49); | ||
bw.Write((byte)0x46); | ||
bw.Write((byte)0x46); | ||
|
||
bw.Write(size); | ||
|
||
bw.BaseStream.Position -= 4; | ||
|
||
bw.Write((byte)0x57); | ||
bw.Write((byte)0x41); | ||
bw.Write((byte)0x56); | ||
bw.Write((byte)0x45); | ||
|
||
bw.Close(); | ||
} | ||
|
||
public static void Main(string[] args) | ||
{ | ||
if (args.Length == 0) | ||
{ | ||
Console.WriteLine("Incorrect arguments!"); | ||
PrintHelp(); | ||
return; | ||
} | ||
|
||
bool encoding = false; | ||
|
||
switch(args[0]) | ||
{ | ||
case "-encode": | ||
encoding = true; | ||
break; | ||
case "-decode": | ||
encoding = false; | ||
break; | ||
default: | ||
Console.WriteLine("Please provide a method (encoding or decoding)"); ; | ||
return; | ||
} | ||
|
||
if (encoding) | ||
{ | ||
EncodeToWem(args); | ||
} else | ||
{ | ||
DecodeFromWEM(args); | ||
//Console.WriteLine("Decoding is not supported"); | ||
} | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
using System.Reflection; | ||
using System.Runtime.CompilerServices; | ||
using System.Runtime.InteropServices; | ||
|
||
// General Information about an assembly is controlled through the following | ||
// set of attributes. Change these attribute values to modify the information | ||
// associated with an assembly. | ||
[assembly: AssemblyTitle("wwise_pd3")] | ||
[assembly: AssemblyDescription("")] | ||
[assembly: AssemblyConfiguration("")] | ||
[assembly: AssemblyCompany("")] | ||
[assembly: AssemblyProduct("wwise_pd3")] | ||
[assembly: AssemblyCopyright("Copyright © 2023")] | ||
[assembly: AssemblyTrademark("")] | ||
[assembly: AssemblyCulture("")] | ||
|
||
// Setting ComVisible to false makes the types in this assembly not visible | ||
// to COM components. If you need to access a type in this assembly from | ||
// COM, set the ComVisible attribute to true on that type. | ||
[assembly: ComVisible(false)] | ||
|
||
// The following GUID is for the ID of the typelib if this project is exposed to COM | ||
[assembly: Guid("1bb43d41-accb-45ac-b962-a49507dee616")] | ||
|
||
// Version information for an assembly consists of the following four values: | ||
// | ||
// Major Version | ||
// Minor Version | ||
// Build Number | ||
// Revision | ||
// | ||
// You can specify all the values or you can default the Build and Revision Numbers | ||
// by using the '*' as shown below: | ||
// [assembly: AssemblyVersion("1.0.*")] | ||
[assembly: AssemblyVersion("1.0.0.0")] | ||
[assembly: AssemblyFileVersion("1.0.0.0")] |
Oops, something went wrong.