media-sound/mac (Monkey's Audio 4.38): New recipe (#3338)

This commit is contained in:
Robert Kausch
2018-11-05 21:12:38 +01:00
committed by fbrosson
parent cc6e284237
commit f1c9ef6bc0
4 changed files with 413 additions and 0 deletions

View File

@@ -0,0 +1,69 @@
VERSION = 4
CXXOPTS = -I Source/Shared -I Source/MACLib -DPLATFORM_LINUX -c
LDOPTS = -lstdc++
DLLLDOPTS = -shared
CMDLDOPTS =
DLLNAME = libMAC.so.$(VERSION)
CMDNAME = mac
#Set folders if not provided.
ifndef prefix
prefix = /usr/local
endif
ifndef bindir
bindir = $(prefix)/bin
endif
ifndef libdir
libdir = $(prefix)/lib
endif
ifndef includedir
includedir = $(prefix)/include
endif
SHAREDOBJECTS = Source/Shared/CharacterHelper.o Source/Shared/CircleBuffer.o Source/Shared/GlobalFunctions.o Source/Shared/StdLibFileIO.o Source/Shared/WinFileIO.o
LIBOBJECTS = Source/MACLib/APECompress.o Source/MACLib/APECompressCore.o Source/MACLib/APECompressCreate.o Source/MACLib/APEDecompress.o Source/MACLib/APEHeader.o Source/MACLib/APEInfo.o Source/MACLib/APELink.o Source/MACLib/APESimple.o Source/MACLib/APETag.o Source/MACLib/BitArray.o Source/MACLib/MACLib.o Source/MACLib/MACProgressHelper.o Source/MACLib/MD5.o Source/MACLib/NewPredictor.o Source/MACLib/NNFilter.o Source/MACLib/Prepare.o Source/MACLib/UnBitArray.o Source/MACLib/UnBitArrayBase.o Source/MACLib/WAVInputSource.o Source/MACLib/Old/Anti-Predictor.o Source/MACLib/Old/AntiPredictorExtraHigh.o Source/MACLib/Old/AntiPredictorFast.o Source/MACLib/Old/AntiPredictorHigh.o Source/MACLib/Old/AntiPredictorNormal.o Source/MACLib/Old/APEDecompressCore.o Source/MACLib/Old/APEDecompressOld.o Source/MACLib/Old/UnBitArrayOld.o Source/MACLib/Old/UnMAC.o
DLLOBJECTS = Source/MACDll/MACDll.o
CMDOBJECTS = Source/Console/Console.o
all: $(DLLNAME) $(CMDNAME)
clean:
rm -f $(DLLNAME) $(SHAREDOBJECTS) $(LIBOBJECTS) $(DLLOBJECTS) $(CMDNAME) $(CMDOBJECTS)
install:
mkdir -p $(bindir)
cp $(CMDNAME) $(bindir)
mkdir -p $(libdir)
cp $(DLLNAME) $(libdir)
ln -sf $(DLLNAME) $(libdir)/libMAC.so
mkdir -p $(includedir)/MAC
cp Shared/*.h $(includedir)/MAC
$(DLLNAME): $(SHAREDOBJECTS) $(LIBOBJECTS) $(DLLOBJECTS)
$(CXX) $(SHAREDOBJECTS) $(LIBOBJECTS) $(DLLOBJECTS) $(LDOPTS) $(LDFLAGS) $(DLLLDOPTS) -o $@
$(CMDNAME): $(DLLNAME) $(CMDOBJECTS)
$(CXX) $(CMDOBJECTS) $(DLLNAME) $(LDOPTS) $(LDFLAGS) $(CMDLDOPTS) -o $@
Source/Shared/%.o: Source/Shared/%.cpp
$(CXX) $(CXXOPTS) $(CXXFLAGS) $< -o $@
Source/MACLib/%.o: Source/MACLib/%.cpp
$(CXX) $(CXXOPTS) $(CXXFLAGS) $< -o $@
Source/MACLib/Old/%.o: Source/MACLib/Old/%.cpp
$(CXX) $(CXXOPTS) $(CXXFLAGS) $< -o $@
Source/MACDll/%.o: Source/MACDll/%.cpp
$(CXX) $(CXXOPTS) $(CXXFLAGS) $< -o $@
Source/Console/%.o: Source/Console/%.cpp
$(CXX) $(CXXOPTS) $(CXXFLAGS) $< -o $@

View File

@@ -0,0 +1,13 @@
Monkey's Audio SDK and Source Code License Agreement
1. The Monkey's Audio SDK and source code can be freely used to add APE format playback, encoding, or
tagging support to any product, free or commercial.
2. Monkey's Audio source can be included in GPL and open-source software, although Monkey's Audio
itself will not be subjected to external licensing requirements or other viral source restrictions.
3. Code changes and improvements must be contributed back to the Monkey's Audio project or made
freely available, unless exempted by written consent of the author.
4. Any source code, ideas, or libraries used must be plainly acknowledged in the software using the code.
5. Although the software has been tested thoroughly, the author is in no way responsible for damages
due to bugs or misuse.
6. If you do not completely agree with all of the previous stipulations, you must cease using this source
code and remove it from your storage device.

View File

@@ -0,0 +1,73 @@
SUMMARY="A fast and powerful lossless audio compressor"
DESCRIPTION="Monkey's Audio is a lossless audio format. This package provides \
the mac command line utility for compressing and decompressing Monkey's Audio \
files."
HOMEPAGE="https://www.monkeysaudio.com/"
COPYRIGHT="2000-2018 Matthew T. Ashland"
LICENSE="Monkey's Audio SDK and Source Code License Agreement"
REVISION="1"
SOURCE_URI="https://www.monkeysaudio.com/files/MAC_SDK_${portVersion/./}.zip"
CHECKSUM_SHA256="1ab9a0c74a0478c3fe713908789017c53c3b333a482225d2d09990a16069f981"
SOURCE_DIR=""
PATCHES="mac-$portVersion.patchset"
ADDITIONAL_FILES="Makefile"
ARCHITECTURES="!x86_gcc2 x86 x86_64"
SECONDARY_ARCHITECTURES="x86"
commandSuffix=$secondaryArchSuffix
commandBinDir=$binDir
if [ "$targetArchitecture" = x86_gcc2 ]; then
commandSuffix=
commandBinDir=$prefix/bin
fi
libVersion="4"
PROVIDES="
mac$secondaryArchSuffix = $portVersion
cmd:mac$commandSuffix = $portVersion
lib:libMAC$secondaryArchSuffix = $libVersion
"
REQUIRES="
haiku$secondaryArchSuffix
"
PROVIDES_devel="
mac${secondaryArchSuffix}_devel = $portVersion
devel:libMAC$secondaryArchSuffix = $libVersion
"
REQUIRES_devel="
mac$secondaryArchSuffix == $portVersion base
"
BUILD_REQUIRES="
haiku${secondaryArchSuffix}_devel
"
BUILD_PREREQUIRES="
cmd:g++$secondaryArchSuffix
cmd:gcc$secondaryArchSuffix
cmd:ld$secondaryArchSuffix
cmd:make
"
BUILD()
{
cp "$portDir"/additional-files/Makefile .
make $jobArgs
}
INSTALL()
{
make prefix="$prefix" bindir="$commandBinDir" libdir="$libDir" \
includedir="$includeDir" install
install -m 755 -d "$developDocDir"
install -m 644 -t "$developDocDir" Readme.txt
prepareInstalledDevelLibs libMAC
packageEntries devel \
"$developDir"
}

View File

@@ -0,0 +1,258 @@
From 05dd48adcca1be839f7099770e22109062a01de6 Mon Sep 17 00:00:00 2001
From: Robert Kausch <robert.kausch@freac.org>
Date: Sat, 3 Nov 2018 18:31:20 +0100
Subject: Fixes for building on Haiku.
diff --git a/Shared/All.h b/Shared/All.h
index b34d3b1..12d7a89 100644
--- a/Shared/All.h
+++ b/Shared/All.h
@@ -57,7 +57,9 @@ Global compiler settings (useful for porting)
*****************************************************************************************/
// assembly code (helps performance, but limits portability)
#if !defined(PLATFORM_ARM) && !defined(PLATFORM_ANDROID)
- #define ENABLE_SSE_ASSEMBLY
+ #ifdef __SSE2__
+ #define ENABLE_SSE_ASSEMBLY
+ #endif
#ifdef _MSC_VER // doesn't compile in gcc
#ifndef PLATFORM_x64
#define ENABLE_MMX_ASSEMBLY
diff --git a/Shared/MACDll.h b/Shared/MACDll.h
index e7eb619..487d5e8 100644
--- a/Shared/MACDll.h
+++ b/Shared/MACDll.h
@@ -30,15 +30,19 @@ Helper functions
extern "C"
{
DLLEXPORT int __stdcall GetVersionNumber();
+#ifdef PLATFORM_WINDOWS
DLLEXPORT int __stdcall GetInterfaceCompatibility(int nVersion, BOOL bDisplayWarningsOnFailure = TRUE, HWND hwndParent = NULL);
DLLEXPORT int __stdcall ShowFileInfoDialog(const APE::str_ansi * pFilename, HWND hwndWindow);
+#endif
DLLEXPORT int __stdcall TagFileSimple(const APE::str_ansi * pFilename, const char * pArtist, const char * pAlbum, const char * pTitle, const char * pComment, const char * pGenre, const char * pYear, const char * pTrack, BOOL bClearFirst, BOOL bUseOldID3);
DLLEXPORT int __stdcall GetID3Tag(const APE::str_ansi * pFilename, APE::ID3_TAG * pID3Tag);
DLLEXPORT int __stdcall RemoveTag(const APE::str_ansi * pFilename);
}
typedef int (__stdcall * proc_GetVersionNumber)();
+#ifdef PLATFORM_WINDOWS
typedef int (__stdcall * proc_GetInterfaceCompatibility)(int, BOOL, HWND);
+#endif
/*****************************************************************************************
IAPECompress wrapper(s)
diff --git a/Shared/NoWindows.h b/Shared/NoWindows.h
index d188ee0..a0f4116 100644
--- a/Shared/NoWindows.h
+++ b/Shared/NoWindows.h
@@ -32,6 +32,9 @@ typedef long LRESULT;
#define ZeroMemory(POINTER, BYTES) memset(POINTER, 0, BYTES);
+#define TRUE true
+#define FALSE false
+
#define CALLBACK
#define _T(x) L ## x
diff --git a/Source/Console/Console.cpp b/Source/Console/Console.cpp
index b990169..ee30b30 100644
--- a/Source/Console/Console.cpp
+++ b/Source/Console/Console.cpp
@@ -20,6 +20,15 @@ using namespace APE;
#define CONVERT_MODE 3
#define UNDEFINED_MODE -1
+#define _tmain main
+#define _tcscpy strcpy
+#define _tcsncpy strncpy
+#define _tcsnicmp strncasecmp
+#define _ftprintf fprintf
+#define _ttoi atoi
+#define TCHAR char
+#define _T(x) x
+
// global variables
TICK_COUNT_TYPE g_nInitialTickCount = 0;
@@ -89,13 +98,8 @@ int _tmain(int argc, TCHAR * argv[])
}
// store the filenames
- #ifdef _UNICODE
- spInputFilename.Assign(argv[1], TRUE, FALSE);
- spOutputFilename.Assign(argv[2], TRUE, FALSE);
- #else
- spInputFilename.Assign(CAPECharacterHelper::GetUTF16FromANSI(argv[1]), TRUE);
- spOutputFilename.Assign(CAPECharacterHelper::GetUTF16FromANSI(argv[2]), TRUE);
- #endif
+ spInputFilename.Assign(CAPECharacterHelper::GetUTF16FromUTF8((str_utf8*) argv[1]), TRUE);
+ spOutputFilename.Assign(CAPECharacterHelper::GetUTF16FromUTF8((str_utf8*) argv[2]), TRUE);
// verify that the input file exists
if (!FileExists(spInputFilename))
diff --git a/Source/MACDll/MACDll.cpp b/Source/MACDll/MACDll.cpp
index 0d74e64..cb5c4d5 100644
--- a/Source/MACDll/MACDll.cpp
+++ b/Source/MACDll/MACDll.cpp
@@ -1,9 +1,16 @@
-#include "stdafx.h"
#include "resource.h"
#include "MACDll.h"
+
+using namespace APE;
+
+#ifdef PLATFORM_WINDOWS
#include "WinFileIO.h"
#include "APEInfoDialog.h"
#include "WAVInfoDialog.h"
+#else
+#include "StdLibFileIO.h"
+#endif
+
#include "APEDecompress.h"
#include "APECompressCreate.h"
#include "APECompressCore.h"
@@ -17,6 +24,7 @@ int __stdcall GetVersionNumber()
return MAC_FILE_VERSION_NUMBER;
}
+#ifdef PLATFORM_WINDOWS
int __stdcall GetInterfaceCompatibility(int nVersion, BOOL bDisplayWarningsOnFailure, HWND hwndParent)
{
int nRetVal = 0;
@@ -26,7 +34,7 @@ int __stdcall GetInterfaceCompatibility(int nVersion, BOOL bDisplayWarningsOnFai
if (bDisplayWarningsOnFailure)
{
TCHAR cMessage[1024];
- _stprintf_s(cMessage, 1024, _T("You system does not have a new enough version of Monkey's Audio installed.\n")
+ _stprintf(cMessage, _T("You system does not have a new enough version of Monkey's Audio installed.\n")
_T("Please visit www.monkeysaudio.com for the latest version.\n\n(version %.2f or later required)"),
float(nVersion) / float(1000));
MessageBox(hwndParent, cMessage, _T("Please Update Monkey's Audio"), MB_OK | MB_ICONINFORMATION);
@@ -38,7 +46,7 @@ int __stdcall GetInterfaceCompatibility(int nVersion, BOOL bDisplayWarningsOnFai
if (bDisplayWarningsOnFailure)
{
TCHAR cMessage[1024];
- _stprintf_s(cMessage, 1024, _T("This program is trying to use an old version of Monkey's Audio.\n")
+ _stprintf(cMessage, _T("This program is trying to use an old version of Monkey's Audio.\n")
_T("Please contact the author about updating their support for Monkey's Audio.\n\n")
_T("Monkey's Audio currently installed: %.2f\nProgram is searching for: %.2f"),
float(MAC_FILE_VERSION_NUMBER) / float(1000), float(nVersion) / float(1000));
@@ -48,7 +56,9 @@ int __stdcall GetInterfaceCompatibility(int nVersion, BOOL bDisplayWarningsOnFai
return nRetVal;
}
+#endif
+#ifdef _MSC_VER
int __stdcall ShowFileInfoDialog(const str_ansi * pFilename, HWND hwndWindow)
{
// convert the filename
@@ -87,6 +97,7 @@ int __stdcall ShowFileInfoDialog(const str_ansi * pFilename, HWND hwndWindow)
return 0;
};
}
+#endif
int __stdcall TagFileSimple(const str_ansi * pFilename, const char * pArtist, const char * pAlbum, const char * pTitle, const char * pComment, const char * pGenre, const char * pYear, const char * pTrack, BOOL bClearFirst, BOOL bUseOldID3)
{
diff --git a/Source/MACDll/MACDll.h b/Source/MACDll/MACDll.h
index e7eb619..487d5e8 100644
--- a/Source/MACDll/MACDll.h
+++ b/Source/MACDll/MACDll.h
@@ -30,15 +30,19 @@ Helper functions
extern "C"
{
DLLEXPORT int __stdcall GetVersionNumber();
+#ifdef PLATFORM_WINDOWS
DLLEXPORT int __stdcall GetInterfaceCompatibility(int nVersion, BOOL bDisplayWarningsOnFailure = TRUE, HWND hwndParent = NULL);
DLLEXPORT int __stdcall ShowFileInfoDialog(const APE::str_ansi * pFilename, HWND hwndWindow);
+#endif
DLLEXPORT int __stdcall TagFileSimple(const APE::str_ansi * pFilename, const char * pArtist, const char * pAlbum, const char * pTitle, const char * pComment, const char * pGenre, const char * pYear, const char * pTrack, BOOL bClearFirst, BOOL bUseOldID3);
DLLEXPORT int __stdcall GetID3Tag(const APE::str_ansi * pFilename, APE::ID3_TAG * pID3Tag);
DLLEXPORT int __stdcall RemoveTag(const APE::str_ansi * pFilename);
}
typedef int (__stdcall * proc_GetVersionNumber)();
+#ifdef PLATFORM_WINDOWS
typedef int (__stdcall * proc_GetInterfaceCompatibility)(int, BOOL, HWND);
+#endif
/*****************************************************************************************
IAPECompress wrapper(s)
diff --git a/Source/MACLib/WAVInputSource.cpp b/Source/MACLib/WAVInputSource.cpp
index a4f2eef..acbce21 100644
--- a/Source/MACLib/WAVInputSource.cpp
+++ b/Source/MACLib/WAVInputSource.cpp
@@ -9,8 +9,8 @@ namespace APE
struct RIFF_HEADER
{
- char cRIFF[4]; // the characters 'RIFF' indicating that it's a RIFF file
- unsigned long nBytes; // the number of bytes following this header
+ char cRIFF[4]; // the characters 'RIFF' indicating that it's a RIFF file
+ uint32 nBytes; // the number of bytes following this header
};
struct DATA_TYPE_ID_HEADER
@@ -20,18 +20,18 @@ struct DATA_TYPE_ID_HEADER
struct WAV_FORMAT_HEADER
{
- unsigned short nFormatTag; // the format of the WAV...should equal 1 for a PCM file
- unsigned short nChannels; // the number of channels
- unsigned long nSamplesPerSecond; // the number of samples per second
- unsigned long nBytesPerSecond; // the bytes per second
- unsigned short nBlockAlign; // block alignment
- unsigned short nBitsPerSample; // the number of bits per sample
+ uint16 nFormatTag; // the format of the WAV...should equal 1 for a PCM file
+ uint16 nChannels; // the number of channels
+ uint32 nSamplesPerSecond; // the number of samples per second
+ uint32 nBytesPerSecond; // the bytes per second
+ uint16 nBlockAlign; // block alignment
+ uint16 nBitsPerSample; // the number of bits per sample
};
struct RIFF_CHUNK_HEADER
{
- char cChunkLabel[4]; // should equal "data" indicating the data chunk
- unsigned long nChunkBytes; // the bytes of the chunk
+ char cChunkLabel[4]; // should equal "data" indicating the data chunk
+ uint32 nChunkBytes; // the bytes of the chunk
};
diff --git a/Source/Shared/All.h b/Source/Shared/All.h
index b34d3b1..12d7a89 100644
--- a/Source/Shared/All.h
+++ b/Source/Shared/All.h
@@ -57,7 +57,9 @@ Global compiler settings (useful for porting)
*****************************************************************************************/
// assembly code (helps performance, but limits portability)
#if !defined(PLATFORM_ARM) && !defined(PLATFORM_ANDROID)
- #define ENABLE_SSE_ASSEMBLY
+ #ifdef __SSE2__
+ #define ENABLE_SSE_ASSEMBLY
+ #endif
#ifdef _MSC_VER // doesn't compile in gcc
#ifndef PLATFORM_x64
#define ENABLE_MMX_ASSEMBLY
diff --git a/Source/Shared/NoWindows.h b/Source/Shared/NoWindows.h
index d188ee0..a0f4116 100644
--- a/Source/Shared/NoWindows.h
+++ b/Source/Shared/NoWindows.h
@@ -32,6 +32,9 @@ typedef long LRESULT;
#define ZeroMemory(POINTER, BYTES) memset(POINTER, 0, BYTES);
+#define TRUE true
+#define FALSE false
+
#define CALLBACK
#define _T(x) L ## x
--
2.19.1