Welcome Guest ( Log In | Register )

Reply to this topicStart new topic
Monkey's Audio 4.13 and filesize, it can create APE files greater than 2 GB
post Feb 8 2015, 00:20
Post #1

Group: Developer
Posts: 3766
Joined: 2-December 07
Member No.: 49183

The latest Monkey's Audio encoder supports WAV files greater than 2 GB. So, the limit of input file size was raised from 2GB to 4GB.
This means that MAC can create APE files greater than 2GB, and it seems that even the latest 4.13 SDK doesn't like such files.

foobar2000 can decode the resulting big APE files without problems, but it cannot seek to the end of them:
Decoding failure at 5:35:32.119 (Unsupported format or corrupted file (1002)):

And Winamp (+in_APE.dll) also can decode but cannot seek to the end (it simply crashes).
I compiled in_APE.dll myself, then tried to debug it.
The following patch fixes this problem and allows Winamp to seek to the end of such big files.
diff --git a/MAC_SDK_413/Source/MACLib/APEDecompress.cpp b/MAC_SDK_413/Source/MACLib/APEDecompress.cpp
index 3d09b84..84262ac 100644
--- a/MAC_SDK_413/Source/MACLib/APEDecompress.cpp
+++ b/MAC_SDK_413/Source/MACLib/APEDecompress.cpp
@@ -426,7 +426,7 @@ Seek to the proper frame (if necessary) and do any alignment of the bit array
int CAPEDecompress::SeekToFrame(int nFrameIndex)
- int nSeekRemainder = (GetInfo(APE_INFO_SEEK_BYTE, nFrameIndex) - GetInfo(APE_INFO_SEEK_BYTE, 0)) % 4;
+ int nSeekRemainder = ((unsigned)GetInfo(APE_INFO_SEEK_BYTE, nFrameIndex) - (unsigned)GetInfo(APE_INFO_SEEK_BYTE, 0)) % 4;
return m_spUnBitArray->FillAndResetBitArray(GetInfo(APE_INFO_SEEK_BYTE, nFrameIndex) - nSeekRemainder, nSeekRemainder * 8);

diff --git a/MAC_SDK_413/Source/Shared/WinFileIO.cpp b/MAC_SDK_413/Source/Shared/WinFileIO.cpp
index 58408bd..6b76cf8 100644
--- a/MAC_SDK_413/Source/Shared/WinFileIO.cpp
+++ b/MAC_SDK_413/Source/Shared/WinFileIO.cpp
@@ -99,7 +99,11 @@ int CWinFileIO::Write(const void * pBuffer, unsigned int nBytesToWrite, unsigned

int CWinFileIO::Seek(int nDistance, unsigned int nMoveMode)
- SetFilePointer(m_hFile, nDistance, NULL, nMoveMode);
+ LONG high = 0;
+ if(nMoveMode == FILE_BEGIN)
+ SetFilePointer(m_hFile, nDistance, &high, nMoveMode); /* treat nDistance as unsigned */
+ else
+ SetFilePointer(m_hFile, nDistance, NULL, nMoveMode);
return 0;

(the plugin still reports negative file sizes and compression level, but it's not a big problem for me...)
Go to the top of the page
+Quote Post
post Feb 8 2015, 10:48
Post #2

Group: Members
Posts: 188
Joined: 9-May 10
Member No.: 80499

QUOTE (lvqcl @ Feb 8 2015, 00:20) *
I compiled in_APE.dll myself

It would be nice to share a patched build wink.gif
Go to the top of the page
+Quote Post
post Feb 8 2015, 11:09
Post #3

Group: Developer
Posts: 3766
Joined: 2-December 07
Member No.: 49183

I'm not sure that I'm allowed to do this: http://www.monkeysaudio.com/license.html
3. The redistribution of Monkey's Audio is only allowed in cases where the original installer and components therein have not been modified.

Besides, the size of the original in_APE.dll is 440kB, and my version is 2MB long. I don't know why.

P.S. I wonder what other lossless codecs do for very long files (1GB, 3GB, 5GB input; 1GB, 3GB, 5GB output; 1G, 3G, 5G samples). Maybe I'll test it someday...
Go to the top of the page
+Quote Post

Reply to this topicStart new topic
1 User(s) are reading this topic (1 Guests and 0 Anonymous Users)
0 Members:


RSS Lo-Fi Version Time is now: 9th October 2015 - 00:36