All audio formats can now be read from a .rar archive.

Cleaned up .APE library of outdated code.
This commit is contained in:
chudov
2008-11-10 16:12:16 +00:00
parent d4e68c5261
commit 58d3af09c7
18 changed files with 306 additions and 1026 deletions

View File

@@ -5,6 +5,7 @@ using namespace System::Text;
using namespace System::Collections::Generic; using namespace System::Collections::Generic;
using namespace System::Collections::Specialized; using namespace System::Collections::Specialized;
using namespace System::Runtime::InteropServices; using namespace System::Runtime::InteropServices;
using namespace System::IO;
using namespace APETagsDotNet; using namespace APETagsDotNet;
#ifndef _WAVEFORMATEX_ #ifndef _WAVEFORMATEX_
@@ -35,13 +36,75 @@ typedef struct tWAVEFORMATEX
#include "All.h" #include "All.h"
#include "MACLib.h" #include "MACLib.h"
#include "IO.h"
namespace APEDotNet { namespace APEDotNet {
class CWinFileIO : public CIO
{
public:
// construction / destruction
CWinFileIO(GCHandle gchIO, GCHandle gchBuffer)
{
_gchIO = gchIO;
_gchBuffer = gchBuffer;
}
~CWinFileIO()
{
}
// open / close
int Open(const wchar_t * pName)
{
throw gcnew Exception("CIO::Open Unsupported.");
}
int Close()
{
throw gcnew Exception("CIO::Close Unsupported.");
}
// read / write
int Read(void * pBuffer, unsigned int nBytesToRead, unsigned int * pBytesRead);
int Write(const void * pBuffer, unsigned int nBytesToWrite, unsigned int * pBytesWritten);
// seek
int Seek(int nDistance, unsigned int nMoveMode);
// other functions
int SetEOF()
{
throw gcnew Exception("CIO::SetEOF unsupported.");
}
// creation / destruction
int Create(const wchar_t * pName)
{
throw gcnew Exception("CIO::Create unsupported.");
}
int Delete()
{
throw gcnew Exception("CIO::Delete unsupported.");
}
// attributes
int GetPosition();
int GetSize();
int GetName(wchar_t * pBuffer)
{
throw gcnew Exception("CIO::GetName unsupported.");
}
private:
GCHandle _gchIO;
GCHandle _gchBuffer;
};
public ref class APEReader { public ref class APEReader {
public: public:
APEReader(String^ path) { APEReader(String^ path, Stream^ IO) {
IntPtr pathChars;
pAPEDecompress = NULL; pAPEDecompress = NULL;
_sampleOffset = 0; _sampleOffset = 0;
@@ -49,14 +112,13 @@ namespace APEDotNet {
pBuffer = NULL; pBuffer = NULL;
int nRetVal = 0; int nRetVal = 0;
pathChars = Marshal::StringToHGlobalUni(path); _IO = (IO != nullptr) ? IO : gcnew FileStream (path, FileMode::Open, FileAccess::Read, FileShare::Read);
size_t pathLen = wcslen ((const wchar_t*)pathChars.ToPointer())+1; _readBuffer = gcnew array<unsigned char>(0x4000);
wchar_t * pPath = new wchar_t[pathLen]; _gchIO = GCHandle::Alloc(_IO);
memcpy ((void*) pPath, (const wchar_t*)pathChars.ToPointer(), pathLen*sizeof(wchar_t)); _gchReadBuffer = GCHandle::Alloc(_readBuffer);
Marshal::FreeHGlobal(pathChars); _winFileIO = new CWinFileIO(_gchIO, _gchReadBuffer);
pAPEDecompress = CreateIAPEDecompressEx (_winFileIO, &nRetVal);
pAPEDecompress = CreateIAPEDecompress (pPath, &nRetVal);
if (!pAPEDecompress) { if (!pAPEDecompress) {
throw gcnew Exception("Unable to open file."); throw gcnew Exception("Unable to open file.");
} }
@@ -76,6 +138,12 @@ namespace APEDotNet {
~APEReader () ~APEReader ()
{ {
if (pBuffer) delete [] pBuffer; if (pBuffer) delete [] pBuffer;
if (_winFileIO)
delete _winFileIO;
if (_gchIO.IsAllocated)
_gchIO.Free();
if (_gchReadBuffer.IsAllocated)
_gchReadBuffer.Free();
} }
property Int32 BitsPerSample { property Int32 BitsPerSample {
@@ -122,6 +190,11 @@ namespace APEDotNet {
void Close() { void Close() {
if (pAPEDecompress) delete pAPEDecompress; if (pAPEDecompress) delete pAPEDecompress;
pAPEDecompress = NULL; pAPEDecompress = NULL;
if (_IO != nullptr)
{
_IO->Close ();
_IO = nullptr;
}
} }
property String^ Path { property String^ Path {
@@ -134,7 +207,7 @@ namespace APEDotNet {
NameValueCollection^ get () { NameValueCollection^ get () {
if (!_tags) if (!_tags)
{ {
APETagDotNet^ apeTag = gcnew APETagDotNet (_path, true, true); APETagDotNet^ apeTag = gcnew APETagDotNet (_IO, true);
_tags = apeTag->GetStringTags (true); _tags = apeTag->GetStringTags (true);
apeTag->Close (); apeTag->Close ();
} }
@@ -179,28 +252,10 @@ namespace APEDotNet {
int nBlockAlign; int nBlockAlign;
unsigned char * pBuffer; unsigned char * pBuffer;
String^ _path; String^ _path;
Stream^ _IO;
#if 0 array<unsigned char>^ _readBuffer;
APE__StreamDecoderWriteStatus WriteCallback(const APE__StreamDecoder *decoder, CWinFileIO* _winFileIO;
const APE__Frame *frame, const APE__int32 * const buffer[], void *client_data) GCHandle _gchIO, _gchReadBuffer;
{
if ((_sampleBuffer == nullptr) || (_sampleBuffer->GetLength(0) != sampleCount)) {
_sampleBuffer = gcnew array<Int32, 2>(sampleCount, _channelCount);
}
for (Int32 iChan = 0; iChan < _channelCount; iChan++) {
interior_ptr<Int32> pMyBuffer = &_sampleBuffer[0, iChan];
const APE__int32 *pAPEBuffer = buffer[iChan];
const APE__int32 *pAPEBufferEnd = pAPEBuffer + sampleCount;
while (pAPEBuffer < pAPEBufferEnd) {
*pMyBuffer = *pAPEBuffer;
pMyBuffer += _channelCount;
pAPEBuffer++;
}
}
}
#endif
}; };
public ref class APEWriter { public ref class APEWriter {
@@ -213,6 +268,7 @@ namespace APEDotNet {
_path = path; _path = path;
_tags = gcnew NameValueCollection(); _tags = gcnew NameValueCollection();
_winFileIO = NULL;
_compressionLevel = COMPRESSION_LEVEL_NORMAL; _compressionLevel = COMPRESSION_LEVEL_NORMAL;
@@ -228,6 +284,16 @@ namespace APEDotNet {
} }
} }
~APEWriter()
{
if (_winFileIO)
delete _winFileIO;
if (_gchIO.IsAllocated)
_gchIO.Free();
if (_gchBuffer.IsAllocated)
_gchBuffer.Free();
}
void Close() { void Close() {
if (pAPECompress) if (pAPECompress)
{ {
@@ -242,12 +308,18 @@ namespace APEDotNet {
if (_tags->Count > 0) if (_tags->Count > 0)
{ {
APETagDotNet^ apeTag = gcnew APETagDotNet (_path, true, false); APETagDotNet^ apeTag = gcnew APETagDotNet (_IO, true);
apeTag->SetStringTags (_tags, true); apeTag->SetStringTags (_tags, true);
apeTag->Save(); apeTag->Save();
apeTag->Close(); apeTag->Close();
_tags->Clear (); _tags->Clear ();
} }
if (_IO != nullptr)
{
_IO->Close ();
_IO = nullptr;
}
} }
property Int32 FinalSampleCount { property Int32 FinalSampleCount {
@@ -303,31 +375,86 @@ namespace APEDotNet {
Int32 _compressionLevel; Int32 _compressionLevel;
NameValueCollection^ _tags; NameValueCollection^ _tags;
String^ _path; String^ _path;
Stream^ _IO;
GCHandle _gchIO, _gchBuffer;
CWinFileIO* _winFileIO;
array<unsigned char>^ _writeBuffer;
void Initialize() { void Initialize() {
IntPtr pathChars; _IO = gcnew FileStream (_path, FileMode::Create, FileAccess::ReadWrite, FileShare::Read);
int res; _writeBuffer = gcnew array<unsigned char>(0x4000);
WAVEFORMATEX waveFormat;
pathChars = Marshal::StringToHGlobalUni(_path); _gchIO = GCHandle::Alloc(_IO);
_gchBuffer = GCHandle::Alloc(_writeBuffer);
_winFileIO = new CWinFileIO(_gchIO, _gchBuffer);
WAVEFORMATEX waveFormat;
FillWaveFormatEx (&waveFormat, _sampleRate, _bitsPerSample, _channelCount); FillWaveFormatEx (&waveFormat, _sampleRate, _bitsPerSample, _channelCount);
res = pAPECompress->Start ((const wchar_t*)pathChars.ToPointer(),
int res = pAPECompress->StartEx (_winFileIO,
&waveFormat, &waveFormat,
(_finalSampleCount == 0) ? MAX_AUDIO_BYTES_UNKNOWN : _finalSampleCount * _blockAlign, (_finalSampleCount == 0) ? MAX_AUDIO_BYTES_UNKNOWN : _finalSampleCount * _blockAlign,
_compressionLevel, _compressionLevel,
NULL, NULL,
CREATE_WAV_HEADER_ON_DECOMPRESSION); CREATE_WAV_HEADER_ON_DECOMPRESSION);
Marshal::FreeHGlobal(pathChars);
if (res) if (res)
{
throw gcnew Exception("Unable to create the encoder."); throw gcnew Exception("Unable to create the encoder.");
}
_initialized = true; _initialized = true;
} }
}; };
int CWinFileIO::Read(void * pBuffer, unsigned int nBytesToRead, unsigned int * pBytesRead)
{
array<unsigned char>^ buff = (array<unsigned char>^) _gchBuffer.Target;
if (buff->Length < nBytesToRead)
Array::Resize (buff, nBytesToRead);
int len = ((Stream^)_gchIO.Target)->Read (buff, 0, nBytesToRead);
if (len) Marshal::Copy (buff, 0, (IntPtr)pBuffer, len);
*pBytesRead = len;
return 0;
}
int CWinFileIO::Write(const void * pBuffer, unsigned int nBytesToWrite, unsigned int * pBytesWritten)
{
array<unsigned char>^ buff = (array<unsigned char>^) _gchBuffer.Target;
if (buff->Length < nBytesToWrite)
Array::Resize (buff, nBytesToWrite);
Marshal::Copy ((IntPtr)(void*)pBuffer, buff, 0, nBytesToWrite);
((Stream^)_gchIO.Target)->Write (buff, 0, nBytesToWrite);
*pBytesWritten = nBytesToWrite;
return 0;
}
int CWinFileIO::GetPosition()
{
return ((Stream^)_gchIO.Target)->Position;
}
int CWinFileIO::GetSize()
{
return ((Stream^)_gchIO.Target)->Length;
}
int CWinFileIO::Seek(int delta, unsigned int mode)
{
switch (mode)
{
case FILE_BEGIN:
((Stream^)_gchIO.Target)->Seek (delta, System::IO::SeekOrigin::Begin);
break;
case FILE_END:
((Stream^)_gchIO.Target)->Seek (delta, System::IO::SeekOrigin::End);
break;
case FILE_CURRENT:
((Stream^)_gchIO.Target)->Seek (delta, System::IO::SeekOrigin::Current);
break;
default:
return -1;
}
return 0;
}
#if 0 #if 0
extern "C" extern "C"
{ {

View File

@@ -10,40 +10,24 @@ using System.Collections.Specialized;
namespace CUEToolsLib { namespace CUEToolsLib {
public static class AudioReadWrite { public static class AudioReadWrite {
public static IAudioSource GetAudioSource(string path) {
switch (Path.GetExtension(path).ToLower()) {
case ".wav":
return new WAVReader(path, null);
#if !MONO
case ".flac":
return new FLACReader(path, null);
case ".wv":
return new WavPackReader(path, null, null);
case ".ape":
return new APEReader(path);
case ".m4a":
return new ALACReader(path, null);
#endif
default:
throw new Exception("Unsupported audio type.");
}
}
public static IAudioSource GetAudioSource(string path, Stream IO) public static IAudioSource GetAudioSource(string path, Stream IO)
{ {
switch (Path.GetExtension(path).ToLower()) switch (Path.GetExtension(path).ToLower())
{ {
case ".wav": case ".wav":
return new WAVReader(path, IO); return new WAVReader(path, IO);
case ".m4a":
return new ALACReader(path, IO);
#if !MONO #if !MONO
case ".flac": case ".flac":
return new FLACReader(path, IO); return new FLACReader(path, IO);
case ".wv": case ".wv":
return new WavPackReader(path, IO, null); return new WavPackReader(path, IO, null);
case ".m4a": case ".ape":
return new ALACReader(path, IO); return new APEReader(path, IO);
#endif #endif
default: default:
throw new Exception("Unsupported audio type in archive."); throw new Exception("Unsupported audio type.");
} }
} }
@@ -242,8 +226,8 @@ namespace CUEToolsLib {
int[,] _sampleBuffer; int[,] _sampleBuffer;
uint _bufferOffset, _bufferLength; uint _bufferOffset, _bufferLength;
public APEReader(string path) { public APEReader(string path, Stream IO) {
_apeReader = new APEDotNet.APEReader(path); _apeReader = new APEDotNet.APEReader(path, IO);
_bufferOffset = 0; _bufferOffset = 0;
_bufferLength = 0; _bufferLength = 0;
} }

View File

@@ -541,7 +541,7 @@ namespace CUEToolsLib
NameValueCollection tags; NameValueCollection tags;
string cuesheetTag = null; string cuesheetTag = null;
audioSource = AudioReadWrite.GetAudioSource(pathIn); audioSource = AudioReadWrite.GetAudioSource(pathIn,null);
tags = audioSource.Tags; tags = audioSource.Tags;
cuesheetTag = tags.Get("CUESHEET"); cuesheetTag = tags.Get("CUESHEET");
_accurateRipId = tags.Get("ACCURATERIPID"); _accurateRipId = tags.Get("ACCURATERIPID");
@@ -1017,7 +1017,7 @@ namespace CUEToolsLib
audioSource = AudioReadWrite.GetAudioSource(path, IO); audioSource = AudioReadWrite.GetAudioSource(path, IO);
} else } else
#endif #endif
audioSource = AudioReadWrite.GetAudioSource(path); audioSource = AudioReadWrite.GetAudioSource(path, null);
if ((audioSource.BitsPerSample != 16) || if ((audioSource.BitsPerSample != 16) ||
(audioSource.ChannelCount != 2) || (audioSource.ChannelCount != 2) ||
@@ -1760,7 +1760,7 @@ namespace CUEToolsLib
if (_hasEmbeddedCUESheet) if (_hasEmbeddedCUESheet)
{ {
IAudioSource audioSource = AudioReadWrite.GetAudioSource(_sourcePaths[0]); IAudioSource audioSource = AudioReadWrite.GetAudioSource(_sourcePaths[0], null);
NameValueCollection tags = audioSource.Tags; NameValueCollection tags = audioSource.Tags;
CleanupTags(tags, "ACCURATERIP"); CleanupTags(tags, "ACCURATERIP");
GenerateAccurateRipTags (tags, 0, bestOffset, -1); GenerateAccurateRipTags (tags, 0, bestOffset, -1);
@@ -1775,7 +1775,7 @@ namespace CUEToolsLib
for (int iTrack = 0; iTrack < TrackCount; iTrack++) for (int iTrack = 0; iTrack < TrackCount; iTrack++)
{ {
string src = _sourcePaths[iTrack + (_hasHTOAFilename ? 1 : 0)]; string src = _sourcePaths[iTrack + (_hasHTOAFilename ? 1 : 0)];
IAudioSource audioSource = AudioReadWrite.GetAudioSource(src); IAudioSource audioSource = AudioReadWrite.GetAudioSource(src, null);
#if !MONO #if !MONO
if (audioSource is FLACReader) if (audioSource is FLACReader)
{ {
@@ -2414,7 +2414,7 @@ namespace CUEToolsLib
} }
else else
#endif #endif
audioSource = AudioReadWrite.GetAudioSource(sourceInfo.Path); audioSource = AudioReadWrite.GetAudioSource(sourceInfo.Path, null);
} }
if (sourceInfo.Offset != 0) if (sourceInfo.Offset != 0)

View File

@@ -49,7 +49,7 @@ Global compiler settings (useful for porting)
#define ENABLE_ASSEMBLY #define ENABLE_ASSEMBLY
#endif #endif
#define BACKWARDS_COMPATIBILITY #define NO_BACKWARDS_COMPATIBILITY
#define ENABLE_COMPRESSION_MODE_FAST #define ENABLE_COMPRESSION_MODE_FAST
#define ENABLE_COMPRESSION_MODE_NORMAL #define ENABLE_COMPRESSION_MODE_NORMAL
@@ -68,8 +68,8 @@ Global compiler settings (useful for porting)
typedef wchar_t str_utf16; typedef wchar_t str_utf16;
#define IO_USE_WIN_FILE_IO #define IO_USE_WIN_FILE_IO
#define IO_HEADER_FILE "WinFileIO.h" #define NO_IO_HEADER_FILE "WinFileIO.h"
#define IO_CLASS_NAME CWinFileIO #define NO_IO_CLASS_NAME CWinFileIO
#define DLLEXPORT __declspec(dllexport) #define DLLEXPORT __declspec(dllexport)
#define SLEEP(MILLISECONDS) ::Sleep(MILLISECONDS) #define SLEEP(MILLISECONDS) ::Sleep(MILLISECONDS)
#define MESSAGEBOX(PARENT, TEXT, CAPTION, TYPE) ::MessageBox(PARENT, TEXT, CAPTION, TYPE) #define MESSAGEBOX(PARENT, TEXT, CAPTION, TYPE) ::MessageBox(PARENT, TEXT, CAPTION, TYPE)

View File

@@ -306,9 +306,11 @@ public:
// on decompression) // on decompression)
////////////////////////////////////////////////////////////////////////////////////////////// //////////////////////////////////////////////////////////////////////////////////////////////
#ifdef IO_CLASS_NAME
virtual int Start(const str_utf16 * pOutputFilename, const WAVEFORMATEX * pwfeInput, virtual int Start(const str_utf16 * pOutputFilename, const WAVEFORMATEX * pwfeInput,
int nMaxAudioBytes = MAX_AUDIO_BYTES_UNKNOWN, int nCompressionLevel = COMPRESSION_LEVEL_NORMAL, int nMaxAudioBytes = MAX_AUDIO_BYTES_UNKNOWN, int nCompressionLevel = COMPRESSION_LEVEL_NORMAL,
const void * pHeaderData = NULL, int nHeaderBytes = CREATE_WAV_HEADER_ON_DECOMPRESSION) = 0; const void * pHeaderData = NULL, int nHeaderBytes = CREATE_WAV_HEADER_ON_DECOMPRESSION) = 0;
#endif
virtual int StartEx(CIO * pioOutput, const WAVEFORMATEX * pwfeInput, virtual int StartEx(CIO * pioOutput, const WAVEFORMATEX * pwfeInput,
int nMaxAudioBytes = MAX_AUDIO_BYTES_UNKNOWN, int nCompressionLevel = COMPRESSION_LEVEL_NORMAL, int nMaxAudioBytes = MAX_AUDIO_BYTES_UNKNOWN, int nCompressionLevel = COMPRESSION_LEVEL_NORMAL,

View File

@@ -1,6 +1,8 @@
#include "All.h" #include "All.h"
#include "APECompress.h" #include "APECompress.h"
#ifdef IO_CLASS_NAME
#include IO_HEADER_FILE #include IO_HEADER_FILE
#endif
#include "APECompressCreate.h" #include "APECompressCreate.h"
#include "WAVInputSource.h" #include "WAVInputSource.h"
@@ -28,6 +30,7 @@ CAPECompress::~CAPECompress()
} }
} }
#ifdef IO_CLASS_NAME
int CAPECompress::Start(const wchar_t * pOutputFilename, const WAVEFORMATEX * pwfeInput, int nMaxAudioBytes, int nCompressionLevel, const void * pHeaderData, int nHeaderBytes) int CAPECompress::Start(const wchar_t * pOutputFilename, const WAVEFORMATEX * pwfeInput, int nMaxAudioBytes, int nCompressionLevel, const void * pHeaderData, int nHeaderBytes)
{ {
m_pioOutput = new IO_CLASS_NAME; m_pioOutput = new IO_CLASS_NAME;
@@ -48,6 +51,7 @@ int CAPECompress::Start(const wchar_t * pOutputFilename, const WAVEFORMATEX * pw
return ERROR_SUCCESS; return ERROR_SUCCESS;
} }
#endif
int CAPECompress::StartEx(CIO * pioOutput, const WAVEFORMATEX * pwfeInput, int nMaxAudioBytes, int nCompressionLevel, const void * pHeaderData, int nHeaderBytes) int CAPECompress::StartEx(CIO * pioOutput, const WAVEFORMATEX * pwfeInput, int nMaxAudioBytes, int nCompressionLevel, const void * pHeaderData, int nHeaderBytes)
{ {

View File

@@ -15,7 +15,9 @@ public:
~CAPECompress(); ~CAPECompress();
// start encoding // start encoding
#ifdef IO_CLASS_NAME
int Start(const wchar_t * pOutputFilename, const WAVEFORMATEX * pwfeInput, int nMaxAudioBytes, int nCompressionLevel = COMPRESSION_LEVEL_NORMAL, const void * pHeaderData = NULL, int nHeaderBytes = CREATE_WAV_HEADER_ON_DECOMPRESSION); int Start(const wchar_t * pOutputFilename, const WAVEFORMATEX * pwfeInput, int nMaxAudioBytes, int nCompressionLevel = COMPRESSION_LEVEL_NORMAL, const void * pHeaderData = NULL, int nHeaderBytes = CREATE_WAV_HEADER_ON_DECOMPRESSION);
#endif
int StartEx(CIO * pioOutput, const WAVEFORMATEX * pwfeInput, int nMaxAudioBytes, int nCompressionLevel = COMPRESSION_LEVEL_NORMAL, const void * pHeaderData = NULL, int nHeaderBytes = CREATE_WAV_HEADER_ON_DECOMPRESSION); int StartEx(CIO * pioOutput, const WAVEFORMATEX * pwfeInput, int nMaxAudioBytes, int nCompressionLevel = COMPRESSION_LEVEL_NORMAL, const void * pHeaderData = NULL, int nHeaderBytes = CREATE_WAV_HEADER_ON_DECOMPRESSION);
// add data / compress data // add data / compress data

View File

@@ -11,6 +11,7 @@ CAPEInfo:
/***************************************************************************************** /*****************************************************************************************
Construction Construction
*****************************************************************************************/ *****************************************************************************************/
#ifdef IO_CLASS_NAME
CAPEInfo::CAPEInfo(int * pErrorCode, const wchar_t * pFilename, CAPETag * pTag, bool fReadOnly) CAPEInfo::CAPEInfo(int * pErrorCode, const wchar_t * pFilename, CAPETag * pTag, bool fReadOnly)
{ {
*pErrorCode = ERROR_SUCCESS; *pErrorCode = ERROR_SUCCESS;
@@ -34,6 +35,7 @@ CAPEInfo::CAPEInfo(int * pErrorCode, const wchar_t * pFilename, CAPETag * pTag,
return; return;
} }
#ifndef NO_TAG
// get the tag (do this second so that we don't do it on failure) // get the tag (do this second so that we don't do it on failure)
if (pTag == NULL) if (pTag == NULL)
{ {
@@ -49,8 +51,9 @@ CAPEInfo::CAPEInfo(int * pErrorCode, const wchar_t * pFilename, CAPETag * pTag,
{ {
m_spAPETag.Assign(pTag); m_spAPETag.Assign(pTag);
} }
#endif
} }
#endif
CAPEInfo::CAPEInfo(int * pErrorCode, CIO * pIO, CAPETag * pTag) CAPEInfo::CAPEInfo(int * pErrorCode, CIO * pIO, CAPETag * pTag)
{ {
@@ -67,11 +70,13 @@ CAPEInfo::CAPEInfo(int * pErrorCode, CIO * pIO, CAPETag * pTag)
return; return;
} }
#ifndef NO_TAG
// get the tag (do this second so that we don't do it on failure) // get the tag (do this second so that we don't do it on failure)
if (pTag == NULL) if (pTag == NULL)
m_spAPETag.Assign(new CAPETag(m_spIO, TRUE)); m_spAPETag.Assign(new CAPETag(m_spIO, FALSE));
else else
m_spAPETag.Assign(pTag); m_spAPETag.Assign(pTag);
#endif
} }
@@ -94,7 +99,9 @@ int CAPEInfo::CloseFile()
m_APEFileInfo.spSeekByteTable.Delete(); m_APEFileInfo.spSeekByteTable.Delete();
m_APEFileInfo.spAPEDescriptor.Delete(); m_APEFileInfo.spAPEDescriptor.Delete();
#ifndef NO_TAG
m_spAPETag.Delete(); m_spAPETag.Delete();
#endif
// re-initialize variables // re-initialize variables
m_APEFileInfo.nSeekTableElements = 0; m_APEFileInfo.nSeekTableElements = 0;
@@ -275,6 +282,7 @@ int CAPEInfo::GetInfo(APE_DECOMPRESS_FIELDS Field, int nParam1, int nParam2)
} }
break; break;
} }
#ifndef NO_TAG
case APE_INFO_WAV_TERMINATING_DATA: case APE_INFO_WAV_TERMINATING_DATA:
{ {
char * pBuffer = (char *) nParam1; char * pBuffer = (char *) nParam1;
@@ -303,6 +311,7 @@ int CAPEInfo::GetInfo(APE_DECOMPRESS_FIELDS Field, int nParam1, int nParam2)
} }
break; break;
} }
#endif
case APE_INFO_WAVEFORMATEX: case APE_INFO_WAVEFORMATEX:
{ {
WAVEFORMATEX * pWaveFormatEx = (WAVEFORMATEX *) nParam1; WAVEFORMATEX * pWaveFormatEx = (WAVEFORMATEX *) nParam1;
@@ -313,6 +322,7 @@ int CAPEInfo::GetInfo(APE_DECOMPRESS_FIELDS Field, int nParam1, int nParam2)
case APE_INFO_IO_SOURCE: case APE_INFO_IO_SOURCE:
nRetVal = (int) m_spIO.GetPtr(); nRetVal = (int) m_spIO.GetPtr();
break; break;
#ifndef NO_TAG
case APE_INFO_FRAME_BYTES: case APE_INFO_FRAME_BYTES:
{ {
int nFrame = nParam1; int nFrame = nParam1;
@@ -331,6 +341,7 @@ int CAPEInfo::GetInfo(APE_DECOMPRESS_FIELDS Field, int nParam1, int nParam2)
} }
break; break;
} }
#endif
case APE_INFO_FRAME_BLOCKS: case APE_INFO_FRAME_BLOCKS:
{ {
int nFrame = nParam1; int nFrame = nParam1;
@@ -349,9 +360,11 @@ int CAPEInfo::GetInfo(APE_DECOMPRESS_FIELDS Field, int nParam1, int nParam2)
} }
break; break;
} }
#ifndef NO_TAG
case APE_INFO_TAG: case APE_INFO_TAG:
nRetVal = (int) m_spAPETag.GetPtr(); nRetVal = (int) m_spAPETag.GetPtr();
break; break;
#endif
case APE_INTERNAL_INFO: case APE_INTERNAL_INFO:
nRetVal = (int) &m_APEFileInfo; nRetVal = (int) &m_APEFileInfo;
break; break;

View File

@@ -22,7 +22,11 @@ WARNING:
#define APE_APEINFO_H #define APE_APEINFO_H
#include "IO.h" #include "IO.h"
#ifndef NO_TAG
#include "APETag.h" #include "APETag.h"
#else
#define CAPETag void
#endif
#include "MACLib.h" #include "MACLib.h"
/***************************************************************************************** /*****************************************************************************************
@@ -93,7 +97,9 @@ private:
// internal variables // internal variables
BOOL m_bHasFileInformationLoaded; BOOL m_bHasFileInformationLoaded;
CSmartPtr<CIO> m_spIO; CSmartPtr<CIO> m_spIO;
#ifndef NO_TAG
CSmartPtr<CAPETag> m_spAPETag; CSmartPtr<CAPETag> m_spAPETag;
#endif
APE_FILE_INFO m_APEFileInfo; APE_FILE_INFO m_APEFileInfo;
}; };

View File

@@ -382,7 +382,11 @@ int DecompressCore(const str_utf16 * pInputFilename, const str_utf16 * pOutputFi
else if (nOutputMode == UNMAC_DECODER_OUTPUT_APE) else if (nOutputMode == UNMAC_DECODER_OUTPUT_APE)
{ {
// write the WAV data and any tag // write the WAV data and any tag
#ifndef NO_TAG
int nTagBytes = GET_TAG(spAPEDecompress)->GetTagBytes(); int nTagBytes = GET_TAG(spAPEDecompress)->GetTagBytes();
#else
int nTagBytes = 0;
#endif
BOOL bHasTag = (nTagBytes > 0); BOOL bHasTag = (nTagBytes > 0);
int nTerminatingBytes = nTagBytes; int nTerminatingBytes = nTagBytes;
nTerminatingBytes += spAPEDecompress->GetInfo(APE_INFO_WAV_TERMINATING_BYTES); nTerminatingBytes += spAPEDecompress->GetInfo(APE_INFO_WAV_TERMINATING_BYTES);

View File

@@ -1,6 +1,8 @@
#include "All.h" #include "All.h"
#include "ID3Genres.h" #include "ID3Genres.h"
#ifndef NO_TAG
#include "APETag.h" #include "APETag.h"
#endif
#include "CharacterHelper.h" #include "CharacterHelper.h"
#include "IO.h" #include "IO.h"
#include IO_HEADER_FILE #include IO_HEADER_FILE

View File

@@ -42,6 +42,7 @@ IAPEDecompress * CreateIAPEDecompressCore(CAPEInfo * pAPEInfo, int nStartBlock,
return pAPEDecompress; return pAPEDecompress;
} }
#ifdef IO_CLASS_NAME
IAPEDecompress * __stdcall CreateIAPEDecompress(const str_utf16 * pFilename, int * pErrorCode) IAPEDecompress * __stdcall CreateIAPEDecompress(const str_utf16 * pFilename, int * pErrorCode)
{ {
// error check the parameters // error check the parameters
@@ -68,7 +69,11 @@ IAPEDecompress * __stdcall CreateIAPEDecompress(const str_utf16 * pFilename, int
CAPELink APELink(pFilename); CAPELink APELink(pFilename);
if (APELink.GetIsLinkFile()) if (APELink.GetIsLinkFile())
{ {
#ifndef NO_TAG
pAPEInfo = new CAPEInfo(&nErrorCode, APELink.GetImageFilename(), new CAPETag(pFilename, TRUE)); pAPEInfo = new CAPEInfo(&nErrorCode, APELink.GetImageFilename(), new CAPETag(pFilename, TRUE));
#else
pAPEInfo = new CAPEInfo(&nErrorCode, APELink.GetImageFilename(), NULL);
#endif
nStartBlock = APELink.GetStartBlock(); nFinishBlock = APELink.GetFinishBlock(); nStartBlock = APELink.GetStartBlock(); nFinishBlock = APELink.GetFinishBlock();
} }
} }
@@ -90,6 +95,7 @@ IAPEDecompress * __stdcall CreateIAPEDecompress(const str_utf16 * pFilename, int
if (pErrorCode) *pErrorCode = nErrorCode; if (pErrorCode) *pErrorCode = nErrorCode;
return pAPEDecompress; return pAPEDecompress;
} }
#endif
IAPEDecompress * __stdcall CreateIAPEDecompressEx(CIO * pIO, int * pErrorCode) IAPEDecompress * __stdcall CreateIAPEDecompressEx(CIO * pIO, int * pErrorCode)
{ {

View File

@@ -306,9 +306,11 @@ public:
// on decompression) // on decompression)
////////////////////////////////////////////////////////////////////////////////////////////// //////////////////////////////////////////////////////////////////////////////////////////////
#ifdef IO_CLASS_NAME
virtual int Start(const str_utf16 * pOutputFilename, const WAVEFORMATEX * pwfeInput, virtual int Start(const str_utf16 * pOutputFilename, const WAVEFORMATEX * pwfeInput,
int nMaxAudioBytes = MAX_AUDIO_BYTES_UNKNOWN, int nCompressionLevel = COMPRESSION_LEVEL_NORMAL, int nMaxAudioBytes = MAX_AUDIO_BYTES_UNKNOWN, int nCompressionLevel = COMPRESSION_LEVEL_NORMAL,
const void * pHeaderData = NULL, int nHeaderBytes = CREATE_WAV_HEADER_ON_DECOMPRESSION) = 0; const void * pHeaderData = NULL, int nHeaderBytes = CREATE_WAV_HEADER_ON_DECOMPRESSION) = 0;
#endif
virtual int StartEx(CIO * pioOutput, const WAVEFORMATEX * pwfeInput, virtual int StartEx(CIO * pioOutput, const WAVEFORMATEX * pwfeInput,
int nMaxAudioBytes = MAX_AUDIO_BYTES_UNKNOWN, int nCompressionLevel = COMPRESSION_LEVEL_NORMAL, int nMaxAudioBytes = MAX_AUDIO_BYTES_UNKNOWN, int nCompressionLevel = COMPRESSION_LEVEL_NORMAL,

View File

@@ -46,7 +46,7 @@
Name="VCCLCompilerTool" Name="VCCLCompilerTool"
Optimization="0" Optimization="0"
AdditionalIncludeDirectories="..\Shared" AdditionalIncludeDirectories="..\Shared"
PreprocessorDefinitions="WIN32;_DEBUG;_LIB;UNICODE" PreprocessorDefinitions="WIN32;_DEBUG;_LIB;UNICODE;NO_TAG"
BasicRuntimeChecks="3" BasicRuntimeChecks="3"
RuntimeLibrary="3" RuntimeLibrary="3"
AssemblerListingLocation=".\Debug/" AssemblerListingLocation=".\Debug/"
@@ -121,7 +121,7 @@
Name="VCCLCompilerTool" Name="VCCLCompilerTool"
Optimization="0" Optimization="0"
AdditionalIncludeDirectories="..\Shared" AdditionalIncludeDirectories="..\Shared"
PreprocessorDefinitions="WIN32;_DEBUG;_LIB;UNICODE;_CRT_SECURE_NO_WARNINGS" PreprocessorDefinitions="WIN32;_DEBUG;_LIB;UNICODE;_CRT_SECURE_NO_WARNINGS;NO_TAG"
BasicRuntimeChecks="3" BasicRuntimeChecks="3"
RuntimeLibrary="3" RuntimeLibrary="3"
WarningLevel="3" WarningLevel="3"
@@ -193,7 +193,7 @@
EnableIntrinsicFunctions="true" EnableIntrinsicFunctions="true"
FavorSizeOrSpeed="1" FavorSizeOrSpeed="1"
AdditionalIncludeDirectories="..\Shared" AdditionalIncludeDirectories="..\Shared"
PreprocessorDefinitions="WIN32;NDEBUG;_LIB;UNICODE;_CRT_SECURE_NO_WARNINGS" PreprocessorDefinitions="WIN32;NDEBUG;_LIB;UNICODE;_CRT_SECURE_NO_WARNINGS;NO_TAG"
RuntimeLibrary="2" RuntimeLibrary="2"
UsePrecompiledHeader="0" UsePrecompiledHeader="0"
PrecompiledHeaderThrough="all.h" PrecompiledHeaderThrough="all.h"
@@ -271,7 +271,7 @@
EnableIntrinsicFunctions="true" EnableIntrinsicFunctions="true"
FavorSizeOrSpeed="1" FavorSizeOrSpeed="1"
AdditionalIncludeDirectories="..\Shared" AdditionalIncludeDirectories="..\Shared"
PreprocessorDefinitions="WIN32;NDEBUG;_LIB;UNICODE;_CRT_SECURE_NO_WARNINGS" PreprocessorDefinitions="WIN32;NDEBUG;_LIB;UNICODE;_CRT_SECURE_NO_WARNINGS;NO_TAG"
RuntimeLibrary="2" RuntimeLibrary="2"
UsePrecompiledHeader="0" UsePrecompiledHeader="0"
PrecompiledHeaderThrough="all.h" PrecompiledHeaderThrough="all.h"
@@ -323,54 +323,6 @@
Name="Source Files" Name="Source Files"
Filter="cpp;c;cxx;rc;def;r;odl;idl;hpj;bat" Filter="cpp;c;cxx;rc;def;r;odl;idl;hpj;bat"
> >
<File
RelativePath="APESimple.cpp"
>
<FileConfiguration
Name="Debug|Win32"
>
<Tool
Name="VCCLCompilerTool"
Optimization="0"
AdditionalIncludeDirectories=""
PreprocessorDefinitions=""
BasicRuntimeChecks="3"
/>
</FileConfiguration>
<FileConfiguration
Name="Debug|x64"
>
<Tool
Name="VCCLCompilerTool"
Optimization="0"
AdditionalIncludeDirectories=""
PreprocessorDefinitions=""
BasicRuntimeChecks="3"
/>
</FileConfiguration>
<FileConfiguration
Name="Release|Win32"
>
<Tool
Name="VCCLCompilerTool"
Optimization="3"
AdditionalIncludeDirectories=""
PreprocessorDefinitions=""
BrowseInformation="1"
/>
</FileConfiguration>
<FileConfiguration
Name="Release|x64"
>
<Tool
Name="VCCLCompilerTool"
Optimization="3"
AdditionalIncludeDirectories=""
PreprocessorDefinitions=""
BrowseInformation="1"
/>
</FileConfiguration>
</File>
<File <File
RelativePath="MACLib.cpp" RelativePath="MACLib.cpp"
> >
@@ -762,442 +714,6 @@
/> />
</FileConfiguration> </FileConfiguration>
</File> </File>
<Filter
Name="Old"
>
<File
RelativePath="Old\Anti-Predictor.cpp"
>
<FileConfiguration
Name="Debug|Win32"
>
<Tool
Name="VCCLCompilerTool"
Optimization="0"
AdditionalIncludeDirectories=""
PreprocessorDefinitions=""
BasicRuntimeChecks="3"
/>
</FileConfiguration>
<FileConfiguration
Name="Debug|x64"
>
<Tool
Name="VCCLCompilerTool"
Optimization="0"
AdditionalIncludeDirectories=""
PreprocessorDefinitions=""
BasicRuntimeChecks="3"
/>
</FileConfiguration>
<FileConfiguration
Name="Release|Win32"
>
<Tool
Name="VCCLCompilerTool"
Optimization="3"
AdditionalIncludeDirectories=""
PreprocessorDefinitions=""
BrowseInformation="1"
/>
</FileConfiguration>
<FileConfiguration
Name="Release|x64"
>
<Tool
Name="VCCLCompilerTool"
Optimization="3"
AdditionalIncludeDirectories=""
PreprocessorDefinitions=""
BrowseInformation="1"
/>
</FileConfiguration>
</File>
<File
RelativePath="Old\AntiPredictorExtraHigh.cpp"
>
<FileConfiguration
Name="Debug|Win32"
>
<Tool
Name="VCCLCompilerTool"
Optimization="0"
AdditionalIncludeDirectories=""
PreprocessorDefinitions=""
BasicRuntimeChecks="3"
/>
</FileConfiguration>
<FileConfiguration
Name="Debug|x64"
>
<Tool
Name="VCCLCompilerTool"
Optimization="0"
AdditionalIncludeDirectories=""
PreprocessorDefinitions=""
BasicRuntimeChecks="3"
/>
</FileConfiguration>
<FileConfiguration
Name="Release|Win32"
>
<Tool
Name="VCCLCompilerTool"
Optimization="3"
AdditionalIncludeDirectories=""
PreprocessorDefinitions=""
BrowseInformation="1"
/>
</FileConfiguration>
<FileConfiguration
Name="Release|x64"
>
<Tool
Name="VCCLCompilerTool"
Optimization="3"
AdditionalIncludeDirectories=""
PreprocessorDefinitions=""
BrowseInformation="1"
/>
</FileConfiguration>
</File>
<File
RelativePath="Old\AntiPredictorFast.cpp"
>
<FileConfiguration
Name="Debug|Win32"
>
<Tool
Name="VCCLCompilerTool"
Optimization="0"
AdditionalIncludeDirectories=""
PreprocessorDefinitions=""
BasicRuntimeChecks="3"
/>
</FileConfiguration>
<FileConfiguration
Name="Debug|x64"
>
<Tool
Name="VCCLCompilerTool"
Optimization="0"
AdditionalIncludeDirectories=""
PreprocessorDefinitions=""
BasicRuntimeChecks="3"
/>
</FileConfiguration>
<FileConfiguration
Name="Release|Win32"
>
<Tool
Name="VCCLCompilerTool"
Optimization="3"
AdditionalIncludeDirectories=""
PreprocessorDefinitions=""
BrowseInformation="1"
/>
</FileConfiguration>
<FileConfiguration
Name="Release|x64"
>
<Tool
Name="VCCLCompilerTool"
Optimization="3"
AdditionalIncludeDirectories=""
PreprocessorDefinitions=""
BrowseInformation="1"
/>
</FileConfiguration>
</File>
<File
RelativePath="Old\AntiPredictorHigh.cpp"
>
<FileConfiguration
Name="Debug|Win32"
>
<Tool
Name="VCCLCompilerTool"
Optimization="0"
AdditionalIncludeDirectories=""
PreprocessorDefinitions=""
BasicRuntimeChecks="3"
/>
</FileConfiguration>
<FileConfiguration
Name="Debug|x64"
>
<Tool
Name="VCCLCompilerTool"
Optimization="0"
AdditionalIncludeDirectories=""
PreprocessorDefinitions=""
BasicRuntimeChecks="3"
/>
</FileConfiguration>
<FileConfiguration
Name="Release|Win32"
>
<Tool
Name="VCCLCompilerTool"
Optimization="3"
AdditionalIncludeDirectories=""
PreprocessorDefinitions=""
BrowseInformation="1"
/>
</FileConfiguration>
<FileConfiguration
Name="Release|x64"
>
<Tool
Name="VCCLCompilerTool"
Optimization="3"
AdditionalIncludeDirectories=""
PreprocessorDefinitions=""
BrowseInformation="1"
/>
</FileConfiguration>
</File>
<File
RelativePath="Old\AntiPredictorNormal.cpp"
>
<FileConfiguration
Name="Debug|Win32"
>
<Tool
Name="VCCLCompilerTool"
Optimization="0"
AdditionalIncludeDirectories=""
PreprocessorDefinitions=""
BasicRuntimeChecks="3"
/>
</FileConfiguration>
<FileConfiguration
Name="Debug|x64"
>
<Tool
Name="VCCLCompilerTool"
Optimization="0"
AdditionalIncludeDirectories=""
PreprocessorDefinitions=""
BasicRuntimeChecks="3"
/>
</FileConfiguration>
<FileConfiguration
Name="Release|Win32"
>
<Tool
Name="VCCLCompilerTool"
Optimization="3"
AdditionalIncludeDirectories=""
PreprocessorDefinitions=""
BrowseInformation="1"
/>
</FileConfiguration>
<FileConfiguration
Name="Release|x64"
>
<Tool
Name="VCCLCompilerTool"
Optimization="3"
AdditionalIncludeDirectories=""
PreprocessorDefinitions=""
BrowseInformation="1"
/>
</FileConfiguration>
</File>
<File
RelativePath="Old\APEDecompressCore.cpp"
>
<FileConfiguration
Name="Debug|Win32"
>
<Tool
Name="VCCLCompilerTool"
Optimization="0"
AdditionalIncludeDirectories=""
PreprocessorDefinitions=""
BasicRuntimeChecks="3"
/>
</FileConfiguration>
<FileConfiguration
Name="Debug|x64"
>
<Tool
Name="VCCLCompilerTool"
Optimization="0"
AdditionalIncludeDirectories=""
PreprocessorDefinitions=""
BasicRuntimeChecks="3"
/>
</FileConfiguration>
<FileConfiguration
Name="Release|Win32"
>
<Tool
Name="VCCLCompilerTool"
Optimization="3"
AdditionalIncludeDirectories=""
PreprocessorDefinitions=""
BrowseInformation="1"
/>
</FileConfiguration>
<FileConfiguration
Name="Release|x64"
>
<Tool
Name="VCCLCompilerTool"
Optimization="3"
AdditionalIncludeDirectories=""
PreprocessorDefinitions=""
BrowseInformation="1"
/>
</FileConfiguration>
</File>
<File
RelativePath="Old\APEDecompressOld.cpp"
>
<FileConfiguration
Name="Debug|Win32"
>
<Tool
Name="VCCLCompilerTool"
Optimization="0"
AdditionalIncludeDirectories=""
PreprocessorDefinitions=""
BasicRuntimeChecks="3"
/>
</FileConfiguration>
<FileConfiguration
Name="Debug|x64"
>
<Tool
Name="VCCLCompilerTool"
Optimization="0"
AdditionalIncludeDirectories=""
PreprocessorDefinitions=""
BasicRuntimeChecks="3"
/>
</FileConfiguration>
<FileConfiguration
Name="Release|Win32"
>
<Tool
Name="VCCLCompilerTool"
Optimization="3"
AdditionalIncludeDirectories=""
PreprocessorDefinitions=""
BrowseInformation="1"
/>
</FileConfiguration>
<FileConfiguration
Name="Release|x64"
>
<Tool
Name="VCCLCompilerTool"
Optimization="3"
AdditionalIncludeDirectories=""
PreprocessorDefinitions=""
BrowseInformation="1"
/>
</FileConfiguration>
</File>
<File
RelativePath="Old\UnBitArrayOld.cpp"
>
<FileConfiguration
Name="Debug|Win32"
>
<Tool
Name="VCCLCompilerTool"
Optimization="0"
AdditionalIncludeDirectories=""
PreprocessorDefinitions=""
BasicRuntimeChecks="3"
/>
</FileConfiguration>
<FileConfiguration
Name="Debug|x64"
>
<Tool
Name="VCCLCompilerTool"
Optimization="0"
AdditionalIncludeDirectories=""
PreprocessorDefinitions=""
BasicRuntimeChecks="3"
/>
</FileConfiguration>
<FileConfiguration
Name="Release|Win32"
>
<Tool
Name="VCCLCompilerTool"
Optimization="3"
AdditionalIncludeDirectories=""
PreprocessorDefinitions=""
BrowseInformation="1"
/>
</FileConfiguration>
<FileConfiguration
Name="Release|x64"
>
<Tool
Name="VCCLCompilerTool"
Optimization="3"
AdditionalIncludeDirectories=""
PreprocessorDefinitions=""
BrowseInformation="1"
/>
</FileConfiguration>
</File>
<File
RelativePath="Old\UnMAC.cpp"
>
<FileConfiguration
Name="Debug|Win32"
>
<Tool
Name="VCCLCompilerTool"
Optimization="0"
AdditionalIncludeDirectories=""
PreprocessorDefinitions=""
BasicRuntimeChecks="3"
/>
</FileConfiguration>
<FileConfiguration
Name="Debug|x64"
>
<Tool
Name="VCCLCompilerTool"
Optimization="0"
AdditionalIncludeDirectories=""
PreprocessorDefinitions=""
BasicRuntimeChecks="3"
/>
</FileConfiguration>
<FileConfiguration
Name="Release|Win32"
>
<Tool
Name="VCCLCompilerTool"
Optimization="3"
AdditionalIncludeDirectories=""
PreprocessorDefinitions=""
BrowseInformation="1"
/>
</FileConfiguration>
<FileConfiguration
Name="Release|x64"
>
<Tool
Name="VCCLCompilerTool"
Optimization="3"
AdditionalIncludeDirectories=""
PreprocessorDefinitions=""
BrowseInformation="1"
/>
</FileConfiguration>
</File>
</Filter>
</Filter> </Filter>
<Filter <Filter
Name="Info" Name="Info"
@@ -1298,202 +814,10 @@
/> />
</FileConfiguration> </FileConfiguration>
</File> </File>
<File
RelativePath="APELink.cpp"
>
<FileConfiguration
Name="Debug|Win32"
>
<Tool
Name="VCCLCompilerTool"
Optimization="0"
AdditionalIncludeDirectories=""
PreprocessorDefinitions=""
BasicRuntimeChecks="3"
/>
</FileConfiguration>
<FileConfiguration
Name="Debug|x64"
>
<Tool
Name="VCCLCompilerTool"
Optimization="0"
AdditionalIncludeDirectories=""
PreprocessorDefinitions=""
BasicRuntimeChecks="3"
/>
</FileConfiguration>
<FileConfiguration
Name="Release|Win32"
>
<Tool
Name="VCCLCompilerTool"
Optimization="3"
AdditionalIncludeDirectories=""
PreprocessorDefinitions=""
BrowseInformation="1"
/>
</FileConfiguration>
<FileConfiguration
Name="Release|x64"
>
<Tool
Name="VCCLCompilerTool"
Optimization="3"
AdditionalIncludeDirectories=""
PreprocessorDefinitions=""
BrowseInformation="1"
/>
</FileConfiguration>
</File>
<File
RelativePath="APETag.cpp"
>
<FileConfiguration
Name="Debug|Win32"
>
<Tool
Name="VCCLCompilerTool"
Optimization="0"
AdditionalIncludeDirectories=""
PreprocessorDefinitions=""
BasicRuntimeChecks="3"
/>
</FileConfiguration>
<FileConfiguration
Name="Debug|x64"
>
<Tool
Name="VCCLCompilerTool"
Optimization="0"
AdditionalIncludeDirectories=""
PreprocessorDefinitions=""
BasicRuntimeChecks="3"
/>
</FileConfiguration>
<FileConfiguration
Name="Release|Win32"
>
<Tool
Name="VCCLCompilerTool"
Optimization="3"
AdditionalIncludeDirectories=""
PreprocessorDefinitions=""
BrowseInformation="1"
/>
</FileConfiguration>
<FileConfiguration
Name="Release|x64"
>
<Tool
Name="VCCLCompilerTool"
Optimization="3"
AdditionalIncludeDirectories=""
PreprocessorDefinitions=""
BrowseInformation="1"
/>
</FileConfiguration>
</File>
<File
RelativePath="WAVInputSource.cpp"
>
<FileConfiguration
Name="Debug|Win32"
>
<Tool
Name="VCCLCompilerTool"
Optimization="0"
AdditionalIncludeDirectories=""
PreprocessorDefinitions=""
BasicRuntimeChecks="3"
/>
</FileConfiguration>
<FileConfiguration
Name="Debug|x64"
>
<Tool
Name="VCCLCompilerTool"
Optimization="0"
AdditionalIncludeDirectories=""
PreprocessorDefinitions=""
BasicRuntimeChecks="3"
/>
</FileConfiguration>
<FileConfiguration
Name="Release|Win32"
>
<Tool
Name="VCCLCompilerTool"
Optimization="3"
AdditionalIncludeDirectories=""
PreprocessorDefinitions=""
BrowseInformation="1"
/>
</FileConfiguration>
<FileConfiguration
Name="Release|x64"
>
<Tool
Name="VCCLCompilerTool"
Optimization="3"
AdditionalIncludeDirectories=""
PreprocessorDefinitions=""
BrowseInformation="1"
/>
</FileConfiguration>
</File>
</Filter> </Filter>
<Filter <Filter
Name="Tools" Name="Tools"
> >
<File
RelativePath="..\Shared\CharacterHelper.cpp"
>
<FileConfiguration
Name="Debug|Win32"
>
<Tool
Name="VCCLCompilerTool"
Optimization="0"
AdditionalIncludeDirectories=""
PreprocessorDefinitions=""
BasicRuntimeChecks="3"
/>
</FileConfiguration>
<FileConfiguration
Name="Debug|x64"
>
<Tool
Name="VCCLCompilerTool"
Optimization="0"
AdditionalIncludeDirectories=""
PreprocessorDefinitions=""
BasicRuntimeChecks="3"
/>
</FileConfiguration>
<FileConfiguration
Name="Release|Win32"
>
<Tool
Name="VCCLCompilerTool"
Optimization="3"
AdditionalIncludeDirectories=""
PreprocessorDefinitions=""
BrowseInformation="1"
/>
</FileConfiguration>
<FileConfiguration
Name="Release|x64"
>
<Tool
Name="VCCLCompilerTool"
Optimization="3"
AdditionalIncludeDirectories=""
PreprocessorDefinitions=""
BrowseInformation="1"
/>
</FileConfiguration>
</File>
<File <File
RelativePath="..\Shared\CircleBuffer.cpp" RelativePath="..\Shared\CircleBuffer.cpp"
> >
@@ -1542,102 +866,6 @@
/> />
</FileConfiguration> </FileConfiguration>
</File> </File>
<File
RelativePath="..\Shared\GlobalFunctions.cpp"
>
<FileConfiguration
Name="Debug|Win32"
>
<Tool
Name="VCCLCompilerTool"
Optimization="0"
AdditionalIncludeDirectories=""
PreprocessorDefinitions=""
BasicRuntimeChecks="3"
/>
</FileConfiguration>
<FileConfiguration
Name="Debug|x64"
>
<Tool
Name="VCCLCompilerTool"
Optimization="0"
AdditionalIncludeDirectories=""
PreprocessorDefinitions=""
BasicRuntimeChecks="3"
/>
</FileConfiguration>
<FileConfiguration
Name="Release|Win32"
>
<Tool
Name="VCCLCompilerTool"
Optimization="3"
AdditionalIncludeDirectories=""
PreprocessorDefinitions=""
BrowseInformation="1"
/>
</FileConfiguration>
<FileConfiguration
Name="Release|x64"
>
<Tool
Name="VCCLCompilerTool"
Optimization="3"
AdditionalIncludeDirectories=""
PreprocessorDefinitions=""
BrowseInformation="1"
/>
</FileConfiguration>
</File>
<File
RelativePath="MACProgressHelper.cpp"
>
<FileConfiguration
Name="Debug|Win32"
>
<Tool
Name="VCCLCompilerTool"
Optimization="0"
AdditionalIncludeDirectories=""
PreprocessorDefinitions=""
BasicRuntimeChecks="3"
/>
</FileConfiguration>
<FileConfiguration
Name="Debug|x64"
>
<Tool
Name="VCCLCompilerTool"
Optimization="0"
AdditionalIncludeDirectories=""
PreprocessorDefinitions=""
BasicRuntimeChecks="3"
/>
</FileConfiguration>
<FileConfiguration
Name="Release|Win32"
>
<Tool
Name="VCCLCompilerTool"
Optimization="3"
AdditionalIncludeDirectories=""
PreprocessorDefinitions=""
BrowseInformation="1"
/>
</FileConfiguration>
<FileConfiguration
Name="Release|x64"
>
<Tool
Name="VCCLCompilerTool"
Optimization="3"
AdditionalIncludeDirectories=""
PreprocessorDefinitions=""
BrowseInformation="1"
/>
</FileConfiguration>
</File>
<File <File
RelativePath="MD5.cpp" RelativePath="MD5.cpp"
> >
@@ -1734,106 +962,6 @@
/> />
</FileConfiguration> </FileConfiguration>
</File> </File>
<Filter
Name="IO"
>
<File
RelativePath="..\Shared\StdLibFileIO.cpp"
>
<FileConfiguration
Name="Debug|Win32"
>
<Tool
Name="VCCLCompilerTool"
Optimization="0"
AdditionalIncludeDirectories=""
PreprocessorDefinitions=""
BasicRuntimeChecks="3"
/>
</FileConfiguration>
<FileConfiguration
Name="Debug|x64"
>
<Tool
Name="VCCLCompilerTool"
Optimization="0"
AdditionalIncludeDirectories=""
PreprocessorDefinitions=""
BasicRuntimeChecks="3"
/>
</FileConfiguration>
<FileConfiguration
Name="Release|Win32"
>
<Tool
Name="VCCLCompilerTool"
Optimization="3"
AdditionalIncludeDirectories=""
PreprocessorDefinitions=""
BrowseInformation="1"
/>
</FileConfiguration>
<FileConfiguration
Name="Release|x64"
>
<Tool
Name="VCCLCompilerTool"
Optimization="3"
AdditionalIncludeDirectories=""
PreprocessorDefinitions=""
BrowseInformation="1"
/>
</FileConfiguration>
</File>
<File
RelativePath="..\Shared\WinFileIO.cpp"
>
<FileConfiguration
Name="Debug|Win32"
>
<Tool
Name="VCCLCompilerTool"
Optimization="0"
AdditionalIncludeDirectories=""
PreprocessorDefinitions=""
BasicRuntimeChecks="3"
/>
</FileConfiguration>
<FileConfiguration
Name="Debug|x64"
>
<Tool
Name="VCCLCompilerTool"
Optimization="0"
AdditionalIncludeDirectories=""
PreprocessorDefinitions=""
BasicRuntimeChecks="3"
/>
</FileConfiguration>
<FileConfiguration
Name="Release|Win32"
>
<Tool
Name="VCCLCompilerTool"
Optimization="3"
AdditionalIncludeDirectories=""
PreprocessorDefinitions=""
BrowseInformation="1"
/>
</FileConfiguration>
<FileConfiguration
Name="Release|x64"
>
<Tool
Name="VCCLCompilerTool"
Optimization="3"
AdditionalIncludeDirectories=""
PreprocessorDefinitions=""
BrowseInformation="1"
/>
</FileConfiguration>
</File>
</Filter>
</Filter> </Filter>
<Filter <Filter
Name="Prediction" Name="Prediction"

View File

@@ -51,7 +51,7 @@ Global compiler settings (useful for porting)
#endif #endif
#endif #endif
#define BACKWARDS_COMPATIBILITY #define NO_BACKWARDS_COMPATIBILITY
#define ENABLE_COMPRESSION_MODE_FAST #define ENABLE_COMPRESSION_MODE_FAST
#define ENABLE_COMPRESSION_MODE_NORMAL #define ENABLE_COMPRESSION_MODE_NORMAL
@@ -71,7 +71,7 @@ Global compiler settings (useful for porting)
#define IO_USE_WIN_FILE_IO #define IO_USE_WIN_FILE_IO
#define IO_HEADER_FILE "WinFileIO.h" #define IO_HEADER_FILE "WinFileIO.h"
#define IO_CLASS_NAME CWinFileIO #define NO_IO_CLASS_NAME CWinFileIO
#define DLLEXPORT __declspec(dllexport) #define DLLEXPORT __declspec(dllexport)
#define SLEEP(MILLISECONDS) ::Sleep(MILLISECONDS) #define SLEEP(MILLISECONDS) ::Sleep(MILLISECONDS)
#define MESSAGEBOX(PARENT, TEXT, CAPTION, TYPE) ::MessageBox(PARENT, TEXT, CAPTION, TYPE) #define MESSAGEBOX(PARENT, TEXT, CAPTION, TYPE) ::MessageBox(PARENT, TEXT, CAPTION, TYPE)

View File

@@ -45,32 +45,32 @@ namespace WavPackDotNet {
int write_block(void *id, void *data, int32_t length); int write_block(void *id, void *data, int32_t length);
[UnmanagedFunctionPointer(CallingConvention::Cdecl)] [UnmanagedFunctionPointer(CallingConvention::Cdecl)]
public delegate int32_t DecoderReadDelegate(void *id, void *data, int32_t bcount); public delegate int32_t DecoderReadDelegate(void *id, void *data, int32_t bcount);
[UnmanagedFunctionPointer(CallingConvention::Cdecl)] [UnmanagedFunctionPointer(CallingConvention::Cdecl)]
public delegate uint32_t DecoderTellDelegate(void *id); public delegate uint32_t DecoderTellDelegate(void *id);
[UnmanagedFunctionPointer(CallingConvention::Cdecl)] [UnmanagedFunctionPointer(CallingConvention::Cdecl)]
public delegate int DecoderSeekDelegate(void *id, uint32_t pos); public delegate int DecoderSeekDelegate(void *id, uint32_t pos);
[UnmanagedFunctionPointer(CallingConvention::Cdecl)] [UnmanagedFunctionPointer(CallingConvention::Cdecl)]
public delegate int DecoderSeekRelativeDelegate(void *id, int32_t delta, int mode); public delegate int DecoderSeekRelativeDelegate(void *id, int32_t delta, int mode);
[UnmanagedFunctionPointer(CallingConvention::Cdecl)] [UnmanagedFunctionPointer(CallingConvention::Cdecl)]
public delegate int DecoderPushBackDelegate(void *id, int c); public delegate int DecoderPushBackDelegate(void *id, int c);
[UnmanagedFunctionPointer(CallingConvention::Cdecl)] [UnmanagedFunctionPointer(CallingConvention::Cdecl)]
public delegate uint32_t DecoderLengthDelegate(void *id); public delegate uint32_t DecoderLengthDelegate(void *id);
[UnmanagedFunctionPointer(CallingConvention::Cdecl)] [UnmanagedFunctionPointer(CallingConvention::Cdecl)]
public delegate int DecoderCanSeekDelegate(void *id); public delegate int DecoderCanSeekDelegate(void *id);
public ref class WavPackReader { public ref class WavPackReader {
public: public:
WavPackReader(String^ path, Stream^ IO, Stream^ IO_WVC) { WavPackReader(String^ path, Stream^ IO, Stream^ IO_WVC) {
char errorMessage[256]; char errorMessage[256];
_readDel = gcnew DecoderReadDelegate (this, &WavPackReader::ReadCallback); _readDel = gcnew DecoderReadDelegate (this, &WavPackReader::ReadCallback);
_tellDel = gcnew DecoderTellDelegate (this, &WavPackReader::TellCallback); _tellDel = gcnew DecoderTellDelegate (this, &WavPackReader::TellCallback);
_seekDel = gcnew DecoderSeekDelegate (this, &WavPackReader::SeekCallback); _seekDel = gcnew DecoderSeekDelegate (this, &WavPackReader::SeekCallback);
_seekRelDel = gcnew DecoderSeekRelativeDelegate (this, &WavPackReader::SeekRelCallback); _seekRelDel = gcnew DecoderSeekRelativeDelegate (this, &WavPackReader::SeekRelCallback);
_pushBackDel = gcnew DecoderPushBackDelegate (this, &WavPackReader::PushBackCallback); _pushBackDel = gcnew DecoderPushBackDelegate (this, &WavPackReader::PushBackCallback);
_lengthDel = gcnew DecoderLengthDelegate (this, &WavPackReader::LengthCallback); _lengthDel = gcnew DecoderLengthDelegate (this, &WavPackReader::LengthCallback);
_canSeekDel = gcnew DecoderCanSeekDelegate (this, &WavPackReader::CanSeekCallback); _canSeekDel = gcnew DecoderCanSeekDelegate (this, &WavPackReader::CanSeekCallback);
ioReader = new WavpackStreamReader; ioReader = new WavpackStreamReader;
ioReader->read_bytes = (int32_t (*)(void *, void *, int32_t)) Marshal::GetFunctionPointerForDelegate(_readDel).ToPointer(); ioReader->read_bytes = (int32_t (*)(void *, void *, int32_t)) Marshal::GetFunctionPointerForDelegate(_readDel).ToPointer();
@@ -212,18 +212,18 @@ namespace WavPackDotNet {
String^ _path; String^ _path;
Stream^ _IO; Stream^ _IO;
Stream^ _IO_WVC; Stream^ _IO_WVC;
DecoderReadDelegate^ _readDel; DecoderReadDelegate^ _readDel;
DecoderTellDelegate^ _tellDel; DecoderTellDelegate^ _tellDel;
DecoderSeekDelegate^ _seekDel; DecoderSeekDelegate^ _seekDel;
DecoderSeekRelativeDelegate^ _seekRelDel; DecoderSeekRelativeDelegate^ _seekRelDel;
DecoderPushBackDelegate^ _pushBackDel; DecoderPushBackDelegate^ _pushBackDel;
DecoderLengthDelegate^ _lengthDel; DecoderLengthDelegate^ _lengthDel;
DecoderCanSeekDelegate^ _canSeekDel; DecoderCanSeekDelegate^ _canSeekDel;
array<unsigned char>^ _readBuffer; array<unsigned char>^ _readBuffer;
int _IO_ungetc, _IO_WVC_ungetc; int _IO_ungetc, _IO_WVC_ungetc;
WavpackStreamReader* ioReader; WavpackStreamReader* ioReader;
int32_t ReadCallback (void *id, void *data, int32_t bcount) int32_t ReadCallback (void *id, void *data, int32_t bcount)
{ {
Stream^ IO = (*(char*)id=='c') ? _IO_WVC : _IO; Stream^ IO = (*(char*)id=='c') ? _IO_WVC : _IO;
int IO_ungetc = (*(char*)id=='c') ? _IO_WVC_ungetc : _IO_ungetc; int IO_ungetc = (*(char*)id=='c') ? _IO_WVC_ungetc : _IO_ungetc;
@@ -256,15 +256,15 @@ namespace WavPackDotNet {
return IO->Position; return IO->Position;
} }
int SeekCallback (void *id, uint32_t pos) int SeekCallback (void *id, uint32_t pos)
{ {
Stream^ IO = (*(char*)id=='c') ? _IO_WVC : _IO; Stream^ IO = (*(char*)id=='c') ? _IO_WVC : _IO;
IO->Position = pos; IO->Position = pos;
return 0; return 0;
} }
int SeekRelCallback (void *id, int32_t delta, int mode) int SeekRelCallback (void *id, int32_t delta, int mode)
{ {
Stream^ IO = (*(char*)id=='c') ? _IO_WVC : _IO; Stream^ IO = (*(char*)id=='c') ? _IO_WVC : _IO;
switch (mode) switch (mode)
{ {
@@ -279,37 +279,37 @@ namespace WavPackDotNet {
break; break;
default: default:
return -1; return -1;
} }
return 0; return 0;
} }
int PushBackCallback (void *id, int c) int PushBackCallback (void *id, int c)
{ {
Stream^ IO = (*(char*)id=='c') ? _IO_WVC : _IO; Stream^ IO = (*(char*)id=='c') ? _IO_WVC : _IO;
if (IO == _IO) if (IO == _IO)
{ {
if (_IO_ungetc != -1) if (_IO_ungetc != -1)
throw gcnew Exception("Double PushBackCallback unsupported."); throw gcnew Exception("Double PushBackCallback unsupported.");
_IO_ungetc = c; _IO_ungetc = c;
} else } else
{ {
if (_IO_WVC_ungetc != -1) if (_IO_WVC_ungetc != -1)
throw gcnew Exception("Double PushBackCallback unsupported."); throw gcnew Exception("Double PushBackCallback unsupported.");
_IO_WVC_ungetc = c; _IO_WVC_ungetc = c;
} }
} }
uint32_t LengthCallback (void *id) uint32_t LengthCallback (void *id)
{ {
Stream^ IO = (*(char*)id=='c') ? _IO_WVC : _IO; Stream^ IO = (*(char*)id=='c') ? _IO_WVC : _IO;
return IO->Length; return IO->Length;
} }
int CanSeekCallback(void *id) int CanSeekCallback(void *id)
{ {
Stream^ IO = (*(char*)id=='c') ? _IO_WVC : _IO; Stream^ IO = (*(char*)id=='c') ? _IO_WVC : _IO;
return IO->CanSeek; return IO->CanSeek;
} }
}; };
public ref class WavPackWriter { public ref class WavPackWriter {
@@ -498,4 +498,4 @@ namespace WavPackDotNet {
int write_block(void *id, void *data, int32_t length) { int write_block(void *id, void *data, int32_t length) {
return (fwrite(data, 1, length, (FILE*)id) == length); return (fwrite(data, 1, length, (FILE*)id) == length);
} }
} }