Skip to content
This repository has been archived by the owner on Sep 1, 2022. It is now read-only.

Commit

Permalink
- Tak codec support. Closes #9
Browse files Browse the repository at this point in the history
- Minor code refactor
- Minor GUI fixes
- Rewrote FFMPEG class
  • Loading branch information
john32b committed Oct 22, 2018
1 parent dd60732 commit 90eb2a8
Show file tree
Hide file tree
Showing 25 changed files with 958 additions and 494 deletions.
10 changes: 7 additions & 3 deletions CHANGELOG.MD
Original file line number Diff line number Diff line change
@@ -1,11 +1,15 @@

## CHANGELOG

### V1.4.3
- Added support for TAK Lossless audio codec. (*https://wiki.hydrogenaud.io/index.php?title=TAK*)

### V1.4.2
- Program will check for `ffmpeg` in the `tools` folder. Now the full release package will run out of the box.
- Removed ffmpeg clear button from settings. It didn't provide any meaningful functionality
- Program will check for `ffmpeg` in the `tools` folder. Now the full release package will run out of the box.
- Removed ffmpeg clear button from settings. It didn't provide any meaningful functionality

### V1.4.1
- Fixed Crash when loading a CD with any track having a pregap
- Fixed Crash when loading a CD with any track having a pregap

### V1.4
- New CD Parser class
Expand Down
12 changes: 7 additions & 5 deletions README.MD
Original file line number Diff line number Diff line change
@@ -1,11 +1,12 @@


# CDCRUSH dot NET

**Name**: cdcrush, *Highy compress cd-image games*\
**Author:** John Dimi, <johndimi@outlook.com> *twitter*: [@jondmt](https://twitter.com/jondmt)\
**Project Page and Sources:** [https://github.com/johndimi/cdcrush.net](https://github.com/johndimi/cdcrush.net)\
**Language:** C# .NET 4.5, **Licence:** MIT\
**Version:** 1.3 **Platform:** Windows\
**Version:** 1.4.3 **Platform:** Windows\
**Sister Project** : [cdcrush nodejs](https://www.npmjs.com/package/cdcrush)

## Download
Expand All @@ -25,14 +26,14 @@ Available for **windows** only.
- The program separates the tracks of a CD image and compress them separately.
- For **data** tracks it will use **ecm tools** to remove Error Correction/Detection Codes (ECC/EDC) data from the sectors. *( redundant data )*
- For **audio** tracks, it will use an encoder of your choice. You can select a lossy encoder like (**opus** or **vorbis**) to produce a decent quality audio file with a much smaller filesize compared to the uncompressed PCM audio original.
- **OR** you can choose to encode audio with **FLAC** which is lossless.
- **OR** you can choose to encode audio with a **lossless audio encoder** *( FLAC, TAK)*
- Finally it compresses everything into a single `.arc` archive using the **FreeArc** archiver.

**⇒ Restoring a crushed CD :**

**cdcrush** can **restore** the crushed CD image back to it's original form, a **.bin/.cue** image that is ready to be used however you like.

**NOTE**: Archives with the audio tracks encoded with **FLAC**, will be restored to a 1:1 copy, byte for byte, of the original source CD
**NOTE**: Archives with the audio tracks encoded with **a lossless audio encoder**, will be restored to a 1:1 copy, byte for byte, of the original source CD

### Some examples of game sizes archived with 7zip and cdcrush:

Expand Down Expand Up @@ -104,7 +105,8 @@ To convert a CD, go to the **Compress a CD** screen and **tick** the`convert to
:warning: **WARNING** : Make sure the temp folder can hold up to 1.2GB of data !

**FFmpeg Path** :
Point to the location of `ffmpeg.exe` , it is needed for encoding/decoding the audio tracks. If you have `FFmpeg` set on the system/user PATH, it will be checked once you **clear** the custom path.
Point to the location of `ffmpeg.exe` , it is needed for encoding/decoding the audio tracks. If you have `FFmpeg` set on the system/user PATH, it will be checked once you **clear** the custom path.
- Note: If you download the **full package** of cdcrush. FFMPEG is included, so don't worry about it.

**Max Concurrent Tasks**:
How many tracks to process at the same time. *(For when compressing or restoring with ffmpeg and ecm tools)*
Expand All @@ -124,7 +126,7 @@ See [`CHANGELOG.MD`](CHANGELOG.MD)
**Q** : I am worried about the audio quality.\
**A** : The OGG vorbis (also new **OPUS**) codec is decent and it can produce very good results even at 96kbps. **However** if you don't want any compressed audio you can select the **FLAC** encoder, which is lossless.

**Q**: Is storing the entire CD with FLAC really lossless? I am worried about byte integrity.\
**Q**: Is storing the entire CD with FLAC/TAK really lossless? I am worried about byte integrity.\
**A**: YES, to the last byte. The filesize and checksums of the restored tracks are the same as the original ones. (data&audio). You can check for yourself by calculating the checksums of restored files vs original source. **ALSO Checksum reports** ~~are coming at a later version~~ implemented since v.1.2.4

**Q** : Why there are two versions of the program?\
Expand Down
4 changes: 3 additions & 1 deletion cdcrush/cdcrush.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -119,10 +119,12 @@
<Compile Include="forms\PanelRestore.Designer.cs">
<DependentUpon>PanelRestore.cs</DependentUpon>
</Compile>
<Compile Include="lib\app\ICliReport.cs" />
<Compile Include="lib\app\Tak.cs" />
<Compile Include="lib\app\IProcessStatus.cs" />
<Compile Include="lib\FileTools.cs" />
<Compile Include="lib\FormTools.cs" />
<Compile Include="lib\task\CTestTask.cs" />
<Compile Include="prog\AudioMaster.cs" />
<Compile Include="prog\CDCRUSH.cs" />
<Compile Include="lib\app\AbArchiver.cs" />
<Compile Include="lib\app\CliApp.cs" />
Expand Down
81 changes: 78 additions & 3 deletions cdcrush/forms/FormComponentsTest.Designer.cs

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

82 changes: 80 additions & 2 deletions cdcrush/forms/FormComponentsTest.cs
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ private void FormComponentsTest_Load(object sender, EventArgs e)
// Select files to apply operations
// -
string[] SELECTED_FILES;
private void txt_files_TextChanged(object sender, EventArgs e)
private void txt_files_Click(object sender, EventArgs e)
{
SELECTED_FILES = FormTools.fileLoadDialog("all","",true);
if(SELECTED_FILES != null)
Expand All @@ -56,7 +56,6 @@ private void txt_files_TextChanged(object sender, EventArgs e)
}
}// -----------------------------------------


// --
// Create ARC
private void btn_arc_Click(object sender, EventArgs e)
Expand Down Expand Up @@ -124,5 +123,84 @@ private void btn_unecm_Click(object sender, EventArgs e)
};
app.unecm(SELECTED_FILES[0]);
}// -----------------------------------------

private void btn_tak_Click(object sender, EventArgs e)
{
if(SELECTED_FILES==null) return;
var app = new Tak(prog.CDCRUSH.TOOLS_PATH);
app.onComplete = (s) => {
LOG.log("-- WAV to TAK Complete :: {0}", s);
};
app.encode(SELECTED_FILES[0],txt_files_2.Text);
}

private void btn_untak_Click(object sender, EventArgs e)
{
if(SELECTED_FILES==null) return;
var app = new Tak(prog.CDCRUSH.TOOLS_PATH);
app.onComplete = (s) => {
LOG.log("--TAK to WAV Complete :: {0}", s);
};
app.decode(SELECTED_FILES[0],txt_files_2.Text);
}

private void btn_tak_pcm_Click(object sender, EventArgs e)
{
if(SELECTED_FILES==null) return;

var ffmp = new FFmpeg(prog.CDCRUSH.FFMPEG_PATH);
var tak = new Tak(prog.CDCRUSH.TOOLS_PATH);

tak.onComplete = (s) => {
LOG.log($"TAK Operation Complete - {s}");
};

ffmp.onComplete = (s) => {
LOG.log($"FFMPEG Operation Complete - {s}");
};

string INPUT = SELECTED_FILES[0];
string OUTPUT = Path.ChangeExtension(INPUT,".tak");

// This will make FFMPEG read the PCM file, convert it to WAV on the fly
// and feed it to TAK, which will convert and save it.

ffmp.convertPCMStreamToWavStream( (ffmpegIn,ffmpegOut) => {
var sourceFile = File.OpenRead(INPUT);
tak.encodeFromStream(OUTPUT, (takIn) => {
ffmpegOut.CopyTo(takIn);
takIn.Close();
});
sourceFile.CopyTo(ffmpegIn); // Feed PCM to FFMPEG
ffmpegIn.Close();
});
}// --

private void btn_untak_pcm_Click(object sender, EventArgs e)
{
if(SELECTED_FILES==null) return;

string INPUT = SELECTED_FILES[0];
string OUTPUT = Path.ChangeExtension(INPUT,".pcm");
var ffmp = new FFmpeg(prog.CDCRUSH.FFMPEG_PATH);
var tak = new Tak(prog.CDCRUSH.TOOLS_PATH);

tak.onComplete = (s) => {
LOG.log($"TAK Operation Complete - {s}");
};

ffmp.onComplete = (s) => {
LOG.log($"FFMPEG Operation Complete - {s}");
};

tak.decodeToStream(INPUT,(_out) => {
ffmp.convertWavStreamToPCM(OUTPUT,(_in)=>{
_out.CopyTo(_in);
_in.Close();
});
});

}// --

}// --
}// --
5 changes: 3 additions & 2 deletions cdcrush/forms/FormMain.cs
Original file line number Diff line number Diff line change
Expand Up @@ -242,8 +242,9 @@ public void form_setText(string msg="", int type=0)


/// <summary>
/// Updates progress bar
/// Can be called from threads
/// Updates progress bar (Can be called from threads safely)
/// -1 = Use a Marquee
/// 0 - 100 = Set a progress percent
/// </summary>
/// <param name="per">Progress Percent</param>
public void form_setProgress(int per)
Expand Down
Loading

0 comments on commit 90eb2a8

Please sign in to comment.