You've already forked Microtransactions64
mirror of
https://github.com/Print-and-Panic/Microtransactions64.git
synced 2026-01-21 10:17:19 -08:00
Refresh 10.1
This commit is contained in:
318
tools/util/audiofile_strip.patch
Normal file
318
tools/util/audiofile_strip.patch
Normal file
@@ -0,0 +1,318 @@
|
||||
diff --git a/libaudiofile/FileHandle.cpp b/libaudiofile/FileHandle.cpp
|
||||
index 8562d4b..5d6342a 100644
|
||||
--- a/libaudiofile/FileHandle.cpp
|
||||
+++ b/libaudiofile/FileHandle.cpp
|
||||
@@ -74,26 +74,8 @@ _AFfilehandle *_AFfilehandle::create(int fileFormat)
|
||||
case AF_FILE_AIFF:
|
||||
case AF_FILE_AIFFC:
|
||||
return new AIFFFile();
|
||||
- case AF_FILE_NEXTSND:
|
||||
- return new NeXTFile();
|
||||
case AF_FILE_WAVE:
|
||||
return new WAVEFile();
|
||||
- case AF_FILE_BICSF:
|
||||
- return new IRCAMFile();
|
||||
- case AF_FILE_AVR:
|
||||
- return new AVRFile();
|
||||
- case AF_FILE_IFF_8SVX:
|
||||
- return new IFFFile();
|
||||
- case AF_FILE_SAMPLEVISION:
|
||||
- return new SampleVisionFile();
|
||||
- case AF_FILE_VOC:
|
||||
- return new VOCFile();
|
||||
- case AF_FILE_NIST_SPHERE:
|
||||
- return new NISTFile();
|
||||
- case AF_FILE_CAF:
|
||||
- return new CAFFile();
|
||||
- case AF_FILE_FLAC:
|
||||
- return new FLACFile();
|
||||
default:
|
||||
return NULL;
|
||||
}
|
||||
diff --git a/libaudiofile/aupv.c b/libaudiofile/aupv.c
|
||||
index 64e798b..374838b 100644
|
||||
--- a/libaudiofile/aupv.c
|
||||
+++ b/libaudiofile/aupv.c
|
||||
@@ -47,7 +47,7 @@ AUpvlist AUpvnew (int maxitems)
|
||||
if (aupvlist == NULL)
|
||||
return AU_NULL_PVLIST;
|
||||
|
||||
- aupvlist->items = calloc(maxitems, sizeof (struct _AUpvitem));
|
||||
+ aupvlist->items = (struct _AUpvitem *)calloc(maxitems, sizeof (struct _AUpvitem));
|
||||
|
||||
assert(aupvlist->items);
|
||||
if (aupvlist->items == NULL)
|
||||
diff --git a/libaudiofile/g711.c b/libaudiofile/g711.c
|
||||
index 8fb2323..1b323ec 100644
|
||||
--- a/libaudiofile/g711.c
|
||||
+++ b/libaudiofile/g711.c
|
||||
@@ -74,8 +74,7 @@ static int search(int val, const short *table, int size)
|
||||
* John Wiley & Sons, pps 98-111 and 472-476.
|
||||
*/
|
||||
unsigned char
|
||||
-_af_linear2alaw(pcm_val)
|
||||
- int pcm_val; /* 2's complement (16-bit range) */
|
||||
+_af_linear2alaw(int pcm_val)
|
||||
{
|
||||
int mask;
|
||||
int seg;
|
||||
@@ -110,8 +109,7 @@ _af_linear2alaw(pcm_val)
|
||||
*
|
||||
*/
|
||||
int
|
||||
-_af_alaw2linear(a_val)
|
||||
- unsigned char a_val;
|
||||
+_af_alaw2linear(unsigned char a_val)
|
||||
{
|
||||
int t;
|
||||
int seg;
|
||||
diff --git a/libaudiofile/units.cpp b/libaudiofile/units.cpp
|
||||
index ffd0a63..51d2dc3 100644
|
||||
--- a/libaudiofile/units.cpp
|
||||
+++ b/libaudiofile/units.cpp
|
||||
@@ -32,24 +32,12 @@
|
||||
#include "units.h"
|
||||
|
||||
#include "AIFF.h"
|
||||
-#include "AVR.h"
|
||||
-#include "CAF.h"
|
||||
-#include "FLACFile.h"
|
||||
-#include "IFF.h"
|
||||
-#include "IRCAM.h"
|
||||
-#include "NeXT.h"
|
||||
-#include "NIST.h"
|
||||
#include "Raw.h"
|
||||
-#include "SampleVision.h"
|
||||
-#include "VOC.h"
|
||||
#include "WAVE.h"
|
||||
|
||||
#include "compression.h"
|
||||
|
||||
-#include "modules/ALAC.h"
|
||||
-#include "modules/FLAC.h"
|
||||
#include "modules/G711.h"
|
||||
-#include "modules/IMA.h"
|
||||
#include "modules/MSADPCM.h"
|
||||
#include "modules/PCM.h"
|
||||
|
||||
@@ -99,20 +87,6 @@ const Unit _af_units[_AF_NUM_UNITS] =
|
||||
_AF_AIFF_NUM_INSTPARAMS,
|
||||
_af_aiff_inst_params
|
||||
},
|
||||
- {
|
||||
- AF_FILE_NEXTSND,
|
||||
- "NeXT .snd/Sun .au", "NeXT .snd/Sun .au Format", "next",
|
||||
- true,
|
||||
- NeXTFile::completeSetup,
|
||||
- NeXTFile::recognize,
|
||||
- AF_SAMPFMT_TWOSCOMP, 16,
|
||||
- _AF_NEXT_NUM_COMPTYPES,
|
||||
- _af_next_compression_types,
|
||||
- 0, /* maximum marker count */
|
||||
- 0, /* maximum instrument count */
|
||||
- 0, /* maximum number of loops per instrument */
|
||||
- 0, NULL
|
||||
- },
|
||||
{
|
||||
AF_FILE_WAVE,
|
||||
"MS RIFF WAVE", "Microsoft RIFF WAVE Format", "wave",
|
||||
@@ -128,144 +102,6 @@ const Unit _af_units[_AF_NUM_UNITS] =
|
||||
_AF_WAVE_NUM_INSTPARAMS,
|
||||
_af_wave_inst_params
|
||||
},
|
||||
- {
|
||||
- AF_FILE_IRCAM,
|
||||
- "BICSF", "Berkeley/IRCAM/CARL Sound Format", "bicsf",
|
||||
- true,
|
||||
- IRCAMFile::completeSetup,
|
||||
- IRCAMFile::recognize,
|
||||
- AF_SAMPFMT_TWOSCOMP, 16,
|
||||
- _AF_IRCAM_NUM_COMPTYPES,
|
||||
- _af_ircam_compression_types,
|
||||
- 0, // maximum marker count
|
||||
- 0, // maximum instrument count
|
||||
- 0, // maximum number of loops per instrument
|
||||
- 0, // number of instrument parameters
|
||||
- NULL // instrument parameters
|
||||
- },
|
||||
- {
|
||||
- AF_FILE_MPEG1BITSTREAM,
|
||||
- "MPEG", "MPEG Audio Bitstream", "mpeg",
|
||||
- false
|
||||
- },
|
||||
- {
|
||||
- AF_FILE_SOUNDDESIGNER1,
|
||||
- "Sound Designer 1", "Sound Designer 1 File Format", "sd1",
|
||||
- false
|
||||
- },
|
||||
- {
|
||||
- AF_FILE_SOUNDDESIGNER2,
|
||||
- "Sound Designer 2", "Sound Designer 2 File Format", "sd2",
|
||||
- false
|
||||
- },
|
||||
- {
|
||||
- AF_FILE_AVR,
|
||||
- "AVR", "Audio Visual Research File Format", "avr",
|
||||
- true,
|
||||
- AVRFile::completeSetup,
|
||||
- AVRFile::recognize,
|
||||
- AF_SAMPFMT_TWOSCOMP, 16,
|
||||
- 0, /* number of compression types */
|
||||
- NULL, /* compression types */
|
||||
- 0, /* maximum marker count */
|
||||
- 0, /* maximum instrument count */
|
||||
- 0, /* maximum number of loops per instrument */
|
||||
- 0, /* number of instrument parameters */
|
||||
- },
|
||||
- {
|
||||
- AF_FILE_IFF_8SVX,
|
||||
- "IFF/8SVX", "Amiga IFF/8SVX Sound File Format", "iff",
|
||||
- true,
|
||||
- IFFFile::completeSetup,
|
||||
- IFFFile::recognize,
|
||||
- AF_SAMPFMT_TWOSCOMP, 8,
|
||||
- 0, /* number of compression types */
|
||||
- NULL, /* compression types */
|
||||
- 0, /* maximum marker count */
|
||||
- 0, /* maximum instrument count */
|
||||
- 0, /* maximum number of loops per instrument */
|
||||
- 0, /* number of instrument parameters */
|
||||
- },
|
||||
- {
|
||||
- AF_FILE_SAMPLEVISION,
|
||||
- "Sample Vision", "Sample Vision File Format", "smp",
|
||||
- true,
|
||||
- SampleVisionFile::completeSetup,
|
||||
- SampleVisionFile::recognize,
|
||||
- AF_SAMPFMT_TWOSCOMP, 16,
|
||||
- 0, // number of compression types
|
||||
- NULL, // compression types
|
||||
- 0, // maximum marker count
|
||||
- 0, // maximum instrument count
|
||||
- 0, // maximum number of loops per instrument
|
||||
- 0, // number of instrument parameters
|
||||
- NULL // instrument parameters
|
||||
- },
|
||||
- {
|
||||
- AF_FILE_VOC,
|
||||
- "VOC", "Creative Voice File Format", "voc",
|
||||
- true,
|
||||
- VOCFile::completeSetup,
|
||||
- VOCFile::recognize,
|
||||
- AF_SAMPFMT_TWOSCOMP, 16,
|
||||
- _AF_VOC_NUM_COMPTYPES,
|
||||
- _af_voc_compression_types,
|
||||
- 0, // maximum marker count
|
||||
- 0, // maximum instrument count
|
||||
- 0, // maximum number of loops per instrument
|
||||
- 0, // number of instrument parameters
|
||||
- NULL // instrument parameters
|
||||
- },
|
||||
- {
|
||||
- AF_FILE_NIST_SPHERE,
|
||||
- "NIST SPHERE", "NIST SPHERE File Format", "nist",
|
||||
- true,
|
||||
- NISTFile::completeSetup,
|
||||
- NISTFile::recognize,
|
||||
- AF_SAMPFMT_TWOSCOMP, 16,
|
||||
- 0, /* number of compression types */
|
||||
- NULL, /* compression types */
|
||||
- 0, /* maximum marker count */
|
||||
- 0, /* maximum instrument count */
|
||||
- 0, /* maximum number of loops per instrument */
|
||||
- 0, /* number of instrument parameters */
|
||||
- NULL /* instrument parameters */
|
||||
- },
|
||||
- {
|
||||
- AF_FILE_SOUNDFONT2,
|
||||
- "SoundFont 2", "SoundFont 2 File Format", "sf2",
|
||||
- false
|
||||
- },
|
||||
- {
|
||||
- AF_FILE_CAF,
|
||||
- "CAF", "Core Audio Format", "caf",
|
||||
- true,
|
||||
- CAFFile::completeSetup,
|
||||
- CAFFile::recognize,
|
||||
- AF_SAMPFMT_TWOSCOMP, 16,
|
||||
- _AF_CAF_NUM_COMPTYPES,
|
||||
- _af_caf_compression_types,
|
||||
- 0, // maximum marker count
|
||||
- 0, // maximum instrument count
|
||||
- 0, // maximum number of loops per instrument
|
||||
- 0, // number of instrument parameters
|
||||
- NULL // instrument parameters
|
||||
- },
|
||||
- {
|
||||
- AF_FILE_FLAC,
|
||||
- "FLAC", "Free Lossless Audio Codec", "flac",
|
||||
- true,
|
||||
- FLACFile::completeSetup,
|
||||
- FLACFile::recognize,
|
||||
- AF_SAMPFMT_TWOSCOMP, 16,
|
||||
- _AF_FLAC_NUM_COMPTYPES,
|
||||
- _af_flac_compression_types,
|
||||
- 0, // maximum marker count
|
||||
- 0, // maximum instrument count
|
||||
- 0, // maximum number of loops per instrument
|
||||
- 0, // number of instrument parameters
|
||||
- NULL // instrument parameters
|
||||
- }
|
||||
};
|
||||
|
||||
const CompressionUnit _af_compression[_AF_NUM_COMPRESSION] =
|
||||
@@ -309,19 +145,6 @@ const CompressionUnit _af_compression[_AF_NUM_COMPRESSION] =
|
||||
_af_g711_format_ok,
|
||||
_AFg711initcompress, _AFg711initdecompress
|
||||
},
|
||||
- {
|
||||
- AF_COMPRESSION_IMA,
|
||||
- true,
|
||||
- "ima4", /* label */
|
||||
- "IMA ADPCM", /* short name */
|
||||
- "IMA DVI ADPCM",
|
||||
- 4.0,
|
||||
- AF_SAMPFMT_TWOSCOMP, 16,
|
||||
- true, /* needsRebuffer */
|
||||
- false, /* multiple_of */
|
||||
- _af_ima_adpcm_format_ok,
|
||||
- _af_ima_adpcm_init_compress, _af_ima_adpcm_init_decompress
|
||||
- },
|
||||
{
|
||||
AF_COMPRESSION_MS_ADPCM,
|
||||
true,
|
||||
@@ -335,34 +158,4 @@ const CompressionUnit _af_compression[_AF_NUM_COMPRESSION] =
|
||||
_af_ms_adpcm_format_ok,
|
||||
_af_ms_adpcm_init_compress, _af_ms_adpcm_init_decompress
|
||||
},
|
||||
- {
|
||||
- AF_COMPRESSION_FLAC,
|
||||
-#if ENABLE(FLAC)
|
||||
- true,
|
||||
-#else
|
||||
- false,
|
||||
-#endif
|
||||
- "flac", // label
|
||||
- "FLAC", // short name
|
||||
- "Free Lossless Audio Codec",
|
||||
- 1.0,
|
||||
- AF_SAMPFMT_TWOSCOMP, 16,
|
||||
- false, // needsRebuffer
|
||||
- false, // multiple_of
|
||||
- _af_flac_format_ok,
|
||||
- _af_flac_init_compress, _af_flac_init_decompress
|
||||
- },
|
||||
- {
|
||||
- AF_COMPRESSION_ALAC,
|
||||
- true,
|
||||
- "alac", // label
|
||||
- "ALAC", // short name
|
||||
- "Apple Lossless Audio Codec",
|
||||
- 1.0,
|
||||
- AF_SAMPFMT_TWOSCOMP, 16,
|
||||
- true, // needsRebuffer
|
||||
- false, // multiple_of
|
||||
- _af_alac_format_ok,
|
||||
- _af_alac_init_compress, _af_alac_init_decompress
|
||||
- }
|
||||
};
|
||||
@@ -63,16 +63,6 @@ file_list = [
|
||||
'Commands/CDirectiveMessage.h',
|
||||
'Commands/CDirectiveMessage.cpp',
|
||||
'Commands/CommandSequence.cpp',
|
||||
'Core/ELF/ElfFile.cpp',
|
||||
'Core/ELF/ElfRelocator.cpp',
|
||||
'Core/Assembler.cpp',
|
||||
'Core/Common.cpp',
|
||||
'Core/Expression.cpp',
|
||||
'Core/ExpressionFunctions.cpp',
|
||||
'Core/FileManager.cpp',
|
||||
'Core/Misc.cpp',
|
||||
'Core/SymbolData.cpp',
|
||||
'Core/SymbolTable.cpp',
|
||||
'Parser/DirectivesParser.cpp',
|
||||
'Parser/ExpressionParser.cpp',
|
||||
'Parser/Parser.cpp',
|
||||
@@ -84,6 +74,16 @@ file_list = [
|
||||
'Util/Util.cpp',
|
||||
'Main/CommandLineInterface.h',
|
||||
'Main/CommandLineInterface.cpp',
|
||||
'Core/ELF/ElfFile.cpp',
|
||||
'Core/ELF/ElfRelocator.cpp',
|
||||
'Core/Assembler.cpp',
|
||||
'Core/Common.cpp',
|
||||
'Core/Expression.cpp',
|
||||
'Core/ExpressionFunctions.cpp',
|
||||
'Core/FileManager.cpp',
|
||||
'Core/Misc.cpp',
|
||||
'Core/SymbolData.cpp',
|
||||
'Core/SymbolTable.cpp',
|
||||
'Main/main.cpp',
|
||||
]
|
||||
|
||||
|
||||
136
tools/util/generate_audiofile_cpp.py
Normal file
136
tools/util/generate_audiofile_cpp.py
Normal file
@@ -0,0 +1,136 @@
|
||||
#!/usr/bin/env python
|
||||
|
||||
import os
|
||||
import re
|
||||
import sys
|
||||
|
||||
file_list = [
|
||||
'Features.h',
|
||||
'Compiler.h',
|
||||
'error.h',
|
||||
'extended.h',
|
||||
'compression.h',
|
||||
'aupvinternal.h',
|
||||
'aupvlist.h',
|
||||
'audiofile.h',
|
||||
'afinternal.h',
|
||||
'byteorder.h',
|
||||
'AudioFormat.h',
|
||||
'debug.h',
|
||||
'util.h',
|
||||
'units.h',
|
||||
'UUID.h',
|
||||
'Shared.h',
|
||||
'Buffer.h',
|
||||
'File.h',
|
||||
'FileHandle.h',
|
||||
'Instrument.h',
|
||||
'Track.h',
|
||||
'Marker.h',
|
||||
'Setup.h',
|
||||
'Tag.h',
|
||||
'PacketTable.h',
|
||||
'pcm.h',
|
||||
'g711.h',
|
||||
'af_vfs.h',
|
||||
'Raw.h',
|
||||
'WAVE.h',
|
||||
'SampleVision.h',
|
||||
'modules/Module.h',
|
||||
'modules/ModuleState.h',
|
||||
'modules/SimpleModule.h',
|
||||
'modules/FileModule.h',
|
||||
'modules/RebufferModule.h',
|
||||
'modules/BlockCodec.h',
|
||||
'modules/BlockCodec.cpp',
|
||||
'modules/FileModule.cpp',
|
||||
'modules/G711.h',
|
||||
'modules/G711.cpp',
|
||||
'modules/Module.cpp',
|
||||
'modules/ModuleState.cpp',
|
||||
'modules/MSADPCM.h',
|
||||
'modules/MSADPCM.cpp',
|
||||
'modules/PCM.h',
|
||||
'modules/PCM.cpp',
|
||||
'modules/SimpleModule.cpp',
|
||||
'modules/RebufferModule.cpp',
|
||||
'AIFF.h',
|
||||
'AIFF.cpp',
|
||||
'AudioFormat.cpp',
|
||||
'Buffer.cpp',
|
||||
'File.cpp',
|
||||
'FileHandle.cpp',
|
||||
'Instrument.cpp',
|
||||
'Loop.cpp',
|
||||
'Marker.cpp',
|
||||
'Miscellaneous.cpp',
|
||||
'PacketTable.cpp',
|
||||
'Raw.cpp',
|
||||
'Setup.cpp',
|
||||
'Track.cpp',
|
||||
'UUID.cpp',
|
||||
'WAVE.cpp',
|
||||
'aes.cpp',
|
||||
'af_vfs.cpp',
|
||||
'aupv.c',
|
||||
'compression.cpp',
|
||||
'data.cpp',
|
||||
'debug.cpp',
|
||||
'error.c',
|
||||
'extended.c',
|
||||
'format.cpp',
|
||||
'g711.c',
|
||||
'openclose.cpp',
|
||||
'pcm.cpp',
|
||||
'query.cpp',
|
||||
'units.cpp',
|
||||
'util.cpp',
|
||||
]
|
||||
|
||||
file_header = \
|
||||
"""// libaudiofile b62c902
|
||||
// https://github.com/mpruett/audiofile
|
||||
// To simplify compilation, all files have been concatenated into one.
|
||||
// Support for all formats except WAVE, AIFF(C) and RAW has been stripped out.
|
||||
"""
|
||||
|
||||
prepend_defs = \
|
||||
"""#define HAVE_UNISTD_H 1
|
||||
#if defined __BIG_ENDIAN__
|
||||
# define WORDS_BIGENDIAN 1
|
||||
#endif
|
||||
#include <stdlib.h>
|
||||
"""
|
||||
|
||||
def banned(line):
|
||||
return '#pragma once' in line or '#include "' in line or '#include <config.h>' in line
|
||||
|
||||
def cat_file(fout, fin_name):
|
||||
with open(fin_name) as fin:
|
||||
lines = fin.readlines()
|
||||
lines = [l.rstrip() for l in lines if not banned(l)]
|
||||
for l in lines:
|
||||
fout.write(l + '\n')
|
||||
fout.write('\n')
|
||||
|
||||
def combine_libaudiofile(fout_name, libaudiofile_path):
|
||||
with open(fout_name, 'w') as fout:
|
||||
fout.write(file_header + "\n")
|
||||
fout.write("/*\n")
|
||||
cat_file(fout, os.path.join(libaudiofile_path, '../COPYING'))
|
||||
fout.write("*/\n\n")
|
||||
fout.write(prepend_defs + "\n")
|
||||
for f in file_list:
|
||||
fout.write(f"// file: {f}\n")
|
||||
cat_file(fout, os.path.join(libaudiofile_path, f))
|
||||
|
||||
def main():
|
||||
if len(sys.argv) > 1 and sys.argv[1] in ['-h', '--help']:
|
||||
print('Usage: generate_audiofile_cpp.py [output_filename] [libaudiofile_src_dir]')
|
||||
print('Defaults: [output_filename = "audiofile.cpp"] [libaudiofile_src_dir = "./audiofile/libaudiofile"]')
|
||||
return
|
||||
fout_name = sys.argv[1] if len(sys.argv) > 1 else 'audiofile.cpp'
|
||||
libaudiofile_path = sys.argv[2] if len(sys.argv) > 2 else './audiofile/libaudiofile'
|
||||
combine_libaudiofile(fout_name, os.path.expanduser(libaudiofile_path))
|
||||
|
||||
main()
|
||||
Reference in New Issue
Block a user