diff --git a/APEDotNet/apedotnet.cpp b/APEDotNet/apedotnet.cpp index fccac42..12b9550 100644 --- a/APEDotNet/apedotnet.cpp +++ b/APEDotNet/apedotnet.cpp @@ -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(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(sampleCount, _channelCount); - } - - for (Int32 iChan = 0; iChan < _channelCount; iChan++) { - interior_ptr 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^ _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^ _writeBuffer; void Initialize() { - IntPtr pathChars; - int res; - WAVEFORMATEX waveFormat; + _IO = gcnew FileStream (_path, FileMode::Create, FileAccess::ReadWrite, FileShare::Read); + _writeBuffer = gcnew array(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^ buff = (array^) _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^ buff = (array^) _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" { diff --git a/CUEToolsLib/AudioReadWrite.cs b/CUEToolsLib/AudioReadWrite.cs index 68bf233..e699c87 100644 --- a/CUEToolsLib/AudioReadWrite.cs +++ b/CUEToolsLib/AudioReadWrite.cs @@ -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; } diff --git a/CUEToolsLib/Main.cs b/CUEToolsLib/Main.cs index 358e1f6..408984b 100644 --- a/CUEToolsLib/Main.cs +++ b/CUEToolsLib/Main.cs @@ -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) diff --git a/MAC_SDK/Shared/All.h b/MAC_SDK/Shared/All.h index 9150851..27192cd 100644 --- a/MAC_SDK/Shared/All.h +++ b/MAC_SDK/Shared/All.h @@ -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) diff --git a/MAC_SDK/Shared/MACLib.h b/MAC_SDK/Shared/MACLib.h index af0cbcd..5a70cd3 100644 --- a/MAC_SDK/Shared/MACLib.h +++ b/MAC_SDK/Shared/MACLib.h @@ -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, diff --git a/MAC_SDK/Source/MACLib/APECompress.cpp b/MAC_SDK/Source/MACLib/APECompress.cpp index a040140..8cd14e4 100644 --- a/MAC_SDK/Source/MACLib/APECompress.cpp +++ b/MAC_SDK/Source/MACLib/APECompress.cpp @@ -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) { diff --git a/MAC_SDK/Source/MACLib/APECompress.h b/MAC_SDK/Source/MACLib/APECompress.h index 50e80ec..e91bd56 100644 --- a/MAC_SDK/Source/MACLib/APECompress.h +++ b/MAC_SDK/Source/MACLib/APECompress.h @@ -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 diff --git a/MAC_SDK/Source/MACLib/APEInfo.cpp b/MAC_SDK/Source/MACLib/APEInfo.cpp index 7e01b69..a62d08d 100644 --- a/MAC_SDK/Source/MACLib/APEInfo.cpp +++ b/MAC_SDK/Source/MACLib/APEInfo.cpp @@ -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; diff --git a/MAC_SDK/Source/MACLib/APEInfo.h b/MAC_SDK/Source/MACLib/APEInfo.h index 07115fa..b1865fe 100644 --- a/MAC_SDK/Source/MACLib/APEInfo.h +++ b/MAC_SDK/Source/MACLib/APEInfo.h @@ -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 m_spIO; +#ifndef NO_TAG CSmartPtr m_spAPETag; +#endif APE_FILE_INFO m_APEFileInfo; }; diff --git a/MAC_SDK/Source/MACLib/APESimple.cpp b/MAC_SDK/Source/MACLib/APESimple.cpp index a757218..2420021 100644 --- a/MAC_SDK/Source/MACLib/APESimple.cpp +++ b/MAC_SDK/Source/MACLib/APESimple.cpp @@ -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); diff --git a/MAC_SDK/Source/MACLib/APETag.cpp b/MAC_SDK/Source/MACLib/APETag.cpp index db9a1f1..d2582b9 100644 --- a/MAC_SDK/Source/MACLib/APETag.cpp +++ b/MAC_SDK/Source/MACLib/APETag.cpp @@ -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 diff --git a/MAC_SDK/Source/MACLib/Assembly/Assembly.obj b/MAC_SDK/Source/MACLib/Assembly/Assembly.obj index 2d336e6..1535ff7 100644 Binary files a/MAC_SDK/Source/MACLib/Assembly/Assembly.obj and b/MAC_SDK/Source/MACLib/Assembly/Assembly.obj differ diff --git a/MAC_SDK/Source/MACLib/Assembly/Assembly64.obj b/MAC_SDK/Source/MACLib/Assembly/Assembly64.obj index cf0008d..cb0e9bd 100644 Binary files a/MAC_SDK/Source/MACLib/Assembly/Assembly64.obj and b/MAC_SDK/Source/MACLib/Assembly/Assembly64.obj differ diff --git a/MAC_SDK/Source/MACLib/MACLib.cpp b/MAC_SDK/Source/MACLib/MACLib.cpp index 600ba6a..db26bd8 100644 --- a/MAC_SDK/Source/MACLib/MACLib.cpp +++ b/MAC_SDK/Source/MACLib/MACLib.cpp @@ -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) { diff --git a/MAC_SDK/Source/MACLib/MACLib.h b/MAC_SDK/Source/MACLib/MACLib.h index af0cbcd..5a70cd3 100644 --- a/MAC_SDK/Source/MACLib/MACLib.h +++ b/MAC_SDK/Source/MACLib/MACLib.h @@ -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, diff --git a/MAC_SDK/Source/MACLib/MACLib.vcproj b/MAC_SDK/Source/MACLib/MACLib.vcproj index 029ebc0..337b0f1 100644 --- a/MAC_SDK/Source/MACLib/MACLib.vcproj +++ b/MAC_SDK/Source/MACLib/MACLib.vcproj @@ -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" > - - - - - - - - - - - - - - @@ -762,442 +714,6 @@ /> - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - @@ -1542,102 +866,6 @@ /> - - - - - - - - - - - - - - - - - - - - - - - - - - - - @@ -1734,106 +962,6 @@ /> - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 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^ _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^ _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); } -} \ No newline at end of file +}