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::Specialized;
using namespace System::Runtime::InteropServices;
using namespace System::IO;
using namespace APETagsDotNet;
#ifndef _WAVEFORMATEX_
@@ -35,13 +36,75 @@ typedef struct tWAVEFORMATEX
#include "All.h"
#include "MACLib.h"
#include "IO.h"
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:
APEReader(String^ path) {
IntPtr pathChars;
APEReader(String^ path, Stream^ IO) {
pAPEDecompress = NULL;
_sampleOffset = 0;
@@ -49,14 +112,13 @@ namespace APEDotNet {
pBuffer = NULL;
int nRetVal = 0;
pathChars = Marshal::StringToHGlobalUni(path);
size_t pathLen = wcslen ((const wchar_t*)pathChars.ToPointer())+1;
wchar_t * pPath = new wchar_t[pathLen];
memcpy ((void*) pPath, (const wchar_t*)pathChars.ToPointer(), pathLen*sizeof(wchar_t));
Marshal::FreeHGlobal(pathChars);
pAPEDecompress = CreateIAPEDecompress (pPath, &nRetVal);
_IO = (IO != nullptr) ? IO : gcnew FileStream (path, FileMode::Open, FileAccess::Read, FileShare::Read);
_readBuffer = gcnew array<unsigned char>(0x4000);
_gchIO = GCHandle::Alloc(_IO);
_gchReadBuffer = GCHandle::Alloc(_readBuffer);
_winFileIO = new CWinFileIO(_gchIO, _gchReadBuffer);
pAPEDecompress = CreateIAPEDecompressEx (_winFileIO, &nRetVal);
if (!pAPEDecompress) {
throw gcnew Exception("Unable to open file.");
}
@@ -76,6 +138,12 @@ namespace APEDotNet {
~APEReader ()
{
if (pBuffer) delete [] pBuffer;
if (_winFileIO)
delete _winFileIO;
if (_gchIO.IsAllocated)
_gchIO.Free();
if (_gchReadBuffer.IsAllocated)
_gchReadBuffer.Free();
}
property Int32 BitsPerSample {
@@ -122,6 +190,11 @@ namespace APEDotNet {
void Close() {
if (pAPEDecompress) delete pAPEDecompress;
pAPEDecompress = NULL;
if (_IO != nullptr)
{
_IO->Close ();
_IO = nullptr;
}
}
property String^ Path {
@@ -134,7 +207,7 @@ namespace APEDotNet {
NameValueCollection^ get () {
if (!_tags)
{
APETagDotNet^ apeTag = gcnew APETagDotNet (_path, true, true);
APETagDotNet^ apeTag = gcnew APETagDotNet (_IO, true);
_tags = apeTag->GetStringTags (true);
apeTag->Close ();
}
@@ -179,28 +252,10 @@ namespace APEDotNet {
int nBlockAlign;
unsigned char * pBuffer;
String^ _path;
#if 0
APE__StreamDecoderWriteStatus WriteCallback(const APE__StreamDecoder *decoder,
const APE__Frame *frame, const APE__int32 * const buffer[], void *client_data)
{
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
Stream^ _IO;
array<unsigned char>^ _readBuffer;
CWinFileIO* _winFileIO;
GCHandle _gchIO, _gchReadBuffer;
};
public ref class APEWriter {
@@ -213,6 +268,7 @@ namespace APEDotNet {
_path = path;
_tags = gcnew NameValueCollection();
_winFileIO = NULL;
_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() {
if (pAPECompress)
{
@@ -242,12 +308,18 @@ namespace APEDotNet {
if (_tags->Count > 0)
{
APETagDotNet^ apeTag = gcnew APETagDotNet (_path, true, false);
APETagDotNet^ apeTag = gcnew APETagDotNet (_IO, true);
apeTag->SetStringTags (_tags, true);
apeTag->Save();
apeTag->Close();
_tags->Clear ();
}
if (_IO != nullptr)
{
_IO->Close ();
_IO = nullptr;
}
}
property Int32 FinalSampleCount {
@@ -303,31 +375,86 @@ namespace APEDotNet {
Int32 _compressionLevel;
NameValueCollection^ _tags;
String^ _path;
Stream^ _IO;
GCHandle _gchIO, _gchBuffer;
CWinFileIO* _winFileIO;
array<unsigned char>^ _writeBuffer;
void Initialize() {
IntPtr pathChars;
int res;
WAVEFORMATEX waveFormat;
_IO = gcnew FileStream (_path, FileMode::Create, FileAccess::ReadWrite, FileShare::Read);
_writeBuffer = gcnew array<unsigned char>(0x4000);
pathChars = Marshal::StringToHGlobalUni(_path);
_gchIO = GCHandle::Alloc(_IO);
_gchBuffer = GCHandle::Alloc(_writeBuffer);
_winFileIO = new CWinFileIO(_gchIO, _gchBuffer);
WAVEFORMATEX waveFormat;
FillWaveFormatEx (&waveFormat, _sampleRate, _bitsPerSample, _channelCount);
res = pAPECompress->Start ((const wchar_t*)pathChars.ToPointer(),
int res = pAPECompress->StartEx (_winFileIO,
&waveFormat,
(_finalSampleCount == 0) ? MAX_AUDIO_BYTES_UNKNOWN : _finalSampleCount * _blockAlign,
_compressionLevel,
NULL,
CREATE_WAV_HEADER_ON_DECOMPRESSION);
Marshal::FreeHGlobal(pathChars);
if (res)
{
throw gcnew Exception("Unable to create the encoder.");
}
_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
extern "C"
{

View File

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

View File

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

View File

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

View File

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

View File

@@ -1,6 +1,8 @@
#include "All.h"
#include "APECompress.h"
#ifdef IO_CLASS_NAME
#include IO_HEADER_FILE
#endif
#include "APECompressCreate.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)
{
m_pioOutput = new IO_CLASS_NAME;
@@ -48,6 +51,7 @@ int CAPECompress::Start(const wchar_t * pOutputFilename, const WAVEFORMATEX * pw
return ERROR_SUCCESS;
}
#endif
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();
// 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);
#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);
// add data / compress data

View File

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

View File

@@ -22,7 +22,11 @@ WARNING:
#define APE_APEINFO_H
#include "IO.h"
#ifndef NO_TAG
#include "APETag.h"
#else
#define CAPETag void
#endif
#include "MACLib.h"
/*****************************************************************************************
@@ -93,7 +97,9 @@ private:
// internal variables
BOOL m_bHasFileInformationLoaded;
CSmartPtr<CIO> m_spIO;
#ifndef NO_TAG
CSmartPtr<CAPETag> m_spAPETag;
#endif
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)
{
// write the WAV data and any tag
#ifndef NO_TAG
int nTagBytes = GET_TAG(spAPEDecompress)->GetTagBytes();
#else
int nTagBytes = 0;
#endif
BOOL bHasTag = (nTagBytes > 0);
int nTerminatingBytes = nTagBytes;
nTerminatingBytes += spAPEDecompress->GetInfo(APE_INFO_WAV_TERMINATING_BYTES);

View File

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

View File

@@ -42,6 +42,7 @@ IAPEDecompress * CreateIAPEDecompressCore(CAPEInfo * pAPEInfo, int nStartBlock,
return pAPEDecompress;
}
#ifdef IO_CLASS_NAME
IAPEDecompress * __stdcall CreateIAPEDecompress(const str_utf16 * pFilename, int * pErrorCode)
{
// error check the parameters
@@ -68,7 +69,11 @@ IAPEDecompress * __stdcall CreateIAPEDecompress(const str_utf16 * pFilename, int
CAPELink APELink(pFilename);
if (APELink.GetIsLinkFile())
{
#ifndef NO_TAG
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();
}
}
@@ -90,6 +95,7 @@ IAPEDecompress * __stdcall CreateIAPEDecompress(const str_utf16 * pFilename, int
if (pErrorCode) *pErrorCode = nErrorCode;
return pAPEDecompress;
}
#endif
IAPEDecompress * __stdcall CreateIAPEDecompressEx(CIO * pIO, int * pErrorCode)
{

View File

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

View File

@@ -46,7 +46,7 @@
Name="VCCLCompilerTool"
Optimization="0"
AdditionalIncludeDirectories="..\Shared"
PreprocessorDefinitions="WIN32;_DEBUG;_LIB;UNICODE"
PreprocessorDefinitions="WIN32;_DEBUG;_LIB;UNICODE;NO_TAG"
BasicRuntimeChecks="3"
RuntimeLibrary="3"
AssemblerListingLocation=".\Debug/"
@@ -121,7 +121,7 @@
Name="VCCLCompilerTool"
Optimization="0"
AdditionalIncludeDirectories="..\Shared"
PreprocessorDefinitions="WIN32;_DEBUG;_LIB;UNICODE;_CRT_SECURE_NO_WARNINGS"
PreprocessorDefinitions="WIN32;_DEBUG;_LIB;UNICODE;_CRT_SECURE_NO_WARNINGS;NO_TAG"
BasicRuntimeChecks="3"
RuntimeLibrary="3"
WarningLevel="3"
@@ -193,7 +193,7 @@
EnableIntrinsicFunctions="true"
FavorSizeOrSpeed="1"
AdditionalIncludeDirectories="..\Shared"
PreprocessorDefinitions="WIN32;NDEBUG;_LIB;UNICODE;_CRT_SECURE_NO_WARNINGS"
PreprocessorDefinitions="WIN32;NDEBUG;_LIB;UNICODE;_CRT_SECURE_NO_WARNINGS;NO_TAG"
RuntimeLibrary="2"
UsePrecompiledHeader="0"
PrecompiledHeaderThrough="all.h"
@@ -271,7 +271,7 @@
EnableIntrinsicFunctions="true"
FavorSizeOrSpeed="1"
AdditionalIncludeDirectories="..\Shared"
PreprocessorDefinitions="WIN32;NDEBUG;_LIB;UNICODE;_CRT_SECURE_NO_WARNINGS"
PreprocessorDefinitions="WIN32;NDEBUG;_LIB;UNICODE;_CRT_SECURE_NO_WARNINGS;NO_TAG"
RuntimeLibrary="2"
UsePrecompiledHeader="0"
PrecompiledHeaderThrough="all.h"
@@ -323,54 +323,6 @@
Name="Source Files"
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
RelativePath="MACLib.cpp"
>
@@ -762,442 +714,6 @@
/>
</FileConfiguration>
</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
Name="Info"
@@ -1298,202 +814,10 @@
/>
</FileConfiguration>
</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
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
RelativePath="..\Shared\CircleBuffer.cpp"
>
@@ -1542,102 +866,6 @@
/>
</FileConfiguration>
</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
RelativePath="MD5.cpp"
>
@@ -1734,106 +962,6 @@
/>
</FileConfiguration>
</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
Name="Prediction"

View File

@@ -51,7 +51,7 @@ Global compiler settings (useful for porting)
#endif
#endif
#define BACKWARDS_COMPATIBILITY
#define NO_BACKWARDS_COMPATIBILITY
#define ENABLE_COMPRESSION_MODE_FAST
#define ENABLE_COMPRESSION_MODE_NORMAL
@@ -71,7 +71,7 @@ Global compiler settings (useful for porting)
#define IO_USE_WIN_FILE_IO
#define IO_HEADER_FILE "WinFileIO.h"
#define IO_CLASS_NAME CWinFileIO
#define NO_IO_CLASS_NAME CWinFileIO
#define DLLEXPORT __declspec(dllexport)
#define SLEEP(MILLISECONDS) ::Sleep(MILLISECONDS)
#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);
[UnmanagedFunctionPointer(CallingConvention::Cdecl)]
public delegate int32_t DecoderReadDelegate(void *id, void *data, int32_t bcount);
[UnmanagedFunctionPointer(CallingConvention::Cdecl)]
public delegate uint32_t DecoderTellDelegate(void *id);
[UnmanagedFunctionPointer(CallingConvention::Cdecl)]
public delegate int DecoderSeekDelegate(void *id, uint32_t pos);
[UnmanagedFunctionPointer(CallingConvention::Cdecl)]
public delegate int DecoderSeekRelativeDelegate(void *id, int32_t delta, int mode);
[UnmanagedFunctionPointer(CallingConvention::Cdecl)]
public delegate int DecoderPushBackDelegate(void *id, int c);
[UnmanagedFunctionPointer(CallingConvention::Cdecl)]
public delegate uint32_t DecoderLengthDelegate(void *id);
[UnmanagedFunctionPointer(CallingConvention::Cdecl)]
public delegate int DecoderCanSeekDelegate(void *id);
public delegate int32_t DecoderReadDelegate(void *id, void *data, int32_t bcount);
[UnmanagedFunctionPointer(CallingConvention::Cdecl)]
public delegate uint32_t DecoderTellDelegate(void *id);
[UnmanagedFunctionPointer(CallingConvention::Cdecl)]
public delegate int DecoderSeekDelegate(void *id, uint32_t pos);
[UnmanagedFunctionPointer(CallingConvention::Cdecl)]
public delegate int DecoderSeekRelativeDelegate(void *id, int32_t delta, int mode);
[UnmanagedFunctionPointer(CallingConvention::Cdecl)]
public delegate int DecoderPushBackDelegate(void *id, int c);
[UnmanagedFunctionPointer(CallingConvention::Cdecl)]
public delegate uint32_t DecoderLengthDelegate(void *id);
[UnmanagedFunctionPointer(CallingConvention::Cdecl)]
public delegate int DecoderCanSeekDelegate(void *id);
public ref class WavPackReader {
public:
WavPackReader(String^ path, Stream^ IO, Stream^ IO_WVC) {
char errorMessage[256];
_readDel = gcnew DecoderReadDelegate (this, &WavPackReader::ReadCallback);
_tellDel = gcnew DecoderTellDelegate (this, &WavPackReader::TellCallback);
_seekDel = gcnew DecoderSeekDelegate (this, &WavPackReader::SeekCallback);
_seekRelDel = gcnew DecoderSeekRelativeDelegate (this, &WavPackReader::SeekRelCallback);
_pushBackDel = gcnew DecoderPushBackDelegate (this, &WavPackReader::PushBackCallback);
_lengthDel = gcnew DecoderLengthDelegate (this, &WavPackReader::LengthCallback);
_canSeekDel = gcnew DecoderCanSeekDelegate (this, &WavPackReader::CanSeekCallback);
_readDel = gcnew DecoderReadDelegate (this, &WavPackReader::ReadCallback);
_tellDel = gcnew DecoderTellDelegate (this, &WavPackReader::TellCallback);
_seekDel = gcnew DecoderSeekDelegate (this, &WavPackReader::SeekCallback);
_seekRelDel = gcnew DecoderSeekRelativeDelegate (this, &WavPackReader::SeekRelCallback);
_pushBackDel = gcnew DecoderPushBackDelegate (this, &WavPackReader::PushBackCallback);
_lengthDel = gcnew DecoderLengthDelegate (this, &WavPackReader::LengthCallback);
_canSeekDel = gcnew DecoderCanSeekDelegate (this, &WavPackReader::CanSeekCallback);
ioReader = new WavpackStreamReader;
ioReader->read_bytes = (int32_t (*)(void *, void *, int32_t)) Marshal::GetFunctionPointerForDelegate(_readDel).ToPointer();
@@ -212,18 +212,18 @@ namespace WavPackDotNet {
String^ _path;
Stream^ _IO;
Stream^ _IO_WVC;
DecoderReadDelegate^ _readDel;
DecoderTellDelegate^ _tellDel;
DecoderSeekDelegate^ _seekDel;
DecoderSeekRelativeDelegate^ _seekRelDel;
DecoderPushBackDelegate^ _pushBackDel;
DecoderLengthDelegate^ _lengthDel;
DecoderCanSeekDelegate^ _canSeekDel;
array<unsigned char>^ _readBuffer;
int _IO_ungetc, _IO_WVC_ungetc;
WavpackStreamReader* ioReader;
int32_t ReadCallback (void *id, void *data, int32_t bcount)
DecoderReadDelegate^ _readDel;
DecoderTellDelegate^ _tellDel;
DecoderSeekDelegate^ _seekDel;
DecoderSeekRelativeDelegate^ _seekRelDel;
DecoderPushBackDelegate^ _pushBackDel;
DecoderLengthDelegate^ _lengthDel;
DecoderCanSeekDelegate^ _canSeekDel;
array<unsigned char>^ _readBuffer;
int _IO_ungetc, _IO_WVC_ungetc;
WavpackStreamReader* ioReader;
int32_t ReadCallback (void *id, void *data, int32_t bcount)
{
Stream^ IO = (*(char*)id=='c') ? _IO_WVC : _IO;
int IO_ungetc = (*(char*)id=='c') ? _IO_WVC_ungetc : _IO_ungetc;
@@ -256,15 +256,15 @@ namespace WavPackDotNet {
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;
IO->Position = pos;
return 0;
}
int SeekRelCallback (void *id, int32_t delta, int mode)
{
IO->Position = pos;
return 0;
}
int SeekRelCallback (void *id, int32_t delta, int mode)
{
Stream^ IO = (*(char*)id=='c') ? _IO_WVC : _IO;
switch (mode)
{
@@ -279,37 +279,37 @@ namespace WavPackDotNet {
break;
default:
return -1;
}
return 0;
}
int PushBackCallback (void *id, int c)
{
Stream^ IO = (*(char*)id=='c') ? _IO_WVC : _IO;
if (IO == _IO)
{
if (_IO_ungetc != -1)
throw gcnew Exception("Double PushBackCallback unsupported.");
_IO_ungetc = c;
} else
{
if (_IO_WVC_ungetc != -1)
throw gcnew Exception("Double PushBackCallback unsupported.");
_IO_WVC_ungetc = c;
}
}
uint32_t LengthCallback (void *id)
{
Stream^ IO = (*(char*)id=='c') ? _IO_WVC : _IO;
return IO->Length;
}
int CanSeekCallback(void *id)
{
Stream^ IO = (*(char*)id=='c') ? _IO_WVC : _IO;
return IO->CanSeek;
}
}
return 0;
}
int PushBackCallback (void *id, int c)
{
Stream^ IO = (*(char*)id=='c') ? _IO_WVC : _IO;
if (IO == _IO)
{
if (_IO_ungetc != -1)
throw gcnew Exception("Double PushBackCallback unsupported.");
_IO_ungetc = c;
} else
{
if (_IO_WVC_ungetc != -1)
throw gcnew Exception("Double PushBackCallback unsupported.");
_IO_WVC_ungetc = c;
}
}
uint32_t LengthCallback (void *id)
{
Stream^ IO = (*(char*)id=='c') ? _IO_WVC : _IO;
return IO->Length;
}
int CanSeekCallback(void *id)
{
Stream^ IO = (*(char*)id=='c') ? _IO_WVC : _IO;
return IO->CanSeek;
}
};
public ref class WavPackWriter {
@@ -498,4 +498,4 @@ namespace WavPackDotNet {
int write_block(void *id, void *data, int32_t length) {
return (fwrite(data, 1, length, (FILE*)id) == length);
}
}
}