Updated DUMB

This commit is contained in:
Chris Moeller 2013-09-27 20:24:23 -07:00
parent d969f5a6a7
commit 17682d4397
256 changed files with 47317 additions and 35807 deletions

View file

@ -350,9 +350,15 @@
/* Begin PBXProject section */
0867D690FE84028FC02AAC07 /* Project object */ = {
isa = PBXProject;
attributes = {
};
buildConfigurationList = 1DEB91B108733DA50010E9CD /* Build configuration list for PBXProject "CogAudio" */;
compatibilityVersion = "Xcode 3.0";
developmentRegion = English;
hasScannedForEncodings = 1;
knownRegions = (
en,
);
mainGroup = 0867D691FE84028FC02AAC07 /* CogAudio */;
productRefGroup = 034768DFFF38A50411DB9C8B /* Products */;
projectDirPath = "";
@ -405,6 +411,7 @@
1DEB91AE08733DA50010E9CD /* Debug */ = {
isa = XCBuildConfiguration;
buildSettings = {
ARCHS = "$(ARCHS_STANDARD)";
COPY_PHASE_STRIP = NO;
DYLIB_COMPATIBILITY_VERSION = 1;
DYLIB_CURRENT_VERSION = 1;
@ -421,6 +428,7 @@
INSTALL_PATH = "@executable_path/../Frameworks";
OTHER_LDFLAGS = "";
PRODUCT_NAME = CogAudio;
SDKROOT = macosx10.6;
WARNING_LDFLAGS = "";
WRAPPER_EXTENSION = framework;
ZERO_LINK = YES;
@ -431,8 +439,8 @@
isa = XCBuildConfiguration;
buildSettings = {
ARCHS = (
ppc,
i386,
ppc,
);
DYLIB_COMPATIBILITY_VERSION = 1;
DYLIB_CURRENT_VERSION = 1;
@ -447,6 +455,7 @@
INSTALL_PATH = "@executable_path/../Frameworks";
OTHER_LDFLAGS = "";
PRODUCT_NAME = CogAudio;
SDKROOT = macosx10.6;
WARNING_LDFLAGS = "";
WRAPPER_EXTENSION = framework;
};

View file

@ -87,7 +87,6 @@
17A8F6860D6A7FCA0095DA13 /* repeat_none.png in Resources */ = {isa = PBXBuildFile; fileRef = 17A8F6830D6A7FCA0095DA13 /* repeat_none.png */; };
17A8F6870D6A7FCA0095DA13 /* repeat_one.png in Resources */ = {isa = PBXBuildFile; fileRef = 17A8F6840D6A7FCA0095DA13 /* repeat_one.png */; };
17A8F71A0D6A89730095DA13 /* repeat_album.png in Resources */ = {isa = PBXBuildFile; fileRef = 17A8F7190D6A89730095DA13 /* repeat_album.png */; };
17B6FA7F0D48225300C3BEF1 /* Sparkle.framework in CopyFiles */ = {isa = PBXBuildFile; fileRef = 17BF2B270CDD77EB007E1295 /* Sparkle.framework */; };
17B7CF5C0F5A05EE00A47027 /* pauseBadge.png in Resources */ = {isa = PBXBuildFile; fileRef = 17B7CF590F5A05EE00A47027 /* pauseBadge.png */; };
17B7CF5D0F5A05EE00A47027 /* playBadge.png in Resources */ = {isa = PBXBuildFile; fileRef = 17B7CF5A0F5A05EE00A47027 /* playBadge.png */; };
17B7CF5E0F5A05EE00A47027 /* stopBadge.png in Resources */ = {isa = PBXBuildFile; fileRef = 17B7CF5B0F5A05EE00A47027 /* stopBadge.png */; };
@ -97,7 +96,6 @@
17BB5CFA0B8A86350009ACB1 /* CoreAudio.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 17BB5CF70B8A86350009ACB1 /* CoreAudio.framework */; };
17BB5CFB0B8A86350009ACB1 /* CoreAudioKit.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 17BB5CF80B8A86350009ACB1 /* CoreAudioKit.framework */; };
17BB5EA60B8A87850009ACB1 /* IOKit.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 17BB5EA50B8A87850009ACB1 /* IOKit.framework */; };
17BF2B280CDD7802007E1295 /* Sparkle.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 17BF2B270CDD77EB007E1295 /* Sparkle.framework */; };
17C809910C3BD201005707C4 /* WavPack.bundle in CopyFiles */ = {isa = PBXBuildFile; fileRef = 17C808C80C3BD1DD005707C4 /* WavPack.bundle */; };
17C809920C3BD206005707C4 /* Vorbis.bundle in CopyFiles */ = {isa = PBXBuildFile; fileRef = 17C808BF0C3BD1D2005707C4 /* Vorbis.bundle */; };
17C809930C3BD21D005707C4 /* TagLib.bundle in CopyFiles */ = {isa = PBXBuildFile; fileRef = 17C808B60C3BD1C5005707C4 /* TagLib.bundle */; };
@ -193,20 +191,6 @@
remoteGlobalIDString = 8D5B49AC048680CD000E48DA;
remoteInfo = "AudioOverload Plugin";
};
17BF2B260CDD77EB007E1295 /* PBXContainerItemProxy */ = {
isa = PBXContainerItemProxy;
containerPortal = 17BF2B1F0CDD77EB007E1295 /* Sparkle.xcodeproj */;
proxyType = 2;
remoteGlobalIDString = 8DC2EF5B0486A6940098B216;
remoteInfo = Sparkle;
};
17BF2B390CDD7827007E1295 /* PBXContainerItemProxy */ = {
isa = PBXContainerItemProxy;
containerPortal = 17BF2B1F0CDD77EB007E1295 /* Sparkle.xcodeproj */;
proxyType = 1;
remoteGlobalIDString = 8DC2EF4F0486A6940098B216;
remoteInfo = Sparkle;
};
17C808780C3BD167005707C4 /* PBXContainerItemProxy */ = {
isa = PBXContainerItemProxy;
containerPortal = 17C808710C3BD167005707C4 /* FileSource.xcodeproj */;
@ -518,7 +502,6 @@
dstPath = "";
dstSubfolderSpec = 10;
files = (
17B6FA7F0D48225300C3BEF1 /* Sparkle.framework in CopyFiles */,
17F561400C3BD4F30019975C /* CogAudio.framework in CopyFiles */,
170680840B950164006BA573 /* Growl.framework in CopyFiles */,
);
@ -661,7 +644,6 @@
17BB5CF70B8A86350009ACB1 /* CoreAudio.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = CoreAudio.framework; path = /System/Library/Frameworks/CoreAudio.framework; sourceTree = "<absolute>"; };
17BB5CF80B8A86350009ACB1 /* CoreAudioKit.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = CoreAudioKit.framework; path = /System/Library/Frameworks/CoreAudioKit.framework; sourceTree = "<absolute>"; };
17BB5EA50B8A87850009ACB1 /* IOKit.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = IOKit.framework; path = /System/Library/Frameworks/IOKit.framework; sourceTree = "<absolute>"; };
17BF2B1F0CDD77EB007E1295 /* Sparkle.xcodeproj */ = {isa = PBXFileReference; lastKnownFileType = "wrapper.pb-project"; name = Sparkle.xcodeproj; path = Frameworks/Sparkle/Sparkle.xcodeproj; sourceTree = "<group>"; };
17C808660C3BD0F8005707C4 /* CoreAudio.xcodeproj */ = {isa = PBXFileReference; lastKnownFileType = "wrapper.pb-project"; name = CoreAudio.xcodeproj; path = Plugins/CoreAudio/CoreAudio.xcodeproj; sourceTree = SOURCE_ROOT; };
17C808710C3BD167005707C4 /* FileSource.xcodeproj */ = {isa = PBXFileReference; lastKnownFileType = "wrapper.pb-project"; name = FileSource.xcodeproj; path = Plugins/FileSource/FileSource.xcodeproj; sourceTree = "<group>"; };
17C8087A0C3BD173005707C4 /* Flac.xcodeproj */ = {isa = PBXFileReference; lastKnownFileType = "wrapper.pb-project"; name = Flac.xcodeproj; path = Plugins/Flac/Flac.xcodeproj; sourceTree = "<group>"; };
@ -778,7 +760,6 @@
isa = PBXFrameworksBuildPhase;
buildActionMask = 2147483647;
files = (
17BF2B280CDD7802007E1295 /* Sparkle.framework in Frameworks */,
8D11072F0486CEB800E47090 /* Cocoa.framework in Frameworks */,
8E6889240AAA403C00AD3950 /* Carbon.framework in Frameworks */,
17BB5CED0B8A86010009ACB1 /* AudioToolbox.framework in Frameworks */,
@ -826,7 +807,6 @@
1058C7A0FEA54F0111CA2CBB /* Linked Frameworks */ = {
isa = PBXGroup;
children = (
17BF2B1F0CDD77EB007E1295 /* Sparkle.xcodeproj */,
17F5612A0C3BD4DC0019975C /* CogAudio.xcodeproj */,
170680620B950158006BA573 /* Growl.framework */,
8E6889230AAA403C00AD3950 /* Carbon.framework */,
@ -1036,14 +1016,6 @@
name = Products;
sourceTree = "<group>";
};
17BF2B200CDD77EB007E1295 /* Products */ = {
isa = PBXGroup;
children = (
17BF2B270CDD77EB007E1295 /* Sparkle.framework */,
);
name = Products;
sourceTree = "<group>";
};
17C808720C3BD167005707C4 /* Products */ = {
isa = PBXGroup;
children = (
@ -1511,7 +1483,6 @@
17F3BB8B0CBC566200864489 /* PBXTargetDependency */,
17C8F44C0CBEDD37008D969D /* PBXTargetDependency */,
17C8F7DA0CBEF3F9008D969D /* PBXTargetDependency */,
17BF2B3A0CDD7827007E1295 /* PBXTargetDependency */,
17643CBC0D5BD44900F0A9FE /* PBXTargetDependency */,
17B7CF960F5A0A3700A47027 /* PBXTargetDependency */,
);
@ -1526,8 +1497,11 @@
/* Begin PBXProject section */
29B97313FDCFA39411CA2CEA /* Project object */ = {
isa = PBXProject;
attributes = {
};
buildConfigurationList = C01FCF4E08A954540054247B /* Build configuration list for PBXProject "Cog" */;
compatibilityVersion = "Xcode 3.0";
developmentRegion = English;
hasScannedForEncodings = 1;
knownRegions = (
English,
@ -1610,10 +1584,6 @@
ProductGroup = 17C808A80C3BD1BA005707C4 /* Products */;
ProjectRef = 17C808A70C3BD1BA005707C4 /* Shorten.xcodeproj */;
},
{
ProductGroup = 17BF2B200CDD77EB007E1295 /* Products */;
ProjectRef = 17BF2B1F0CDD77EB007E1295 /* Sparkle.xcodeproj */;
},
{
ProductGroup = 17C808B10C3BD1C5005707C4 /* Products */;
ProjectRef = 17C808B00C3BD1C5005707C4 /* TagLib.xcodeproj */;
@ -1646,13 +1616,6 @@
remoteRef = 17B7CF7B0F5A09FD00A47027 /* PBXContainerItemProxy */;
sourceTree = BUILT_PRODUCTS_DIR;
};
17BF2B270CDD77EB007E1295 /* Sparkle.framework */ = {
isa = PBXReferenceProxy;
fileType = wrapper.framework;
path = Sparkle.framework;
remoteRef = 17BF2B260CDD77EB007E1295 /* PBXContainerItemProxy */;
sourceTree = BUILT_PRODUCTS_DIR;
};
17C808790C3BD167005707C4 /* FileSource.bundle */ = {
isa = PBXReferenceProxy;
fileType = wrapper.cfbundle;
@ -1958,11 +1921,6 @@
name = "AudioOverload Plugin";
targetProxy = 17B7CF950F5A0A3700A47027 /* PBXContainerItemProxy */;
};
17BF2B3A0CDD7827007E1295 /* PBXTargetDependency */ = {
isa = PBXTargetDependency;
name = Sparkle;
targetProxy = 17BF2B390CDD7827007E1295 /* PBXContainerItemProxy */;
};
17C8097E0C3BD1F5005707C4 /* PBXTargetDependency */ = {
isa = PBXTargetDependency;
name = Musepack;
@ -2166,9 +2124,11 @@
OTHER_LDFLAGS = (
"-weak_framework",
CogAudio,
"-undefined",
dynamic_lookup,
);
PRODUCT_NAME = Cog;
SDKROOT = "$(DEVELOPER_SDK_DIR)/MacOSX10.5.sdk";
SDKROOT = macosx10.6;
WRAPPER_EXTENSION = app;
ZERO_LINK = NO;
};
@ -2202,9 +2162,11 @@
OTHER_LDFLAGS = (
"-weak_framework",
CogAudio,
"-undefined",
dynamic_lookup,
);
PRODUCT_NAME = Cog;
SDKROOT = "$(DEVELOPER_SDK_DIR)/MacOSX10.5.sdk";
SDKROOT = macosx10.6;
WRAPPER_EXTENSION = app;
};
name = Release;

View file

@ -441,9 +441,15 @@
/* Begin PBXProject section */
0867D690FE84028FC02AAC07 /* Project object */ = {
isa = PBXProject;
attributes = {
};
buildConfigurationList = 1DEB91B108733DA50010E9CD /* Build configuration list for PBXProject "AudioOverload" */;
compatibilityVersion = "Xcode 3.1";
developmentRegion = English;
hasScannedForEncodings = 1;
knownRegions = (
en,
);
mainGroup = 0867D691FE84028FC02AAC07 /* AudioOverload */;
productRefGroup = 034768DFFF38A50411DB9C8B /* Products */;
projectDirPath = "";
@ -522,6 +528,7 @@
isa = XCBuildConfiguration;
buildSettings = {
ALWAYS_SEARCH_USER_PATHS = NO;
ARCHS = "$(ARCHS_STANDARD)";
COPY_PHASE_STRIP = NO;
DYLIB_COMPATIBILITY_VERSION = 1;
DYLIB_CURRENT_VERSION = 1;
@ -545,6 +552,7 @@
INFOPLIST_FILE = Info.plist;
INSTALL_PATH = "@loader_path/../Frameworks";
PRODUCT_NAME = AudioOverload;
SDKROOT = macosx10.6;
USE_HEADERMAP = NO;
WRAPPER_EXTENSION = framework;
};
@ -554,6 +562,10 @@
isa = XCBuildConfiguration;
buildSettings = {
ALWAYS_SEARCH_USER_PATHS = NO;
ARCHS = (
i386,
ppc,
);
DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym";
DYLIB_COMPATIBILITY_VERSION = 1;
DYLIB_CURRENT_VERSION = 1;
@ -574,6 +586,7 @@
INFOPLIST_FILE = Info.plist;
INSTALL_PATH = "@loader_path/../Frameworks";
PRODUCT_NAME = AudioOverload;
SDKROOT = macosx10.6;
USE_HEADERMAP = NO;
WRAPPER_EXTENSION = framework;
};
@ -589,7 +602,7 @@
GCC_WARN_UNUSED_VARIABLE = YES;
ONLY_ACTIVE_ARCH = YES;
PREBINDING = NO;
SDKROOT = macosx10.5;
SDKROOT = macosx10.6;
SYMROOT = ../../build;
};
name = Debug;
@ -602,7 +615,7 @@
GCC_WARN_ABOUT_RETURN_TYPE = YES;
GCC_WARN_UNUSED_VARIABLE = YES;
PREBINDING = NO;
SDKROOT = macosx10.5;
SDKROOT = macosx10.6;
SYMROOT = ../../build;
};
name = Release;

View file

@ -540,7 +540,7 @@ static void *MAINThread(int samp2run)
lastch=ch;
// lastns=ns; // changemeback
return;
return 0;
}
}

View file

@ -9,7 +9,7 @@
/* Begin PBXBuildFile section */
17C8F63E0CBEE797008D969D /* dumb.h in Headers */ = {isa = PBXBuildFile; fileRef = 17C8F60C0CBEE797008D969D /* dumb.h */; settings = {ATTRIBUTES = (Public, ); }; };
17C8F63F0CBEE797008D969D /* dumb.h in Headers */ = {isa = PBXBuildFile; fileRef = 17C8F60E0CBEE797008D969D /* dumb.h */; };
17C8F6400CBEE797008D969D /* it.h in Headers */ = {isa = PBXBuildFile; fileRef = 17C8F60F0CBEE797008D969D /* it.h */; };
17C8F6400CBEE797008D969D /* it.h in Headers */ = {isa = PBXBuildFile; fileRef = 17C8F60F0CBEE797008D969D /* it.h */; settings = {ATTRIBUTES = (Public, ); }; };
17C8F6410CBEE797008D969D /* atexit.c in Sources */ = {isa = PBXBuildFile; fileRef = 17C8F6120CBEE797008D969D /* atexit.c */; };
17C8F6420CBEE797008D969D /* duhlen.c in Sources */ = {isa = PBXBuildFile; fileRef = 17C8F6130CBEE797008D969D /* duhlen.c */; };
17C8F6430CBEE797008D969D /* duhtag.c in Sources */ = {isa = PBXBuildFile; fileRef = 17C8F6140CBEE797008D969D /* duhtag.c */; };
@ -49,6 +49,61 @@
17C8F6680CBEE797008D969D /* readxm.c in Sources */ = {isa = PBXBuildFile; fileRef = 17C8F63B0CBEE797008D969D /* readxm.c */; };
17C8F6690CBEE797008D969D /* readxm2.c in Sources */ = {isa = PBXBuildFile; fileRef = 17C8F63C0CBEE797008D969D /* readxm2.c */; };
17C8F66A0CBEE797008D969D /* xmeffect.c in Sources */ = {isa = PBXBuildFile; fileRef = 17C8F63D0CBEE797008D969D /* xmeffect.c */; };
8370B62617F60FE2001A4D7A /* barray.h in Headers */ = {isa = PBXBuildFile; fileRef = 8370B61E17F60FE2001A4D7A /* barray.h */; settings = {ATTRIBUTES = (Private, ); }; };
8370B62817F60FE2001A4D7A /* dumbfile.h in Headers */ = {isa = PBXBuildFile; fileRef = 8370B62017F60FE2001A4D7A /* dumbfile.h */; };
8370B62A17F60FE2001A4D7A /* lpc.h in Headers */ = {isa = PBXBuildFile; fileRef = 8370B62217F60FE2001A4D7A /* lpc.h */; };
8370B62B17F60FE2001A4D7A /* riff.h in Headers */ = {isa = PBXBuildFile; fileRef = 8370B62317F60FE2001A4D7A /* riff.h */; };
8370B62C17F60FE2001A4D7A /* stack_alloc.h in Headers */ = {isa = PBXBuildFile; fileRef = 8370B62417F60FE2001A4D7A /* stack_alloc.h */; };
8370B62D17F60FE2001A4D7A /* tarray.h in Headers */ = {isa = PBXBuildFile; fileRef = 8370B62517F60FE2001A4D7A /* tarray.h */; settings = {ATTRIBUTES = (Private, ); }; };
8370B63417F61001001A4D7A /* barray.c in Sources */ = {isa = PBXBuildFile; fileRef = 8370B62E17F61001001A4D7A /* barray.c */; };
8370B63517F61001001A4D7A /* blip_buf.c in Sources */ = {isa = PBXBuildFile; fileRef = 8370B62F17F61001001A4D7A /* blip_buf.c */; };
8370B63617F61001001A4D7A /* lanczos_resampler.c in Sources */ = {isa = PBXBuildFile; fileRef = 8370B63017F61001001A4D7A /* lanczos_resampler.c */; };
8370B63717F61001001A4D7A /* lpc.c in Sources */ = {isa = PBXBuildFile; fileRef = 8370B63117F61001001A4D7A /* lpc.c */; };
8370B63817F61001001A4D7A /* riff.c in Sources */ = {isa = PBXBuildFile; fileRef = 8370B63217F61001001A4D7A /* riff.c */; };
8370B63917F61001001A4D7A /* tarray.c in Sources */ = {isa = PBXBuildFile; fileRef = 8370B63317F61001001A4D7A /* tarray.c */; };
8370B66317F61038001A4D7A /* load669.c in Sources */ = {isa = PBXBuildFile; fileRef = 8370B63A17F61038001A4D7A /* load669.c */; };
8370B66417F61038001A4D7A /* load6692.c in Sources */ = {isa = PBXBuildFile; fileRef = 8370B63B17F61038001A4D7A /* load6692.c */; };
8370B66517F61038001A4D7A /* loadamf.c in Sources */ = {isa = PBXBuildFile; fileRef = 8370B63C17F61038001A4D7A /* loadamf.c */; };
8370B66617F61038001A4D7A /* loadamf2.c in Sources */ = {isa = PBXBuildFile; fileRef = 8370B63D17F61038001A4D7A /* loadamf2.c */; };
8370B66717F61038001A4D7A /* loadany.c in Sources */ = {isa = PBXBuildFile; fileRef = 8370B63E17F61038001A4D7A /* loadany.c */; };
8370B66817F61038001A4D7A /* loadany2.c in Sources */ = {isa = PBXBuildFile; fileRef = 8370B63F17F61038001A4D7A /* loadany2.c */; };
8370B66917F61038001A4D7A /* loadasy.c in Sources */ = {isa = PBXBuildFile; fileRef = 8370B64017F61038001A4D7A /* loadasy.c */; };
8370B66A17F61038001A4D7A /* loadasy2.c in Sources */ = {isa = PBXBuildFile; fileRef = 8370B64117F61038001A4D7A /* loadasy2.c */; };
8370B66B17F61038001A4D7A /* loadmtm.c in Sources */ = {isa = PBXBuildFile; fileRef = 8370B64217F61038001A4D7A /* loadmtm.c */; };
8370B66C17F61038001A4D7A /* loadmtm2.c in Sources */ = {isa = PBXBuildFile; fileRef = 8370B64317F61038001A4D7A /* loadmtm2.c */; };
8370B66D17F61038001A4D7A /* loadokt.c in Sources */ = {isa = PBXBuildFile; fileRef = 8370B64417F61038001A4D7A /* loadokt.c */; };
8370B66E17F61038001A4D7A /* loadokt2.c in Sources */ = {isa = PBXBuildFile; fileRef = 8370B64517F61038001A4D7A /* loadokt2.c */; };
8370B66F17F61038001A4D7A /* loadoldpsm.c in Sources */ = {isa = PBXBuildFile; fileRef = 8370B64617F61038001A4D7A /* loadoldpsm.c */; };
8370B67017F61038001A4D7A /* loadoldpsm2.c in Sources */ = {isa = PBXBuildFile; fileRef = 8370B64717F61038001A4D7A /* loadoldpsm2.c */; };
8370B67117F61038001A4D7A /* loadpsm.c in Sources */ = {isa = PBXBuildFile; fileRef = 8370B64817F61038001A4D7A /* loadpsm.c */; };
8370B67217F61038001A4D7A /* loadpsm2.c in Sources */ = {isa = PBXBuildFile; fileRef = 8370B64917F61038001A4D7A /* loadpsm2.c */; };
8370B67317F61038001A4D7A /* loadptm.c in Sources */ = {isa = PBXBuildFile; fileRef = 8370B64A17F61038001A4D7A /* loadptm.c */; };
8370B67417F61038001A4D7A /* loadptm2.c in Sources */ = {isa = PBXBuildFile; fileRef = 8370B64B17F61038001A4D7A /* loadptm2.c */; };
8370B67517F61038001A4D7A /* loadriff.c in Sources */ = {isa = PBXBuildFile; fileRef = 8370B64C17F61038001A4D7A /* loadriff.c */; };
8370B67617F61038001A4D7A /* loadriff2.c in Sources */ = {isa = PBXBuildFile; fileRef = 8370B64D17F61038001A4D7A /* loadriff2.c */; };
8370B67717F61038001A4D7A /* loadstm.c in Sources */ = {isa = PBXBuildFile; fileRef = 8370B64E17F61038001A4D7A /* loadstm.c */; };
8370B67817F61038001A4D7A /* loadstm2.c in Sources */ = {isa = PBXBuildFile; fileRef = 8370B64F17F61038001A4D7A /* loadstm2.c */; };
8370B67917F61038001A4D7A /* ptmeffect.c in Sources */ = {isa = PBXBuildFile; fileRef = 8370B65017F61038001A4D7A /* ptmeffect.c */; };
8370B67A17F61038001A4D7A /* read669.c in Sources */ = {isa = PBXBuildFile; fileRef = 8370B65117F61038001A4D7A /* read669.c */; };
8370B67B17F61038001A4D7A /* read6692.c in Sources */ = {isa = PBXBuildFile; fileRef = 8370B65217F61038001A4D7A /* read6692.c */; };
8370B67C17F61038001A4D7A /* readam.c in Sources */ = {isa = PBXBuildFile; fileRef = 8370B65317F61038001A4D7A /* readam.c */; };
8370B67D17F61038001A4D7A /* readamf.c in Sources */ = {isa = PBXBuildFile; fileRef = 8370B65417F61038001A4D7A /* readamf.c */; };
8370B67E17F61038001A4D7A /* readamf2.c in Sources */ = {isa = PBXBuildFile; fileRef = 8370B65517F61038001A4D7A /* readamf2.c */; };
8370B67F17F61038001A4D7A /* readany.c in Sources */ = {isa = PBXBuildFile; fileRef = 8370B65617F61038001A4D7A /* readany.c */; };
8370B68017F61038001A4D7A /* readany2.c in Sources */ = {isa = PBXBuildFile; fileRef = 8370B65717F61038001A4D7A /* readany2.c */; };
8370B68117F61038001A4D7A /* readasy.c in Sources */ = {isa = PBXBuildFile; fileRef = 8370B65817F61038001A4D7A /* readasy.c */; };
8370B68217F61038001A4D7A /* readdsmf.c in Sources */ = {isa = PBXBuildFile; fileRef = 8370B65917F61038001A4D7A /* readdsmf.c */; };
8370B68317F61038001A4D7A /* readmtm.c in Sources */ = {isa = PBXBuildFile; fileRef = 8370B65A17F61038001A4D7A /* readmtm.c */; };
8370B68417F61038001A4D7A /* readokt.c in Sources */ = {isa = PBXBuildFile; fileRef = 8370B65B17F61038001A4D7A /* readokt.c */; };
8370B68517F61038001A4D7A /* readokt2.c in Sources */ = {isa = PBXBuildFile; fileRef = 8370B65C17F61038001A4D7A /* readokt2.c */; };
8370B68617F61038001A4D7A /* readoldpsm.c in Sources */ = {isa = PBXBuildFile; fileRef = 8370B65D17F61038001A4D7A /* readoldpsm.c */; };
8370B68717F61038001A4D7A /* readpsm.c in Sources */ = {isa = PBXBuildFile; fileRef = 8370B65E17F61038001A4D7A /* readpsm.c */; };
8370B68817F61038001A4D7A /* readptm.c in Sources */ = {isa = PBXBuildFile; fileRef = 8370B65F17F61038001A4D7A /* readptm.c */; };
8370B68917F61038001A4D7A /* readriff.c in Sources */ = {isa = PBXBuildFile; fileRef = 8370B66017F61038001A4D7A /* readriff.c */; };
8370B68A17F61038001A4D7A /* readstm.c in Sources */ = {isa = PBXBuildFile; fileRef = 8370B66117F61038001A4D7A /* readstm.c */; };
8370B68B17F61038001A4D7A /* readstm2.c in Sources */ = {isa = PBXBuildFile; fileRef = 8370B66217F61038001A4D7A /* readstm2.c */; };
8370B7E917F62A40001A4D7A /* blip_buf.h in Headers */ = {isa = PBXBuildFile; fileRef = 8370B7E717F62A40001A4D7A /* blip_buf.h */; };
8370B7EA17F62A40001A4D7A /* lanczos_resampler.h in Headers */ = {isa = PBXBuildFile; fileRef = 8370B7E817F62A40001A4D7A /* lanczos_resampler.h */; };
8DC2EF530486A6940098B216 /* InfoPlist.strings in Resources */ = {isa = PBXBuildFile; fileRef = 089C1666FE841158C02AAC07 /* InfoPlist.strings */; };
8DC2EF570486A6940098B216 /* Cocoa.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 1058C7B1FEA5585E11CA2CBB /* Cocoa.framework */; };
/* End PBXBuildFile section */
@ -103,6 +158,61 @@
17C8F63B0CBEE797008D969D /* readxm.c */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.c; path = readxm.c; sourceTree = "<group>"; };
17C8F63C0CBEE797008D969D /* readxm2.c */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.c; path = readxm2.c; sourceTree = "<group>"; };
17C8F63D0CBEE797008D969D /* xmeffect.c */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.c; path = xmeffect.c; sourceTree = "<group>"; };
8370B61E17F60FE2001A4D7A /* barray.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = barray.h; sourceTree = "<group>"; };
8370B62017F60FE2001A4D7A /* dumbfile.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = dumbfile.h; sourceTree = "<group>"; };
8370B62217F60FE2001A4D7A /* lpc.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = lpc.h; sourceTree = "<group>"; };
8370B62317F60FE2001A4D7A /* riff.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = riff.h; sourceTree = "<group>"; };
8370B62417F60FE2001A4D7A /* stack_alloc.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = stack_alloc.h; sourceTree = "<group>"; };
8370B62517F60FE2001A4D7A /* tarray.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = tarray.h; sourceTree = "<group>"; };
8370B62E17F61001001A4D7A /* barray.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = barray.c; sourceTree = "<group>"; };
8370B62F17F61001001A4D7A /* blip_buf.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = blip_buf.c; sourceTree = "<group>"; };
8370B63017F61001001A4D7A /* lanczos_resampler.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = lanczos_resampler.c; sourceTree = "<group>"; };
8370B63117F61001001A4D7A /* lpc.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = lpc.c; sourceTree = "<group>"; };
8370B63217F61001001A4D7A /* riff.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = riff.c; sourceTree = "<group>"; };
8370B63317F61001001A4D7A /* tarray.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = tarray.c; sourceTree = "<group>"; };
8370B63A17F61038001A4D7A /* load669.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = load669.c; sourceTree = "<group>"; };
8370B63B17F61038001A4D7A /* load6692.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = load6692.c; sourceTree = "<group>"; };
8370B63C17F61038001A4D7A /* loadamf.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = loadamf.c; sourceTree = "<group>"; };
8370B63D17F61038001A4D7A /* loadamf2.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = loadamf2.c; sourceTree = "<group>"; };
8370B63E17F61038001A4D7A /* loadany.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = loadany.c; sourceTree = "<group>"; };
8370B63F17F61038001A4D7A /* loadany2.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = loadany2.c; sourceTree = "<group>"; };
8370B64017F61038001A4D7A /* loadasy.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = loadasy.c; sourceTree = "<group>"; };
8370B64117F61038001A4D7A /* loadasy2.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = loadasy2.c; sourceTree = "<group>"; };
8370B64217F61038001A4D7A /* loadmtm.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = loadmtm.c; sourceTree = "<group>"; };
8370B64317F61038001A4D7A /* loadmtm2.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = loadmtm2.c; sourceTree = "<group>"; };
8370B64417F61038001A4D7A /* loadokt.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = loadokt.c; sourceTree = "<group>"; };
8370B64517F61038001A4D7A /* loadokt2.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = loadokt2.c; sourceTree = "<group>"; };
8370B64617F61038001A4D7A /* loadoldpsm.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = loadoldpsm.c; sourceTree = "<group>"; };
8370B64717F61038001A4D7A /* loadoldpsm2.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = loadoldpsm2.c; sourceTree = "<group>"; };
8370B64817F61038001A4D7A /* loadpsm.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = loadpsm.c; sourceTree = "<group>"; };
8370B64917F61038001A4D7A /* loadpsm2.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = loadpsm2.c; sourceTree = "<group>"; };
8370B64A17F61038001A4D7A /* loadptm.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = loadptm.c; sourceTree = "<group>"; };
8370B64B17F61038001A4D7A /* loadptm2.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = loadptm2.c; sourceTree = "<group>"; };
8370B64C17F61038001A4D7A /* loadriff.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = loadriff.c; sourceTree = "<group>"; };
8370B64D17F61038001A4D7A /* loadriff2.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = loadriff2.c; sourceTree = "<group>"; };
8370B64E17F61038001A4D7A /* loadstm.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = loadstm.c; sourceTree = "<group>"; };
8370B64F17F61038001A4D7A /* loadstm2.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = loadstm2.c; sourceTree = "<group>"; };
8370B65017F61038001A4D7A /* ptmeffect.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = ptmeffect.c; sourceTree = "<group>"; };
8370B65117F61038001A4D7A /* read669.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = read669.c; sourceTree = "<group>"; };
8370B65217F61038001A4D7A /* read6692.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = read6692.c; sourceTree = "<group>"; };
8370B65317F61038001A4D7A /* readam.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = readam.c; sourceTree = "<group>"; };
8370B65417F61038001A4D7A /* readamf.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = readamf.c; sourceTree = "<group>"; };
8370B65517F61038001A4D7A /* readamf2.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = readamf2.c; sourceTree = "<group>"; };
8370B65617F61038001A4D7A /* readany.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = readany.c; sourceTree = "<group>"; };
8370B65717F61038001A4D7A /* readany2.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = readany2.c; sourceTree = "<group>"; };
8370B65817F61038001A4D7A /* readasy.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = readasy.c; sourceTree = "<group>"; };
8370B65917F61038001A4D7A /* readdsmf.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = readdsmf.c; sourceTree = "<group>"; };
8370B65A17F61038001A4D7A /* readmtm.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = readmtm.c; sourceTree = "<group>"; };
8370B65B17F61038001A4D7A /* readokt.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = readokt.c; sourceTree = "<group>"; };
8370B65C17F61038001A4D7A /* readokt2.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = readokt2.c; sourceTree = "<group>"; };
8370B65D17F61038001A4D7A /* readoldpsm.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = readoldpsm.c; sourceTree = "<group>"; };
8370B65E17F61038001A4D7A /* readpsm.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = readpsm.c; sourceTree = "<group>"; };
8370B65F17F61038001A4D7A /* readptm.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = readptm.c; sourceTree = "<group>"; };
8370B66017F61038001A4D7A /* readriff.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = readriff.c; sourceTree = "<group>"; };
8370B66117F61038001A4D7A /* readstm.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = readstm.c; sourceTree = "<group>"; };
8370B66217F61038001A4D7A /* readstm2.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = readstm2.c; sourceTree = "<group>"; };
8370B7E717F62A40001A4D7A /* blip_buf.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = blip_buf.h; sourceTree = "<group>"; };
8370B7E817F62A40001A4D7A /* lanczos_resampler.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = lanczos_resampler.h; sourceTree = "<group>"; };
8DC2EF5A0486A6940098B216 /* Info.plist */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.plist; path = Info.plist; sourceTree = "<group>"; };
8DC2EF5B0486A6940098B216 /* Dumb.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; path = Dumb.framework; sourceTree = BUILT_PRODUCTS_DIR; };
D2F7E79907B2D74100F64583 /* CoreData.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = CoreData.framework; path = /System/Library/Frameworks/CoreData.framework; sourceTree = "<absolute>"; };
@ -197,6 +307,14 @@
17C8F60D0CBEE797008D969D /* internal */ = {
isa = PBXGroup;
children = (
8370B7E717F62A40001A4D7A /* blip_buf.h */,
8370B7E817F62A40001A4D7A /* lanczos_resampler.h */,
8370B61E17F60FE2001A4D7A /* barray.h */,
8370B62017F60FE2001A4D7A /* dumbfile.h */,
8370B62217F60FE2001A4D7A /* lpc.h */,
8370B62317F60FE2001A4D7A /* riff.h */,
8370B62417F60FE2001A4D7A /* stack_alloc.h */,
8370B62517F60FE2001A4D7A /* tarray.h */,
17C8F60E0CBEE797008D969D /* dumb.h */,
17C8F60F0CBEE797008D969D /* it.h */,
);
@ -236,6 +354,12 @@
17C8F61E0CBEE797008D969D /* helpers */ = {
isa = PBXGroup;
children = (
8370B62E17F61001001A4D7A /* barray.c */,
8370B62F17F61001001A4D7A /* blip_buf.c */,
8370B63017F61001001A4D7A /* lanczos_resampler.c */,
8370B63117F61001001A4D7A /* lpc.c */,
8370B63217F61001001A4D7A /* riff.c */,
8370B63317F61001001A4D7A /* tarray.c */,
17C8F61F0CBEE797008D969D /* clickrem.c */,
17C8F6200CBEE797008D969D /* memfile.c */,
17C8F6210CBEE797008D969D /* resamp2.inc */,
@ -252,6 +376,47 @@
17C8F6280CBEE797008D969D /* it */ = {
isa = PBXGroup;
children = (
8370B63A17F61038001A4D7A /* load669.c */,
8370B63B17F61038001A4D7A /* load6692.c */,
8370B63C17F61038001A4D7A /* loadamf.c */,
8370B63D17F61038001A4D7A /* loadamf2.c */,
8370B63E17F61038001A4D7A /* loadany.c */,
8370B63F17F61038001A4D7A /* loadany2.c */,
8370B64017F61038001A4D7A /* loadasy.c */,
8370B64117F61038001A4D7A /* loadasy2.c */,
8370B64217F61038001A4D7A /* loadmtm.c */,
8370B64317F61038001A4D7A /* loadmtm2.c */,
8370B64417F61038001A4D7A /* loadokt.c */,
8370B64517F61038001A4D7A /* loadokt2.c */,
8370B64617F61038001A4D7A /* loadoldpsm.c */,
8370B64717F61038001A4D7A /* loadoldpsm2.c */,
8370B64817F61038001A4D7A /* loadpsm.c */,
8370B64917F61038001A4D7A /* loadpsm2.c */,
8370B64A17F61038001A4D7A /* loadptm.c */,
8370B64B17F61038001A4D7A /* loadptm2.c */,
8370B64C17F61038001A4D7A /* loadriff.c */,
8370B64D17F61038001A4D7A /* loadriff2.c */,
8370B64E17F61038001A4D7A /* loadstm.c */,
8370B64F17F61038001A4D7A /* loadstm2.c */,
8370B65017F61038001A4D7A /* ptmeffect.c */,
8370B65117F61038001A4D7A /* read669.c */,
8370B65217F61038001A4D7A /* read6692.c */,
8370B65317F61038001A4D7A /* readam.c */,
8370B65417F61038001A4D7A /* readamf.c */,
8370B65517F61038001A4D7A /* readamf2.c */,
8370B65617F61038001A4D7A /* readany.c */,
8370B65717F61038001A4D7A /* readany2.c */,
8370B65817F61038001A4D7A /* readasy.c */,
8370B65917F61038001A4D7A /* readdsmf.c */,
8370B65A17F61038001A4D7A /* readmtm.c */,
8370B65B17F61038001A4D7A /* readokt.c */,
8370B65C17F61038001A4D7A /* readokt2.c */,
8370B65D17F61038001A4D7A /* readoldpsm.c */,
8370B65E17F61038001A4D7A /* readpsm.c */,
8370B65F17F61038001A4D7A /* readptm.c */,
8370B66017F61038001A4D7A /* readriff.c */,
8370B66117F61038001A4D7A /* readstm.c */,
8370B66217F61038001A4D7A /* readstm2.c */,
17C8F6290CBEE797008D969D /* itload.c */,
17C8F62A0CBEE797008D969D /* itload2.c */,
17C8F62B0CBEE797008D969D /* itmisc.c */,
@ -285,8 +450,16 @@
buildActionMask = 2147483647;
files = (
17C8F63E0CBEE797008D969D /* dumb.h in Headers */,
17C8F63F0CBEE797008D969D /* dumb.h in Headers */,
17C8F6400CBEE797008D969D /* it.h in Headers */,
8370B62D17F60FE2001A4D7A /* tarray.h in Headers */,
8370B62617F60FE2001A4D7A /* barray.h in Headers */,
8370B7EA17F62A40001A4D7A /* lanczos_resampler.h in Headers */,
8370B7E917F62A40001A4D7A /* blip_buf.h in Headers */,
17C8F63F0CBEE797008D969D /* dumb.h in Headers */,
8370B62B17F60FE2001A4D7A /* riff.h in Headers */,
8370B62A17F60FE2001A4D7A /* lpc.h in Headers */,
8370B62817F60FE2001A4D7A /* dumbfile.h in Headers */,
8370B62C17F60FE2001A4D7A /* stack_alloc.h in Headers */,
);
runOnlyForDeploymentPostprocessing = 0;
};
@ -317,9 +490,15 @@
/* Begin PBXProject section */
0867D690FE84028FC02AAC07 /* Project object */ = {
isa = PBXProject;
attributes = {
};
buildConfigurationList = 1DEB91B108733DA50010E9CD /* Build configuration list for PBXProject "Dumb" */;
compatibilityVersion = "Xcode 2.4";
developmentRegion = English;
hasScannedForEncodings = 1;
knownRegions = (
en,
);
mainGroup = 0867D691FE84028FC02AAC07 /* Dumb */;
productRefGroup = 034768DFFF38A50411DB9C8B /* Products */;
projectDirPath = "";
@ -346,29 +525,56 @@
isa = PBXSourcesBuildPhase;
buildActionMask = 2147483647;
files = (
8370B66D17F61038001A4D7A /* loadokt.c in Sources */,
8370B68A17F61038001A4D7A /* readstm.c in Sources */,
17C8F6410CBEE797008D969D /* atexit.c in Sources */,
17C8F6420CBEE797008D969D /* duhlen.c in Sources */,
8370B66E17F61038001A4D7A /* loadokt2.c in Sources */,
8370B63817F61001001A4D7A /* riff.c in Sources */,
17C8F6430CBEE797008D969D /* duhtag.c in Sources */,
8370B63517F61001001A4D7A /* blip_buf.c in Sources */,
8370B68117F61038001A4D7A /* readasy.c in Sources */,
8370B67217F61038001A4D7A /* loadpsm2.c in Sources */,
17C8F6440CBEE797008D969D /* dumbfile.c in Sources */,
8370B68317F61038001A4D7A /* readmtm.c in Sources */,
17C8F6450CBEE797008D969D /* loadduh.c in Sources */,
8370B67D17F61038001A4D7A /* readamf.c in Sources */,
8370B63717F61001001A4D7A /* lpc.c in Sources */,
17C8F6460CBEE797008D969D /* makeduh.c in Sources */,
17C8F6470CBEE797008D969D /* rawsig.c in Sources */,
17C8F6480CBEE797008D969D /* readduh.c in Sources */,
8370B67917F61038001A4D7A /* ptmeffect.c in Sources */,
17C8F6490CBEE797008D969D /* register.c in Sources */,
8370B67C17F61038001A4D7A /* readam.c in Sources */,
17C8F64A0CBEE797008D969D /* rendduh.c in Sources */,
8370B63417F61001001A4D7A /* barray.c in Sources */,
8370B67817F61038001A4D7A /* loadstm2.c in Sources */,
8370B66A17F61038001A4D7A /* loadasy2.c in Sources */,
8370B68717F61038001A4D7A /* readpsm.c in Sources */,
8370B67B17F61038001A4D7A /* read6692.c in Sources */,
17C8F64B0CBEE797008D969D /* rendsig.c in Sources */,
17C8F64C0CBEE797008D969D /* unload.c in Sources */,
17C8F64D0CBEE797008D969D /* clickrem.c in Sources */,
17C8F64E0CBEE797008D969D /* memfile.c in Sources */,
17C8F6510CBEE797008D969D /* resample.c in Sources */,
8370B66F17F61038001A4D7A /* loadoldpsm.c in Sources */,
17C8F6530CBEE797008D969D /* sampbuf.c in Sources */,
17C8F6540CBEE797008D969D /* silence.c in Sources */,
17C8F6550CBEE797008D969D /* stdfile.c in Sources */,
8370B67417F61038001A4D7A /* loadptm2.c in Sources */,
8370B68817F61038001A4D7A /* readptm.c in Sources */,
8370B67317F61038001A4D7A /* loadptm.c in Sources */,
8370B66417F61038001A4D7A /* load6692.c in Sources */,
17C8F6560CBEE797008D969D /* itload.c in Sources */,
17C8F6570CBEE797008D969D /* itload2.c in Sources */,
8370B63617F61001001A4D7A /* lanczos_resampler.c in Sources */,
17C8F6580CBEE797008D969D /* itmisc.c in Sources */,
8370B67517F61038001A4D7A /* loadriff.c in Sources */,
8370B66917F61038001A4D7A /* loadasy.c in Sources */,
17C8F6590CBEE797008D969D /* itorder.c in Sources */,
8370B66317F61038001A4D7A /* load669.c in Sources */,
17C8F65A0CBEE797008D969D /* itread.c in Sources */,
8370B68B17F61038001A4D7A /* readstm2.c in Sources */,
17C8F65B0CBEE797008D969D /* itread2.c in Sources */,
17C8F65C0CBEE797008D969D /* itrender.c in Sources */,
17C8F65D0CBEE797008D969D /* itunload.c in Sources */,
@ -376,14 +582,34 @@
17C8F65F0CBEE797008D969D /* loadmod2.c in Sources */,
17C8F6600CBEE797008D969D /* loads3m.c in Sources */,
17C8F6610CBEE797008D969D /* loads3m2.c in Sources */,
8370B63917F61001001A4D7A /* tarray.c in Sources */,
8370B66B17F61038001A4D7A /* loadmtm.c in Sources */,
8370B68517F61038001A4D7A /* readokt2.c in Sources */,
17C8F6620CBEE797008D969D /* loadxm.c in Sources */,
17C8F6630CBEE797008D969D /* loadxm2.c in Sources */,
8370B67117F61038001A4D7A /* loadpsm.c in Sources */,
8370B67617F61038001A4D7A /* loadriff2.c in Sources */,
8370B66C17F61038001A4D7A /* loadmtm2.c in Sources */,
8370B67A17F61038001A4D7A /* read669.c in Sources */,
8370B66717F61038001A4D7A /* loadany.c in Sources */,
8370B68017F61038001A4D7A /* readany2.c in Sources */,
17C8F6640CBEE797008D969D /* readmod.c in Sources */,
8370B67017F61038001A4D7A /* loadoldpsm2.c in Sources */,
8370B68217F61038001A4D7A /* readdsmf.c in Sources */,
17C8F6650CBEE797008D969D /* readmod2.c in Sources */,
8370B68617F61038001A4D7A /* readoldpsm.c in Sources */,
17C8F6660CBEE797008D969D /* reads3m.c in Sources */,
17C8F6670CBEE797008D969D /* reads3m2.c in Sources */,
17C8F6680CBEE797008D969D /* readxm.c in Sources */,
8370B68917F61038001A4D7A /* readriff.c in Sources */,
17C8F6690CBEE797008D969D /* readxm2.c in Sources */,
8370B66617F61038001A4D7A /* loadamf2.c in Sources */,
8370B68417F61038001A4D7A /* readokt.c in Sources */,
8370B66817F61038001A4D7A /* loadany2.c in Sources */,
8370B66517F61038001A4D7A /* loadamf.c in Sources */,
8370B67717F61038001A4D7A /* loadstm.c in Sources */,
8370B67E17F61038001A4D7A /* readamf2.c in Sources */,
8370B67F17F61038001A4D7A /* readany.c in Sources */,
17C8F66A0CBEE797008D969D /* xmeffect.c in Sources */,
);
runOnlyForDeploymentPostprocessing = 0;
@ -421,6 +647,7 @@
OBJROOT = ../../build;
PRECOMPS_INCLUDE_HEADERS_FROM_BUILT_PRODUCTS_DIR = NO;
PRODUCT_NAME = Dumb;
SDKROOT = macosx10.6;
SHARED_PRECOMPS_DIR = "";
SYMROOT = ../../build;
WRAPPER_EXTENSION = framework;
@ -448,6 +675,7 @@
OBJROOT = ../../build;
PRECOMPS_INCLUDE_HEADERS_FROM_BUILT_PRODUCTS_DIR = NO;
PRODUCT_NAME = Dumb;
SDKROOT = macosx10.6;
SHARED_PRECOMPS_DIR = "";
SYMROOT = ../../build;
WRAPPER_EXTENSION = framework;

View file

@ -0,0 +1,59 @@
<?xml version="1.0" encoding="UTF-8"?>
<Scheme
LastUpgradeVersion = "0460"
version = "1.3">
<BuildAction
parallelizeBuildables = "YES"
buildImplicitDependencies = "YES">
<BuildActionEntries>
<BuildActionEntry
buildForTesting = "YES"
buildForRunning = "YES"
buildForProfiling = "YES"
buildForArchiving = "YES"
buildForAnalyzing = "YES">
<BuildableReference
BuildableIdentifier = "primary"
BlueprintIdentifier = "8DC2EF4F0486A6940098B216"
BuildableName = "Dumb.framework"
BlueprintName = "Dumb Framework"
ReferencedContainer = "container:Dumb.xcodeproj">
</BuildableReference>
</BuildActionEntry>
</BuildActionEntries>
</BuildAction>
<TestAction
selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"
selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
shouldUseLaunchSchemeArgsEnv = "YES"
buildConfiguration = "Debug">
<Testables>
</Testables>
</TestAction>
<LaunchAction
selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"
selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
launchStyle = "0"
useCustomWorkingDirectory = "NO"
buildConfiguration = "Debug"
ignoresPersistentStateOnLaunch = "NO"
debugDocumentVersioning = "YES"
allowLocationSimulation = "YES">
<AdditionalOptions>
</AdditionalOptions>
</LaunchAction>
<ProfileAction
shouldUseLaunchSchemeArgsEnv = "YES"
savedToolIdentifier = ""
useCustomWorkingDirectory = "NO"
buildConfiguration = "Release"
debugDocumentVersioning = "YES">
</ProfileAction>
<AnalyzeAction
buildConfiguration = "Debug">
</AnalyzeAction>
<ArchiveAction
buildConfiguration = "Release"
revealArchiveInOrganizer = "YES">
</ArchiveAction>
</Scheme>

View file

@ -0,0 +1,22 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>SchemeUserState</key>
<dict>
<key>Dumb Framework.xcscheme</key>
<dict>
<key>orderHint</key>
<integer>10</integer>
</dict>
</dict>
<key>SuppressBuildableAutocreation</key>
<dict>
<key>8DC2EF4F0486A6940098B216</key>
<dict>
<key>primary</key>
<true/>
</dict>
</dict>
</dict>
</plist>

View file

@ -24,6 +24,10 @@
#include <stdlib.h>
#include <stdio.h>
#ifdef _DEBUG
#define _CRTDBG_MAP_ALLOC
#include <crtdbg.h>
#endif
#ifdef __cplusplus
extern "C" {
@ -156,19 +160,29 @@ typedef struct DUMBFILE_SYSTEM
int (*getc)(void *f);
long (*getnc)(char *ptr, long n, void *f);
void (*close)(void *f);
int (*seek)(void *f, long n);
long (*get_size)(void *f);
}
DUMBFILE_SYSTEM;
typedef struct DUMBFILE DUMBFILE;
void register_dumbfile_system(DUMBFILE_SYSTEM *dfs);
void register_dumbfile_system(const DUMBFILE_SYSTEM *dfs);
DUMBFILE *dumbfile_open(const char *filename);
DUMBFILE *dumbfile_open_ex(void *file, DUMBFILE_SYSTEM *dfs);
DUMBFILE *dumbfile_open_ex(void *file, const DUMBFILE_SYSTEM *dfs);
long dumbfile_pos(DUMBFILE *f);
int dumbfile_skip(DUMBFILE *f, long n);
#define DFS_SEEK_SET 0
#define DFS_SEEK_CUR 1
#define DFS_SEEK_END 2
int dumbfile_seek(DUMBFILE *f, long n, int origin);
long dumbfile_get_size(DUMBFILE *f);
int dumbfile_getc(DUMBFILE *f);
int dumbfile_igetw(DUMBFILE *f);
@ -213,7 +227,6 @@ long duh_get_length(DUH *duh);
const char *duh_get_tag(DUH *duh, const char *key);
/* Signal Rendering Functions */
typedef struct DUH_SIGRENDERER DUH_SIGRENDERER;
@ -357,38 +370,98 @@ DUMB_IT_SIGDATA *duh_get_it_sigdata(DUH *duh);
DUH_SIGRENDERER *duh_encapsulate_it_sigrenderer(DUMB_IT_SIGRENDERER *it_sigrenderer, int n_channels, long pos);
DUMB_IT_SIGRENDERER *duh_get_it_sigrenderer(DUH_SIGRENDERER *sigrenderer);
int dumb_it_trim_silent_patterns(DUH * duh);
typedef int (*dumb_scan_callback)(void *, int, long);
int dumb_it_scan_for_playable_orders(DUMB_IT_SIGDATA *sigdata, dumb_scan_callback callback, void * callback_data);
DUH_SIGRENDERER *dumb_it_start_at_order(DUH *duh, int n_channels, int startorder);
void dumb_it_set_resampling_quality(DUMB_IT_SIGRENDERER * sigrenderer, int quality);
void dumb_it_set_ramp_style(DUMB_IT_SIGRENDERER * sigrenderer, int ramp_style);
void dumb_it_set_loop_callback(DUMB_IT_SIGRENDERER *sigrenderer, int (*callback)(void *data), void *data);
void dumb_it_set_xm_speed_zero_callback(DUMB_IT_SIGRENDERER *sigrenderer, int (*callback)(void *data), void *data);
void dumb_it_set_midi_callback(DUMB_IT_SIGRENDERER *sigrenderer, int (*callback)(void *data, int channel, unsigned char midi_byte), void *data);
void dumb_it_set_global_volume_zero_callback(DUMB_IT_SIGRENDERER *sigrenderer, int (*callback)(void *data), void *data);
int dumb_it_callback_terminate(void *data);
int dumb_it_callback_midi_block(void *data, int channel, unsigned char midi_byte);
/* dumb_*_mod*: restrict_ |= 1-Don't read 15 sample files / 2-Use old pattern counting method */
DUH *dumb_load_it(const char *filename);
DUH *dumb_load_xm(const char *filename);
DUH *dumb_load_s3m(const char *filename);
DUH *dumb_load_mod(const char *filename);
DUH *dumb_load_stm(const char *filename);
DUH *dumb_load_mod(const char *filename, int restrict_);
DUH *dumb_load_ptm(const char *filename);
DUH *dumb_load_669(const char *filename);
DUH *dumb_load_psm(const char *filename, int subsong);
DUH *dumb_load_old_psm(const char * filename);
DUH *dumb_load_mtm(const char *filename);
DUH *dumb_load_riff(const char *filename);
DUH *dumb_load_asy(const char *filename);
DUH *dumb_load_amf(const char *filename);
DUH *dumb_load_okt(const char *filename);
DUH *dumb_read_it(DUMBFILE *f);
DUH *dumb_read_xm(DUMBFILE *f);
DUH *dumb_read_s3m(DUMBFILE *f);
DUH *dumb_read_mod(DUMBFILE *f);
DUH *dumb_read_stm(DUMBFILE *f);
DUH *dumb_read_mod(DUMBFILE *f, int restrict_);
DUH *dumb_read_ptm(DUMBFILE *f);
DUH *dumb_read_669(DUMBFILE *f);
DUH *dumb_read_psm(DUMBFILE *f, int subsong);
DUH *dumb_read_old_psm(DUMBFILE *f);
DUH *dumb_read_mtm(DUMBFILE *f);
DUH *dumb_read_riff(DUMBFILE *f);
DUH *dumb_read_asy(DUMBFILE *f);
DUH *dumb_read_amf(DUMBFILE *f);
DUH *dumb_read_okt(DUMBFILE *f);
DUH *dumb_load_it_quick(const char *filename);
DUH *dumb_load_xm_quick(const char *filename);
DUH *dumb_load_s3m_quick(const char *filename);
DUH *dumb_load_mod_quick(const char *filename);
DUH *dumb_load_stm_quick(const char *filename);
DUH *dumb_load_mod_quick(const char *filename, int restrict_);
DUH *dumb_load_ptm_quick(const char *filename);
DUH *dumb_load_669_quick(const char *filename);
DUH *dumb_load_psm_quick(const char *filename, int subsong);
DUH *dumb_load_old_psm_quick(const char * filename);
DUH *dumb_load_mtm_quick(const char *filename);
DUH *dumb_load_riff_quick(const char *filename);
DUH *dumb_load_asy_quick(const char *filename);
DUH *dumb_load_amf_quick(const char *filename);
DUH *dumb_load_okt_quick(const char *filename);
DUH *dumb_read_it_quick(DUMBFILE *f);
DUH *dumb_read_xm_quick(DUMBFILE *f);
DUH *dumb_read_s3m_quick(DUMBFILE *f);
DUH *dumb_read_mod_quick(DUMBFILE *f);
DUH *dumb_read_stm_quick(DUMBFILE *f);
DUH *dumb_read_mod_quick(DUMBFILE *f, int restrict_);
DUH *dumb_read_ptm_quick(DUMBFILE *f);
DUH *dumb_read_669_quick(DUMBFILE *f);
DUH *dumb_read_psm_quick(DUMBFILE *f, int subsong);
DUH *dumb_read_old_psm_quick(DUMBFILE *f);
DUH *dumb_read_mtm_quick(DUMBFILE *f);
DUH *dumb_read_riff_quick(DUMBFILE *f);
DUH *dumb_read_asy_quick(DUMBFILE *f);
DUH *dumb_read_amf_quick(DUMBFILE *f);
DUH *dumb_read_okt_quick(DUMBFILE *f);
long dumb_it_build_checkpoints(DUMB_IT_SIGDATA *sigdata);
DUH *dumb_read_any_quick(DUMBFILE *f, int restrict_, int subsong);
DUH *dumb_read_any(DUMBFILE *f, int restrict_, int subsong);
DUH *dumb_load_any_quick(const char *filename, int restrict_, int subsong);
DUH *dumb_load_any(const char *filename, int restrict_, int subsong);
long dumb_it_build_checkpoints(DUMB_IT_SIGDATA *sigdata, int startorder);
void dumb_it_do_initial_runthrough(DUH *duh);
int dumb_get_psm_subsong_count(DUMBFILE *f);
const unsigned char *dumb_it_sd_get_song_message(DUMB_IT_SIGDATA *sd);
int dumb_it_sd_get_n_orders(DUMB_IT_SIGDATA *sd);
@ -512,6 +585,10 @@ typedef void (*DUH_SIGRENDERER_GET_CURRENT_SAMPLE)(
sample_t *samples
);
typedef long (*DUH_SIGRENDERER_GET_POSITION)(
sigrenderer_t *sigrenderer
);
typedef void (*DUH_END_SIGRENDERER)(sigrenderer_t *sigrenderer);
typedef void (*DUH_UNLOAD_SIGDATA)(sigdata_t *sigdata);
@ -527,6 +604,7 @@ typedef struct DUH_SIGTYPE_DESC
DUH_SIGRENDERER_SET_SIGPARAM sigrenderer_set_sigparam;
DUH_SIGRENDERER_GENERATE_SAMPLES sigrenderer_generate_samples;
DUH_SIGRENDERER_GET_CURRENT_SAMPLE sigrenderer_get_current_sample;
DUH_SIGRENDERER_GET_POSITION sigrenderer_get_position;
DUH_END_SIGRENDERER end_sigrenderer;
DUH_UNLOAD_SIGDATA unload_sigdata;
}
@ -534,6 +612,8 @@ DUH_SIGTYPE_DESC;
void dumb_register_sigtype(DUH_SIGTYPE_DESC *desc);
int duh_add_signal(DUH *duh, DUH_SIGTYPE_DESC *desc, sigdata_t *sigdata);
// Decide where to put these functions; new heading?
@ -589,13 +669,18 @@ void dumb_destroy_click_remover_array(int n, DUMB_CLICK_REMOVER **cr);
#define DUMB_RQ_ALIASING 0
#define DUMB_RQ_LINEAR 1
#define DUMB_RQ_CUBIC 2
#define DUMB_RQ_N_LEVELS 3
#define DUMB_RQ_FIR 3
#define DUMB_RQ_N_LEVELS 4
extern int dumb_resampling_quality;
typedef struct DUMB_RESAMPLER DUMB_RESAMPLER;
typedef struct DUMB_VOLUME_RAMP_INFO DUMB_VOLUME_RAMP_INFO;
typedef void (*DUMB_RESAMPLE_PICKUP)(DUMB_RESAMPLER *resampler, void *data);
typedef struct blip_t blip_t;
struct DUMB_RESAMPLER
{
void *src;
@ -605,8 +690,7 @@ struct DUMB_RESAMPLER
int dir;
DUMB_RESAMPLE_PICKUP pickup;
void *pickup_data;
int min_quality;
int max_quality;
int quality;
/* Everything below this point is internal: do not use. */
union {
sample_t x24[3*2];
@ -614,54 +698,67 @@ struct DUMB_RESAMPLER
signed char x8[3*2];
} x;
int overshot;
int last_clock;
int last_amp[2];
blip_t* blip_buffer[2];
double fir_resampler_ratio;
void* fir_resampler[2];
};
void dumb_reset_resampler(DUMB_RESAMPLER *resampler, sample_t *src, int src_channels, long pos, long start, long end);
DUMB_RESAMPLER *dumb_start_resampler(sample_t *src, int src_channels, long pos, long start, long end);
long dumb_resample_1_1(DUMB_RESAMPLER *resampler, sample_t *dst, long dst_size, float volume, float delta);
long dumb_resample_1_2(DUMB_RESAMPLER *resampler, sample_t *dst, long dst_size, float volume_left, float volume_right, float delta);
long dumb_resample_2_1(DUMB_RESAMPLER *resampler, sample_t *dst, long dst_size, float volume_left, float volume_right, float delta);
long dumb_resample_2_2(DUMB_RESAMPLER *resampler, sample_t *dst, long dst_size, float volume_left, float volume_right, float delta);
void dumb_resample_get_current_sample_1_1(DUMB_RESAMPLER *resampler, float volume, sample_t *dst);
void dumb_resample_get_current_sample_1_2(DUMB_RESAMPLER *resampler, float volume_left, float volume_right, sample_t *dst);
void dumb_resample_get_current_sample_2_1(DUMB_RESAMPLER *resampler, float volume_left, float volume_right, sample_t *dst);
void dumb_resample_get_current_sample_2_2(DUMB_RESAMPLER *resampler, float volume_left, float volume_right, sample_t *dst);
struct DUMB_VOLUME_RAMP_INFO
{
float volume;
float delta;
float target;
float mix;
};
void dumb_reset_resampler(DUMB_RESAMPLER *resampler, sample_t *src, int src_channels, long pos, long start, long end, int quality);
DUMB_RESAMPLER *dumb_start_resampler(sample_t *src, int src_channels, long pos, long start, long end, int quality);
long dumb_resample_1_1(DUMB_RESAMPLER *resampler, sample_t *dst, long dst_size, DUMB_VOLUME_RAMP_INFO * volume, float delta);
long dumb_resample_1_2(DUMB_RESAMPLER *resampler, sample_t *dst, long dst_size, DUMB_VOLUME_RAMP_INFO * volume_left, DUMB_VOLUME_RAMP_INFO * volume_right, float delta);
long dumb_resample_2_1(DUMB_RESAMPLER *resampler, sample_t *dst, long dst_size, DUMB_VOLUME_RAMP_INFO * volume_left, DUMB_VOLUME_RAMP_INFO * volume_right, float delta);
long dumb_resample_2_2(DUMB_RESAMPLER *resampler, sample_t *dst, long dst_size, DUMB_VOLUME_RAMP_INFO * volume_left, DUMB_VOLUME_RAMP_INFO * volume_right, float delta);
void dumb_resample_get_current_sample_1_1(DUMB_RESAMPLER *resampler, DUMB_VOLUME_RAMP_INFO * volume, sample_t *dst);
void dumb_resample_get_current_sample_1_2(DUMB_RESAMPLER *resampler, DUMB_VOLUME_RAMP_INFO * volume_left, DUMB_VOLUME_RAMP_INFO * volume_right, sample_t *dst);
void dumb_resample_get_current_sample_2_1(DUMB_RESAMPLER *resampler, DUMB_VOLUME_RAMP_INFO * volume_left, DUMB_VOLUME_RAMP_INFO * volume_right, sample_t *dst);
void dumb_resample_get_current_sample_2_2(DUMB_RESAMPLER *resampler, DUMB_VOLUME_RAMP_INFO * volume_left, DUMB_VOLUME_RAMP_INFO * volume_right, sample_t *dst);
void dumb_end_resampler(DUMB_RESAMPLER *resampler);
void dumb_reset_resampler_16(DUMB_RESAMPLER *resampler, short *src, int src_channels, long pos, long start, long end);
DUMB_RESAMPLER *dumb_start_resampler_16(short *src, int src_channels, long pos, long start, long end);
long dumb_resample_16_1_1(DUMB_RESAMPLER *resampler, sample_t *dst, long dst_size, float volume, float delta);
long dumb_resample_16_1_2(DUMB_RESAMPLER *resampler, sample_t *dst, long dst_size, float volume_left, float volume_right, float delta);
long dumb_resample_16_2_1(DUMB_RESAMPLER *resampler, sample_t *dst, long dst_size, float volume_left, float volume_right, float delta);
long dumb_resample_16_2_2(DUMB_RESAMPLER *resampler, sample_t *dst, long dst_size, float volume_left, float volume_right, float delta);
void dumb_resample_get_current_sample_16_1_1(DUMB_RESAMPLER *resampler, float volume, sample_t *dst);
void dumb_resample_get_current_sample_16_1_2(DUMB_RESAMPLER *resampler, float volume_left, float volume_right, sample_t *dst);
void dumb_resample_get_current_sample_16_2_1(DUMB_RESAMPLER *resampler, float volume_left, float volume_right, sample_t *dst);
void dumb_resample_get_current_sample_16_2_2(DUMB_RESAMPLER *resampler, float volume_left, float volume_right, sample_t *dst);
void dumb_reset_resampler_16(DUMB_RESAMPLER *resampler, short *src, int src_channels, long pos, long start, long end, int quality);
DUMB_RESAMPLER *dumb_start_resampler_16(short *src, int src_channels, long pos, long start, long end, int quality);
long dumb_resample_16_1_1(DUMB_RESAMPLER *resampler, sample_t *dst, long dst_size, DUMB_VOLUME_RAMP_INFO * volume, float delta);
long dumb_resample_16_1_2(DUMB_RESAMPLER *resampler, sample_t *dst, long dst_size, DUMB_VOLUME_RAMP_INFO * volume_left, DUMB_VOLUME_RAMP_INFO * volume_right, float delta);
long dumb_resample_16_2_1(DUMB_RESAMPLER *resampler, sample_t *dst, long dst_size, DUMB_VOLUME_RAMP_INFO * volume_left, DUMB_VOLUME_RAMP_INFO * volume_right, float delta);
long dumb_resample_16_2_2(DUMB_RESAMPLER *resampler, sample_t *dst, long dst_size, DUMB_VOLUME_RAMP_INFO * volume_left, DUMB_VOLUME_RAMP_INFO * volume_right, float delta);
void dumb_resample_get_current_sample_16_1_1(DUMB_RESAMPLER *resampler, DUMB_VOLUME_RAMP_INFO * volume, sample_t *dst);
void dumb_resample_get_current_sample_16_1_2(DUMB_RESAMPLER *resampler, DUMB_VOLUME_RAMP_INFO * volume_left, DUMB_VOLUME_RAMP_INFO * volume_right, sample_t *dst);
void dumb_resample_get_current_sample_16_2_1(DUMB_RESAMPLER *resampler, DUMB_VOLUME_RAMP_INFO * volume_left, DUMB_VOLUME_RAMP_INFO * volume_right, sample_t *dst);
void dumb_resample_get_current_sample_16_2_2(DUMB_RESAMPLER *resampler, DUMB_VOLUME_RAMP_INFO * volume_left, DUMB_VOLUME_RAMP_INFO * volume_right, sample_t *dst);
void dumb_end_resampler_16(DUMB_RESAMPLER *resampler);
void dumb_reset_resampler_8(DUMB_RESAMPLER *resampler, signed char *src, int src_channels, long pos, long start, long end);
DUMB_RESAMPLER *dumb_start_resampler_8(signed char *src, int src_channels, long pos, long start, long end);
long dumb_resample_8_1_1(DUMB_RESAMPLER *resampler, sample_t *dst, long dst_size, float volume, float delta);
long dumb_resample_8_1_2(DUMB_RESAMPLER *resampler, sample_t *dst, long dst_size, float volume_left, float volume_right, float delta);
long dumb_resample_8_2_1(DUMB_RESAMPLER *resampler, sample_t *dst, long dst_size, float volume_left, float volume_right, float delta);
long dumb_resample_8_2_2(DUMB_RESAMPLER *resampler, sample_t *dst, long dst_size, float volume_left, float volume_right, float delta);
void dumb_resample_get_current_sample_8_1_1(DUMB_RESAMPLER *resampler, float volume, sample_t *dst);
void dumb_resample_get_current_sample_8_1_2(DUMB_RESAMPLER *resampler, float volume_left, float volume_right, sample_t *dst);
void dumb_resample_get_current_sample_8_2_1(DUMB_RESAMPLER *resampler, float volume_left, float volume_right, sample_t *dst);
void dumb_resample_get_current_sample_8_2_2(DUMB_RESAMPLER *resampler, float volume_left, float volume_right, sample_t *dst);
void dumb_reset_resampler_8(DUMB_RESAMPLER *resampler, signed char *src, int src_channels, long pos, long start, long end, int quality);
DUMB_RESAMPLER *dumb_start_resampler_8(signed char *src, int src_channels, long pos, long start, long end, int quality);
long dumb_resample_8_1_1(DUMB_RESAMPLER *resampler, sample_t *dst, long dst_size, DUMB_VOLUME_RAMP_INFO * volume, float delta);
long dumb_resample_8_1_2(DUMB_RESAMPLER *resampler, sample_t *dst, long dst_size, DUMB_VOLUME_RAMP_INFO * volume_left, DUMB_VOLUME_RAMP_INFO * volume_right, float delta);
long dumb_resample_8_2_1(DUMB_RESAMPLER *resampler, sample_t *dst, long dst_size, DUMB_VOLUME_RAMP_INFO * volume_left, DUMB_VOLUME_RAMP_INFO * volume_right, float delta);
long dumb_resample_8_2_2(DUMB_RESAMPLER *resampler, sample_t *dst, long dst_size, DUMB_VOLUME_RAMP_INFO * volume_left, DUMB_VOLUME_RAMP_INFO * volume_right, float delta);
void dumb_resample_get_current_sample_8_1_1(DUMB_RESAMPLER *resampler, DUMB_VOLUME_RAMP_INFO * volume, sample_t *dst);
void dumb_resample_get_current_sample_8_1_2(DUMB_RESAMPLER *resampler, DUMB_VOLUME_RAMP_INFO * volume_left, DUMB_VOLUME_RAMP_INFO * volume_right, sample_t *dst);
void dumb_resample_get_current_sample_8_2_1(DUMB_RESAMPLER *resampler, DUMB_VOLUME_RAMP_INFO * volume_left, DUMB_VOLUME_RAMP_INFO * volume_right, sample_t *dst);
void dumb_resample_get_current_sample_8_2_2(DUMB_RESAMPLER *resampler, DUMB_VOLUME_RAMP_INFO * volume_left, DUMB_VOLUME_RAMP_INFO * volume_right, sample_t *dst);
void dumb_end_resampler_8(DUMB_RESAMPLER *resampler);
void dumb_reset_resampler_n(int n, DUMB_RESAMPLER *resampler, void *src, int src_channels, long pos, long start, long end);
DUMB_RESAMPLER *dumb_start_resampler_n(int n, void *src, int src_channels, long pos, long start, long end);
long dumb_resample_n_1_1(int n, DUMB_RESAMPLER *resampler, sample_t *dst, long dst_size, float volume, float delta);
long dumb_resample_n_1_2(int n, DUMB_RESAMPLER *resampler, sample_t *dst, long dst_size, float volume_left, float volume_right, float delta);
long dumb_resample_n_2_1(int n, DUMB_RESAMPLER *resampler, sample_t *dst, long dst_size, float volume_left, float volume_right, float delta);
long dumb_resample_n_2_2(int n, DUMB_RESAMPLER *resampler, sample_t *dst, long dst_size, float volume_left, float volume_right, float delta);
void dumb_resample_get_current_sample_n_1_1(int n, DUMB_RESAMPLER *resampler, float volume, sample_t *dst);
void dumb_resample_get_current_sample_n_1_2(int n, DUMB_RESAMPLER *resampler, float volume_left, float volume_right, sample_t *dst);
void dumb_resample_get_current_sample_n_2_1(int n, DUMB_RESAMPLER *resampler, float volume_left, float volume_right, sample_t *dst);
void dumb_resample_get_current_sample_n_2_2(int n, DUMB_RESAMPLER *resampler, float volume_left, float volume_right, sample_t *dst);
void dumb_reset_resampler_n(int n, DUMB_RESAMPLER *resampler, void *src, int src_channels, long pos, long start, long end, int quality);
DUMB_RESAMPLER *dumb_start_resampler_n(int n, void *src, int src_channels, long pos, long start, long end, int quality);
long dumb_resample_n_1_1(int n, DUMB_RESAMPLER *resampler, sample_t *dst, long dst_size, DUMB_VOLUME_RAMP_INFO * volume, float delta);
long dumb_resample_n_1_2(int n, DUMB_RESAMPLER *resampler, sample_t *dst, long dst_size, DUMB_VOLUME_RAMP_INFO * volume_left, DUMB_VOLUME_RAMP_INFO * volume_right, float delta);
long dumb_resample_n_2_1(int n, DUMB_RESAMPLER *resampler, sample_t *dst, long dst_size, DUMB_VOLUME_RAMP_INFO * volume_left, DUMB_VOLUME_RAMP_INFO * volume_right, float delta);
long dumb_resample_n_2_2(int n, DUMB_RESAMPLER *resampler, sample_t *dst, long dst_size, DUMB_VOLUME_RAMP_INFO * volume_left, DUMB_VOLUME_RAMP_INFO * volume_right, float delta);
void dumb_resample_get_current_sample_n_1_1(int n, DUMB_RESAMPLER *resampler, DUMB_VOLUME_RAMP_INFO * volume, sample_t *dst);
void dumb_resample_get_current_sample_n_1_2(int n, DUMB_RESAMPLER *resampler, DUMB_VOLUME_RAMP_INFO * volume_left, DUMB_VOLUME_RAMP_INFO * volume_right, sample_t *dst);
void dumb_resample_get_current_sample_n_2_1(int n, DUMB_RESAMPLER *resampler, DUMB_VOLUME_RAMP_INFO * volume_left, DUMB_VOLUME_RAMP_INFO * volume_right, sample_t *dst);
void dumb_resample_get_current_sample_n_2_2(int n, DUMB_RESAMPLER *resampler, DUMB_VOLUME_RAMP_INFO * volume_left, DUMB_VOLUME_RAMP_INFO * volume_right, sample_t *dst);
void dumb_end_resampler_n(int n, DUMB_RESAMPLER *resampler);

View file

@ -0,0 +1,27 @@
/* _______ ____ __ ___ ___
* \ _ \ \ / \ / \ \ / / ' ' '
* | | \ \ | | || | \/ | . .
* | | | | | | || ||\ /| |
* | | | | | | || || \/ | | ' ' '
* | | | | | | || || | | . .
* | |_/ / \ \__// || | |
* /_______/ynamic \____/niversal /__\ /____\usic /| . . ibliotheque
* / \
* / . \
* internal/aldumb.h - The internal header file / / \ \
* for DUMB with Allegro. | < / \_
* | \/ /\ /
* \_ / > /
* | \ / /
* | ' /
* \__/
*/
#ifndef INTERNAL_ALDUMB_H
#define INTERNAL_ALDUMB_H
void _dat_unload_duh(void *duh);
#endif /* INTERNAL_DUMB_H */

View file

@ -0,0 +1,20 @@
#ifndef _B_ARRAY_H_
#define _B_ARRAY_H_
#include <stdlib.h>
void * bit_array_create(size_t size);
void bit_array_destroy(void * array);
void * bit_array_dup(void * array);
void bit_array_reset(void * array);
void bit_array_set(void * array, size_t bit);
int bit_array_test(void * array, size_t bit);
int bit_array_test_range(void * array, size_t bit, size_t count);
void bit_array_clear(void * array, size_t bit);
void bit_array_merge(void * array, void * source, size_t offset);
void bit_array_mask(void * array, void * source, size_t offset);
#endif

View file

@ -0,0 +1,77 @@
/** \file
Sample buffer that resamples from input clock rate to output sample rate */
/* blip_buf 1.1.0 */
#ifndef BLIP_BUF_H
#define BLIP_BUF_H
#ifdef __cplusplus
extern "C" {
#endif
/** First parameter of most functions is blip_t*, or const blip_t* if nothing
is changed. */
typedef struct blip_t blip_t;
/** Creates new buffer that can hold at most sample_count samples. Sets rates
so that there are blip_max_ratio clocks per sample. Returns pointer to new
buffer, or NULL if insufficient memory. */
blip_t* blip_new( int sample_count );
blip_t* blip_dup( blip_t* );
/** Sets approximate input clock rate and output sample rate. For every
clock_rate input clocks, approximately sample_rate samples are generated. */
void blip_set_rates( blip_t*, double clock_rate, double sample_rate );
enum { /** Maximum clock_rate/sample_rate ratio. For a given sample_rate,
clock_rate must not be greater than sample_rate*blip_max_ratio. */
blip_max_ratio = 1 << 20 };
/** Clears entire buffer. Afterwards, blip_samples_avail() == 0. */
void blip_clear( blip_t* );
/** Adds positive/negative delta into buffer at specified clock time. */
void blip_add_delta( blip_t*, unsigned int clock_time, int delta );
/** Same as blip_add_delta(), but uses faster, lower-quality synthesis. */
void blip_add_delta_fast( blip_t*, unsigned int clock_time, int delta );
/** Length of time frame, in clocks, needed to make sample_count additional
samples available. */
int blip_clocks_needed( const blip_t*, int sample_count );
enum { /** Maximum number of samples that can be generated from one time frame. */
blip_max_frame = 4000 };
/** Makes input clocks before clock_duration available for reading as output
samples. Also begins new time frame at clock_duration, so that clock time 0 in
the new time frame specifies the same clock as clock_duration in the old time
frame specified. Deltas can have been added slightly past clock_duration (up to
however many clocks there are in two output samples). */
void blip_end_frame( blip_t*, unsigned int clock_duration );
/** Number of buffered samples available for reading. */
int blip_samples_avail( const blip_t* );
/** Reads and removes at most 'count' samples and writes them to 'out'. If
'stereo' is true, writes output to every other element of 'out', allowing easy
interleaving of two buffers into a stereo sample stream. Outputs 16-bit signed
samples. Returns number of samples actually read. */
int blip_read_samples( blip_t*, int out [], int count );
/** Reads the current integrator and returns it */
int blip_peek_sample( blip_t* );
/** Frees buffer. No effect if NULL is passed. */
void blip_delete( blip_t* );
/* Deprecated */
typedef blip_t blip_buffer_t;
#ifdef __cplusplus
}
#endif
#endif

View file

@ -0,0 +1,13 @@
#ifndef DUMBFILE_H
#define DUMBFILE_H
#include "../dumb.h"
struct DUMBFILE
{
const DUMBFILE_SYSTEM *dfs;
void *file;
long pos;
};
#endif // DUMBFILE_H

View file

@ -0,0 +1,18 @@
#ifndef _FIR_RESAMPLER_H_
#define _FIR_RESAMPLER_H_
void fir_init();
void * fir_resampler_create();
void fir_resampler_delete(void *);
void * fir_resampler_dup(void *);
int fir_resampler_get_free_count(void *);
void fir_resampler_write_sample(void *, short sample);
void fir_resampler_set_rate( void *, double new_factor );
int fir_resampler_ready(void *);
void fir_resampler_clear(void *);
int fir_resampler_get_sample(void *);
void fir_resampler_remove_sample(void *);
#endif

View file

@ -28,9 +28,17 @@
#define INTERNAL_IT_H
#define BIT_ARRAY_BULLSHIT
#include <stddef.h>
#ifdef __FRAMEWORK__
#include <Dumb/barray.h>
#include <Dumb/tarray.h>
#else
#include "barray.h"
#include "tarray.h"
#endif
/** TO DO: THINK ABOUT THE FOLLOWING:
@ -52,9 +60,8 @@ sigdata->flags & IT_COMPATIBLE_GXX
* handle ambiguities in the format specification. The correct code in each
* case will be determined most likely by experimentation.
*/
#define STEREO_SAMPLES_COUNT_AS_TWO
//#define STEREO_SAMPLES_COUNT_AS_TWO
#define INVALID_ORDERS_END_SONG
#define INVALID_NOTES_CAUSE_NOTE_CUT
#define SUSTAIN_LOOP_OVERRIDES_NORMAL_LOOP
#define VOLUME_OUT_OF_RANGE_SETS_MAXIMUM
@ -66,6 +73,9 @@ sigdata->flags & IT_COMPATIBLE_GXX
#define IT_INSTRUMENT_SIGNATURE DUMB_ID('I', 'M', 'P', 'I')
#define IT_SAMPLE_SIGNATURE DUMB_ID('I', 'M', 'P', 'S')
// olivier sux
#define IT_MPTX_SIGNATURE DUMB_ID('X', 'T', 'P', 'M')
#define IT_INSM_SIGNATURE DUMB_ID('M', 'S', 'N', 'I')
/* 1 minute per 4 rows, each row 6 ticks; this is divided by the tempo to get
@ -80,7 +90,9 @@ sigdata->flags & IT_COMPATIBLE_GXX
*/
/* #define AMIGA_DIVISOR ((float)(4.0 * 14317056.0)) */
/* I believe the following one to be more accurate. */
#define AMIGA_DIVISOR ((float)(8.0 * 7159090.5))
//#define AMIGA_DIVISOR ((float)(8.0 * 7159090.5))
#define AMIGA_CLOCK 3546895
#define AMIGA_DIVISOR ((float)(16.0 * AMIGA_CLOCK))
@ -120,6 +132,7 @@ struct IT_FILTER_STATE
#define IT_ENVELOPE_ON 1
#define IT_ENVELOPE_LOOP_ON 2
#define IT_ENVELOPE_SUSTAIN_LOOP 4
#define IT_ENVELOPE_CARRY 8
#define IT_ENVELOPE_PITCH_IS_FILTER 128
struct IT_ENVELOPE
@ -164,7 +177,7 @@ struct IT_INSTRUMENT
unsigned char new_note_action;
unsigned char dup_check_type;
unsigned char dup_check_action;
unsigned char pp_separation;
signed char pp_separation;
unsigned char pp_centre;
unsigned char global_volume;
unsigned char default_pan;
@ -176,6 +189,8 @@ struct IT_INSTRUMENT
unsigned char map_note[120];
unsigned short map_sample[120];
//int output;
};
@ -189,14 +204,17 @@ struct IT_INSTRUMENT
#define IT_SAMPLE_PINGPONG_SUS_LOOP 128
#define IT_VIBRATO_SINE 0
#define IT_VIBRATO_SAWTOOTH 1 /* Ramp down */
#define IT_VIBRATO_SAWTOOTH 1
#define IT_VIBRATO_SQUARE 2
#define IT_VIBRATO_RANDOM 3
#define IT_VIBRATO_XM_SQUARE 4
#define IT_VIBRATO_RAMP_DOWN 5
#define IT_VIBRATO_RAMP_UP 6
struct IT_SAMPLE
{
unsigned char name[29];
unsigned char filename[14];
unsigned char name[35];
unsigned char filename[15];
unsigned char flags;
unsigned char global_volume;
unsigned char default_volume;
@ -219,7 +237,11 @@ struct IT_SAMPLE
unsigned char vibrato_rate;
unsigned char vibrato_waveform;
signed short finetune;
void *data;
int max_resampling_quality;
};
@ -277,7 +299,24 @@ struct IT_SAMPLE
#define IT_XM_KEY_OFF 32
#define IT_XM_SET_ENVELOPE_POSITION 33
#define IT_N_EFFECTS 34
/* More effects needed for PTM compatibility */
#define IT_PTM_NOTE_SLIDE_DOWN 34
#define IT_PTM_NOTE_SLIDE_UP 35
#define IT_PTM_NOTE_SLIDE_DOWN_RETRIG 36
#define IT_PTM_NOTE_SLIDE_UP_RETRIG 37
/* More effects needed for OKT compatibility */
#define IT_OKT_NOTE_SLIDE_DOWN 38
#define IT_OKT_NOTE_SLIDE_DOWN_ROW 39
#define IT_OKT_NOTE_SLIDE_UP 40
#define IT_OKT_NOTE_SLIDE_UP_ROW 41
#define IT_OKT_ARPEGGIO_3 42
#define IT_OKT_ARPEGGIO_4 43
#define IT_OKT_ARPEGGIO_5 44
#define IT_OKT_VOLUME_SLIDE_DOWN 45
#define IT_OKT_VOLUME_SLIDE_UP 46
#define IT_N_EFFECTS 47
/* These represent the top nibble of the command value. */
#define IT_S_SET_FILTER 0 /* Greyed out in IT... */
@ -370,12 +409,24 @@ struct IT_PATTERN
#define IT_WAS_AN_XM 64 /* Set for both XMs and MODs */
#define IT_WAS_A_MOD 128
#define IT_WAS_AN_S3M 256
#define IT_WAS_A_PTM 512
#define IT_WAS_A_669 1024
#define IT_WAS_AN_OKT 2048
#define IT_WAS_AN_STM 4096
#define IT_WAS_PROCESSED 8192 /* Will be set the first time a sigdata passes through a sigrenderer */
#define IT_ORDER_END 255
#define IT_ORDER_SKIP 254
struct DUMB_IT_SIGDATA
{
unsigned char name[29];
unsigned char name[65];
unsigned char *song_message;
@ -383,6 +434,7 @@ struct DUMB_IT_SIGDATA
int n_instruments;
int n_samples;
int n_patterns;
int n_pchannels;
int flags;
@ -422,11 +474,14 @@ struct IT_PLAYING_ENVELOPE
#define IT_PLAYING_SUSTAINOFF 2
#define IT_PLAYING_FADING 4
#define IT_PLAYING_DEAD 8
#define IT_PLAYING_REVERSE 16
struct IT_PLAYING
{
int flags;
int resampling_quality;
IT_CHANNEL *channel;
IT_SAMPLE *sample;
IT_INSTRUMENT *instrument;
@ -435,13 +490,24 @@ struct IT_PLAYING
unsigned short sampnum;
unsigned char instnum;
unsigned char declick_stage;
float declick_volume;
float float_volume[2];
float ramp_volume[2];
float ramp_delta[2];
unsigned char channel_volume;
unsigned char volume;
unsigned short pan;
signed char volume_offset, panning_offset;
unsigned char note;
unsigned char enabled_envelopes;
unsigned char filter_cutoff;
unsigned char filter_resonance;
@ -452,16 +518,26 @@ struct IT_PLAYING
unsigned char vibrato_depth;
unsigned char vibrato_n; /* May be specified twice: volpan & effect. */
unsigned char vibrato_time;
unsigned char vibrato_waveform;
unsigned char tremolo_speed;
unsigned char tremolo_depth;
unsigned char tremolo_time;
unsigned char tremolo_waveform;
unsigned char panbrello_speed;
unsigned char panbrello_depth;
unsigned char panbrello_time;
unsigned char panbrello_waveform;
signed char panbrello_random;
unsigned char sample_vibrato_time;
unsigned char sample_vibrato_waveform;
int sample_vibrato_depth; /* Starts at rate?0:depth, increases by rate */
int slide;
float delta;
int finetune;
IT_PLAYING_ENVELOPE volume_envelope;
IT_PLAYING_ENVELOPE pan_envelope;
@ -483,12 +559,18 @@ struct IT_PLAYING
* proceeding.
*/
long time_lost;
//int output;
};
#define IT_CHANNEL_MUTED 1
#define IT_ENV_VOLUME 1
#define IT_ENV_PANNING 2
#define IT_ENV_PITCH 4
struct IT_CHANNEL
{
int flags;
@ -523,7 +605,12 @@ struct IT_CHANNEL
unsigned char note_delay_count;
IT_ENTRY *note_delay_entry;
int arpeggio;
unsigned char new_note_action;
unsigned char const* arpeggio_table;
signed char arpeggio_offsets[3];
int arpeggio_shift;
unsigned char retrig;
unsigned char xm_retrig;
int retrig_tick;
@ -531,9 +618,18 @@ struct IT_CHANNEL
unsigned char tremor;
unsigned char tremor_time; /* Bit 6 set if note on; bit 7 set if tremor active. */
unsigned char vibrato_waveform;
unsigned char tremolo_waveform;
unsigned char panbrello_waveform;
int portamento;
int toneporta;
int toneslide;
unsigned char toneslide_tick, last_toneslide_tick, ptm_toneslide, ptm_last_toneslide, okt_toneslide;
unsigned char destnote;
unsigned char toneslide_retrig;
unsigned char glissando;
/** WARNING - for neatness, should one or both of these be in the IT_PLAYING struct? */
unsigned short sample;
@ -549,6 +645,8 @@ struct IT_CHANNEL
unsigned char lastHdepth;
unsigned char lastRspeed;
unsigned char lastRdepth;
unsigned char lastYspeed;
unsigned char lastYdepth;
unsigned char lastI;
unsigned char lastJ; /* Doubles as last portamento down for XM files */
unsigned char lastN;
@ -569,7 +667,18 @@ struct IT_CHANNEL
unsigned char xm_lastX1;
unsigned char xm_lastX2;
unsigned char inv_loop_delay;
unsigned char inv_loop_speed;
int inv_loop_offset;
IT_PLAYING *playing;
#ifdef BIT_ARRAY_BULLSHIT
void * played_patjump;
int played_patjump_order;
#endif
//int output;
};
@ -580,10 +689,12 @@ struct DUMB_IT_SIGRENDERER
int n_channels;
int resampling_quality;
unsigned char globalvolume;
signed char globalvolslide;
unsigned char tempo;
int tempo;
signed char temposlide;
IT_CHANNEL channel[DUMB_IT_N_CHANNELS];
@ -599,7 +710,8 @@ struct DUMB_IT_SIGRENDERER
int processorder;
int processrow;
int breakrow;
int pat_loop_row;
int restart_position;
int n_rows;
@ -613,6 +725,33 @@ struct DUMB_IT_SIGRENDERER
DUMB_CLICK_REMOVER **click_remover;
IT_CALLBACKS *callbacks;
#ifdef BIT_ARRAY_BULLSHIT
/* bit array, which rows are played, only checked by pattern break or loop commands */
void * played;
/*
Loop indicator for internal processes, may also be useful for external processes
0 - Not looped
1 - Looped
-1 - Continued past loop
*/
int looped;
/*
Kept until looped
*/
LONG_LONG time_played;
void * row_timekeeper;
#endif
long gvz_time;
int gvz_sub_time;
int ramp_style;
//int max_output;
};
@ -648,6 +787,10 @@ struct IT_CALLBACKS
* itself. In other words, return 1 if the Zxx macros in an IT file are
* controlling filters and shouldn't be.
*/
int (*global_volume_zero)(void *data);
void *global_volume_zero_data;
/* Return 1 to terminate the module when global volume is set to zero. */
};
@ -693,12 +836,14 @@ extern DUH_SIGTYPE_DESC _dumb_sigtype_it;
#define XM_E_SET_FINETUNE 0x5
#define XM_E_SET_LOOP 0x6
#define XM_E_SET_TREMOLO_CONTROL 0x7
#define XM_E_SET_PANNING 0x8
#define XM_E_RETRIG_NOTE 0x9
#define XM_E_FINE_VOLSLIDE_UP 0xA
#define XM_E_FINE_VOLSLIDE_DOWN 0xB
#define XM_E_NOTE_CUT 0xC
#define XM_E_NOTE_DELAY 0xD
#define XM_E_PATTERN_DELAY 0xE
#define XM_E_SET_MIDI_MACRO 0xF
#define XM_X_EXTRAFINE_PORTA_UP 1
#define XM_X_EXTRAFINE_PORTA_DOWN 2
@ -725,9 +870,58 @@ unsigned char **_dumb_malloc2(int w, int h);
void _dumb_free2(unsigned char **line);
#endif
void _dumb_it_xm_convert_effect(int effect, int value, IT_ENTRY *entry);
void _dumb_it_xm_convert_effect(int effect, int value, IT_ENTRY *entry, int mod);
int _dumb_it_fix_invalid_orders(DUMB_IT_SIGDATA *sigdata);
#define PTM_APPREGIO 0
#define PTM_PORTAMENTO_UP 1
#define PTM_PORTAMENTO_DOWN 2
#define PTM_TONE_PORTAMENTO 3
#define PTM_VIBRATO 4
#define PTM_VOLSLIDE_TONEPORTA 5
#define PTM_VOLSLIDE_VIBRATO 6
#define PTM_TREMOLO 7
#define PTM_SAMPLE_OFFSET 9
#define PTM_VOLUME_SLIDE 10 /* A */
#define PTM_POSITION_JUMP 11 /* B */
#define PTM_SET_CHANNEL_VOLUME 12 /* C */
#define PTM_PATTERN_BREAK 13 /* D */
#define PTM_E 14 /* E */
#define PTM_SET_TEMPO_BPM 15 /* F */
#define PTM_SET_GLOBAL_VOLUME 16 /* G */
#define PTM_RETRIGGER 17 /* H */
#define PTM_FINE_VIBRATO 18 /* I */
#define PTM_NOTE_SLIDE_UP 19 /* J */
#define PTM_NOTE_SLIDE_DOWN 20 /* K */
#define PTM_NOTE_SLIDE_UP_RETRIG 21 /* L */
#define PTM_NOTE_SLIDE_DOWN_RETRIG 22 /* M */
#define PTM_N_EFFECTS 23
#define PTM_E_FINE_PORTA_DOWN 0x1
#define PTM_E_FINE_PORTA_UP 0x2
#define PTM_E_SET_VIBRATO_CONTROL 0x4
#define PTM_E_SET_FINETUNE 0x5
#define PTM_E_SET_LOOP 0x6
#define PTM_E_SET_TREMOLO_CONTROL 0x7
#define PTM_E_SET_PANNING 0x8
#define PTM_E_RETRIG_NOTE 0x9
#define PTM_E_FINE_VOLSLIDE_UP 0xA
#define PTM_E_FINE_VOLSLIDE_DOWN 0xB
#define PTM_E_NOTE_CUT 0xC
#define PTM_E_NOTE_DELAY 0xD
#define PTM_E_PATTERN_DELAY 0xE
/* To make my life a bit simpler during conversion, effect E:xy is converted
* to effect number EBASE+x:y. The same applies to effect X, and IT's S. That
* way, these effects can be manipulated like regular effects.
*/
#define PTM_EBASE (PTM_N_EFFECTS)
void _dumb_it_ptm_convert_effect(int effect, int value, IT_ENTRY *entry);
long _dumb_it_read_sample_data_adpcm4(IT_SAMPLE *sample, DUMBFILE *f);
void _dumb_it_interleave_stereo_sample(IT_SAMPLE *sample);
#endif /* INTERNAL_IT_H */

View file

@ -0,0 +1,19 @@
#ifndef _LANCZOS_RESAMPLER_H_
#define _LANCZOS_RESAMPLER_H_
void lanczos_init();
void * lanczos_resampler_create();
void lanczos_resampler_delete(void *);
void * lanczos_resampler_dup(void *);
int lanczos_resampler_get_free_count(void *);
void lanczos_resampler_write_sample(void *, short sample);
void lanczos_resampler_set_rate( void *, double new_factor );
int lanczos_resampler_ready(void *);
void lanczos_resampler_clear(void *);
int lanczos_resampler_get_sample_count(void *);
int lanczos_resampler_get_sample(void *);
void lanczos_resampler_remove_sample(void *);
#endif

View file

@ -0,0 +1,30 @@
/********************************************************************
* *
* THIS FILE IS PART OF THE OggVorbis SOFTWARE CODEC SOURCE CODE. *
* USE, DISTRIBUTION AND REPRODUCTION OF THIS LIBRARY SOURCE IS *
* GOVERNED BY A BSD-STYLE SOURCE LICENSE INCLUDED WITH THIS SOURCE *
* IN 'COPYING'. PLEASE READ THESE TERMS BEFORE DISTRIBUTING. *
* *
* THE OggVorbis SOURCE CODE IS (C) COPYRIGHT 1994-2007 *
* by the Xiph.Org Foundation http://www.xiph.org/ *
* *
********************************************************************
function: LPC low level routines
last mod: $Id: lpc.h 16037 2009-05-26 21:10:58Z xiphmont $
********************************************************************/
#ifndef _V_LPC_H_
#define _V_LPC_H_
/* simple linear scale LPC code */
extern float vorbis_lpc_from_data(float *data,float *lpc,int n,int m);
extern void vorbis_lpc_predict(float *coeff,float *prime,int m,
float *data,long n);
struct DUMB_IT_SIGDATA;
extern void dumb_it_add_lpc(struct DUMB_IT_SIGDATA *sigdata);
#endif

View file

@ -0,0 +1,24 @@
#ifndef RIFF_H
#define RIFF_H
struct riff;
struct riff_chunk
{
unsigned type;
long offset;
unsigned size;
struct riff * nested;
};
struct riff
{
unsigned type;
unsigned chunk_count;
struct riff_chunk * chunks;
};
struct riff * riff_parse( DUMBFILE * f, long offset, long size, unsigned proper );
void riff_free( struct riff * );
#endif

View file

@ -0,0 +1,113 @@
/* Copyright (C) 2002 Jean-Marc Valin */
/**
@file stack_alloc.h
@brief Temporary memory allocation on stack
*/
/*
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions
are met:
- Redistributions of source code must retain the above copyright
notice, this list of conditions and the following disclaimer.
- Redistributions in binary form must reproduce the above copyright
notice, this list of conditions and the following disclaimer in the
documentation and/or other materials provided with the distribution.
- Neither the name of the Xiph.org Foundation nor the names of its
contributors may be used to endorse or promote products derived from
this software without specific prior written permission.
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR
CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
#ifndef STACK_ALLOC_H
#define STACK_ALLOC_H
#ifdef WIN32
# include <malloc.h>
#else
# ifdef HAVE_ALLOCA_H
# include <alloca.h>
# else
# include <stdlib.h>
# endif
#endif
/**
* @def ALIGN(stack, size)
*
* Aligns the stack to a 'size' boundary
*
* @param stack Stack
* @param size New size boundary
*/
/**
* @def PUSH(stack, size, type)
*
* Allocates 'size' elements of type 'type' on the stack
*
* @param stack Stack
* @param size Number of elements
* @param type Type of element
*/
/**
* @def VARDECL(var)
*
* Declare variable on stack
*
* @param var Variable to declare
*/
/**
* @def ALLOC(var, size, type)
*
* Allocate 'size' elements of 'type' on stack
*
* @param var Name of variable to allocate
* @param size Number of elements
* @param type Type of element
*/
#ifdef ENABLE_VALGRIND
#include <valgrind/memcheck.h>
#define ALIGN(stack, size) ((stack) += ((size) - (long)(stack)) & ((size) - 1))
#define PUSH(stack, size, type) (VALGRIND_MAKE_NOACCESS(stack, 1000),ALIGN((stack),sizeof(type)),VALGRIND_MAKE_WRITABLE(stack, ((size)*sizeof(type))),(stack)+=((size)*sizeof(type)),(type*)((stack)-((size)*sizeof(type))))
#else
#define ALIGN(stack, size) ((stack) += ((size) - (long)(stack)) & ((size) - 1))
#define PUSH(stack, size, type) (ALIGN((stack),sizeof(type)),(stack)+=((size)*sizeof(type)),(type*)((stack)-((size)*sizeof(type))))
#endif
#if defined(VAR_ARRAYS)
#define VARDECL(var)
#define ALLOC(var, size, type) type var[size]
#elif defined(USE_ALLOCA)
#define VARDECL(var) var
#define ALLOC(var, size, type) var = alloca(sizeof(type)*(size))
#else
#define VARDECL(var) var
#define ALLOC(var, size, type) var = PUSH(stack, size, type)
#endif
#endif

View file

@ -0,0 +1,25 @@
#ifndef _T_ARRAY_H_
#define _T_ARRAY_H_
#include <stdlib.h>
#ifdef __FRAMEWORK__
#include <Dumb/dumb.h>
#else
#include "../dumb.h"
#endif
void * timekeeping_array_create(size_t size);
void timekeeping_array_destroy(void * array);
void * timekeeping_array_dup(void * array);
void timekeeping_array_reset(void * array, size_t loop_start);
void timekeeping_array_push(void * array, size_t index, LONG_LONG time);
void timekeeping_array_bump(void * array, size_t index);
unsigned int timekeeping_array_get_count(void * array, size_t index);
LONG_LONG timekeeping_array_get_item(void * array, size_t index);
#endif

3
Frameworks/Dumb/dumb/prj/.gitignore vendored Normal file
View file

@ -0,0 +1,3 @@
dumb-build-Desktop-Release
dumb-build-Desktop-Debug
*.user

View file

@ -0,0 +1,132 @@
#-------------------------------------------------
#
# Project created by QtCreator 2012-12-22T16:33:53
#
#-------------------------------------------------
QT -= core gui
TARGET = dumb
TEMPLATE = lib
CONFIG += staticlib
DEFINES += _USE_SSE
INCLUDEPATH += ../../include
QMAKE_CFLAGS += -msse
SOURCES += \
../../src/core/unload.c \
../../src/core/rendsig.c \
../../src/core/rendduh.c \
../../src/core/register.c \
../../src/core/readduh.c \
../../src/core/rawsig.c \
../../src/core/makeduh.c \
../../src/core/loadduh.c \
../../src/core/dumbfile.c \
../../src/core/duhtag.c \
../../src/core/duhlen.c \
../../src/core/atexit.c \
../../src/helpers/stdfile.c \
../../src/helpers/silence.c \
../../src/helpers/sampbuf.c \
../../src/helpers/riff.c \
../../src/helpers/resample.c \
../../src/helpers/memfile.c \
../../src/helpers/clickrem.c \
../../src/helpers/blip_buf.c \
../../src/helpers/barray.c \
../../src/helpers/tarray.c \
../../src/it/xmeffect.c \
../../src/it/readxm2.c \
../../src/it/readxm.c \
../../src/it/readstm2.c \
../../src/it/readstm.c \
../../src/it/reads3m2.c \
../../src/it/reads3m.c \
../../src/it/readriff.c \
../../src/it/readptm.c \
../../src/it/readpsm.c \
../../src/it/readoldpsm.c \
../../src/it/readokt2.c \
../../src/it/readokt.c \
../../src/it/readmtm.c \
../../src/it/readmod2.c \
../../src/it/readmod.c \
../../src/it/readdsmf.c \
../../src/it/readasy.c \
../../src/it/readamf2.c \
../../src/it/readamf.c \
../../src/it/readam.c \
../../src/it/read6692.c \
../../src/it/read669.c \
../../src/it/ptmeffect.c \
../../src/it/loadxm2.c \
../../src/it/loadxm.c \
../../src/it/loadstm2.c \
../../src/it/loadstm.c \
../../src/it/loads3m2.c \
../../src/it/loads3m.c \
../../src/it/loadriff2.c \
../../src/it/loadriff.c \
../../src/it/loadptm2.c \
../../src/it/loadptm.c \
../../src/it/loadpsm2.c \
../../src/it/loadpsm.c \
../../src/it/loadoldpsm2.c \
../../src/it/loadoldpsm.c \
../../src/it/loadokt2.c \
../../src/it/loadokt.c \
../../src/it/loadmtm2.c \
../../src/it/loadmtm.c \
../../src/it/loadmod2.c \
../../src/it/loadmod.c \
../../src/it/loadasy2.c \
../../src/it/loadasy.c \
../../src/it/loadamf2.c \
../../src/it/loadamf.c \
../../src/it/load6692.c \
../../src/it/load669.c \
../../src/it/itunload.c \
../../src/it/itrender.c \
../../src/it/itread2.c \
../../src/it/itread.c \
../../src/it/itorder.c \
../../src/it/itmisc.c \
../../src/it/itload2.c \
../../src/it/itload.c \
../../src/it/readany.c \
../../src/it/loadany2.c \
../../src/it/loadany.c \
../../src/it/readany2.c \
../../src/helpers/lanczos_resampler.c \
../../src/helpers/lpc.c
HEADERS += \
../../include/dumb.h \
../../include/internal/riff.h \
../../include/internal/it.h \
../../include/internal/dumb.h \
../../include/internal/blip_buf.h \
../../include/internal/barray.h \
../../include/internal/tarray.h \
../../include/internal/aldumb.h \
../../include/internal/lanczos_resampler.h \
../../include/internal/stack_alloc.h \
../../include/internal/lpc.h \
../../include/internal/dumbfile.h
unix:!symbian {
maemo5 {
target.path = /opt/usr/lib
} else {
target.path = /usr/lib
}
INSTALLS += target
}
OTHER_FILES += \
../../src/helpers/resample.inc \
../../src/helpers/resamp3.inc \
../../src/helpers/resamp2.inc

View file

@ -23,27 +23,24 @@
static DUMBFILE_SYSTEM *the_dfs = NULL;
static const DUMBFILE_SYSTEM *the_dfs = NULL;
void register_dumbfile_system(DUMBFILE_SYSTEM *dfs)
void register_dumbfile_system(const DUMBFILE_SYSTEM *dfs)
{
ASSERT(dfs);
ASSERT(dfs->open);
ASSERT(dfs->getc);
ASSERT(dfs->close);
ASSERT(dfs->seek);
ASSERT(dfs->get_size);
the_dfs = dfs;
}
struct DUMBFILE
{
DUMBFILE_SYSTEM *dfs;
void *file;
long pos;
};
#include "internal/dumbfile.h"
@ -53,7 +50,7 @@ DUMBFILE *dumbfile_open(const char *filename)
ASSERT(the_dfs);
f = malloc(sizeof(*f));
f = (DUMBFILE *) malloc(sizeof(*f));
if (!f)
return NULL;
@ -74,7 +71,7 @@ DUMBFILE *dumbfile_open(const char *filename)
DUMBFILE *dumbfile_open_ex(void *file, DUMBFILE_SYSTEM *dfs)
DUMBFILE *dumbfile_open_ex(void *file, const DUMBFILE_SYSTEM *dfs)
{
DUMBFILE *f;
@ -82,7 +79,7 @@ DUMBFILE *dumbfile_open_ex(void *file, DUMBFILE_SYSTEM *dfs)
ASSERT(dfs->getc);
ASSERT(file);
f = malloc(sizeof(*f));
f = (DUMBFILE *) malloc(sizeof(*f));
if (!f) {
if (dfs->close)
@ -375,6 +372,26 @@ long dumbfile_getnc(char *ptr, long n, DUMBFILE *f)
int dumbfile_seek(DUMBFILE *f, long n, int origin)
{
switch ( origin )
{
case DFS_SEEK_CUR: n += f->pos; break;
case DFS_SEEK_END: n += (*f->dfs->get_size)(f->file); break;
}
f->pos = n;
return (*f->dfs->seek)(f->file, n);
}
long dumbfile_get_size(DUMBFILE *f)
{
return (*f->dfs->get_size)(f->file);
}
int dumbfile_error(DUMBFILE *f)
{
ASSERT(f);

View file

@ -130,3 +130,22 @@ DUH *make_duh(
return duh;
}
int duh_add_signal(DUH *duh, DUH_SIGTYPE_DESC *desc, sigdata_t *sigdata)
{
DUH_SIGNAL **signal;
if ( !duh || !desc || !sigdata ) return -1;
signal = ( DUH_SIGNAL ** ) realloc( duh->signal, ( duh->n_signals + 1 ) * sizeof( *duh->signal ) );
if ( !signal ) return -1;
duh->signal = signal;
memmove( signal + 1, signal, duh->n_signals * sizeof( *signal ) );
duh->n_signals++;
signal[ 0 ] = make_signal( desc, sigdata );
if ( !signal[ 0 ] ) return -1;
return 0;
}

View file

@ -29,16 +29,30 @@
*/
sigdata_t *duh_get_raw_sigdata(DUH *duh, int sig, long type)
{
int i;
DUH_SIGNAL *signal;
if (!duh) return NULL;
if ( sig >= 0 )
{
if ((unsigned int)sig >= (unsigned int)duh->n_signals) return NULL;
signal = duh->signal[sig];
if (signal && signal->desc->type == type)
return signal->sigdata;
}
else
{
for ( i = 0; i < duh->n_signals; i++ )
{
signal = duh->signal[i];
if (signal && signal->desc->type == type)
return signal->sigdata;
}
}
return NULL;
}

View file

@ -99,9 +99,9 @@ void duh_sigrenderer_set_callback(
(void)sigrenderer;
(void)callback;
(void)data;
fprintf(stderr,
/*fprintf(stderr,
"Call to deprecated function duh_sigrenderer_set_callback(). The callback\n"
"was not installed. See dumb/docs/deprec.txt for how to fix this.\n");
"was not installed. See dumb/docs/deprec.txt for how to fix this.\n");*/
}
@ -143,7 +143,15 @@ int duh_sigrenderer_get_n_channels(DUH_SIGRENDERER *sigrenderer)
long duh_sigrenderer_get_position(DUH_SIGRENDERER *sigrenderer)
{
return sigrenderer ? sigrenderer->pos : -1;
DUH_SIGRENDERER_GET_POSITION proc;
if (!sigrenderer) return -1;
proc = sigrenderer->desc->sigrenderer_get_position;
if (proc)
return (*proc)(sigrenderer->sigrenderer);
else
return sigrenderer->pos;
}

View file

@ -0,0 +1,159 @@
#include "internal/barray.h"
#include <string.h>
void * bit_array_create(size_t size)
{
size_t bsize = ((size + 7) >> 3) + sizeof(size_t);
void * ret = calloc(1, bsize);
if (ret) *(size_t *)ret = size;
return ret;
}
void bit_array_destroy(void * array)
{
if (array) free(array);
}
void * bit_array_dup(void * array)
{
if (array)
{
size_t * size = (size_t *) array;
size_t bsize = ((*size + 7) >> 3) + sizeof(*size);
void * ret = malloc(bsize);
if (ret) memcpy(ret, array, bsize);
return ret;
}
return NULL;
}
void bit_array_reset(void * array)
{
if (array)
{
size_t * size = (size_t *) array;
size_t bsize = (*size + 7) >> 3;
memset(size + 1, 0, bsize);
}
}
void bit_array_set(void * array, size_t bit)
{
if (array)
{
size_t * size = (size_t *) array;
if (bit < *size)
{
unsigned char * ptr = (unsigned char *)(size + 1);
ptr[bit >> 3] |= (1U << (bit & 7));
}
}
}
int bit_array_test(void * array, size_t bit)
{
if (array)
{
size_t * size = (size_t *) array;
if (bit < *size)
{
unsigned char * ptr = (unsigned char *)(size + 1);
if (ptr[bit >> 3] & (1U << (bit & 7)))
{
return 1;
}
}
}
return 0;
}
int bit_array_test_range(void * array, size_t bit, size_t count)
{
if (array)
{
size_t * size = (size_t *) array;
if (bit < *size)
{
unsigned char * ptr = (unsigned char *)(size + 1);
if ((bit & 7) && (count > 8))
{
while ((bit < *size) && count && (bit & 7))
{
if (ptr[bit >> 3] & (1U << (bit & 7))) return 1;
bit++;
count--;
}
}
if (!(bit & 7))
{
while (((*size - bit) >= 8) && (count >= 8))
{
if (ptr[bit >> 3]) return 1;
bit += 8;
count -= 8;
}
}
while ((bit < *size) && count)
{
if (ptr[bit >> 3] & (1U << (bit & 7))) return 1;
bit++;
count--;
}
}
}
return 0;
}
void bit_array_clear(void * array, size_t bit)
{
if (array)
{
size_t * size = (size_t *) array;
if (bit < *size)
{
unsigned char * ptr = (unsigned char *)(size + 1);
ptr[bit >> 3] &= ~(1U << (bit & 7));
}
}
}
void bit_array_merge(void * dest, void * source, size_t offset)
{
if (dest && source)
{
size_t * dsize = (size_t *) dest;
size_t * ssize = (size_t *) source;
size_t soffset = 0;
while (offset < *dsize && soffset < *ssize)
{
if (bit_array_test(source, soffset))
{
bit_array_set(dest, offset);
}
soffset++;
offset++;
}
}
}
void bit_array_mask(void * dest, void * source, size_t offset)
{
if (dest && source)
{
size_t * dsize = (size_t *) dest;
size_t * ssize = (size_t *) source;
size_t soffset = 0;
while (offset < *dsize && soffset < *ssize)
{
if (bit_array_test(source, soffset))
{
bit_array_clear(dest, offset);
}
soffset++;
offset++;
}
}
}

View file

@ -0,0 +1,354 @@
/* blip_buf 1.1.0. http://www.slack.net/~ant/ */
#include "internal/blip_buf.h"
#include <assert.h>
#include <limits.h>
#include <string.h>
#include <stdlib.h>
/* Library Copyright (C) 2003-2009 Shay Green. This library is free software;
you can redistribute it and/or modify it under the terms of the GNU Lesser
General Public License as published by the Free Software Foundation; either
version 2.1 of the License, or (at your option) any later version. This
library is distributed in the hope that it will be useful, but WITHOUT ANY
WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR
A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more
details. You should have received a copy of the GNU Lesser General Public
License along with this module; if not, write to the Free Software Foundation,
Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA */
#if defined (BLARGG_TEST) && BLARGG_TEST
#include "blargg_test.h"
#endif
/* Equivalent to ULONG_MAX >= 0xFFFFFFFF00000000.
Avoids constants that don't fit in 32 bits. */
#if ULONG_MAX/0xFFFFFFFF > 0xFFFFFFFF
typedef unsigned long fixed_t;
enum { pre_shift = 32 };
#elif defined(ULLONG_MAX)
typedef unsigned long long fixed_t;
enum { pre_shift = 32 };
#else
typedef unsigned fixed_t;
enum { pre_shift = 0 };
#endif
enum { time_bits = pre_shift + 20 };
static fixed_t const time_unit = (fixed_t) 1 << time_bits;
enum { bass_shift = 9 }; /* affects high-pass filter breakpoint frequency */
enum { end_frame_extra = 2 }; /* allows deltas slightly after frame length */
enum { half_width = 8 };
enum { buf_extra = half_width*2 + end_frame_extra };
enum { phase_bits = 5 };
enum { phase_count = 1 << phase_bits };
enum { delta_bits = 15 };
enum { delta_unit = 1 << delta_bits };
enum { frac_bits = time_bits - pre_shift };
/* We could eliminate avail and encode whole samples in offset, but that would
limit the total buffered samples to blip_max_frame. That could only be
increased by decreasing time_bits, which would reduce resample ratio accuracy.
*/
/** Sample buffer that resamples to output rate and accumulates samples
until they're read out */
struct blip_t
{
fixed_t factor;
fixed_t offset;
int avail;
int size;
int integrator;
};
typedef int buf_t;
/* probably not totally portable */
#define SAMPLES( buf ) ((buf_t*) ((buf) + 1))
/* Arithmetic (sign-preserving) right shift */
#define ARITH_SHIFT( n, shift ) \
((n) >> (shift))
enum { max_sample = +32767 };
enum { min_sample = -32768 };
#define CLAMP( n ) \
{\
if ( (short) n != n )\
n = ARITH_SHIFT( n, 16 ) ^ max_sample;\
}
static void check_assumptions( void )
{
int n;
#if INT_MAX < 0x7FFFFFFF || UINT_MAX < 0xFFFFFFFF
#error "int must be at least 32 bits"
#endif
assert( (-3 >> 1) == -2 ); /* right shift must preserve sign */
n = max_sample * 2;
CLAMP( n );
assert( n == max_sample );
n = min_sample * 2;
CLAMP( n );
assert( n == min_sample );
assert( blip_max_ratio <= time_unit );
assert( blip_max_frame <= (fixed_t) -1 >> time_bits );
}
blip_t* blip_new( int size )
{
blip_t* m;
assert( size >= 0 );
m = (blip_t*) malloc( sizeof *m + (size + buf_extra) * sizeof (buf_t) );
if ( m )
{
m->factor = time_unit / blip_max_ratio;
m->size = size;
blip_clear( m );
check_assumptions();
}
return m;
}
blip_t* blip_dup( blip_t* m )
{
size_t size = sizeof *m + (m->size + buf_extra) * sizeof(buf_t);
blip_t* r = (blip_t*) malloc( size );
if ( r ) memcpy( r, m, size );
return r;
}
void blip_delete( blip_t* m )
{
if ( m != NULL )
{
/* Clear fields in case user tries to use after freeing */
memset( m, 0, sizeof *m );
free( m );
}
}
void blip_set_rates( blip_t* m, double clock_rate, double sample_rate )
{
double factor = time_unit * sample_rate / clock_rate;
m->factor = (fixed_t) factor;
/* Fails if clock_rate exceeds maximum, relative to sample_rate */
assert( 0 <= factor - m->factor && factor - m->factor < 1 );
/* Avoid requiring math.h. Equivalent to
m->factor = (int) ceil( factor ) */
if ( m->factor < factor )
m->factor++;
/* At this point, factor is most likely rounded up, but could still
have been rounded down in the floating-point calculation. */
}
void blip_clear( blip_t* m )
{
/* We could set offset to 0, factor/2, or factor-1. 0 is suitable if
factor is rounded up. factor-1 is suitable if factor is rounded down.
Since we don't know rounding direction, factor/2 accommodates either,
with the slight loss of showing an error in half the time. Since for
a 64-bit factor this is years, the halving isn't a problem. */
m->offset = m->factor / 2;
m->avail = 0;
m->integrator = 0;
memset( SAMPLES( m ), 0, (m->size + buf_extra) * sizeof (buf_t) );
}
int blip_clocks_needed( const blip_t* m, int samples )
{
fixed_t needed;
/* Fails if buffer can't hold that many more samples */
assert( samples >= 0 && m->avail + samples <= m->size );
needed = (fixed_t) samples * time_unit;
if ( needed < m->offset )
return 0;
return (needed - m->offset + m->factor - 1) / m->factor;
}
void blip_end_frame( blip_t* m, unsigned t )
{
fixed_t off = t * m->factor + m->offset;
m->avail += off >> time_bits;
m->offset = off & (time_unit - 1);
/* Fails if buffer size was exceeded */
assert( m->avail <= m->size );
}
int blip_samples_avail( const blip_t* m )
{
return m->avail;
}
static void remove_samples( blip_t* m, int count )
{
buf_t* buf = SAMPLES( m );
int remain = m->avail + buf_extra - count;
m->avail -= count;
memmove( &buf [0], &buf [count], remain * sizeof buf [0] );
memset( &buf [remain], 0, count * sizeof buf [0] );
}
int blip_read_samples( blip_t* m, int out [], int count )
{
assert( count >= 0 );
if ( count > m->avail )
count = m->avail;
if ( count )
{
buf_t const* in = SAMPLES( m );
buf_t const* end = in + count;
int sum = m->integrator;
do
{
/* Eliminate fraction */
int s = ARITH_SHIFT( sum, delta_bits - 8 );
sum += *in++;
*out = s;
out++;
/* High-pass filter */
sum -= s >> (8 - (delta_bits - bass_shift)); //<< (delta_bits - bass_shift - 8);
}
while ( in != end );
m->integrator = sum;
remove_samples( m, count );
}
return count;
}
int blip_peek_sample( blip_t* m )
{
return ARITH_SHIFT( m->integrator, delta_bits - 8 );
}
/* Things that didn't help performance on x86:
__attribute__((aligned(128)))
#define short int
restrict
*/
/* Sinc_Generator( 0.9, 0.55, 4.5 ) */
static short const bl_step [phase_count + 1] [half_width] =
{
{ 43, -115, 350, -488, 1136, -914, 5861,21022},
{ 44, -118, 348, -473, 1076, -799, 5274,21001},
{ 45, -121, 344, -454, 1011, -677, 4706,20936},
{ 46, -122, 336, -431, 942, -549, 4156,20829},
{ 47, -123, 327, -404, 868, -418, 3629,20679},
{ 47, -122, 316, -375, 792, -285, 3124,20488},
{ 47, -120, 303, -344, 714, -151, 2644,20256},
{ 46, -117, 289, -310, 634, -17, 2188,19985},
{ 46, -114, 273, -275, 553, 117, 1758,19675},
{ 44, -108, 255, -237, 471, 247, 1356,19327},
{ 43, -103, 237, -199, 390, 373, 981,18944},
{ 42, -98, 218, -160, 310, 495, 633,18527},
{ 40, -91, 198, -121, 231, 611, 314,18078},
{ 38, -84, 178, -81, 153, 722, 22,17599},
{ 36, -76, 157, -43, 80, 824, -241,17092},
{ 34, -68, 135, -3, 8, 919, -476,16558},
{ 32, -61, 115, 34, -60, 1006, -683,16001},
{ 29, -52, 94, 70, -123, 1083, -862,15422},
{ 27, -44, 73, 106, -184, 1152,-1015,14824},
{ 25, -36, 53, 139, -239, 1211,-1142,14210},
{ 22, -27, 34, 170, -290, 1261,-1244,13582},
{ 20, -20, 16, 199, -335, 1301,-1322,12942},
{ 18, -12, -3, 226, -375, 1331,-1376,12293},
{ 15, -4, -19, 250, -410, 1351,-1408,11638},
{ 13, 3, -35, 272, -439, 1361,-1419,10979},
{ 11, 9, -49, 292, -464, 1362,-1410,10319},
{ 9, 16, -63, 309, -483, 1354,-1383, 9660},
{ 7, 22, -75, 322, -496, 1337,-1339, 9005},
{ 6, 26, -85, 333, -504, 1312,-1280, 8355},
{ 4, 31, -94, 341, -507, 1278,-1205, 7713},
{ 3, 35, -102, 347, -506, 1238,-1119, 7082},
{ 1, 40, -110, 350, -499, 1190,-1021, 6464},
{ 0, 43, -115, 350, -488, 1136, -914, 5861}
};
/* Shifting by pre_shift allows calculation using unsigned int rather than
possibly-wider fixed_t. On 32-bit platforms, this is likely more efficient.
And by having pre_shift 32, a 32-bit platform can easily do the shift by
simply ignoring the low half. */
void blip_add_delta( blip_t* m, unsigned time, int delta )
{
unsigned fixed = (unsigned) ((time * m->factor + m->offset) >> pre_shift);
buf_t* out = SAMPLES( m ) + m->avail + (fixed >> frac_bits);
int const phase_shift = frac_bits - phase_bits;
int phase = fixed >> phase_shift & (phase_count - 1);
short const* in = bl_step [phase];
short const* rev = bl_step [phase_count - phase];
int interp = fixed >> (phase_shift - delta_bits) & (delta_unit - 1);
int delta2 = (delta * interp) >> delta_bits;
delta -= delta2;
/* Fails if buffer size was exceeded */
assert( out <= &SAMPLES( m ) [m->size + end_frame_extra] );
out [0] += in[0]*delta + in[half_width+0]*delta2;
out [1] += in[1]*delta + in[half_width+1]*delta2;
out [2] += in[2]*delta + in[half_width+2]*delta2;
out [3] += in[3]*delta + in[half_width+3]*delta2;
out [4] += in[4]*delta + in[half_width+4]*delta2;
out [5] += in[5]*delta + in[half_width+5]*delta2;
out [6] += in[6]*delta + in[half_width+6]*delta2;
out [7] += in[7]*delta + in[half_width+7]*delta2;
in = rev;
out [ 8] += in[7]*delta + in[7-half_width]*delta2;
out [ 9] += in[6]*delta + in[6-half_width]*delta2;
out [10] += in[5]*delta + in[5-half_width]*delta2;
out [11] += in[4]*delta + in[4-half_width]*delta2;
out [12] += in[3]*delta + in[3-half_width]*delta2;
out [13] += in[2]*delta + in[2-half_width]*delta2;
out [14] += in[1]*delta + in[1-half_width]*delta2;
out [15] += in[0]*delta + in[0-half_width]*delta2;
}
void blip_add_delta_fast( blip_t* m, unsigned time, int delta )
{
unsigned fixed = (unsigned) ((time * m->factor + m->offset) >> pre_shift);
buf_t* out = SAMPLES( m ) + m->avail + (fixed >> frac_bits);
int interp = fixed >> (frac_bits - delta_bits) & (delta_unit - 1);
int delta2 = delta * interp;
/* Fails if buffer size was exceeded */
assert( out <= &SAMPLES( m ) [m->size + end_frame_extra] );
out [7] += delta * delta_unit - delta2;
out [8] += delta2;
}

View file

@ -151,14 +151,14 @@ void dumb_remove_clicks(DUMB_CLICK_REMOVER *cr, sample_t *samples, long length,
offset = -offset;
while (pos < end) {
samples[pos] -= offset;
offset = (int)((LONG_LONG)(offset << 1) * factor >> 32);
offset = (int)(((LONG_LONG)(offset << 1) * factor) >> 32);
pos += step;
}
offset = -offset;
} else {
while (pos < end) {
samples[pos] += offset;
offset = (int)((LONG_LONG)(offset << 1) * factor >> 32);
offset = (int)(((LONG_LONG)(offset << 1) * factor) >> 32);
pos += step;
}
}

View file

@ -0,0 +1,281 @@
#include <stdlib.h>
#include <string.h>
#include <math.h>
#include "internal/fir_resampler.h"
enum { fir_width = 16 };
enum { fir_max_res = 1024 };
enum { fir_min_width = (fir_width < 4 ? 4 : fir_width) };
enum { fir_adj_width = fir_min_width / 4 * 4 + 2 };
enum { fir_stereo = 1 }; /* channel count, not boolean value */
enum { fir_write_offset = fir_adj_width * fir_stereo };
enum { fir_buffer_size = fir_width * 2 };
typedef short fir_impulse[fir_adj_width];
/* exp slope to 31/32 of ln(8) */
static const double fir_ratios[32] = {
1.000, 1.067, 1.139, 1.215, 1.297, 1.384, 1.477, 1.576,
1.682, 1.795, 1.915, 2.044, 2.181, 2.327, 2.484, 2.650,
2.828, 3.018, 3.221, 3.437, 3.668, 3.914, 4.177, 4.458,
4.757, 5.076, 5.417, 5.781, 6.169, 6.583, 7.025, 7.497
};
static fir_impulse fir_impulses[32][fir_max_res];
#undef PI
#define PI 3.1415926535897932384626433832795029
static void gen_sinc( double rolloff, int width, double offset, double spacing, double scale,
int count, short* out )
{
double const maxh = 256;
double const step = PI / maxh * spacing;
double const to_w = maxh * 2 / width;
double const pow_a_n = pow( rolloff, maxh );
double angle = (count / 2 - 1 + offset) * -step;
scale /= maxh * 2;
while ( count-- )
{
double w;
*out++ = 0;
w = angle * to_w;
if ( fabs( w ) < PI )
{
double rolloff_cos_a = rolloff * cos( angle );
double num = 1 - rolloff_cos_a -
pow_a_n * cos( maxh * angle ) +
pow_a_n * rolloff * cos( (maxh - 1) * angle );
double den = 1 - rolloff_cos_a - rolloff_cos_a + rolloff * rolloff;
double sinc = scale * num / den - scale;
out [-1] = (short) (cos( w ) * sinc + sinc);
}
angle += step;
}
}
typedef struct fir_resampler
{
int write_pos, write_filled;
int read_pos, read_filled;
unsigned short phase;
unsigned int phase_inc;
unsigned int ratio_set;
int buffer_in[fir_buffer_size * 2];
int buffer_out[fir_buffer_size];
} fir_resampler;
void * fir_resampler_create()
{
fir_resampler * r = ( fir_resampler * ) malloc( sizeof(fir_resampler) );
if ( !r ) return 0;
r->write_pos = 0;
r->write_filled = 0;
r->read_pos = 0;
r->read_filled = 0;
r->phase = 0;
r->phase_inc = 0;
r->ratio_set = 0;
memset( r->buffer_in, 0, sizeof(r->buffer_in) );
memset( r->buffer_out, 0, sizeof(r->buffer_out) );
return r;
}
void fir_resampler_delete(void * _r)
{
free( _r );
}
void * fir_resampler_dup(void * _r)
{
fir_resampler * r_in = ( fir_resampler * ) _r;
fir_resampler * r_out = ( fir_resampler * ) malloc( sizeof(fir_resampler) );
if ( !r_out ) return 0;
r_out->write_pos = r_in->write_pos;
r_out->write_filled = r_in->write_filled;
r_out->read_pos = r_in->read_pos;
r_out->read_filled = r_in->read_filled;
r_out->phase = r_in->phase;
r_out->phase_inc = r_in->phase_inc;
r_out->ratio_set = r_in->ratio_set;
memcpy( r_out->buffer_in, r_in->buffer_in, sizeof(r_in->buffer_in) );
memcpy( r_out->buffer_out, r_in->buffer_out, sizeof(r_in->buffer_out) );
return r_out;
}
int fir_resampler_get_free_count(void *_r)
{
fir_resampler * r = ( fir_resampler * ) _r;
return fir_buffer_size - r->write_filled;
}
int fir_resampler_ready(void *_r)
{
fir_resampler * r = ( fir_resampler * ) _r;
return r->write_filled > fir_adj_width;
}
void fir_resampler_clear(void *_r)
{
fir_resampler * r = ( fir_resampler * ) _r;
r->write_pos = 0;
r->write_filled = 0;
r->read_pos = 0;
r->read_filled = 0;
r->phase = 0;
memset( r->buffer_in, 0, sizeof(r->buffer_in) );
}
void fir_resampler_set_rate(void *_r, double new_factor)
{
fir_resampler * r = ( fir_resampler * ) _r;
r->phase_inc = (int)( new_factor * 65536.0 );
r->ratio_set = 0;
while ( r->ratio_set < 31 && new_factor > fir_ratios[ r->ratio_set ] ) r->ratio_set++;
}
void fir_resampler_write_sample(void *_r, short s)
{
fir_resampler * r = ( fir_resampler * ) _r;
if ( r->write_filled < fir_buffer_size )
{
int s32 = s;
r->buffer_in[ r->write_pos ] = s32;
r->buffer_in[ r->write_pos + fir_buffer_size ] = s32;
++r->write_filled;
r->write_pos = ( r->write_pos + 1 ) % fir_buffer_size;
}
}
void fir_init()
{
double const rolloff = 0.999;
double const gain = 1.0;
int const res = fir_max_res;
int i;
for (i = 0; i < 32; i++)
{
double const ratio_ = fir_ratios[ i ];
double fraction = 1.0 / (double)fir_max_res;
double const filter = (ratio_ < 1.0) ? 1.0 : 1.0 / ratio_;
double pos = 0.0;
short* out = (short*) fir_impulses[ i ];
int n;
for ( n = res; --n >= 0; )
{
gen_sinc( rolloff, (int) (fir_adj_width * filter + 1) & ~1, pos, filter,
(double) (0x7FFF * gain * filter), (int) fir_adj_width, out );
out += fir_adj_width;
pos += fraction;
}
}
}
int fir_resampler_run(void *_r, int ** out_, int * out_end)
{
fir_resampler * r = ( fir_resampler * ) _r;
int in_size = r->write_filled;
int const* in_ = r->buffer_in + fir_buffer_size + r->write_pos - r->write_filled;
int used = 0;
in_size -= fir_write_offset;
if ( in_size > 0 )
{
int* out = *out_;
int const* in = in_;
int const* const in_end = in + in_size;
int phase = r->phase;
int phase_inc = r->phase_inc;
int ratio_set = r->ratio_set;
do
{
// accumulate in extended precision
short const* imp = fir_impulses[ratio_set][(phase & 0xFFC0) >> 6];
int pt = imp [0];
int s = pt * in [0];
int n;
if ( out >= out_end )
break;
for ( n = (fir_adj_width - 2) / 2; n; --n )
{
pt = imp [1];
s += pt * in [1];
// pre-increment more efficient on some RISC processors
imp += 2;
pt = imp [0];
in += 2;
s += pt * in [0];
}
pt = imp [1];
s += pt * in [1];
phase += phase_inc;
in += (phase >> 16) - fir_adj_width + 2;
phase &= 65535;
*out++ = (int) (s >> 7);
}
while ( in < in_end );
r->phase = phase;
*out_ = out;
used = in - in_;
r->write_filled -= used;
}
return used;
}
int fir_resampler_get_sample(void *_r)
{
fir_resampler * r = ( fir_resampler * ) _r;
if ( r->read_filled < 1 )
{
int write_pos = ( r->read_pos + r->read_filled ) % fir_buffer_size;
int write_size = fir_buffer_size - write_pos;
int * out = r->buffer_out + write_pos;
if ( write_size > ( fir_buffer_size - r->read_filled ) )
write_size = fir_buffer_size - r->read_filled;
fir_resampler_run( r, &out, out + write_size );
r->read_filled += out - r->buffer_out - write_pos;
}
if ( r->read_filled < 1 )
return 0;
return r->buffer_out[ r->read_pos ];
}
void fir_resampler_remove_sample(void *_r)
{
fir_resampler * r = ( fir_resampler * ) _r;
if ( r->read_filled > 0 )
{
--r->read_filled;
r->read_pos = ( r->read_pos + 1 ) % fir_buffer_size;
}
}

View file

@ -0,0 +1,229 @@
#include <stdlib.h>
#include <string.h>
#define _USE_MATH_DEFINES
#include <math.h>
#ifndef M_PI
#define M_PI 3.14159265358979323846
#endif
#include "internal/lanczos_resampler.h"
enum { LANCZOS_RESOLUTION = 8192 };
enum { LANCZOS_WIDTH = 8 };
enum { LANCZOS_SAMPLES = LANCZOS_RESOLUTION * LANCZOS_WIDTH };
static double lanczos_lut[LANCZOS_SAMPLES + 1];
enum { lanczos_buffer_size = LANCZOS_WIDTH * 4 };
int fEqual(const double b, const double a)
{
return fabs(a - b) < 1.0e-6;
}
static double sinc(double x)
{
return fEqual(x, 0.0) ? 1.0 : sin(x * M_PI) / (x * M_PI);
}
void lanczos_init()
{
unsigned i;
double dx = (double)(LANCZOS_WIDTH) / LANCZOS_SAMPLES, x = 0.0;
for (i = 0; i < LANCZOS_SAMPLES + 1; ++i, x += dx)
lanczos_lut[i] = abs(x) < LANCZOS_WIDTH ? sinc(x) * sinc(x / LANCZOS_WIDTH) : 0.0;
}
typedef struct lanczos_resampler
{
int write_pos, write_filled;
int read_pos, read_filled;
unsigned short phase;
unsigned int phase_inc;
float buffer_in[lanczos_buffer_size * 2];
int buffer_out[lanczos_buffer_size];
} lanczos_resampler;
void * lanczos_resampler_create()
{
lanczos_resampler * r = ( lanczos_resampler * ) malloc( sizeof(lanczos_resampler) );
if ( !r ) return 0;
r->write_pos = 0;
r->write_filled = 0;
r->read_pos = 0;
r->read_filled = 0;
r->phase = 0;
r->phase_inc = 0;
memset( r->buffer_in, 0, sizeof(r->buffer_in) );
memset( r->buffer_out, 0, sizeof(r->buffer_out) );
return r;
}
void lanczos_resampler_delete(void * _r)
{
free( _r );
}
void * lanczos_resampler_dup(void * _r)
{
lanczos_resampler * r_in = ( lanczos_resampler * ) _r;
lanczos_resampler * r_out = ( lanczos_resampler * ) malloc( sizeof(lanczos_resampler) );
if ( !r_out ) return 0;
r_out->write_pos = r_in->write_pos;
r_out->write_filled = r_in->write_filled;
r_out->read_pos = r_in->read_pos;
r_out->read_filled = r_in->read_filled;
r_out->phase = r_in->phase;
r_out->phase_inc = r_in->phase_inc;
memcpy( r_out->buffer_in, r_in->buffer_in, sizeof(r_in->buffer_in) );
memcpy( r_out->buffer_out, r_in->buffer_out, sizeof(r_in->buffer_out) );
return r_out;
}
int lanczos_resampler_get_free_count(void *_r)
{
lanczos_resampler * r = ( lanczos_resampler * ) _r;
return lanczos_buffer_size - r->write_filled;
}
int lanczos_resampler_ready(void *_r)
{
lanczos_resampler * r = ( lanczos_resampler * ) _r;
return r->write_filled > (LANCZOS_WIDTH * 2);
}
void lanczos_resampler_clear(void *_r)
{
lanczos_resampler * r = ( lanczos_resampler * ) _r;
r->write_pos = 0;
r->write_filled = 0;
r->read_pos = 0;
r->read_filled = 0;
r->phase = 0;
}
void lanczos_resampler_set_rate(void *_r, double new_factor)
{
lanczos_resampler * r = ( lanczos_resampler * ) _r;
r->phase_inc = (int)( new_factor * LANCZOS_RESOLUTION );
}
void lanczos_resampler_write_sample(void *_r, short s)
{
lanczos_resampler * r = ( lanczos_resampler * ) _r;
if ( r->write_filled < lanczos_buffer_size )
{
float s32 = s;
r->buffer_in[ r->write_pos ] = s32;
r->buffer_in[ r->write_pos + lanczos_buffer_size ] = s32;
++r->write_filled;
r->write_pos = ( r->write_pos + 1 ) % lanczos_buffer_size;
}
}
static int lanczos_resampler_run(lanczos_resampler * r, int ** out_, int * out_end)
{
int in_size = r->write_filled;
float const* in_ = r->buffer_in + lanczos_buffer_size + r->write_pos - r->write_filled;
int used = 0;
in_size -= LANCZOS_WIDTH * 2;
if ( in_size > 0 )
{
int* out = *out_;
float const* in = in_;
float const* const in_end = in + in_size;
int phase = r->phase;
int phase_inc = r->phase_inc;
int step = phase_inc > LANCZOS_RESOLUTION ? LANCZOS_RESOLUTION * LANCZOS_RESOLUTION / phase_inc : LANCZOS_RESOLUTION;
do
{
// accumulate in extended precision
double kernel[LANCZOS_WIDTH * 2], kernel_sum = 0.0;
int i = LANCZOS_WIDTH;
int phase_adj = phase * step / LANCZOS_RESOLUTION;
double sample;
if ( out >= out_end )
break;
for (; i >= -LANCZOS_WIDTH + 1; --i)
{
int pos = i * step;
kernel_sum += kernel[i + LANCZOS_WIDTH - 1] = lanczos_lut[abs(phase_adj - pos)];
}
for (sample = 0, i = 0; i < LANCZOS_WIDTH * 2; ++i)
sample += in[i] * kernel[i];
*out++ = (int) (sample / kernel_sum * 256.0);
phase += phase_inc;
in += phase >> 13;
phase &= 8191;
}
while ( in < in_end );
r->phase = phase;
*out_ = out;
used = in - in_;
r->write_filled -= used;
}
return used;
}
static void lanczos_resampler_fill(lanczos_resampler * r)
{
while ( r->write_filled > (LANCZOS_WIDTH * 2) &&
r->read_filled < lanczos_buffer_size )
{
int write_pos = ( r->read_pos + r->read_filled ) % lanczos_buffer_size;
int write_size = lanczos_buffer_size - write_pos;
int * out = r->buffer_out + write_pos;
if ( write_size > ( lanczos_buffer_size - r->read_filled ) )
write_size = lanczos_buffer_size - r->read_filled;
lanczos_resampler_run( r, &out, out + write_size );
r->read_filled += out - r->buffer_out - write_pos;
}
}
int lanczos_resampler_get_sample_count(void *_r)
{
lanczos_resampler * r = ( lanczos_resampler * ) _r;
if ( r->read_filled < 1 )
lanczos_resampler_fill( r );
return r->read_filled;
}
int lanczos_resampler_get_sample(void *_r)
{
lanczos_resampler * r = ( lanczos_resampler * ) _r;
if ( r->read_filled < 1 )
lanczos_resampler_fill( r );
if ( r->read_filled < 1 )
return 0;
return r->buffer_out[ r->read_pos ];
}
void lanczos_resampler_remove_sample(void *_r)
{
lanczos_resampler * r = ( lanczos_resampler * ) _r;
if ( r->read_filled > 0 )
{
--r->read_filled;
r->read_pos = ( r->read_pos + 1 ) % lanczos_buffer_size;
}
}

View file

@ -0,0 +1,320 @@
/********************************************************************
* *
* THIS FILE IS PART OF THE OggVorbis SOFTWARE CODEC SOURCE CODE. *
* USE, DISTRIBUTION AND REPRODUCTION OF THIS LIBRARY SOURCE IS *
* GOVERNED BY A BSD-STYLE SOURCE LICENSE INCLUDED WITH THIS SOURCE *
* IN 'COPYING'. PLEASE READ THESE TERMS BEFORE DISTRIBUTING. *
* *
* THE OggVorbis SOURCE CODE IS (C) COPYRIGHT 1994-2009 *
* by the Xiph.Org Foundation http://www.xiph.org/ *
* *
********************************************************************
function: LPC low level routines
last mod: $Id: lpc.c 16227 2009-07-08 06:58:46Z xiphmont $
********************************************************************/
/* Some of these routines (autocorrelator, LPC coefficient estimator)
are derived from code written by Jutta Degener and Carsten Bormann;
thus we include their copyright below. The entirety of this file
is freely redistributable on the condition that both of these
copyright notices are preserved without modification. */
/* Preserved Copyright: *********************************************/
/* Copyright 1992, 1993, 1994 by Jutta Degener and Carsten Bormann,
Technische Universita"t Berlin
Any use of this software is permitted provided that this notice is not
removed and that neither the authors nor the Technische Universita"t
Berlin are deemed to have made any representations as to the
suitability of this software for any purpose nor are held responsible
for any defects of this software. THERE IS ABSOLUTELY NO WARRANTY FOR
THIS SOFTWARE.
As a matter of courtesy, the authors request to be informed about uses
this software has found, about bugs in this software, and about any
improvements that may be of general interest.
Berlin, 28.11.1994
Jutta Degener
Carsten Bormann
*********************************************************************/
#include <stdlib.h>
#include <string.h>
#include <math.h>
#include "internal/stack_alloc.h"
#include "internal/lpc.h"
/* Autocorrelation LPC coeff generation algorithm invented by
N. Levinson in 1947, modified by J. Durbin in 1959. */
/* Input : n elements of time doamin data
Output: m lpc coefficients, excitation energy */
float vorbis_lpc_from_data(float *data,float *lpci,int n,int m){
double *aut=alloca(sizeof(*aut)*(m+1));
double *lpc=alloca(sizeof(*lpc)*(m));
double error;
double epsilon;
int i,j;
/* autocorrelation, p+1 lag coefficients */
j=m+1;
while(j--){
double d=0; /* double needed for accumulator depth */
for(i=j;i<n;i++)d+=(double)data[i]*data[(i-j)];
aut[j]=d;
}
/* Generate lpc coefficients from autocorr values */
/* set our noise floor to about -100dB */
error=aut[0] * (1. + 1e-10);
epsilon=1e-9*aut[0]+1e-10;
for(i=0;i<m;i++){
double r= -aut[i+1];
if(error<epsilon){
memset(lpc+i,0,(m-i)*sizeof(*lpc));
goto done;
}
/* Sum up this iteration's reflection coefficient; note that in
Vorbis we don't save it. If anyone wants to recycle this code
and needs reflection coefficients, save the results of 'r' from
each iteration. */
for(j=0;j<i;j++)r-=lpc[j]*aut[i-j];
r/=error;
/* Update LPC coefficients and total error */
lpc[i]=r;
for(j=0;j<i/2;j++){
double tmp=lpc[j];
lpc[j]+=r*lpc[i-1-j];
lpc[i-1-j]+=r*tmp;
}
if(i&1)lpc[j]+=lpc[j]*r;
error*=1.-r*r;
}
done:
/* slightly damp the filter */
{
double g = .99;
double damp = g;
for(j=0;j<m;j++){
lpc[j]*=damp;
damp*=g;
}
}
for(j=0;j<m;j++)lpci[j]=(float)lpc[j];
/* we need the error value to know how big an impulse to hit the
filter with later */
return error;
}
void vorbis_lpc_predict(float *coeff,float *prime,int m,
float *data,long n){
/* in: coeff[0...m-1] LPC coefficients
prime[0...m-1] initial values (allocated size of n+m-1)
out: data[0...n-1] data samples */
long i,j,o,p;
float y;
float *work=alloca(sizeof(*work)*(m+n));
if(!prime)
for(i=0;i<m;i++)
work[i]=0.f;
else
for(i=0;i<m;i++)
work[i]=prime[i];
for(i=0;i<n;i++){
y=0;
o=i;
p=m;
for(j=0;j<m;j++)
y-=work[o++]*coeff[--p];
data[i]=work[o]=y;
}
}
#include "dumb.h"
#include "internal/dumb.h"
#include "internal/it.h"
enum { lpc_max = 256 }; /* Maximum number of input samples to train the function */
enum { lpc_order = 32 }; /* Order of the filter */
enum { lpc_extra = 64 }; /* How many samples of padding to predict or silence */
/* This extra sample padding is really only needed by the FIR resampler, but it helps the other resamplers as well. */
void dumb_it_add_lpc(struct DUMB_IT_SIGDATA *sigdata){
float lpc[lpc_order * 2];
float lpc_input[lpc_max * 2];
float lpc_output[lpc_extra * 2];
signed char * s8;
signed short * s16;
int n, o, offset, lpc_samples;
for ( n = 0; n < sigdata->n_samples; n++ ) {
IT_SAMPLE * sample = sigdata->sample + n;
if ( ( sample->flags & ( IT_SAMPLE_EXISTS | IT_SAMPLE_LOOP) ) == IT_SAMPLE_EXISTS ) {
/* If we have enough sample data to train the filter, use the filter to generate the padding */
if ( sample->length >= lpc_order ) {
lpc_samples = sample->length;
if (lpc_samples > lpc_max) lpc_samples = lpc_max;
offset = sample->length - lpc_samples;
if ( sample->flags & IT_SAMPLE_STEREO )
{
if ( sample->flags & IT_SAMPLE_16BIT )
{
s16 = ( signed short * ) sample->data;
s16 += offset * 2;
for ( o = 0; o < lpc_samples; o++ )
{
lpc_input[ o ] = s16[ o * 2 + 0 ];
lpc_input[ o + lpc_max ] = s16[ o * 2 + 1 ];
}
}
else
{
s8 = ( signed char * ) sample->data;
s8 += offset * 2;
for ( o = 0; o < lpc_samples; o++ )
{
lpc_input[ o ] = s8[ o * 2 + 0 ];
lpc_input[ o + lpc_max ] = s8[ o * 2 + 1 ];
}
}
vorbis_lpc_from_data( lpc_input, lpc, lpc_samples, lpc_order );
vorbis_lpc_from_data( lpc_input + lpc_max, lpc + lpc_order, lpc_samples, lpc_order );
vorbis_lpc_predict( lpc, lpc_input + lpc_samples - lpc_order, lpc_order, lpc_output, lpc_extra );
vorbis_lpc_predict( lpc + lpc_order, lpc_input + lpc_max + lpc_samples - lpc_order, lpc_order, lpc_output + lpc_extra, lpc_extra );
if ( sample->flags & IT_SAMPLE_16BIT )
{
s16 = ( signed short * ) realloc( sample->data, ( sample->length + lpc_extra ) * 2 * sizeof(short) );
sample->data = s16;
s16 += sample->length * 2;
sample->length += lpc_extra;
for ( o = 0; o < lpc_extra; o++ )
{
s16[ o * 2 + 0 ] = lpc_output[ o ];
s16[ o * 2 + 1 ] = lpc_output[ o + lpc_extra ];
}
}
else
{
s8 = ( signed char * ) realloc( sample->data, ( sample->length + lpc_extra ) * 2 );
sample->data = s8;
s8 += sample->length * 2;
sample->length += lpc_extra;
for ( o = 0; o < lpc_extra; o++ )
{
s8[ o * 2 + 0 ] = lpc_output[ o ];
s8[ o * 2 + 1 ] = lpc_output[ o + lpc_extra ];
}
}
}
else
{
if ( sample->flags & IT_SAMPLE_16BIT )
{
s16 = ( signed short * ) sample->data;
s16 += offset;
for ( o = 0; o < lpc_samples; o++ )
{
lpc_input[ o ] = s16[ o ];
}
}
else
{
s8 = ( signed char * ) sample->data;
s8 += offset;
for ( o = 0; o < lpc_samples; o++ )
{
lpc_input[ o ] = s8[ o ];
}
}
vorbis_lpc_from_data( lpc_input, lpc, lpc_samples, lpc_order );
vorbis_lpc_predict( lpc, lpc_input + lpc_samples - lpc_order, lpc_order, lpc_output, lpc_extra );
if ( sample->flags & IT_SAMPLE_16BIT )
{
s16 = ( signed short * ) realloc( sample->data, ( sample->length + lpc_extra ) * sizeof(short) );
sample->data = s16;
s16 += sample->length;
sample->length += lpc_extra;
for ( o = 0; o < lpc_extra; o++ )
{
s16[ o ] = lpc_output[ o ];
}
}
else
{
s8 = ( signed char * ) realloc( sample->data, sample->length + lpc_extra );
sample->data = s8;
s8 += sample->length;
sample->length += lpc_extra;
for ( o = 0; o < lpc_extra; o++ )
{
s8[ o ] = lpc_output[ o ];
}
}
}
}
else
/* Otherwise, pad with silence. */
{
offset = sample->length;
lpc_samples = lpc_extra;
sample->length += lpc_samples;
n = 1;
if ( sample->flags & IT_SAMPLE_STEREO ) n *= 2;
if ( sample->flags & IT_SAMPLE_16BIT ) n *= 2;
offset *= n;
lpc_samples *= n;
sample->data = realloc( sample->data, offset + lpc_samples );
memset( (char*)sample->data + offset, 0, lpc_samples );
}
}
}
}

View file

@ -28,8 +28,8 @@ typedef struct MEMFILE MEMFILE;
struct MEMFILE
{
const char *ptr;
long left;
const char *ptr, *ptr_begin;
long left, size;
};
@ -73,13 +73,32 @@ static void dumb_memfile_close(void *f)
}
static int dumb_memfile_seek(void *f, long n)
{
MEMFILE *m = f;
static DUMBFILE_SYSTEM memfile_dfs = {
m->ptr = m->ptr_begin + n;
m->left = m->size - n;
return 0;
}
static long dumb_memfile_get_size(void *f)
{
MEMFILE *m = f;
return m->size;
}
static const DUMBFILE_SYSTEM memfile_dfs = {
NULL,
&dumb_memfile_skip,
&dumb_memfile_getc,
&dumb_memfile_getnc,
&dumb_memfile_close
&dumb_memfile_close,
&dumb_memfile_seek,
&dumb_memfile_get_size
};
@ -89,8 +108,10 @@ DUMBFILE *dumbfile_open_memory(const char *data, long size)
MEMFILE *m = malloc(sizeof(*m));
if (!m) return NULL;
m->ptr_begin = data;
m->ptr = data;
m->left = size;
m->size = size;
return dumbfile_open_ex(m, &memfile_dfs);
}

View file

@ -92,25 +92,60 @@ static int process_pickup(DUMB_RESAMPLER *resampler)
#define VOLUME_PARAMETERS MONO_DEST_VOLUME_PARAMETERS
#define VOLUME_VARIABLES MONO_DEST_VOLUME_VARIABLES
#define SET_VOLUME_VARIABLES SET_MONO_DEST_VOLUME_VARIABLES
#define RETURN_VOLUME_VARIABLES RETURN_MONO_DEST_VOLUME_VARIABLES
#define VOLUMES_ARE_ZERO MONO_DEST_VOLUMES_ARE_ZERO
#define MIX_ALIAS(op, offset) MONO_DEST_MIX_ALIAS(op, offset)
#define MIX_LINEAR(op, o0, o1) MONO_DEST_MIX_LINEAR(op, o0, o1)
#define MIX_CUBIC(op, x0, x3, o0, o1, o2, o3) MONO_DEST_MIX_CUBIC(op, x0, x3, o0, o1, o2, o3)
#define MIX_ALIAS(count) MONO_DEST_MIX_ALIAS(count)
#define PEEK_ALIAS MONO_DEST_PEEK_ALIAS
#define PEEK_FIR MONO_DEST_PEEK_FIR
#define MIX_FIR MONO_DEST_MIX_FIR
#define MIX_LINEAR(op, upd, o0, o1) MONO_DEST_MIX_LINEAR(op, upd, o0, o1)
#define MIX_CUBIC(op, upd, x0, x3, o0, o1, o2, o3) MONO_DEST_MIX_CUBIC(op, upd, x0, x3, o0, o1, o2, o3)
#define MIX_ZEROS(op) *dst++ op 0
#include "resamp3.inc"
/* Create stereo destination resampler. */
#define SUFFIX3 _2
#define VOLUME_PARAMETERS float volume_left, float volume_right
#define VOLUME_VARIABLES lvol, rvol
#define VOLUME_PARAMETERS DUMB_VOLUME_RAMP_INFO * volume_left, DUMB_VOLUME_RAMP_INFO * volume_right
#define VOLUME_VARIABLES lvol, lvolr, lvold, lvolt, lvolm, rvol, rvolr, rvold, rvolt, rvolm
#define SET_VOLUME_VARIABLES { \
lvol = (int)floor(volume_left * 65536.0 + 0.5); \
rvol = (int)floor(volume_right * 65536.0 + 0.5); \
if ( volume_left ) { \
lvolr = (int)(volume_left->volume * 16777216.0); \
lvold = (int)(volume_left->delta * 16777216.0); \
lvolt = (int)(volume_left->target * 16777216.0); \
lvolm = (int)(volume_left->mix * 16777216.0); \
lvol = MULSCV( lvolr, lvolm ); \
if ( lvolr == lvolt ) volume_left = NULL; \
} else { \
lvol = 0; \
lvold = 0; \
lvolt = 0; \
lvolm = 0; \
} \
if ( volume_right ) { \
rvolr = (int)(volume_right->volume * 16777216.0); \
rvold = (int)(volume_right->delta * 16777216.0); \
rvolt = (int)(volume_right->target * 16777216.0); \
rvolm = (int)(volume_right->mix * 16777216.0); \
rvol = MULSCV( rvolr, rvolm ); \
if ( rvolr == rvolt ) volume_right = NULL; \
} else { \
rvol = 0; \
rvold = 0; \
rvolt = 0; \
rvolm = 0; \
} \
}
#define VOLUMES_ARE_ZERO (lvol == 0 && rvol == 0)
#define MIX_ALIAS(op, offset) STEREO_DEST_MIX_ALIAS(op, offset)
#define MIX_LINEAR(op, o0, o1) STEREO_DEST_MIX_LINEAR(op, o0, o1)
#define MIX_CUBIC(op, x0, x3, o0, o1, o2, o3) STEREO_DEST_MIX_CUBIC(op, x0, x3, o0, o1, o2, o3)
#define RETURN_VOLUME_VARIABLES { \
if ( volume_left ) volume_left->volume = (float)lvolr / 16777216.0f; \
if ( volume_right ) volume_right->volume = (float)rvolr / 16777216.0f; \
}
#define VOLUMES_ARE_ZERO (lvol == 0 && lvolt == 0 && rvol == 0 && rvolt == 0)
#define MIX_ALIAS(count) STEREO_DEST_MIX_ALIAS(count)
#define PEEK_ALIAS STEREO_DEST_PEEK_ALIAS
#define PEEK_FIR STEREO_DEST_PEEK_FIR
#define MIX_FIR STEREO_DEST_MIX_FIR
#define MIX_LINEAR(op, upd, o0, o1) STEREO_DEST_MIX_LINEAR(op, upd, o0, o1)
#define MIX_CUBIC(op, upd, x0, x3, o0, o1, o2, o3) STEREO_DEST_MIX_CUBIC(op, upd, x0, x3, o0, o1, o2, o3)
#define MIX_ZEROS(op) { *dst++ op 0; *dst++ op 0; }
#include "resamp3.inc"
@ -124,9 +159,19 @@ static int process_pickup(DUMB_RESAMPLER *resampler)
#undef MONO_DEST_MIX_ALIAS
#undef MONO_DEST_VOLUMES_ARE_ZERO
#undef SET_MONO_DEST_VOLUME_VARIABLES
#undef RETURN_MONO_DEST_VOLUME_VARIABLES
#undef MONO_DEST_VOLUME_ZEROS
#undef MONO_DEST_VOLUME_VARIABLES
#undef MONO_DEST_VOLUME_PARAMETERS
#undef STEREO_DEST_PEEK_ALIAS
#undef MONO_DEST_PEEK_ALIAS
#undef POKE_ALIAS
#undef MONO_DEST_PEEK_FIR
#undef STEREO_DEST_PEEK_FIR
#undef MONO_DEST_MIX_FIR
#undef STEREO_DEST_MIX_FIR
#undef ADVANCE_FIR
#undef POKE_FIR
#undef COPYSRC2
#undef COPYSRC
#undef DIVIDE_BY_SRC_CHANNELS

View file

@ -46,42 +46,49 @@
long dumb_resample(DUMB_RESAMPLER *resampler, sample_t *dst, long dst_size, VOLUME_PARAMETERS, float delta)
{
int dt;
int dt, inv_dt;
int VOLUME_VARIABLES;
long done;
long todo;
LONG_LONG todo64;
int quality;
int blip_samples[256*SRC_CHANNELS];
if (!resampler || resampler->dir == 0) return 0;
ASSERT(resampler->dir == -1 || resampler->dir == 1);
done = 0;
dt = (int)(delta * 65536.0 + 0.5);
if (dt == 0 || dt == (int)-0x80000000) return 0;
inv_dt = (int)(1.0 / delta * 65536.0 + 0.5);
SET_VOLUME_VARIABLES;
if (VOLUMES_ARE_ZERO) dst = NULL;
init_cubic();
quality = dumb_resampling_quality;
if (quality > resampler->max_quality) quality = resampler->max_quality;
else if (quality < resampler->min_quality) quality = resampler->min_quality;
quality = resampler->quality;
while (done < dst_size) {
if (process_pickup(resampler)) return done;
if (process_pickup(resampler)) {
RETURN_VOLUME_VARIABLES;
return done;
}
if ((resampler->dir ^ dt) < 0)
dt = -dt;
if (resampler->dir < 0)
todo = (long)((((LONG_LONG)(resampler->pos - resampler->start) << 16) + resampler->subpos - dt) / -dt);
todo64 = ((((LONG_LONG)(resampler->pos - resampler->start) << 16) + resampler->subpos - dt) / -dt);
else
todo = (long)((((LONG_LONG)(resampler->end - resampler->pos) << 16) - resampler->subpos - 1 + dt) / dt);
todo64 = ((((LONG_LONG)(resampler->end - resampler->pos) << 16) - resampler->subpos - 1 + dt) / dt);
if (todo < 0)
if (todo64 < 0)
todo = 0;
else if (todo > dst_size - done)
else if (todo64 > dst_size - done)
todo = dst_size - done;
else
todo = (long) todo64;
done += todo;
@ -99,29 +106,33 @@ long dumb_resample(DUMB_RESAMPLER *resampler, sample_t *dst, long dst_size, VOLU
subpos = (long)new_subpos & 65535;
} else if (quality <= DUMB_RQ_ALIASING) {
/* Aliasing, backwards */
int todo_clocks = todo << 16, todo_clocks_set = todo_clocks;
SRCTYPE xbuf[2*SRC_CHANNELS];
SRCTYPE *x = &xbuf[0];
SRCTYPE *xstart;
COPYSRC(xbuf, 0, resampler->X, 1);
COPYSRC(xbuf, 1, resampler->X, 2);
while (todo && x < &xbuf[2*SRC_CHANNELS]) {
if ( todo_clocks_set > 256 * 65536 ) todo_clocks_set = 256 * 65536;
while (resampler->last_clock < todo_clocks_set && x < &xbuf[2*SRC_CHANNELS]) {
// TODO: check what happens when multiple tempo slides occur per row
HEAVYASSERT(pos >= resampler->start);
MIX_ALIAS(+=, 0);
subpos += dt;
pos += subpos >> 16;
x -= (subpos >> 16) * SRC_CHANNELS;
subpos &= 65535;
todo--;
POKE_ALIAS(0);
pos--;
x += SRC_CHANNELS;
}
x = &src[pos*SRC_CHANNELS];
while ( todo_clocks ) {
todo_clocks_set = todo_clocks;
if ( todo_clocks_set > 256 * 65536 ) todo_clocks_set = 256 * 65536;
todo_clocks -= todo_clocks_set;
while ( resampler->last_clock < todo_clocks_set )
{
POKE_ALIAS(2);
pos--;
x -= SRC_CHANNELS;
}
todo = todo_clocks_set >> 16;
MIX_ALIAS( todo );
}
x = xstart = &src[pos*SRC_CHANNELS];
LOOP4(todo,
MIX_ALIAS(+=, 2);
subpos += dt;
x += (subpos >> 16) * SRC_CHANNELS;
subpos &= 65535;
);
pos += DIVIDE_BY_SRC_CHANNELS(x - xstart);
} else if (quality <= DUMB_RQ_LINEAR) {
/* Linear interpolation, backwards */
SRCTYPE xbuf[3*SRC_CHANNELS];
@ -131,7 +142,7 @@ long dumb_resample(DUMB_RESAMPLER *resampler, sample_t *dst, long dst_size, VOLU
COPYSRC(xbuf, 2, src, pos);
while (todo && x < &xbuf[3*SRC_CHANNELS]) {
HEAVYASSERT(pos >= resampler->start);
MIX_LINEAR(+=, 0, -1);
MIX_LINEAR(+=, 1, 0, -1);
subpos += dt;
pos += subpos >> 16;
x -= (subpos >> 16) * SRC_CHANNELS;
@ -142,13 +153,13 @@ long dumb_resample(DUMB_RESAMPLER *resampler, sample_t *dst, long dst_size, VOLU
x = &src[pos*SRC_CHANNELS];
LOOP4(todo,
HEAVYASSERT(pos >= resampler->start);
MIX_LINEAR(+=, 1, 2);
MIX_LINEAR(+=, 1, 1, 2);
subpos += dt;
pos += subpos >> 16;
x += (subpos >> 16) * SRC_CHANNELS;
subpos &= 65535;
);
} else {
} else if (quality <= DUMB_RQ_CUBIC) {
/* Cubic interpolation, backwards */
SRCTYPE xbuf[6*SRC_CHANNELS];
SRCTYPE *x = &xbuf[3*SRC_CHANNELS];
@ -160,7 +171,7 @@ long dumb_resample(DUMB_RESAMPLER *resampler, sample_t *dst, long dst_size, VOLU
if (pos-2 >= resampler->start) COPYSRC(xbuf, 5, src, pos-2);
while (todo && x < &xbuf[6*SRC_CHANNELS]) {
HEAVYASSERT(pos >= resampler->start);
MIX_CUBIC(+=, x, x, 0, -1, -2, -3);
MIX_CUBIC(+=, 1, x, x, 0, -1, -2, -3);
subpos += dt;
pos += subpos >> 16;
x -= (subpos >> 16) * SRC_CHANNELS;
@ -170,12 +181,35 @@ long dumb_resample(DUMB_RESAMPLER *resampler, sample_t *dst, long dst_size, VOLU
x = &src[pos*SRC_CHANNELS];
LOOP4(todo,
HEAVYASSERT(pos >= resampler->start);
MIX_CUBIC(+=, x, x, 0, 1, 2, 3);
MIX_CUBIC(+=, 1, x, x, 0, 1, 2, 3);
subpos += dt;
pos += subpos >> 16;
x += (subpos >> 16) * SRC_CHANNELS;
subpos &= 65535;
);
} else {
/* FIR resampling, backwards */
SRCTYPE *x;
if ( resampler->fir_resampler_ratio != delta ) {
lanczos_resampler_set_rate( resampler->fir_resampler[0], delta );
lanczos_resampler_set_rate( resampler->fir_resampler[1], delta );
resampler->fir_resampler_ratio = delta;
}
x = &src[pos*SRC_CHANNELS];
while ( todo ) {
while ( lanczos_resampler_get_free_count( resampler->fir_resampler[0] ) &&
pos >= resampler->start )
{
POKE_FIR(0);
pos--;
x -= SRC_CHANNELS;
}
if ( !lanczos_resampler_get_sample_count( resampler->fir_resampler[0] ) ) break;
MIX_FIR;
ADVANCE_FIR;
--todo;
}
done -= todo;
}
diff = diff - pos;
overshot = resampler->start - pos - 1;
@ -198,31 +232,35 @@ long dumb_resample(DUMB_RESAMPLER *resampler, sample_t *dst, long dst_size, VOLU
LONG_LONG new_subpos = subpos + (LONG_LONG)dt * todo;
pos += (long)(new_subpos >> 16);
subpos = (long)new_subpos & 65535;
} else if (dumb_resampling_quality <= DUMB_RQ_ALIASING) {
} else if (quality <= DUMB_RQ_ALIASING) {
/* Aliasing, forwards */
int todo_clocks = todo << 16, todo_clocks_set = todo_clocks;
SRCTYPE xbuf[2*SRC_CHANNELS];
SRCTYPE *x = &xbuf[0];
SRCTYPE *xstart;
COPYSRC(xbuf, 0, resampler->X, 1);
COPYSRC(xbuf, 1, resampler->X, 2);
while (todo && x < &xbuf[2*SRC_CHANNELS]) {
if ( todo_clocks_set > 256 * 65536 ) todo_clocks_set = 256 * 65536;
while (resampler->last_clock < todo_clocks_set && x < &xbuf[2*SRC_CHANNELS]) {
HEAVYASSERT(pos < resampler->end);
MIX_ALIAS(+=, 0);
subpos += dt;
pos += subpos >> 16;
x += (subpos >> 16) * SRC_CHANNELS;
subpos &= 65535;
todo--;
POKE_ALIAS(0);
pos++;
x += SRC_CHANNELS;
}
x = xstart = &src[pos*SRC_CHANNELS];
LOOP4(todo,
MIX_ALIAS(+=, -2);
subpos += dt;
x += (subpos >> 16) * SRC_CHANNELS;
subpos &= 65535;
);
pos += DIVIDE_BY_SRC_CHANNELS(x - xstart);
} else if (dumb_resampling_quality <= DUMB_RQ_LINEAR) {
x = &src[pos*SRC_CHANNELS];
while ( todo_clocks ) {
todo_clocks_set = todo_clocks;
if ( todo_clocks_set > 256 * 65536 ) todo_clocks_set = 256 * 65536;
todo_clocks -= todo_clocks_set;
while ( resampler->last_clock < todo_clocks_set )
{
POKE_ALIAS(-2);
pos++;
x += SRC_CHANNELS;
}
todo = todo_clocks_set >> 16;
MIX_ALIAS( todo );
}
} else if (quality <= DUMB_RQ_LINEAR) {
/* Linear interpolation, forwards */
SRCTYPE xbuf[3*SRC_CHANNELS];
SRCTYPE *x = &xbuf[1*SRC_CHANNELS];
@ -231,7 +269,7 @@ long dumb_resample(DUMB_RESAMPLER *resampler, sample_t *dst, long dst_size, VOLU
COPYSRC(xbuf, 2, src, pos);
while (todo && x < &xbuf[3*SRC_CHANNELS]) {
HEAVYASSERT(pos < resampler->end);
MIX_LINEAR(+=, -1, 0);
MIX_LINEAR(+=, 1, -1, 0);
subpos += dt;
pos += subpos >> 16;
x += (subpos >> 16) * SRC_CHANNELS;
@ -241,13 +279,13 @@ long dumb_resample(DUMB_RESAMPLER *resampler, sample_t *dst, long dst_size, VOLU
x = &src[pos*SRC_CHANNELS];
LOOP4(todo,
HEAVYASSERT(pos < resampler->end);
MIX_LINEAR(+=, -2, -1);
MIX_LINEAR(+=, 1, -2, -1);
subpos += dt;
pos += subpos >> 16;
x += (subpos >> 16) * SRC_CHANNELS;
subpos &= 65535;
);
} else {
} else if (quality <= DUMB_RQ_CUBIC) {
/* Cubic interpolation, forwards */
SRCTYPE xbuf[6*SRC_CHANNELS];
SRCTYPE *x = &xbuf[3*SRC_CHANNELS];
@ -259,7 +297,7 @@ long dumb_resample(DUMB_RESAMPLER *resampler, sample_t *dst, long dst_size, VOLU
if (pos+2 < resampler->end) COPYSRC(xbuf, 5, src, pos+2);
while (todo && x < &xbuf[6*SRC_CHANNELS]) {
HEAVYASSERT(pos < resampler->end);
MIX_CUBIC(+=, x, x, -3, -2, -1, 0);
MIX_CUBIC(+=, 1, x, x, -3, -2, -1, 0);
subpos += dt;
pos += subpos >> 16;
x += (subpos >> 16) * SRC_CHANNELS;
@ -269,12 +307,35 @@ long dumb_resample(DUMB_RESAMPLER *resampler, sample_t *dst, long dst_size, VOLU
x = &src[pos*SRC_CHANNELS];
LOOP4(todo,
HEAVYASSERT(pos < resampler->end);
MIX_CUBIC(+=, x, x, -3, -2, -1, 0);
MIX_CUBIC(+=, 1, x, x, -3, -2, -1, 0);
subpos += dt;
pos += subpos >> 16;
x += (subpos >> 16) * SRC_CHANNELS;
subpos &= 65535;
);
} else {
/* FIR resampling, forwards */
SRCTYPE *x;
if ( resampler->fir_resampler_ratio != delta ) {
lanczos_resampler_set_rate( resampler->fir_resampler[0], delta );
lanczos_resampler_set_rate( resampler->fir_resampler[1], delta );
resampler->fir_resampler_ratio = delta;
}
x = &src[pos*SRC_CHANNELS];
while ( todo ) {
while ( lanczos_resampler_get_free_count( resampler->fir_resampler[0] ) &&
pos < resampler->end )
{
POKE_FIR(0);
pos++;
x += SRC_CHANNELS;
}
if ( !lanczos_resampler_get_sample_count( resampler->fir_resampler[0] ) ) break;
MIX_FIR;
ADVANCE_FIR;
--todo;
}
done -= todo;
}
diff = pos - diff;
overshot = pos - resampler->end;
@ -297,6 +358,7 @@ long dumb_resample(DUMB_RESAMPLER *resampler, sample_t *dst, long dst_size, VOLU
}
}
RETURN_VOLUME_VARIABLES;
return done;
}
@ -322,9 +384,7 @@ void dumb_resample_get_current_sample(DUMB_RESAMPLER *resampler, VOLUME_PARAMETE
init_cubic();
quality = dumb_resampling_quality;
if (quality > resampler->max_quality) quality = resampler->max_quality;
else if (quality < resampler->min_quality) quality = resampler->min_quality;
quality = resampler->quality;
src = resampler->src;
pos = resampler->pos;
@ -333,27 +393,33 @@ void dumb_resample_get_current_sample(DUMB_RESAMPLER *resampler, VOLUME_PARAMETE
if (resampler->dir < 0) {
HEAVYASSERT(pos >= resampler->start);
if (dumb_resampling_quality <= 0) {
if (quality <= DUMB_RQ_ALIASING) {
/* Aliasing, backwards */
MIX_ALIAS(=, 1);
PEEK_ALIAS;
} else if (quality <= DUMB_RQ_LINEAR) {
/* Linear interpolation, backwards */
MIX_LINEAR(=, 2, 1);
} else {
MIX_LINEAR(=, 0, 2, 1);
} else if (quality <= DUMB_RQ_CUBIC) {
/* Cubic interpolation, backwards */
MIX_CUBIC(=, src, x, pos, 2, 1, 0);
MIX_CUBIC(=, 0, src, x, pos, 2, 1, 0);
} else {
/* FIR resampling, backwards */
PEEK_FIR;
}
} else {
HEAVYASSERT(pos < resampler->end);
if (dumb_resampling_quality <= 0) {
if (quality <= DUMB_RQ_ALIASING) {
/* Aliasing */
MIX_ALIAS(=, 1);
} else if (dumb_resampling_quality <= DUMB_RQ_LINEAR) {
PEEK_ALIAS;
} else if (quality <= DUMB_RQ_LINEAR) {
/* Linear interpolation, forwards */
MIX_LINEAR(=, 1, 2);
} else {
MIX_LINEAR(=, 0, 1, 2);
} else if (quality <= DUMB_RQ_CUBIC) {
/* Cubic interpolation, forwards */
MIX_CUBIC(=, x, src, 0, 1, 2, pos);
MIX_CUBIC(=, 0, x, src, 0, 1, 2, pos);
} else {
/* FIR resampling, forwards */
PEEK_FIR;
}
}
}
@ -364,8 +430,12 @@ void dumb_resample_get_current_sample(DUMB_RESAMPLER *resampler, VOLUME_PARAMETE
#undef MIX_CUBIC
#undef MIX_LINEAR
#undef MIX_ALIAS
#undef MIX_FIR
#undef PEEK_ALIAS
#undef PEEK_FIR
#undef VOLUMES_ARE_ZERO
#undef SET_VOLUME_VARIABLES
#undef RETURN_VOLUME_VARIABLES
#undef VOLUME_VARIABLES
#undef VOLUME_PARAMETERS
#undef SUFFIX3

View file

@ -45,6 +45,9 @@
#include <math.h>
#include "dumb.h"
#include "internal/blip_buf.h"
#include "internal/lanczos_resampler.h"
/* Compile with -DHEAVYDEBUG if you want to make sure the pick-up function is
@ -59,14 +62,22 @@
/* Make MSVC shut the hell up about if ( upd ) UPDATE_VOLUME() conditions being constant */
#ifdef _MSC_VER
#pragma warning(disable:4127 4701)
#endif
/* A global variable for controlling resampling quality wherever a local
* specification doesn't override it. The following values are valid:
*
* 0 - DUMB_RQ_ALIASING - fastest
* 1 - DUMB_RQ_LINEAR
* 2 - DUMB_RQ_CUBIC - nicest
* 2 - DUMB_RQ_CUBIC
* 3 - DUMB_RQ_FIR - nicest
*
* Values outside the range 0-2 will behave the same as the nearest
* Values outside the range 0-3 will behave the same as the nearest
* value within the range.
*/
int dumb_resampling_quality = DUMB_RQ_CUBIC;
@ -75,6 +86,7 @@ int dumb_resampling_quality = DUMB_RQ_CUBIC;
//#define MULSC(a, b) ((int)((LONG_LONG)(a) * (b) >> 16))
//#define MULSC(a, b) ((a) * ((b) >> 2) >> 14)
#define MULSCV(a, b) ((int)((LONG_LONG)(a) * (b) >> 32))
#define MULSC(a, b) ((int)((LONG_LONG)((a) << 4) * ((b) << 12) >> 32))
#define MULSC16(a, b) ((int)((LONG_LONG)((a) << 12) * ((b) << 12) >> 32))
@ -84,6 +96,7 @@ int dumb_resampling_quality = DUMB_RQ_CUBIC;
* Clobbers the 'iterator' variable.
* The loop is unrolled by four.
*/
#if 0
#define LOOP4(iterator, CONTENT) \
{ \
if ((iterator) & 2) { \
@ -102,8 +115,15 @@ int dumb_resampling_quality = DUMB_RQ_CUBIC;
(iterator)--; \
} \
}
#else
#define LOOP4(iterator, CONTENT) \
{ \
while ( (iterator)-- ) \
{ \
CONTENT; \
} \
}
#endif
#define PASTERAW(a, b) a ## b /* This does not expand macros in b ... */
#define PASTE(a, b) PASTERAW(a, b) /* ... but b is expanded during this substitution. */
@ -140,7 +160,7 @@ int dumb_resampling_quality = DUMB_RQ_CUBIC;
static short cubicA0[1025], cubicA1[1025];
static void init_cubic(void)
/*static*/ void init_cubic(void)
{
unsigned int t; /* 3*1024*1024*1024 is within range if it's unsigned */
static int done = 0;
@ -151,6 +171,8 @@ static void init_cubic(void)
cubicA0[t] = -(int)( t*t*t >> 17) + (int)( t*t >> 6) - (int)(t << 3);
cubicA1[t] = (int)(3*t*t*t >> 17) - (int)(5*t*t >> 7) + (int)(1 << 14);
}
lanczos_init();
}
@ -168,7 +190,8 @@ static void init_cubic(void)
#define SRCTYPE sample_t
#define SRCBITS 24
#define ALIAS(x, vol) MULSC(x, vol)
#define ALIAS(x) (x >> 8)
#define FIR(x) (x >> 8)
#define LINEAR(x0, x1) (x0 + MULSC(x1 - x0, subpos))
/*
#define SET_CUBIC_COEFFICIENTS(x0, x1, x2, x3) { \
@ -204,7 +227,8 @@ static void init_cubic(void)
#define SUFFIX _16
#define SRCTYPE short
#define SRCBITS 16
#define ALIAS(x, vol) (x * vol >> 8)
#define ALIAS(x) (x)
#define FIR(x) (x)
#define LINEAR(x0, x1) ((x0 << 8) + MULSC16(x1 - x0, subpos))
/*
#define SET_CUBIC_COEFFICIENTS(x0, x1, x2, x3) { \
@ -226,7 +250,8 @@ static void init_cubic(void)
#define SUFFIX _8
#define SRCTYPE signed char
#define SRCBITS 8
#define ALIAS(x, vol) (x * vol)
#define ALIAS(x) (x << 8)
#define FIR(x) (x << 8)
#define LINEAR(x0, x1) ((x0 << 16) + (x1 - x0) * subpos)
/*
#define SET_CUBIC_COEFFICIENTS(x0, x1, x2, x3) { \
@ -254,31 +279,31 @@ static void init_cubic(void)
void dumb_reset_resampler_n(int n, DUMB_RESAMPLER *resampler, void *src, int src_channels, long pos, long start, long end)
void dumb_reset_resampler_n(int n, DUMB_RESAMPLER *resampler, void *src, int src_channels, long pos, long start, long end, int quality)
{
if (n == 8)
dumb_reset_resampler_8(resampler, src, src_channels, pos, start, end);
dumb_reset_resampler_8(resampler, src, src_channels, pos, start, end, quality);
else if (n == 16)
dumb_reset_resampler_16(resampler, src, src_channels, pos, start, end);
dumb_reset_resampler_16(resampler, src, src_channels, pos, start, end, quality);
else
dumb_reset_resampler(resampler, src, src_channels, pos, start, end);
dumb_reset_resampler(resampler, src, src_channels, pos, start, end, quality);
}
DUMB_RESAMPLER *dumb_start_resampler_n(int n, void *src, int src_channels, long pos, long start, long end)
DUMB_RESAMPLER *dumb_start_resampler_n(int n, void *src, int src_channels, long pos, long start, long end, int quality)
{
if (n == 8)
return dumb_start_resampler_8(src, src_channels, pos, start, end);
return dumb_start_resampler_8(src, src_channels, pos, start, end, quality);
else if (n == 16)
return dumb_start_resampler_16(src, src_channels, pos, start, end);
return dumb_start_resampler_16(src, src_channels, pos, start, end, quality);
else
return dumb_start_resampler(src, src_channels, pos, start, end);
return dumb_start_resampler(src, src_channels, pos, start, end, quality);
}
long dumb_resample_n_1_1(int n, DUMB_RESAMPLER *resampler, sample_t *dst, long dst_size, float volume, float delta)
long dumb_resample_n_1_1(int n, DUMB_RESAMPLER *resampler, sample_t *dst, long dst_size, DUMB_VOLUME_RAMP_INFO * volume, float delta)
{
if (n == 8)
return dumb_resample_8_1_1(resampler, dst, dst_size, volume, delta);
@ -290,7 +315,7 @@ long dumb_resample_n_1_1(int n, DUMB_RESAMPLER *resampler, sample_t *dst, long d
long dumb_resample_n_1_2(int n, DUMB_RESAMPLER *resampler, sample_t *dst, long dst_size, float volume_left, float volume_right, float delta)
long dumb_resample_n_1_2(int n, DUMB_RESAMPLER *resampler, sample_t *dst, long dst_size, DUMB_VOLUME_RAMP_INFO * volume_left, DUMB_VOLUME_RAMP_INFO * volume_right, float delta)
{
if (n == 8)
return dumb_resample_8_1_2(resampler, dst, dst_size, volume_left, volume_right, delta);
@ -302,7 +327,7 @@ long dumb_resample_n_1_2(int n, DUMB_RESAMPLER *resampler, sample_t *dst, long d
long dumb_resample_n_2_1(int n, DUMB_RESAMPLER *resampler, sample_t *dst, long dst_size, float volume_left, float volume_right, float delta)
long dumb_resample_n_2_1(int n, DUMB_RESAMPLER *resampler, sample_t *dst, long dst_size, DUMB_VOLUME_RAMP_INFO * volume_left, DUMB_VOLUME_RAMP_INFO * volume_right, float delta)
{
if (n == 8)
return dumb_resample_8_2_1(resampler, dst, dst_size, volume_left, volume_right, delta);
@ -314,7 +339,7 @@ long dumb_resample_n_2_1(int n, DUMB_RESAMPLER *resampler, sample_t *dst, long d
long dumb_resample_n_2_2(int n, DUMB_RESAMPLER *resampler, sample_t *dst, long dst_size, float volume_left, float volume_right, float delta)
long dumb_resample_n_2_2(int n, DUMB_RESAMPLER *resampler, sample_t *dst, long dst_size, DUMB_VOLUME_RAMP_INFO * volume_left, DUMB_VOLUME_RAMP_INFO * volume_right, float delta)
{
if (n == 8)
return dumb_resample_8_2_2(resampler, dst, dst_size, volume_left, volume_right, delta);
@ -326,7 +351,7 @@ long dumb_resample_n_2_2(int n, DUMB_RESAMPLER *resampler, sample_t *dst, long d
void dumb_resample_get_current_sample_n_1_1(int n, DUMB_RESAMPLER *resampler, float volume, sample_t *dst)
void dumb_resample_get_current_sample_n_1_1(int n, DUMB_RESAMPLER *resampler, DUMB_VOLUME_RAMP_INFO * volume, sample_t *dst)
{
if (n == 8)
dumb_resample_get_current_sample_8_1_1(resampler, volume, dst);
@ -338,7 +363,7 @@ void dumb_resample_get_current_sample_n_1_1(int n, DUMB_RESAMPLER *resampler, fl
void dumb_resample_get_current_sample_n_1_2(int n, DUMB_RESAMPLER *resampler, float volume_left, float volume_right, sample_t *dst)
void dumb_resample_get_current_sample_n_1_2(int n, DUMB_RESAMPLER *resampler, DUMB_VOLUME_RAMP_INFO * volume_left, DUMB_VOLUME_RAMP_INFO * volume_right, sample_t *dst)
{
if (n == 8)
dumb_resample_get_current_sample_8_1_2(resampler, volume_left, volume_right, dst);
@ -350,7 +375,7 @@ void dumb_resample_get_current_sample_n_1_2(int n, DUMB_RESAMPLER *resampler, fl
void dumb_resample_get_current_sample_n_2_1(int n, DUMB_RESAMPLER *resampler, float volume_left, float volume_right, sample_t *dst)
void dumb_resample_get_current_sample_n_2_1(int n, DUMB_RESAMPLER *resampler, DUMB_VOLUME_RAMP_INFO * volume_left, DUMB_VOLUME_RAMP_INFO * volume_right, sample_t *dst)
{
if (n == 8)
dumb_resample_get_current_sample_8_2_1(resampler, volume_left, volume_right, dst);
@ -362,7 +387,7 @@ void dumb_resample_get_current_sample_n_2_1(int n, DUMB_RESAMPLER *resampler, fl
void dumb_resample_get_current_sample_n_2_2(int n, DUMB_RESAMPLER *resampler, float volume_left, float volume_right, sample_t *dst)
void dumb_resample_get_current_sample_n_2_2(int n, DUMB_RESAMPLER *resampler, DUMB_VOLUME_RAMP_INFO * volume_left, DUMB_VOLUME_RAMP_INFO * volume_right, sample_t *dst)
{
if (n == 8)
dumb_resample_get_current_sample_8_2_2(resampler, volume_left, volume_right, dst);

View file

@ -44,7 +44,7 @@
void dumb_reset_resampler(DUMB_RESAMPLER *resampler, SRCTYPE *src, int src_channels, long pos, long start, long end)
void dumb_reset_resampler(DUMB_RESAMPLER *resampler, SRCTYPE *src, int src_channels, long pos, long start, long end, int quality)
{
int i;
resampler->src = src;
@ -55,52 +55,177 @@ void dumb_reset_resampler(DUMB_RESAMPLER *resampler, SRCTYPE *src, int src_chann
resampler->dir = 1;
resampler->pickup = NULL;
resampler->pickup_data = NULL;
resampler->min_quality = 0;
resampler->max_quality = DUMB_RQ_N_LEVELS - 1;
if (quality < 0)
{
resampler->quality = 0;
}
else if (quality > DUMB_RQ_N_LEVELS - 1)
{
resampler->quality = DUMB_RQ_N_LEVELS - 1;
}
else
{
resampler->quality = quality;
}
for (i = 0; i < src_channels*3; i++) resampler->X[i] = 0;
resampler->overshot = -1;
resampler->last_clock = 0;
resampler->last_amp[0] = 0;
resampler->last_amp[1] = 0;
blip_clear(resampler->blip_buffer[0]);
blip_clear(resampler->blip_buffer[1]);
resampler->fir_resampler_ratio = 0;
lanczos_resampler_clear(resampler->fir_resampler[0]);
lanczos_resampler_clear(resampler->fir_resampler[1]);
}
DUMB_RESAMPLER *dumb_start_resampler(SRCTYPE *src, int src_channels, long pos, long start, long end)
DUMB_RESAMPLER *dumb_start_resampler(SRCTYPE *src, int src_channels, long pos, long start, long end, int quality)
{
DUMB_RESAMPLER *resampler = malloc(sizeof(*resampler));
if (!resampler) return NULL;
dumb_reset_resampler(resampler, src, src_channels, pos, start, end);
resampler->blip_buffer[0] = blip_new( 256 );
if (!resampler->blip_buffer[0])
{
free(resampler);
return NULL;
}
resampler->blip_buffer[1] = blip_new( 256 );
if (!resampler->blip_buffer[1])
{
free(resampler->blip_buffer[0]);
free(resampler);
return NULL;
}
blip_set_rates(resampler->blip_buffer[0], 65536, 1);
blip_set_rates(resampler->blip_buffer[1], 65536, 1);
dumb_reset_resampler(resampler, src, src_channels, pos, start, end, quality);
return resampler;
}
#define UPDATE_VOLUME( pvol, vol ) { \
if (pvol) { \
vol##r += vol##d; \
if ((vol##d < 0 && vol##r <= vol##t) || \
(vol##d > 0 && vol##r >= vol##t)) { \
pvol->volume = pvol->target; \
pvol = NULL; \
vol = MULSCV( vol##t, vol##m ); \
} else { \
vol = MULSCV( vol##r, vol##m ); \
} \
} \
}
/* Create mono source resampler. */
#define SUFFIX2 _1
#define SRC_CHANNELS 1
#define DIVIDE_BY_SRC_CHANNELS(x) (x)
#define COPYSRC(dstarray, dstindex, srcarray, srcindex) (dstarray)[dstindex] = (srcarray)[srcindex]
#define COPYSRC2(dstarray, dstindex, condition, srcarray, srcindex) (dstarray)[dstindex] = condition ? (srcarray)[srcindex] : 0
#define MONO_DEST_VOLUME_PARAMETERS float volume
#define MONO_DEST_VOLUME_VARIABLES vol
#define MONO_DEST_VOLUME_PARAMETERS DUMB_VOLUME_RAMP_INFO * volume
#define MONO_DEST_VOLUME_VARIABLES vol, volr, vold, volt, volm
#define MONO_DEST_VOLUME_ZEROS 0
#define SET_MONO_DEST_VOLUME_VARIABLES vol = (int)floor(volume * 65536.0 + 0.5)
#define MONO_DEST_VOLUMES_ARE_ZERO (vol == 0)
#define MONO_DEST_MIX_ALIAS(op, offset) *dst++ op ALIAS(x[offset], vol)
#define STEREO_DEST_MIX_ALIAS(op, offset) { \
int xm = x[offset]; \
*dst++ op ALIAS(xm, lvol); \
*dst++ op ALIAS(xm, rvol); \
#define SET_MONO_DEST_VOLUME_VARIABLES { \
if ( volume ) { \
volr = (int)(volume->volume * 16777216.0); \
vold = (int)(volume->delta * 16777216.0); \
volt = (int)(volume->target * 16777216.0); \
volm = (int)(volume->mix * 16777216.0); \
vol = MULSCV( volr, volm ); \
if ( volr == volt ) volume = NULL; \
} else { \
vol = 0; \
vold = 0; \
volt = 0; \
volm = 0; \
} \
}
#define MONO_DEST_MIX_LINEAR(op, o0, o1) *dst++ op MULSC(LINEAR(x[o0], x[o1]), vol)
#define STEREO_DEST_MIX_LINEAR(op, o0, o1) { \
#define RETURN_MONO_DEST_VOLUME_VARIABLES if ( volume ) volume->volume = (float)volr / 16777216.0f
#define MONO_DEST_VOLUMES_ARE_ZERO (vol == 0 && volt == 0)
#define POKE_ALIAS(offset) { \
int delta = ALIAS(x[offset]) - resampler->last_amp[0]; \
resampler->last_amp[0] += delta; \
if ( delta ) blip_add_delta( resampler->blip_buffer[0], resampler->last_clock, delta ); \
resampler->last_clock += inv_dt; \
}
#define POKE_FIR(offset) { \
lanczos_resampler_write_sample( resampler->fir_resampler[0], FIR(x[offset]) ); \
}
#define MONO_DEST_PEEK_ALIAS *dst = MULSC( blip_peek_sample( resampler->blip_buffer[0] ), vol )
#define MONO_DEST_PEEK_FIR *dst = MULSC( lanczos_resampler_get_sample( resampler->fir_resampler[0] ), vol )
#define MONO_DEST_MIX_FIR { \
*dst++ += MULSC( lanczos_resampler_get_sample( resampler->fir_resampler[0] ), vol ); \
UPDATE_VOLUME( volume, vol ); \
}
#define ADVANCE_FIR lanczos_resampler_remove_sample( resampler->fir_resampler[0] )
#define MONO_DEST_MIX_ALIAS(count) { \
int n = 0; \
resampler->last_clock -= count * 65536; \
blip_end_frame( resampler->blip_buffer[0], count * 65536 ); \
blip_read_samples( resampler->blip_buffer[0], blip_samples, count ); \
LOOP4( count, \
*dst++ += MULSC( blip_samples[n], vol ); \
n++; \
UPDATE_VOLUME( volume, vol ); \
); \
}
#define STEREO_DEST_PEEK_ALIAS { \
int sample = blip_peek_sample( resampler->blip_buffer[0] ); \
*dst++ = MULSC( sample, lvol ); \
*dst++ = MULSC( sample, rvol ); \
}
#define STEREO_DEST_PEEK_FIR { \
int sample = lanczos_resampler_get_sample( resampler->fir_resampler[0] ); \
*dst++ = MULSC( sample, lvol ); \
*dst++ = MULSC( sample, rvol ); \
}
#define STEREO_DEST_MIX_FIR { \
int sample = lanczos_resampler_get_sample( resampler->fir_resampler[0] ); \
*dst++ += MULSC( sample, lvol ); \
*dst++ += MULSC( sample, rvol ); \
UPDATE_VOLUME( volume_left, lvol ); \
UPDATE_VOLUME( volume_right, rvol ); \
}
#define STEREO_DEST_MIX_ALIAS(count) { \
int sample, n = 0; \
resampler->last_clock -= count * 65536; \
blip_end_frame( resampler->blip_buffer[0], count * 65536 ); \
blip_read_samples( resampler->blip_buffer[0], blip_samples, count ); \
LOOP4( count, \
sample = blip_samples[n++]; \
*dst++ += MULSC( sample, lvol ); \
*dst++ += MULSC( sample, rvol ); \
UPDATE_VOLUME( volume_left, lvol ); \
UPDATE_VOLUME( volume_right, rvol ); \
); \
}
#define MONO_DEST_MIX_LINEAR(op, upd, o0, o1) { \
*dst++ op MULSC(LINEAR(x[o0], x[o1]), vol); \
if ( upd ) UPDATE_VOLUME( volume, vol ); \
}
#define STEREO_DEST_MIX_LINEAR(op, upd, o0, o1) { \
int xm = LINEAR(x[o0], x[o1]); \
*dst++ op MULSC(xm, lvol); \
*dst++ op MULSC(xm, rvol); \
if ( upd ) UPDATE_VOLUME( volume_left, lvol ); \
if ( upd ) UPDATE_VOLUME( volume_right, rvol ); \
}
#define MONO_DEST_MIX_CUBIC(op, x0, x3, o0, o1, o2, o3) *dst++ op CUBICVOL(CUBIC(x0[o0], x[o1], x[o2], x3[o3]), vol)
#define STEREO_DEST_MIX_CUBIC(op, x0, x3, o0, o1, o2, o3) { \
#define MONO_DEST_MIX_CUBIC(op, upd, x0, x3, o0, o1, o2, o3) { \
*dst++ op CUBICVOL(CUBIC(x0[o0], x[o1], x[o2], x3[o3]), vol); \
if ( upd ) UPDATE_VOLUME( volume, vol ); \
}
#define STEREO_DEST_MIX_CUBIC(op, upd, x0, x3, o0, o1, o2, o3) { \
int xm = CUBIC(x0[o0], x[o1], x[o2], x3[o3]); \
*dst++ op CUBICVOL(xm, lvol); \
*dst++ op CUBICVOL(xm, rvol); \
if ( upd ) UPDATE_VOLUME( volume_left, lvol ); \
if ( upd ) UPDATE_VOLUME( volume_right, rvol ); \
}
#include "resamp2.inc"
@ -121,30 +246,140 @@ DUMB_RESAMPLER *dumb_start_resampler(SRCTYPE *src, int src_channels, long pos, l
(dstarray)[(dstindex)*2+1] = 0; \
} \
}
#define MONO_DEST_VOLUME_PARAMETERS float volume_left, float volume_right
#define MONO_DEST_VOLUME_VARIABLES lvol, rvol
#define MONO_DEST_VOLUME_PARAMETERS DUMB_VOLUME_RAMP_INFO * volume_left, DUMB_VOLUME_RAMP_INFO * volume_right
#define MONO_DEST_VOLUME_VARIABLES lvol, lvolr, lvold, lvolt, lvolm, rvol, rvolr, rvold, rvolt, rvolm
#define MONO_DEST_VOLUME_ZEROS 0, 0
#define SET_MONO_DEST_VOLUME_VARIABLES { \
lvol = (int)floor(volume_left * 65536.0 + 0.5); \
rvol = (int)floor(volume_right * 65536.0 + 0.5); \
if ( volume_left ) { \
lvolr = (int)(volume_left->volume * 16777216.0); \
lvold = (int)(volume_left->delta * 16777216.0); \
lvolt = (int)(volume_left->target * 16777216.0); \
lvolm = (int)(volume_left->mix * 16777216.0); \
lvol = MULSCV( lvolr, lvolm ); \
if ( lvolr == lvolt ) volume_left = NULL; \
} else { \
lvol = 0; \
lvold = 0; \
lvolt = 0; \
lvolm = 0; \
} \
if ( volume_right ) { \
rvolr = (int)(volume_right->volume * 16777216.0); \
rvold = (int)(volume_right->delta * 16777216.0); \
rvolt = (int)(volume_right->target * 16777216.0); \
rvolm = (int)(volume_right->mix * 16777216.0); \
rvol = MULSCV( rvolr, rvolm ); \
if ( rvolr == rvolt ) volume_right = NULL; \
} else { \
rvol = 0; \
rvold = 0; \
rvolt = 0; \
rvolm = 0; \
} \
}
#define MONO_DEST_VOLUMES_ARE_ZERO (lvol == 0 && rvol == 0)
#define MONO_DEST_MIX_ALIAS(op, offset) *dst++ op ALIAS(x[(offset)*2], lvol) + ALIAS(x[(offset)*2+1], rvol)
#define STEREO_DEST_MIX_ALIAS(op, offset) { \
*dst++ op ALIAS(x[(offset)*2], lvol); \
*dst++ op ALIAS(x[(offset)*2+1], rvol); \
#define RETURN_MONO_DEST_VOLUME_VARIABLES { \
if ( volume_left ) volume_left->volume = (float)lvolr / 16777216.0f; \
if ( volume_right ) volume_right->volume = (float)rvolr / 16777216.0f; \
}
#define MONO_DEST_MIX_LINEAR(op, o0, o1) *dst++ op MULSC(LINEAR(x[(o0)*2], x[(o1)*2]), lvol) + MULSC(LINEAR(x[(o0)*2+1], x[(o1)*2+1]), rvol)
#define STEREO_DEST_MIX_LINEAR(op, o0, o1) { \
#define MONO_DEST_VOLUMES_ARE_ZERO (lvol == 0 && lvolt == 0 && rvol == 0 && rvolt == 0)
#define POKE_ALIAS(offset) { \
int deltal = ALIAS(x[(offset)*2+0]) - resampler->last_amp[0]; \
int deltar = ALIAS(x[(offset)*2+1]) - resampler->last_amp[1]; \
resampler->last_amp[0] += deltal; \
resampler->last_amp[1] += deltar; \
if ( deltal ) blip_add_delta( resampler->blip_buffer[0], resampler->last_clock, deltal ); \
if ( deltar ) blip_add_delta( resampler->blip_buffer[1], resampler->last_clock, deltar ); \
resampler->last_clock += inv_dt; \
}
#define POKE_FIR(offset) { \
lanczos_resampler_write_sample( resampler->fir_resampler[0], FIR(x[(offset)*2+0]) ); \
lanczos_resampler_write_sample( resampler->fir_resampler[1], FIR(x[(offset)*2+1]) ); \
}
#define MONO_DEST_PEEK_ALIAS { \
*dst = MULSC( blip_peek_sample( resampler->blip_buffer[0] ), lvol ) + \
MULSC( blip_peek_sample( resampler->blip_buffer[1] ), rvol ); \
}
#define MONO_DEST_PEEK_FIR { \
*dst = MULSC( lanczos_resampler_get_sample( resampler->fir_resampler[0] ), lvol ) + \
MULSC( lanczos_resampler_get_sample( resampler->fir_resampler[1] ), rvol ); \
}
#define MONO_DEST_MIX_FIR { \
*dst++ += MULSC( lanczos_resampler_get_sample( resampler->fir_resampler[0] ), lvol ) + \
MULSC( lanczos_resampler_get_sample( resampler->fir_resampler[1] ), rvol ); \
UPDATE_VOLUME( volume_left, lvol ); \
UPDATE_VOLUME( volume_right, rvol ); \
}
#define ADVANCE_FIR { \
lanczos_resampler_remove_sample( resampler->fir_resampler[0] ); \
lanczos_resampler_remove_sample( resampler->fir_resampler[1] ); \
}
#define MONO_DEST_MIX_ALIAS(count) { \
int n = 0; \
resampler->last_clock -= count * 65536; \
blip_end_frame( resampler->blip_buffer[0], count * 65536 ); \
blip_end_frame( resampler->blip_buffer[1], count * 65536 ); \
blip_read_samples( resampler->blip_buffer[0], blip_samples, count ); \
blip_read_samples( resampler->blip_buffer[1], blip_samples + 256, count ); \
LOOP4( count, \
*dst++ += MULSC( blip_samples[n], lvol ) + MULSC( blip_samples[256+n], rvol ); \
n++; \
UPDATE_VOLUME( volume_left, lvol ); \
UPDATE_VOLUME( volume_right, rvol ); \
); \
}
#define STEREO_DEST_PEEK_ALIAS { \
*dst++ = MULSC( blip_peek_sample( resampler->blip_buffer[0] ), lvol ); \
*dst++ = MULSC( blip_peek_sample( resampler->blip_buffer[1] ), rvol ); \
}
#define STEREO_DEST_PEEK_FIR { \
*dst++ = MULSC( lanczos_resampler_get_sample( resampler->fir_resampler[0] ), lvol ); \
*dst++ = MULSC( lanczos_resampler_get_sample( resampler->fir_resampler[1] ), rvol ); \
}
#define STEREO_DEST_MIX_FIR { \
*dst++ += MULSC( lanczos_resampler_get_sample( resampler->fir_resampler[0] ), lvol ); \
*dst++ += MULSC( lanczos_resampler_get_sample( resampler->fir_resampler[1] ), rvol ); \
UPDATE_VOLUME( volume_left, lvol ); \
UPDATE_VOLUME( volume_right, rvol ); \
}
#define STEREO_DEST_MIX_ALIAS(count) { \
int n = 0; \
resampler->last_clock -= count * 65536; \
blip_end_frame( resampler->blip_buffer[0], count * 65536 ); \
blip_end_frame( resampler->blip_buffer[1], count * 65536 ); \
blip_read_samples( resampler->blip_buffer[0], blip_samples, count ); \
blip_read_samples( resampler->blip_buffer[1], blip_samples + 256, count ); \
LOOP4( count, \
*dst++ += MULSC( blip_samples[n], lvol); \
*dst++ += MULSC( blip_samples[256+n], rvol); \
n++; \
UPDATE_VOLUME( volume_left, lvol ); \
UPDATE_VOLUME( volume_right, rvol ); \
); \
}
#define MONO_DEST_MIX_LINEAR(op, upd, o0, o1) { \
*dst++ op MULSC(LINEAR(x[(o0)*2], x[(o1)*2]), lvol) + MULSC(LINEAR(x[(o0)*2+1], x[(o1)*2+1]), rvol); \
if ( upd ) UPDATE_VOLUME( volume_left, lvol ); \
if ( upd ) UPDATE_VOLUME( volume_right, rvol ); \
}
#define STEREO_DEST_MIX_LINEAR(op, upd, o0, o1) { \
*dst++ op MULSC(LINEAR(x[(o0)*2], x[(o1)*2]), lvol); \
*dst++ op MULSC(LINEAR(x[(o0)*2+1], x[(o1)*2+1]), rvol); \
if ( upd ) UPDATE_VOLUME( volume_left, lvol ); \
if ( upd ) UPDATE_VOLUME( volume_right, rvol ); \
}
#define MONO_DEST_MIX_CUBIC(op, x0, x3, o0, o1, o2, o3) *dst++ op \
#define MONO_DEST_MIX_CUBIC(op, upd, x0, x3, o0, o1, o2, o3) { \
*dst++ op \
CUBICVOL(CUBIC(x0[(o0)*2], x[(o1)*2], x[(o2)*2], x3[(o3)*2]), lvol) + \
CUBICVOL(CUBIC(x0[(o0)*2+1], x[(o1)*2+1], x[(o2)*2+1], x3[(o3)*2+1]), rvol)
#define STEREO_DEST_MIX_CUBIC(op, x0, x3, o0, o1, o2, o3) { \
CUBICVOL(CUBIC(x0[(o0)*2+1], x[(o1)*2+1], x[(o2)*2+1], x3[(o3)*2+1]), rvol); \
if ( upd ) UPDATE_VOLUME( volume_left, lvol ); \
if ( upd ) UPDATE_VOLUME( volume_right, rvol ); \
}
#define STEREO_DEST_MIX_CUBIC(op, upd, x0, x3, o0, o1, o2, o3) { \
*dst++ op CUBICVOL(CUBIC(x0[(o0)*2], x[(o1)*2], x[(o2)*2], x3[(o3)*2]), lvol); \
*dst++ op CUBICVOL(CUBIC(x0[(o0)*2+1], x[(o1)*2+1], x[(o2)*2+1], x3[(o3)*2+1]), rvol); \
if ( upd ) UPDATE_VOLUME( volume_left, lvol ); \
if ( upd ) UPDATE_VOLUME( volume_right, rvol ); \
}
#include "resamp2.inc"
@ -162,6 +397,7 @@ void dumb_end_resampler(DUMB_RESAMPLER *resampler)
#undef CUBIC
#undef LINEAR
#undef ALIAS
#undef FIR
#undef SRCBITS
#undef SRCTYPE
#undef SUFFIX

View file

@ -0,0 +1,85 @@
#include "dumb.h"
#include "internal/riff.h"
#include <stdlib.h>
struct riff * riff_parse( DUMBFILE * f, long offset, long size, unsigned proper )
{
unsigned stream_size;
struct riff * stream;
if ( size < 8 ) return 0;
if ( dumbfile_seek(f, offset, DFS_SEEK_SET) ) return 0;
if ( dumbfile_mgetl(f) != DUMB_ID('R','I','F','F') ) return 0;
stream_size = dumbfile_igetl(f);
if ( stream_size + 8 > size ) return 0;
if ( stream_size < 4 ) return 0;
stream = (struct riff *) malloc( sizeof( struct riff ) );
if ( ! stream ) return 0;
stream->type = dumbfile_mgetl(f);
stream->chunk_count = 0;
stream->chunks = 0;
stream_size -= 4;
while ( stream_size && !dumbfile_error(f) )
{
struct riff_chunk * chunk;
if ( stream_size < 8 ) break;
stream->chunks = ( struct riff_chunk * ) realloc( stream->chunks, ( stream->chunk_count + 1 ) * sizeof( struct riff_chunk ) );
if ( ! stream->chunks ) break;
chunk = stream->chunks + stream->chunk_count;
chunk->type = dumbfile_mgetl(f);
chunk->size = dumbfile_igetl(f);
chunk->offset = dumbfile_pos(f);
stream_size -= 8;
if ( stream_size < chunk->size ) break;
if ( chunk->type == DUMB_ID('R','I','F','F') )
{
chunk->nested = riff_parse( f, chunk->offset - 8, chunk->size + 8, proper );
if ( ! chunk->nested ) break;
}
else
{
chunk->nested = 0;
}
dumbfile_seek(f, chunk->offset + chunk->size, DFS_SEEK_SET);
stream_size -= chunk->size;
if ( proper && ( chunk->size & 1 ) )
{
dumbfile_skip(f, 1);
-- stream_size;
}
++stream->chunk_count;
}
if ( stream_size )
{
riff_free( stream );
stream = 0;
}
return stream;
}
void riff_free( struct riff * stream )
{
if ( stream )
{
if ( stream->chunks )
{
unsigned i;
for ( i = 0; i < stream->chunk_count; ++i )
{
struct riff_chunk * chunk = stream->chunks + i;
if ( chunk->nested ) riff_free( chunk->nested );
}
free( stream->chunks );
}
free( stream );
}
}

View file

@ -23,47 +23,91 @@
typedef struct dumb_stdfile
{
FILE * file;
long size;
} dumb_stdfile;
static void *dumb_stdfile_open(const char *filename)
{
return fopen(filename, "rb");
dumb_stdfile * file = ( dumb_stdfile * ) malloc( sizeof(dumb_stdfile) );
if ( !file ) return 0;
file->file = fopen(filename, "rb");
fseek(file->file, 0, SEEK_END);
file->size = ftell(file->file);
fseek(file->file, 0, SEEK_SET);
return file;
}
static int dumb_stdfile_skip(void *f, long n)
{
return fseek(f, n, SEEK_CUR);
dumb_stdfile * file = ( dumb_stdfile * ) f;
return fseek(file->file, n, SEEK_CUR);
}
static int dumb_stdfile_getc(void *f)
{
return fgetc(f);
dumb_stdfile * file = ( dumb_stdfile * ) f;
return fgetc(file->file);
}
static long dumb_stdfile_getnc(char *ptr, long n, void *f)
{
return fread(ptr, 1, n, f);
dumb_stdfile * file = ( dumb_stdfile * ) f;
return fread(ptr, 1, n, file->file);
}
static void dumb_stdfile_close(void *f)
{
fclose(f);
dumb_stdfile * file = ( dumb_stdfile * ) f;
fclose(file->file);
free(f);
}
static DUMBFILE_SYSTEM stdfile_dfs = {
static void dumb_stdfile_noclose(void *f)
{
free(f);
}
static int dumb_stdfile_seek(void *f, long n)
{
dumb_stdfile * file = ( dumb_stdfile * ) f;
return fseek(file->file, n, SEEK_SET);
}
static long dumb_stdfile_get_size(void *f)
{
dumb_stdfile * file = ( dumb_stdfile * ) f;
return file->size;
}
static const DUMBFILE_SYSTEM stdfile_dfs = {
&dumb_stdfile_open,
&dumb_stdfile_skip,
&dumb_stdfile_getc,
&dumb_stdfile_getnc,
&dumb_stdfile_close
&dumb_stdfile_close,
&dumb_stdfile_seek,
&dumb_stdfile_get_size
};
@ -75,19 +119,28 @@ void dumb_register_stdfiles(void)
static DUMBFILE_SYSTEM stdfile_dfs_leave_open = {
static const DUMBFILE_SYSTEM stdfile_dfs_leave_open = {
NULL,
&dumb_stdfile_skip,
&dumb_stdfile_getc,
&dumb_stdfile_getnc,
NULL
&dumb_stdfile_noclose,
&dumb_stdfile_seek,
&dumb_stdfile_get_size
};
DUMBFILE *dumbfile_open_stdfile(FILE *p)
{
DUMBFILE *d = dumbfile_open_ex(p, &stdfile_dfs_leave_open);
dumb_stdfile * file = ( dumb_stdfile * ) malloc( sizeof(dumb_stdfile) );
DUMBFILE *d;
if ( !file ) return 0;
file->file = p;
fseek(p, 0, SEEK_END);
file->size = ftell(p);
fseek(p, 0, SEEK_SET);
d = dumbfile_open_ex(file, &stdfile_dfs_leave_open);
return d;
}

View file

@ -0,0 +1,175 @@
#include "internal/tarray.h"
#include <string.h>
/*
Structures which contain the play times of each pattern and row combination in the song,
not guaranteed to be valid for the whole song until the loop status is no longer zero.
The initial count and restart count will both be zero on song start, then both will be
incremented until the song loops. Restart count will be reset to zero on loop for all
rows which have a time equal to or greater than the loop start point, so time keeping
functions will know which timestamp the song is currently located at.
Timestamp lists are guaranteed to be allocated in blocks of 16 timestamps at a time.
*/
/*
We don't need full timekeeping because the player loop only wants the first play time
of the loop start order/row. We also don't really want full timekeeping because it
involves a lot of memory allocations, which is also slow.
*/
#undef FULL_TIMEKEEPING
typedef struct DUMB_IT_ROW_TIME
{
unsigned int count, restart_count;
#ifndef FULL_TIMEKEEPING
LONG_LONG first_time;
#else
LONG_LONG * times;
#endif
} DUMB_IT_ROW_TIME;
void * timekeeping_array_create(size_t size)
{
size_t * _size = (size_t *) calloc( 1, sizeof(size_t) + sizeof(DUMB_IT_ROW_TIME) * size );
if ( _size ) {
*_size = size;
}
return _size;
}
void timekeeping_array_destroy(void * array)
{
#ifdef FULL_TIMEKEEPING
size_t i;
size_t * size = (size_t *) array;
DUMB_IT_ROW_TIME * s = (DUMB_IT_ROW_TIME *)(size + 1);
for (i = 0; i < *size; i++) {
if (s[i].times) free(s[i].times);
}
#endif
free(array);
}
void * timekeeping_array_dup(void * array)
{
size_t i;
size_t * size = (size_t *) array;
DUMB_IT_ROW_TIME * s = (DUMB_IT_ROW_TIME *)(size + 1);
size_t * new_size = (size_t *) calloc( 1, sizeof(size_t) + sizeof(DUMB_IT_ROW_TIME) * *size );
if ( new_size ) {
DUMB_IT_ROW_TIME * new_s = (DUMB_IT_ROW_TIME *)(new_size + 1);
*new_size = *size;
for (i = 0; i < *size; i++) {
new_s[i].count = s[i].count;
new_s[i].restart_count = s[i].restart_count;
#ifndef FULL_TIMEKEEPING
new_s[i].first_time = s[i].first_time;
#else
if ( s[i].times ) {
size_t time_count = ( s[i].count + 15 ) & ~15;
new_s[i].times = (LONG_LONG *) malloc( sizeof(LONG_LONG) * time_count );
if ( new_s[i].times == (void *)0 ) {
timekeeping_array_destroy( new_size );
return (void *) 0;
}
memcpy( new_s[i].times, s[i].times, sizeof(LONG_LONG) * s[i].count );
}
#endif
}
}
return new_size;
}
void timekeeping_array_reset(void * array, size_t loop_start)
{
size_t i;
size_t * size = (size_t *) array;
DUMB_IT_ROW_TIME * s = (DUMB_IT_ROW_TIME *)(size + 1);
DUMB_IT_ROW_TIME * s_loop_start = s + loop_start;
LONG_LONG loop_start_time;
if ( loop_start >= *size || s_loop_start->count < 1 ) return;
#ifndef FULL_TIMEKEEPING
loop_start_time = s_loop_start->first_time;
#else
loop_start_time = s_loop_start->times[0];
#endif
for ( i = 0; i < *size; i++ ) {
#ifndef FULL_TIMEKEEPING
if ( s[i].count && s[i].first_time >= loop_start_time ) {
#else
if ( s[i].count && s[i].times[0] >= loop_start_time ) {
#endif
s[i].restart_count = 0;
}
}
}
void timekeeping_array_push(void * array, size_t index, LONG_LONG time)
{
#ifdef FULL_TIMEKEEPING
size_t i;
size_t time_count;
#endif
size_t * size = (size_t *) array;
DUMB_IT_ROW_TIME * s = (DUMB_IT_ROW_TIME *)(size + 1);
if (index >= *size) return;
#ifndef FULL_TIMEKEEPING
if ( !s[index].count++ )
s[index].first_time = time;
#else
time_count = ( s[index].count + 16 ) & ~15;
s[index].times = (LONG_LONG *) realloc( s[index].times, sizeof(LONG_LONG) * time_count );
s[index].times[s[index].count++] = time;
#endif
}
void timekeeping_array_bump(void * array, size_t index)
{
size_t * size = (size_t *) array;
DUMB_IT_ROW_TIME * s = (DUMB_IT_ROW_TIME *)(size + 1);
if (index >= *size) return;
s[index].restart_count++;
}
unsigned int timekeeping_array_get_count(void * array, size_t index)
{
size_t * size = (size_t *) array;
DUMB_IT_ROW_TIME * s = (DUMB_IT_ROW_TIME *)(size + 1);
if (index >= *size) return 0;
return s[index].count;
}
LONG_LONG timekeeping_array_get_item(void * array, size_t index)
{
size_t * size = (size_t *) array;
DUMB_IT_ROW_TIME * s = (DUMB_IT_ROW_TIME *)(size + 1);
if (index >= *size || s[index].restart_count >= s[index].count) return 0;
#ifndef FULL_TIMEKEEPING
return s[index].first_time;
#else
return s[index].times[s[index].restart_count];
#endif
}

View file

@ -40,3 +40,4 @@ DUH *dumb_load_it_quick(const char *filename)
return duh;
}

View file

@ -24,7 +24,7 @@
DUMB_IT_SIGDATA *duh_get_it_sigdata(DUH *duh)
{
return duh_get_raw_sigdata(duh, 0, SIGTYPE_IT);
return duh_get_raw_sigdata(duh, -1, SIGTYPE_IT);
}

View file

@ -23,42 +23,30 @@
#include "dumb.h"
#include "internal/it.h"
#ifndef min
#define min(a, b) (((a) < (b)) ? (a) : (b))
#endif
#define INVESTIGATE_OLD_INSTRUMENTS
static int it_seek(DUMBFILE *f, long offset)
{
long pos = dumbfile_pos(f);
if (pos > offset)
return -1;
if (pos < offset)
if (dumbfile_skip(f, offset - pos))
return -1;
return 0;
}
typedef unsigned char byte;
typedef unsigned short word;
typedef unsigned long dword;
typedef struct readblock_crap readblock_crap;
struct readblock_crap {
unsigned char *sourcebuf;
unsigned char *sourcepos;
unsigned char *sourceend;
int rembits;
};
static unsigned char *sourcebuf = NULL;
static unsigned char *sourcepos = NULL;
static unsigned char *sourceend;
static int rembits = 0;
static int readblock(DUMBFILE *f)
static int readblock(DUMBFILE *f, readblock_crap * crap)
{
long size;
int c;
@ -67,51 +55,51 @@ static int readblock(DUMBFILE *f)
if (size < 0)
return size;
sourcebuf = malloc(size);
if (!sourcebuf)
crap->sourcebuf = malloc(size);
if (!crap->sourcebuf)
return -1;
c = dumbfile_getnc((char *)sourcebuf, size, f);
c = dumbfile_getnc((char *)crap->sourcebuf, size, f);
if (c < size) {
free(sourcebuf);
sourcebuf = NULL;
free(crap->sourcebuf);
crap->sourcebuf = NULL;
return -1;
}
sourcepos = sourcebuf;
sourceend = sourcebuf + size;
rembits = 8;
crap->sourcepos = crap->sourcebuf;
crap->sourceend = crap->sourcebuf + size;
crap->rembits = 8;
return 0;
}
static void freeblock(void)
static void freeblock(readblock_crap * crap)
{
free(sourcebuf);
sourcebuf = NULL;
free(crap->sourcebuf);
crap->sourcebuf = NULL;
}
static int readbits(int bitwidth)
static int readbits(int bitwidth, readblock_crap * crap)
{
int val = 0;
int b = 0;
if (sourcepos >= sourceend) return val;
if (crap->sourcepos >= crap->sourceend) return val;
while (bitwidth > rembits) {
val |= *sourcepos++ << b;
if (sourcepos >= sourceend) return val;
b += rembits;
bitwidth -= rembits;
rembits = 8;
while (bitwidth > crap->rembits) {
val |= *crap->sourcepos++ << b;
if (crap->sourcepos >= crap->sourceend) return val;
b += crap->rembits;
bitwidth -= crap->rembits;
crap->rembits = 8;
}
val |= (*sourcepos & ((1 << bitwidth) - 1)) << b;
*sourcepos >>= bitwidth;
rembits -= bitwidth;
val |= (*crap->sourcepos & ((1 << bitwidth) - 1)) << b;
*crap->sourcepos >>= bitwidth;
crap->rembits -= bitwidth;
return val;
}
@ -121,18 +109,22 @@ static int readbits(int bitwidth)
/** WARNING - do we even need to pass `right`? */
/** WARNING - why bother memsetting at all? The whole array is written... */
// if we do memset, dumb_silence() would be neater...
static int decompress8(DUMBFILE *f, signed char *data, int len, int cmwt)
static int decompress8(DUMBFILE *f, signed char *data, int len, int it215, int stereo)
{
int blocklen, blockpos;
byte bitwidth;
word val;
char d1, d2;
readblock_crap crap;
memset(data, 0, len * sizeof(*data));
memset(&crap, 0, sizeof(crap));
for (blocklen = 0, blockpos = 0; blocklen < len; blocklen++, blockpos += 1 + stereo)
data[ blockpos ] = 0;
while (len > 0) {
//Read a block of compressed data:
if (readblock(f))
if (readblock(f, &crap))
return -1;
//Set up a few variables
blocklen = (len < 0x8000) ? len : 0x8000; //Max block length is 0x8000 bytes
@ -142,12 +134,12 @@ static int decompress8(DUMBFILE *f, signed char *data, int len, int cmwt)
//Start the decompression:
while (blockpos < blocklen) {
//Read a value:
val = (word)readbits(bitwidth);
val = (word)readbits(bitwidth, &crap);
//Check for bit width change:
if (bitwidth < 7) { //Method 1:
if (val == (1 << (bitwidth - 1))) {
val = (word)readbits(3) + 1;
val = (word)readbits(3, &crap) + 1;
bitwidth = (val < bitwidth) ? val : val + 1;
continue;
}
@ -168,7 +160,7 @@ static int decompress8(DUMBFILE *f, signed char *data, int len, int cmwt)
}
}
else { //Illegal width, abort ?
freeblock();
freeblock(&crap);
return -1;
}
@ -193,29 +185,34 @@ static int decompress8(DUMBFILE *f, signed char *data, int len, int cmwt)
/* Version 2.15 was an unofficial version with hacked compression
* code. Yay, better compression :D
*/
*data++ = cmwt == 0x215 ? d2 : d1;
*data++ = it215 ? d2 : d1;
data += stereo;
len--;
blockpos++;
}
freeblock();
freeblock(&crap);
}
return 0;
}
static int decompress16(DUMBFILE *f, short *data, int len, int cmwt)
static int decompress16(DUMBFILE *f, short *data, int len, int it215, int stereo)
{
int blocklen, blockpos;
byte bitwidth;
long val;
short d1, d2;
readblock_crap crap;
memset(data, 0, len * sizeof(*data));
memset(&crap, 0, sizeof(crap));
for ( blocklen = 0, blockpos = 0; blocklen < len; blocklen++, blockpos += 1 + stereo )
data[ blockpos ] = 0;
while (len > 0) {
//Read a block of compressed data:
if (readblock(f))
if (readblock(f, &crap))
return -1;
//Set up a few variables
blocklen = (len < 0x4000) ? len : 0x4000; // Max block length is 0x4000 bytes
@ -224,12 +221,12 @@ static int decompress16(DUMBFILE *f, short *data, int len, int cmwt)
d1 = d2 = 0;
//Start the decompression:
while (blockpos < blocklen) {
val = readbits(bitwidth);
val = readbits(bitwidth, &crap);
//Check for bit width change:
if (bitwidth < 7) { //Method 1:
if (val == (1 << (bitwidth - 1))) {
val = readbits(4) + 1;
val = readbits(4, &crap) + 1;
bitwidth = (val < bitwidth) ? val : val + 1;
continue;
}
@ -250,7 +247,7 @@ static int decompress16(DUMBFILE *f, short *data, int len, int cmwt)
}
}
else { //Illegal width, abort ?
freeblock();
freeblock(&crap);
return -1;
}
@ -275,11 +272,12 @@ static int decompress16(DUMBFILE *f, short *data, int len, int cmwt)
/* Version 2.15 was an unofficial version with hacked compression
* code. Yay, better compression :D
*/
*data++ = cmwt == 0x215 ? d2 : d1;
*data++ = it215 ? d2 : d1;
data += stereo;
len--;
blockpos++;
}
freeblock();
freeblock(&crap);
}
return 0;
}
@ -296,6 +294,8 @@ static int it_read_envelope(IT_ENVELOPE *envelope, DUMBFILE *f)
envelope->loop_end = dumbfile_getc(f);
envelope->sus_loop_start = dumbfile_getc(f);
envelope->sus_loop_end = dumbfile_getc(f);
if (envelope->n_nodes > 25)
envelope->n_nodes = 25;
for (n = 0; n < envelope->n_nodes; n++) {
envelope->node_y[n] = dumbfile_getc(f);
envelope->node_t[n] = dumbfile_igetw(f);
@ -318,10 +318,12 @@ static int it_read_old_instrument(IT_INSTRUMENT *instrument, DUMBFILE *f)
{
int n;
if (dumbfile_mgetl(f) != IT_INSTRUMENT_SIGNATURE)
return -1;
/*if (dumbfile_mgetl(f) != IT_INSTRUMENT_SIGNATURE)
return -1;*/
// XXX
dumbfile_skip(f, 4);
dumbfile_getnc(instrument->filename, 13, f);
dumbfile_getnc((char *)instrument->filename, 13, f);
instrument->filename[13] = 0;
instrument->volume_envelope.flags = dumbfile_getc(f);
@ -350,7 +352,7 @@ static int it_read_old_instrument(IT_INSTRUMENT *instrument, DUMBFILE *f)
*/
dumbfile_skip(f, 4);
dumbfile_getnc(instrument->name, 26, f);
dumbfile_getnc((char *)instrument->name, 26, f);
instrument->name[26] = 0;
/* Skip unused bytes following the Instrument Name. */
@ -424,14 +426,19 @@ static int it_read_old_instrument(IT_INSTRUMENT *instrument, DUMBFILE *f)
static int it_read_instrument(IT_INSTRUMENT *instrument, DUMBFILE *f)
static int it_read_instrument(IT_INSTRUMENT *instrument, DUMBFILE *f, int maxlen)
{
int n;
int n, len;
if (dumbfile_mgetl(f) != IT_INSTRUMENT_SIGNATURE)
return -1;
/*if (dumbfile_mgetl(f) != IT_INSTRUMENT_SIGNATURE)
return -1;*/
// XXX
dumbfile_getnc(instrument->filename, 13, f);
if (maxlen) len = dumbfile_pos(f);
dumbfile_skip(f, 4);
dumbfile_getnc((char *)instrument->filename, 13, f);
instrument->filename[13] = 0;
instrument->new_note_action = dumbfile_getc(f);
@ -450,13 +457,21 @@ static int it_read_instrument(IT_INSTRUMENT *instrument, DUMBFILE *f)
*/
dumbfile_skip(f, 4);
dumbfile_getnc(instrument->name, 26, f);
dumbfile_getnc((char *)instrument->name, 26, f);
instrument->name[26] = 0;
instrument->filter_cutoff = dumbfile_getc(f);
instrument->filter_resonance = dumbfile_getc(f);
/* Skip MIDI Channel, Program and Bank. */
//dumbfile_skip(f, 4);
/*instrument->output = dumbfile_getc(f);
if ( instrument->output > 16 ) {
instrument->output -= 128;
} else {
instrument->output = 0;
}
dumbfile_skip(f, 3);*/
dumbfile_skip(f, 4);
for (n = 0; n < 120; n++) {
@ -471,6 +486,39 @@ static int it_read_instrument(IT_INSTRUMENT *instrument, DUMBFILE *f)
if (it_read_envelope(&instrument->pan_envelope, f)) return -1;
if (it_read_envelope(&instrument->pitch_envelope, f)) return -1;
if (maxlen) {
len = dumbfile_pos(f) - len;
if ( maxlen - len < 124 ) return 0;
}
if ( dumbfile_mgetl(f) == IT_MPTX_SIGNATURE ) {
for ( n = 0; n < 120; n++ ) {
instrument->map_sample[ n ] += dumbfile_getc( f ) << 8;
}
if (dumbfile_error(f))
return -1;
}
/*if ( dumbfile_mgetl(f) == IT_INSM_SIGNATURE ) {
long end = dumbfile_igetl(f);
end += dumbfile_pos(f);
while ( dumbfile_pos(f) < end ) {
int chunkid = dumbfile_igetl(f);
switch ( chunkid ) {
case DUMB_ID('P','L','U','G'):
instrument->output = dumbfile_getc(f);
break;
default:
chunkid = chunkid / 0x100 + dumbfile_getc(f) * 0x1000000;
break;
}
}
if (dumbfile_error(f))
return -1;
}*/
return 0;
}
@ -478,17 +526,29 @@ static int it_read_instrument(IT_INSTRUMENT *instrument, DUMBFILE *f)
static int it_read_sample_header(IT_SAMPLE *sample, unsigned char *convert, long *offset, DUMBFILE *f)
{
/* XXX
if (dumbfile_mgetl(f) != IT_SAMPLE_SIGNATURE)
return -1;*/
int hax = 0;
long s = dumbfile_mgetl(f);
if (s != IT_SAMPLE_SIGNATURE) {
if ( s == ( IT_SAMPLE_SIGNATURE >> 16 ) ) {
s <<= 16;
s |= dumbfile_mgetw(f);
if ( s != IT_SAMPLE_SIGNATURE )
return -1;
hax = 1;
}
}
dumbfile_getnc(sample->filename, 13, f);
dumbfile_getnc((char *)sample->filename, 13, f);
sample->filename[13] = 0;
sample->global_volume = dumbfile_getc(f);
sample->flags = dumbfile_getc(f);
sample->default_volume = dumbfile_getc(f);
dumbfile_getnc(sample->name, 26, f);
dumbfile_getnc((char *)sample->name, 26, f);
sample->name[26] = 0;
*convert = dumbfile_getc(f);
@ -526,7 +586,8 @@ static int it_read_sample_header(IT_SAMPLE *sample, unsigned char *convert, long
sample->flags &= ~IT_SAMPLE_SUS_LOOP;
/* We may be able to truncate the sample to save memory. */
if (sample->flags & IT_SAMPLE_LOOP) {
if (sample->flags & IT_SAMPLE_LOOP &&
*convert != 0xFF) { /* not truncating compressed samples, for now... */
if ((sample->flags & IT_SAMPLE_SUS_LOOP) && sample->sus_loop_end >= sample->loop_end)
sample->length = sample->sus_loop_end;
else
@ -539,15 +600,46 @@ static int it_read_sample_header(IT_SAMPLE *sample, unsigned char *convert, long
sample->vibrato_speed = dumbfile_getc(f);
sample->vibrato_depth = dumbfile_getc(f);
if ( ! hax ) {
sample->vibrato_rate = dumbfile_getc(f);
sample->vibrato_waveform = dumbfile_getc(f);
} else {
sample->vibrato_rate = 0;
sample->vibrato_waveform = 0;
}
sample->finetune = 0;
sample->max_resampling_quality = -1;
return dumbfile_error(f);
}
long _dumb_it_read_sample_data_adpcm4(IT_SAMPLE *sample, DUMBFILE *f)
{
long n, len, delta;
signed char * ptr, * end;
signed char compression_table[16];
if (dumbfile_getnc((char *)compression_table, 16, f) != 16)
return -1;
ptr = (signed char *) sample->data;
delta = 0;
end = ptr + sample->length;
len = (sample->length + 1) / 2;
for (n = 0; n < len; n++) {
int b = dumbfile_getc(f);
if (b < 0) return -1;
delta += compression_table[b & 0x0F];
*ptr++ = delta;
if (ptr >= end) break;
delta += compression_table[b >> 4];
*ptr++ = delta;
}
return 0;
}
static long it_read_sample_data(int cmwt, IT_SAMPLE *sample, unsigned char convert, DUMBFILE *f)
static long it_read_sample_data(IT_SAMPLE *sample, unsigned char convert, DUMBFILE *f)
{
long n;
@ -558,33 +650,59 @@ static long it_read_sample_data(int cmwt, IT_SAMPLE *sample, unsigned char conve
if (!sample->data)
return -1;
if (sample->flags & 8) {
if (!(sample->flags & IT_SAMPLE_16BIT) && (convert == 0xFF)) {
if (_dumb_it_read_sample_data_adpcm4(sample, f) < 0)
return -1;
} else if (sample->flags & 8) {
/* If the sample is packed, then we must unpack it. */
/** WARNING - unresolved business here... test with ModPlug? */
/* Behavior as defined by greasemonkey's munch.py and observed by XMPlay and OpenMPT */
if (sample->flags & IT_SAMPLE_STEREO)
exit(37); // TODO: if this ever happens, maybe sample->length should be doubled below?
/*
//#ifndef STEREO_SAMPLES_COUNT_AS_TWO
ASSERT(!(sample->flags & IT_SAMPLE_STEREO));
//#endif
*/
if (sample->flags & IT_SAMPLE_STEREO) {
if (sample->flags & IT_SAMPLE_16BIT) {
decompress16(f, (short *) sample->data, datasize >> 1, convert & 4, 1);
decompress16(f, (short *) sample->data + 1, datasize >> 1, convert & 4, 1);
} else {
decompress8(f, (signed char *) sample->data, datasize >> 1, convert & 4, 1);
decompress8(f, (signed char *) sample->data + 1, datasize >> 1, convert & 4, 1);
}
} else {
if (sample->flags & IT_SAMPLE_16BIT)
decompress16(f, sample->data, datasize, cmwt);
decompress16(f, (short *) sample->data, datasize, convert & 4, 0);
else
decompress8(f, sample->data, datasize, cmwt);
decompress8(f, (signed char *) sample->data, datasize, convert & 4, 0);
}
} else if (sample->flags & IT_SAMPLE_16BIT) {
if (sample->flags & IT_SAMPLE_STEREO) {
if (convert & 2) {
for (n = 0; n < datasize; n += 2)
((short *)sample->data)[n] = dumbfile_mgetw(f);
for (n = 1; n < datasize; n += 2)
((short *)sample->data)[n] = dumbfile_mgetw(f);
} else {
for (n = 0; n < datasize; n += 2)
((short *)sample->data)[n] = dumbfile_igetw(f);
for (n = 1; n < datasize; n += 2)
((short *)sample->data)[n] = dumbfile_igetw(f);
}
} else {
if (convert & 2)
for (n = 0; n < datasize; n++)
((short *)sample->data)[n] = dumbfile_mgetw(f);
else
for (n = 0; n < datasize; n++)
((short *)sample->data)[n] = dumbfile_igetw(f);
}
} else {
if (sample->flags & IT_SAMPLE_STEREO) {
for (n = 0; n < datasize; n += 2)
((signed char *)sample->data)[n] = dumbfile_getc(f);
for (n = 1; n < datasize; n += 2)
((signed char *)sample->data)[n] = dumbfile_getc(f);
} else
for (n = 0; n < datasize; n++)
((signed char *)sample->data)[n] = dumbfile_getc(f);
}
if (dumbfile_error(f))
return -1;
@ -611,7 +729,7 @@ static long it_read_sample_data(int cmwt, IT_SAMPLE *sample, unsigned char conve
#define DETECT_DUPLICATE_CHANNELS
//#define DETECT_DUPLICATE_CHANNELS
#ifdef DETECT_DUPLICATE_CHANNELS
#include <stdio.h>
#endif
@ -659,7 +777,7 @@ static int it_read_pattern(IT_PATTERN *pattern, DUMBFILE *f, unsigned char *buff
return -1;
/* Read in the pattern data. */
dumbfile_getnc(buffer, buflen, f);
dumbfile_getnc((char *)buffer, buflen, f);
if (dumbfile_error(f))
return -1;
@ -794,7 +912,7 @@ static int it_read_pattern(IT_PATTERN *pattern, DUMBFILE *f, unsigned char *buff
typedef struct IT_COMPONENT
{
unsigned char type;
unsigned char n;
unsigned short n;
long offset;
short sampfirst; /* component[sampfirst] = first sample data after this */
short sampnext; /* sampnext is used to create linked lists of sample data */
@ -822,19 +940,23 @@ static sigdata_t *it_load_sigdata(DUMBFILE *f)
IT_COMPONENT *component;
int n_components = 0;
unsigned char sample_convert[256];
unsigned char sample_convert[4096];
int n;
unsigned char *buffer;
if (dumbfile_mgetl(f) != IT_SIGNATURE)
{
return NULL;
}
sigdata = malloc(sizeof(*sigdata));
if (!sigdata)
{
return NULL;
}
sigdata->song_message = NULL;
sigdata->order = NULL;
@ -844,7 +966,7 @@ static sigdata_t *it_load_sigdata(DUMBFILE *f)
sigdata->midi = NULL;
sigdata->checkpoint = NULL;
dumbfile_getnc(sigdata->name, 26, f);
dumbfile_getnc((char *)sigdata->name, 26, f);
sigdata->name[26] = 0;
/* Skip pattern row highlight info. */
@ -877,10 +999,11 @@ static sigdata_t *it_load_sigdata(DUMBFILE *f)
/* Skip Reserved. */
dumbfile_skip(f, 4);
dumbfile_getnc(sigdata->channel_pan, DUMB_IT_N_CHANNELS, f);
dumbfile_getnc(sigdata->channel_volume, DUMB_IT_N_CHANNELS, f);
dumbfile_getnc((char *)sigdata->channel_pan, DUMB_IT_N_CHANNELS, f);
dumbfile_getnc((char *)sigdata->channel_volume, DUMB_IT_N_CHANNELS, f);
if (dumbfile_error(f) || sigdata->n_orders <= 0 || sigdata->n_instruments > 256 || sigdata->n_samples > 256 || sigdata->n_patterns > 256) {
// XXX sample count
if (dumbfile_error(f) || sigdata->n_orders <= 0 || sigdata->n_instruments > 256 || sigdata->n_samples > 4000 || sigdata->n_patterns > 256) {
_dumb_it_unload_sigdata(sigdata);
return NULL;
}
@ -919,7 +1042,7 @@ static sigdata_t *it_load_sigdata(DUMBFILE *f)
sigdata->pattern[n].entry = NULL;
}
dumbfile_getnc(sigdata->order, sigdata->n_orders, f);
dumbfile_getnc((char *)sigdata->order, sigdata->n_orders, f);
sigdata->restart_position = 0;
component = malloc(769 * sizeof(*component));
@ -972,12 +1095,14 @@ static sigdata_t *it_load_sigdata(DUMBFILE *f)
return NULL;
}
/*
if (!(sigdata->flags & 128) != !(special & 8)) {
fprintf(stderr, "Flags Bit 7 (\"Request embedded MIDI configuration\"): %s\n", sigdata->flags & 128 ? "=SET=" : "clear");
fprintf(stderr, "Special Bit 3 (\"MIDI configuration embedded\") : %s\n", special & 8 ? "=SET=" : "clear");
fprintf(stderr, "entheh would like to investigate this IT file.\n");
fprintf(stderr, "Please contact him! entheh@users.sf.net\n");
}
*/
if (special & 8) {
/* MIDI configuration is embedded. */
@ -1007,7 +1132,7 @@ static sigdata_t *it_load_sigdata(DUMBFILE *f)
for (i = 0; i < 16; i++) {
unsigned char len = 0;
int j, leftdigit = -1;
if (dumbfile_getnc(mididata, 32, f) < 32) {
if (dumbfile_getnc((char *)mididata, 32, f) < 32) {
free(component);
_dumb_it_unload_sigdata(sigdata);
return NULL;
@ -1039,7 +1164,7 @@ static sigdata_t *it_load_sigdata(DUMBFILE *f)
for (i = 0; i < 128; i++) {
unsigned char len = 0;
int j, leftdigit = -1;
dumbfile_getnc(mididata, 32, f);
dumbfile_getnc((char *)mididata, 32, f);
for (j = 0; j < 32; j++) {
if (leftdigit >= 0) {
if (mididata[j] == 0) {
@ -1078,7 +1203,28 @@ static sigdata_t *it_load_sigdata(DUMBFILE *f)
long offset;
int m;
if (it_seek(f, component[n].offset)) {
/* XXX */
if ( component[n].offset == 0 ) {
switch (component[n].type) {
case IT_COMPONENT_INSTRUMENT:
memset( &sigdata->instrument[component[n].n], 0, sizeof(IT_INSTRUMENT) );
break;
case IT_COMPONENT_SAMPLE:
memset( &sigdata->sample[component[n].n], 0, sizeof(IT_SAMPLE) );
break;
case IT_COMPONENT_PATTERN:
{
IT_PATTERN * p = &sigdata->pattern[component[n].n];
p->entry = 0;
p->n_rows = 64;
p->n_entries = 0;
}
break;
}
continue;
}
if (dumbfile_seek(f, component[n].offset, DFS_SEEK_SET)) {
free(buffer);
free(component);
_dumb_it_unload_sigdata(sigdata);
@ -1088,9 +1234,12 @@ static sigdata_t *it_load_sigdata(DUMBFILE *f)
switch (component[n].type) {
case IT_COMPONENT_SONG_MESSAGE:
if ( n < n_components ) {
message_length = min( message_length, component[n+1].offset - component[n].offset );
}
sigdata->song_message = malloc(message_length + 1);
if (sigdata->song_message) {
if (dumbfile_getnc(sigdata->song_message, message_length, f) < message_length) {
if (dumbfile_getnc((char *)sigdata->song_message, message_length, f) < message_length) {
free(buffer);
free(component);
_dumb_it_unload_sigdata(sigdata);
@ -1104,7 +1253,7 @@ static sigdata_t *it_load_sigdata(DUMBFILE *f)
if (cmwt < 0x200)
m = it_read_old_instrument(&sigdata->instrument[component[n].n], f);
else
m = it_read_instrument(&sigdata->instrument[component[n].n], f);
m = it_read_instrument(&sigdata->instrument[component[n].n], f, (n + 1 < n_components) ? (component[n+1].offset - component[n].offset) : 0);
if (m) {
free(buffer);
@ -1154,14 +1303,14 @@ static sigdata_t *it_load_sigdata(DUMBFILE *f)
m = component[n].sampfirst;
while (m >= 0) {
if (it_seek(f, component[m].offset)) {
if (dumbfile_seek(f, component[m].offset, DFS_SEEK_SET)) {
free(buffer);
free(component);
_dumb_it_unload_sigdata(sigdata);
return NULL;
}
if (it_read_sample_data(cmwt, &sigdata->sample[component[m].n], sample_convert[component[m].n], f)) {
if (it_read_sample_data(&sigdata->sample[component[m].n], sample_convert[component[m].n], f)) {
free(buffer);
free(component);
_dumb_it_unload_sigdata(sigdata);
@ -1172,6 +1321,64 @@ static sigdata_t *it_load_sigdata(DUMBFILE *f)
}
}
for ( n = 0; n < 10; n++ )
{
if ( dumbfile_getc( f ) == 'X' )
{
if ( dumbfile_getc( f ) == 'T' )
{
if ( dumbfile_getc( f ) == 'P' )
{
if ( dumbfile_getc( f ) == 'M' )
{
break;
}
}
}
}
}
if ( !dumbfile_error( f ) && n < 10 )
{
unsigned int mptx_id = dumbfile_igetl( f );
while ( !dumbfile_error( f ) && mptx_id != DUMB_ID('M','P','T','S') )
{
unsigned int size = dumbfile_igetw( f );
switch (mptx_id)
{
/* TODO: Add instrument extension readers */
default:
dumbfile_skip(f, size * sigdata->n_instruments);
break;
}
mptx_id = dumbfile_igetl( f );
}
mptx_id = dumbfile_igetl( f );
while ( !dumbfile_error(f) && dumbfile_pos(f) < dumbfile_get_size(f) )
{
unsigned int size = dumbfile_igetw( f );
switch (mptx_id)
{
/* TODO: Add more song extension readers */
case DUMB_ID('D','T','.','.'):
if ( size == 2 )
sigdata->tempo = dumbfile_igetw( f );
else if ( size == 4 )
sigdata->tempo = dumbfile_igetl( f );
break;
default:
dumbfile_skip(f, size);
break;
}
mptx_id = dumbfile_igetl( f );
}
}
free(buffer);
free(component);
@ -1189,14 +1396,16 @@ DUH *dumb_read_it_quick(DUMBFILE *f)
DUH_SIGTYPE_DESC *descptr = &_dumb_sigtype_it;
sigdata = it_load_sigdata(f);
printf("sigdata: %i\n", sigdata);
if (!sigdata)
return NULL;
{
const char *tag[1][2];
const char *tag[2][2];
tag[0][0] = "TITLE";
tag[0][1] = ((DUMB_IT_SIGDATA *)sigdata)->name;
return make_duh(-1, 1, (const char *const (*)[2])tag, 1, &descptr, &sigdata);
tag[0][1] = (const char *)(((DUMB_IT_SIGDATA *)sigdata)->name);
tag[1][0] = "FORMAT";
tag[1][1] = "IT";
return make_duh(-1, 2, (const char *const (*)[2])tag, 1, &descptr, &sigdata);
}
}

File diff suppressed because it is too large Load diff

View file

@ -0,0 +1,42 @@
/* _______ ____ __ ___ ___
* \ _ \ \ / \ / \ \ / / ' ' '
* | | \ \ | | || | \/ | . .
* | | | | | | || ||\ /| |
* | | | | | | || || \/ | | ' ' '
* | | | | | | || || | | . .
* | |_/ / \ \__// || | |
* /_______/ynamic \____/niversal /__\ /____\usic /| . . ibliotheque
* / \
* / . \
* loadmod.c - Code to read a 669 Composer module / / \ \
* file, opening and closing it for | < / \_
* you. | \/ /\ /
* \_ / > /
* By Chris Moeller | \ / /
* | ' /
* \__/
*/
#include "dumb.h"
#include "internal/it.h"
/* dumb_load_669_quick(): loads a 669 file into a DUH struct, returning a
* pointer to the DUH struct. When you have finished with it, you must
* pass the pointer to unload_duh() so that the memory can be freed.
*/
DUH *dumb_load_669_quick(const char *filename)
{
DUH *duh;
DUMBFILE *f = dumbfile_open(filename);
if (!f)
return NULL;
duh = dumb_read_669_quick(f);
dumbfile_close(f);
return duh;
}

View file

@ -0,0 +1,34 @@
/* _______ ____ __ ___ ___
* \ _ \ \ / \ / \ \ / / ' ' '
* | | \ \ | | || | \/ | . .
* | | | | | | || ||\ /| |
* | | | | | | || || \/ | | ' ' '
* | | | | | | || || | | . .
* | |_/ / \ \__// || | |
* /_______/ynamic \____/niversal /__\ /____\usic /| . . ibliotheque
* / \
* / . \
* loadmod2.c - Code to read a 669 Composer module / / \ \
* file, opening and closing it for | < / \_
* you, and do an initial run-through. | \/ /\ /
* \_ / > /
* By Chris Moeller | \ / /
* | ' /
* \__/
*/
#include "dumb.h"
#include "internal/it.h"
/* dumb_load_669(): loads a 669 file into a DUH struct, returning a pointer
* to the DUH struct. When you have finished with it, you must pass the
* pointer to unload_duh() so that the memory can be freed.
*/
DUH *dumb_load_669(const char *filename)
{
DUH *duh = dumb_load_669_quick(filename);
dumb_it_do_initial_runthrough(duh);
return duh;
}

View file

@ -0,0 +1,42 @@
/* _______ ____ __ ___ ___
* \ _ \ \ / \ / \ \ / / ' ' '
* | | \ \ | | || | \/ | . .
* | | | | | | || ||\ /| |
* | | | | | | || || \/ | | ' ' '
* | | | | | | || || | | . .
* | |_/ / \ \__// || | |
* /_______/ynamic \____/niversal /__\ /____\usic /| . . ibliotheque
* / \
* / . \
* loadamf.c - Code to read a DSMI AMF module file, / / \ \
* opening and closing it for you. | < / \_
* | \/ /\ /
* \_ / > /
* By Chris Moeller. | \ / /
* | ' /
* \__/
*/
#include "dumb.h"
#include "internal/it.h"
/* dumb_load_amf_quick(): loads a AMF file into a DUH struct, returning a
* pointer to the DUH struct. When you have finished with it, you must
* pass the pointer to unload_duh() so that the memory can be freed.
*/
DUH *dumb_load_amf_quick(const char *filename)
{
DUH *duh;
DUMBFILE *f = dumbfile_open(filename);
if (!f)
return NULL;
duh = dumb_read_amf_quick(f);
dumbfile_close(f);
return duh;
}

View file

@ -0,0 +1,34 @@
/* _______ ____ __ ___ ___
* \ _ \ \ / \ / \ \ / / ' ' '
* | | \ \ | | || | \/ | . .
* | | | | | | || ||\ /| |
* | | | | | | || || \/ | | ' ' '
* | | | | | | || || | | . .
* | |_/ / \ \__// || | |
* /_______/ynamic \____/niversal /__\ /____\usic /| . . ibliotheque
* / \
* / . \
* loadamf2.c - Code to read a DSMI AMF module file, / / \ \
* opening and closing it for you, and | < / \_
* do an initial run-through. | \/ /\ /
* \_ / > /
* | \ / /
* By Chris Moeller. | ' /
* \__/
*/
#include "dumb.h"
#include "internal/it.h"
/* dumb_load_amf(): loads a AMF file into a DUH struct, returning a pointer
* to the DUH struct. When you have finished with it, you must pass the
* pointer to unload_duh() so that the memory can be freed.
*/
DUH *dumb_load_amf(const char *filename)
{
DUH *duh = dumb_load_amf_quick(filename);
dumb_it_do_initial_runthrough(duh);
return duh;
}

View file

@ -0,0 +1,38 @@
/* _______ ____ __ ___ ___
* \ _ \ \ / \ / \ \ / / ' ' '
* | | \ \ | | || | \/ | . .
* | | | | | | || ||\ /| |
* | | | | | | || || \/ | | ' ' '
* | | | | | | || || | | . .
* | |_/ / \ \__// || | |
* /_______/ynamic \____/niversal /__\ /____\usic /| . . ibliotheque
* / \
* / . \
* loadany.c - Code to detect and read any of the / / \ \
* module formats supported by DUMB, | < / \_
* opening and closing the file for you. | \/ /\ /
* \_ / > /
* By Chris Moeller. | \ / /
* | ' /
* \__/
*/
#include "dumb.h"
#include "internal/it.h"
DUH *dumb_load_any_quick(const char *filename, int restrict_, int subsong)
{
DUH *duh;
DUMBFILE *f = dumbfile_open(filename);
if (!f)
return NULL;
duh = dumb_read_any_quick(f, restrict_, subsong);
dumbfile_close(f);
return duh;
}

View file

@ -0,0 +1,29 @@
/* _______ ____ __ ___ ___
* \ _ \ \ / \ / \ \ / / ' ' '
* | | \ \ | | || | \/ | . .
* | | | | | | || ||\ /| |
* | | | | | | || || \/ | | ' ' '
* | | | | | | || || | | . .
* | |_/ / \ \__// || | |
* /_______/ynamic \____/niversal /__\ /____\usic /| . . ibliotheque
* / \
* / . \
* loadany2.c - Code to detect and read any of the / / \ \
* module formats supported by DUMB, | < / \_
* opening and closing the file for | \/ /\ /
* you, and do an initial run-through. \_ / > /
* | \ / /
* by Chris Moeller. | ' /
* \__/
*/
#include "dumb.h"
DUH *dumb_load_any(const char *filename, int restrict_, int subsong)
{
DUH *duh = dumb_load_any_quick(filename, restrict_, subsong);
dumb_it_do_initial_runthrough(duh);
return duh;
}

View file

@ -0,0 +1,42 @@
/* _______ ____ __ ___ ___
* \ _ \ \ / \ / \ \ / / ' ' '
* | | \ \ | | || | \/ | . .
* | | | | | | || ||\ /| |
* | | | | | | || || \/ | | ' ' '
* | | | | | | || || | | . .
* | |_/ / \ \__// || | |
* /_______/ynamic \____/niversal /__\ /____\usic /| . . ibliotheque
* / \
* / . \
* loadasy.c - Code to read an ASYLUM Music Format / / \ \
* module file, opening and closing it | < / \_
* for you. | \/ /\ /
* \_ / > /
* By Chris Moeller. | \ / /
* | ' /
* \__/
*/
#include "dumb.h"
#include "internal/it.h"
/* dumb_load_asy_quick(): loads a AMF file into a DUH struct, returning a
* pointer to the DUH struct. When you have finished with it, you must
* pass the pointer to unload_duh() so that the memory can be freed.
*/
DUH *dumb_load_asy_quick(const char *filename)
{
DUH *duh;
DUMBFILE *f = dumbfile_open(filename);
if (!f)
return NULL;
duh = dumb_read_asy_quick(f);
dumbfile_close(f);
return duh;
}

View file

@ -0,0 +1,34 @@
/* _______ ____ __ ___ ___
* \ _ \ \ / \ / \ \ / / ' ' '
* | | \ \ | | || | \/ | . .
* | | | | | | || ||\ /| |
* | | | | | | || || \/ | | ' ' '
* | | | | | | || || | | . .
* | |_/ / \ \__// || | |
* /_______/ynamic \____/niversal /__\ /____\usic /| . . ibliotheque
* / \
* / . \
* loadasy2.c - Code to read an ASYLUM Music Format / / \ \
* module file, opening and closing it | < / \_
* for you, and do an initial run- | \/ /\ /
* through. \_ / > /
* | \ / /
* By Chris Moeller. | ' /
* \__/
*/
#include "dumb.h"
#include "internal/it.h"
/* dumb_load_asy(): loads a AMF file into a DUH struct, returning a pointer
* to the DUH struct. When you have finished with it, you must pass the
* pointer to unload_duh() so that the memory can be freed.
*/
DUH *dumb_load_asy(const char *filename)
{
DUH *duh = dumb_load_asy_quick(filename);
dumb_it_do_initial_runthrough(duh);
return duh;
}

View file

@ -26,7 +26,7 @@
* pointer to the DUH struct. When you have finished with it, you must
* pass the pointer to unload_duh() so that the memory can be freed.
*/
DUH *dumb_load_mod_quick(const char *filename)
DUH *dumb_load_mod_quick(const char *filename, int restrict_)
{
DUH *duh;
DUMBFILE *f = dumbfile_open(filename);
@ -34,7 +34,7 @@ DUH *dumb_load_mod_quick(const char *filename)
if (!f)
return NULL;
duh = dumb_read_mod_quick(f);
duh = dumb_read_mod_quick(f, restrict_);
dumbfile_close(f);

View file

@ -21,9 +21,9 @@
DUH *dumb_load_mod(const char *filename)
DUH *dumb_load_mod(const char *filename, int restrict_)
{
DUH *duh = dumb_load_mod_quick(filename);
DUH *duh = dumb_load_mod_quick(filename, restrict_);
dumb_it_do_initial_runthrough(duh);
return duh;
}

View file

@ -0,0 +1,42 @@
/* _______ ____ __ ___ ___
* \ _ \ \ / \ / \ \ / / ' ' '
* | | \ \ | | || | \/ | . .
* | | | | | | || ||\ /| |
* | | | | | | || || \/ | | ' ' '
* | | | | | | || || | | . .
* | |_/ / \ \__// || | |
* /_______/ynamic \____/niversal /__\ /____\usic /| . . ibliotheque
* / \
* / . \
* loadmtm.c - Code to read a MultiTracker Module / / \ \
* file, opening and closing it for | < / \_
* you. | \/ /\ /
* \_ / > /
* By Chris Moeller | \ / /
* | ' /
* \__/
*/
#include "dumb.h"
#include "internal/it.h"
/* dumb_load_mtm_quick(): loads a MTM file into a DUH struct, returning a
* pointer to the DUH struct. When you have finished with it, you must
* pass the pointer to unload_duh() so that the memory can be freed.
*/
DUH *dumb_load_mtm_quick(const char *filename)
{
DUH *duh;
DUMBFILE *f = dumbfile_open(filename);
if (!f)
return NULL;
duh = dumb_read_mtm_quick(f);
dumbfile_close(f);
return duh;
}

View file

@ -0,0 +1,34 @@
/* _______ ____ __ ___ ___
* \ _ \ \ / \ / \ \ / / ' ' '
* | | \ \ | | || | \/ | . .
* | | | | | | || ||\ /| |
* | | | | | | || || \/ | | ' ' '
* | | | | | | || || | | . .
* | |_/ / \ \__// || | |
* /_______/ynamic \____/niversal /__\ /____\usic /| . . ibliotheque
* / \
* / . \
* loadmtm2.c - Code to read a MultiTracker Module / / \ \
* file, opening and closing it for | < / \_
* you, and do an initial run-through. | \/ /\ /
* \_ / > /
* By Chris Moeller | \ / /
* | ' /
* \__/
*/
#include "dumb.h"
#include "internal/it.h"
/* dumb_load_mtm(): loads a MTM file into a DUH struct, returning a pointer
* to the DUH struct. When you have finished with it, you must pass the
* pointer to unload_duh() so that the memory can be freed.
*/
DUH *dumb_load_mtm(const char *filename)
{
DUH *duh = dumb_load_mtm_quick(filename);
dumb_it_do_initial_runthrough(duh);
return duh;
}

View file

@ -0,0 +1,42 @@
/* _______ ____ __ ___ ___
* \ _ \ \ / \ / \ \ / / ' ' '
* | | \ \ | | || | \/ | . .
* | | | | | | || ||\ /| |
* | | | | | | || || \/ | | ' ' '
* | | | | | | || || | | . .
* | |_/ / \ \__// || | |
* /_______/ynamic \____/niversal /__\ /____\usic /| . . ibliotheque
* / \
* / . \
* loadokt.c - Code to read an Oktalyzer module / / \ \
* file, opening and closing it for | < / \_
* you. | \/ /\ /
* \_ / > /
* By Chris Moeller. | \ / /
* | ' /
* \__/
*/
#include "dumb.h"
#include "internal/it.h"
/* dumb_load_okt_quick(): loads an OKT file into a DUH struct, returning a
* pointer to the DUH struct. When you have finished with it, you must
* pass the pointer to unload_duh() so that the memory can be freed.
*/
DUH *dumb_load_okt_quick(const char *filename)
{
DUH *duh;
DUMBFILE *f = dumbfile_open(filename);
if (!f)
return NULL;
duh = dumb_read_okt_quick(f);
dumbfile_close(f);
return duh;
}

View file

@ -0,0 +1,29 @@
/* _______ ____ __ ___ ___
* \ _ \ \ / \ / \ \ / / ' ' '
* | | \ \ | | || | \/ | . .
* | | | | | | || ||\ /| |
* | | | | | | || || \/ | | ' ' '
* | | | | | | || || | | . .
* | |_/ / \ \__// || | |
* /_______/ynamic \____/niversal /__\ /____\usic /| . . ibliotheque
* / \
* / . \
* loadokt2.c - Function to read an Oktalyzer / / \ \
* module file, opening and closing | < / \_
* it for you, and do an initial run- | \/ /\ /
* through. \_ / > /
* | \ / /
* By Chris Moeller. | ' /
* \__/
*/
#include "dumb.h"
DUH *dumb_load_okt(const char *filename)
{
DUH *duh = dumb_load_okt_quick(filename);
dumb_it_do_initial_runthrough(duh);
return duh;
}

View file

@ -0,0 +1,43 @@
/* _______ ____ __ ___ ___
* \ _ \ \ / \ / \ \ / / ' ' '
* | | \ \ | | || | \/ | . .
* | | | | | | || ||\ /| |
* | | | | | | || || \/ | | ' ' '
* | | | | | | || || | | . .
* | |_/ / \ \__// || | |
* /_______/ynamic \____/niversal /__\ /____\usic /| . . ibliotheque
* / \
* / . \
* loadoldpsm.c - Code to read a ProTracker Studio / / \ \
* file, opening and closing it for | < / \_
* you. | \/ /\ /
* \_ / > /
* By Chris Moeller. | \ / /
* | ' /
* \__/
*/
#include "dumb.h"
#include "internal/it.h"
/* dumb_load_old_psm_quick(): loads an old PSM file into a DUH struct,
* returning a pointer to the DUH struct. When you have finished with it,
* you must pass the pointer to unload_duh() so that the memory can be
* freed.
*/
DUH *dumb_load_old_psm_quick(const char *filename)
{
DUH *duh;
DUMBFILE *f = dumbfile_open(filename);
if (!f)
return NULL;
duh = dumb_read_old_psm_quick(f);
dumbfile_close(f);
return duh;
}

View file

@ -0,0 +1,34 @@
/* _______ ____ __ ___ ___
* \ _ \ \ / \ / \ \ / / ' ' '
* | | \ \ | | || | \/ | . .
* | | | | | | || ||\ /| |
* | | | | | | || || \/ | | ' ' '
* | | | | | | || || | | . .
* | |_/ / \ \__// || | |
* /_______/ynamic \____/niversal /__\ /____\usic /| . . ibliotheque
* / \
* / . \
* loadoldpsm2.c - Code to read a ProTracker Studio / / \ \
* file, opening and closing it for | < / \_
* you, and do an initial run- | \/ /\ /
* through. \_ / > /
* | \ / /
* By Chris Moeller. | ' /
* \__/
*/
#include "dumb.h"
#include "internal/it.h"
/* dumb_load_old_psm(): loads an old PSM file into a DUH struct, returning
* a pointer to the DUH struct. When you have finished with it, you must
* pass the pointer to unload_duh() so that the memory can be freed.
*/
DUH *dumb_load_old_psm(const char *filename)
{
DUH *duh = dumb_load_old_psm_quick(filename);
dumb_it_do_initial_runthrough(duh);
return duh;
}

View file

@ -0,0 +1,42 @@
/* _______ ____ __ ___ ___
* \ _ \ \ / \ / \ \ / / ' ' '
* | | \ \ | | || | \/ | . .
* | | | | | | || ||\ /| |
* | | | | | | || || \/ | | ' ' '
* | | | | | | || || | | . .
* | |_/ / \ \__// || | |
* /_______/ynamic \____/niversal /__\ /____\usic /| . . ibliotheque
* / \
* / . \
* loadpsm.c - Code to read a ProTracker Studio / / \ \
* file, opening and closing it for | < / \_
* you. | \/ /\ /
* \_ / > /
* By Chris Moeller. | \ / /
* | ' /
* \__/
*/
#include "dumb.h"
#include "internal/it.h"
/* dumb_load_psm_quick(): loads a PSM file into a DUH struct, returning a
* pointer to the DUH struct. When you have finished with it, you must
* pass the pointer to unload_duh() so that the memory can be freed.
*/
DUH *dumb_load_psm_quick(const char *filename, int subsong)
{
DUH *duh;
DUMBFILE *f = dumbfile_open(filename);
if (!f)
return NULL;
duh = dumb_read_psm_quick(f, subsong);
dumbfile_close(f);
return duh;
}

View file

@ -0,0 +1,34 @@
/* _______ ____ __ ___ ___
* \ _ \ \ / \ / \ \ / / ' ' '
* | | \ \ | | || | \/ | . .
* | | | | | | || ||\ /| |
* | | | | | | || || \/ | | ' ' '
* | | | | | | || || | | . .
* | |_/ / \ \__// || | |
* /_______/ynamic \____/niversal /__\ /____\usic /| . . ibliotheque
* / \
* / . \
* loadpsm2.c - Code to read a ProTracker Studio / / \ \
* file, opening and closing it for | < / \_
* you, and do an initial run-through. | \/ /\ /
* \_ / > /
* By Chris Moeller. | \ / /
* | ' /
* \__/
*/
#include "dumb.h"
#include "internal/it.h"
/* dumb_load_psm(): loads a PSM file into a DUH struct, returning a pointer
* to the DUH struct. When you have finished with it, you must pass the
* pointer to unload_duh() so that the memory can be freed.
*/
DUH *dumb_load_psm(const char *filename, int subsong)
{
DUH *duh = dumb_load_psm_quick(filename, subsong);
dumb_it_do_initial_runthrough(duh);
return duh;
}

View file

@ -0,0 +1,42 @@
/* _______ ____ __ ___ ___
* \ _ \ \ / \ / \ \ / / ' ' '
* | | \ \ | | || | \/ | . .
* | | | | | | || ||\ /| |
* | | | | | | || || \/ | | ' ' '
* | | | | | | || || | | . .
* | |_/ / \ \__// || | |
* /_______/ynamic \____/niversal /__\ /____\usic /| . . ibliotheque
* / \
* / . \
* loadptm.c - Code to read a Poly Tracker v2.03 / / \ \
* file, opening and closing it for | < / \_
* you. | \/ /\ /
* \_ / > /
* By Chris Moeller. | \ / /
* | ' /
* \__/
*/
#include "dumb.h"
#include "internal/it.h"
/* dumb_load_ptm_quick(): loads a PTM file into a DUH struct, returning a
* pointer to the DUH struct. When you have finished with it, you must
* pass the pointer to unload_duh() so that the memory can be freed.
*/
DUH *dumb_load_ptm_quick(const char *filename)
{
DUH *duh;
DUMBFILE *f = dumbfile_open(filename);
if (!f)
return NULL;
duh = dumb_read_ptm_quick(f);
dumbfile_close(f);
return duh;
}

View file

@ -0,0 +1,34 @@
/* _______ ____ __ ___ ___
* \ _ \ \ / \ / \ \ / / ' ' '
* | | \ \ | | || | \/ | . .
* | | | | | | || ||\ /| |
* | | | | | | || || \/ | | ' ' '
* | | | | | | || || | | . .
* | |_/ / \ \__// || | |
* /_______/ynamic \____/niversal /__\ /____\usic /| . . ibliotheque
* / \
* / . \
* loadptm2.c - Code to read a Poly Tracker v2.03 / / \ \
* file, opening and closing it for | < / \_
* you, and do an initial run-through. | \/ /\ /
* \_ / > /
* By Chris Moeller. | \ / /
* | ' /
* \__/
*/
#include "dumb.h"
#include "internal/it.h"
/* dumb_load_ptm(): loads a PTM file into a DUH struct, returning a pointer
* to the DUH struct. When you have finished with it, you must pass the
* pointer to unload_duh() so that the memory can be freed.
*/
DUH *dumb_load_ptm(const char *filename)
{
DUH *duh = dumb_load_ptm_quick(filename);
dumb_it_do_initial_runthrough(duh);
return duh;
}

View file

@ -0,0 +1,42 @@
/* _______ ____ __ ___ ___
* \ _ \ \ / \ / \ \ / / ' ' '
* | | \ \ | | || | \/ | . .
* | | | | | | || ||\ /| |
* | | | | | | || || \/ | | ' ' '
* | | | | | | || || | | . .
* | |_/ / \ \__// || | |
* /_______/ynamic \____/niversal /__\ /____\usic /| . . ibliotheque
* / \
* / . \
* loadriff.c - Code to read a RIFF module file / / \ \
* opening and closing it for you. | < / \_
* | \/ /\ /
* \_ / > /
* By Chris Moeller. | \ / /
* | ' /
* \__/
*/
#include "dumb.h"
#include "internal/it.h"
/* dumb_load_riff_quick(): loads a RIFF file into a DUH struct, returning
* a pointer to the DUH struct. When you have finished with it, you must
* pass the pointer to unload_duh() so that the memory can be freed.
*/
DUH * dumb_load_riff_quick( const char *filename )
{
DUH * duh;
DUMBFILE * f = dumbfile_open( filename );
if ( ! f )
return NULL;
duh = dumb_read_riff_quick( f );
dumbfile_close( f );
return duh;
}

View file

@ -0,0 +1,29 @@
/* _______ ____ __ ___ ___
* \ _ \ \ / \ / \ \ / / ' ' '
* | | \ \ | | || | \/ | . .
* | | | | | | || ||\ /| |
* | | | | | | || || \/ | | ' ' '
* | | | | | | || || | | . .
* | |_/ / \ \__// || | |
* /_______/ynamic \____/niversal /__\ /____\usic /| . . ibliotheque
* / \
* / . \
* loadriff2.c - Code to read a RIFF module file / / \ \
* opening and closing it for you, | < / \_
* and do an initial run-through. | \/ /\ /
* \_ / > /
* By Chris Moeller. | \ / /
* | ' /
* \__/
*/
#include "dumb.h"
DUH *dumb_load_riff(const char *filename)
{
DUH *duh = dumb_load_riff_quick(filename);
dumb_it_do_initial_runthrough(duh);
return duh;
}

View file

@ -0,0 +1,42 @@
/* _______ ____ __ ___ ___
* \ _ \ \ / \ / \ \ / / ' ' '
* | | \ \ | | || | \/ | . .
* | | | | | | || ||\ /| |
* | | | | | | || || \/ | | ' ' '
* | | | | | | || || | | . .
* | |_/ / \ \__// || | |
* /_______/ynamic \____/niversal /__\ /____\usic /| . . ibliotheque
* / \
* / . \
* loadstm.c - Code to read a ScreamTracker 2 / / \ \
* file, opening and closing it for | < / \_
* you. | \/ /\ /
* \_ / > /
* By Chris Moeller. | \ / /
* | ' /
* \__/
*/
#include "dumb.h"
#include "internal/it.h"
/* dumb_load_stm_quick(): loads an STM file into a DUH struct, returning a
* pointer to the DUH struct. When you have finished with it, you must
* pass the pointer to unload_duh() so that the memory can be freed.
*/
DUH *dumb_load_stm_quick(const char *filename)
{
DUH *duh;
DUMBFILE *f = dumbfile_open(filename);
if (!f)
return NULL;
duh = dumb_read_stm_quick(f);
dumbfile_close(f);
return duh;
}

View file

@ -0,0 +1,29 @@
/* _______ ____ __ ___ ___
* \ _ \ \ / \ / \ \ / / ' ' '
* | | \ \ | | || | \/ | . .
* | | | | | | || ||\ /| |
* | | | | | | || || \/ | | ' ' '
* | | | | | | || || | | . .
* | |_/ / \ \__// || | |
* /_______/ynamic \____/niversal /__\ /____\usic /| . . ibliotheque
* / \
* / . \
* loadstm2.c - Function to read a ScreamTracker 2 / / \ \
* file, opening and closing it for | < / \_
* you, and do an initial run-through. | \/ /\ /
* \_ / > /
* By Chris Moeller. | \ / /
* | ' /
* \__/
*/
#include "dumb.h"
DUH *dumb_load_stm(const char *filename)
{
DUH *duh = dumb_load_stm_quick(filename);
dumb_it_do_initial_runthrough(duh);
return duh;
}

View file

@ -0,0 +1,125 @@
/* _______ ____ __ ___ ___
* \ _ \ \ / \ / \ \ / / ' ' '
* | | \ \ | | || | \/ | . .
* | | | | | | || ||\ /| |
* | | | | | | || || \/ | | ' ' '
* | | | | | | || || | | . .
* | |_/ / \ \__// || | |
* /_______/ynamic \____/niversal /__\ /____\usic /| . . ibliotheque
* / \
* / . \
* ptmeffect.c - Code for converting PTM / / \ \
* effects to IT effects. | < / \_
* | \/ /\ /
* By Chris Moeller. Based on xmeffect.c \_ / > /
* by Julien Cugniere. | \ / /
* | ' /
* \__/
*/
#include <stdlib.h>
#include <string.h>
#include "dumb.h"
#include "internal/it.h"
void _dumb_it_ptm_convert_effect(int effect, int value, IT_ENTRY *entry)
{
if (effect >= PTM_N_EFFECTS)
return;
/* Linearisation of the effect number... */
if (effect == PTM_E) {
effect = PTM_EBASE + HIGH(value);
value = LOW(value);
}
/* convert effect */
entry->mask |= IT_ENTRY_EFFECT;
switch (effect) {
case PTM_APPREGIO: effect = IT_ARPEGGIO; break;
case PTM_PORTAMENTO_UP: effect = IT_PORTAMENTO_UP; break;
case PTM_PORTAMENTO_DOWN: effect = IT_PORTAMENTO_DOWN; break;
case PTM_TONE_PORTAMENTO: effect = IT_TONE_PORTAMENTO; break;
case PTM_VIBRATO: effect = IT_VIBRATO; break;
case PTM_VOLSLIDE_TONEPORTA: effect = IT_VOLSLIDE_TONEPORTA; break;
case PTM_VOLSLIDE_VIBRATO: effect = IT_VOLSLIDE_VIBRATO; break;
case PTM_TREMOLO: effect = IT_TREMOLO; break;
case PTM_SAMPLE_OFFSET: effect = IT_SET_SAMPLE_OFFSET; break;
case PTM_VOLUME_SLIDE: effect = IT_VOLUME_SLIDE; break;
case PTM_POSITION_JUMP: effect = IT_JUMP_TO_ORDER; break;
case PTM_SET_CHANNEL_VOLUME: effect = IT_SET_CHANNEL_VOLUME; break;
case PTM_PATTERN_BREAK: effect = IT_BREAK_TO_ROW; break;
case PTM_SET_GLOBAL_VOLUME: effect = IT_SET_GLOBAL_VOLUME; break;
case PTM_RETRIGGER: effect = IT_RETRIGGER_NOTE; break;
case PTM_FINE_VIBRATO: effect = IT_FINE_VIBRATO; break;
/* TODO properly */
case PTM_NOTE_SLIDE_UP: effect = IT_PTM_NOTE_SLIDE_UP; break;
case PTM_NOTE_SLIDE_DOWN: effect = IT_PTM_NOTE_SLIDE_DOWN; break;
case PTM_NOTE_SLIDE_UP_RETRIG: effect = IT_PTM_NOTE_SLIDE_UP_RETRIG; break;
case PTM_NOTE_SLIDE_DOWN_RETRIG: effect = IT_PTM_NOTE_SLIDE_DOWN_RETRIG; break;
case PTM_SET_TEMPO_BPM:
effect = (value < 0x20) ? (IT_SET_SPEED) : (IT_SET_SONG_TEMPO);
break;
case PTM_EBASE+PTM_E_SET_FINETUNE: effect = SBASE+IT_S_FINETUNE; break; /** TODO */
case PTM_EBASE+PTM_E_SET_LOOP: effect = SBASE+IT_S_PATTERN_LOOP; break;
case PTM_EBASE+PTM_E_NOTE_CUT: effect = SBASE+IT_S_DELAYED_NOTE_CUT; break;
case PTM_EBASE+PTM_E_NOTE_DELAY: effect = SBASE+IT_S_NOTE_DELAY; break;
case PTM_EBASE+PTM_E_PATTERN_DELAY: effect = SBASE+IT_S_PATTERN_DELAY; break;
case PTM_EBASE+PTM_E_SET_PANNING: effect = SBASE+IT_S_SET_PAN; break;
case PTM_EBASE+PTM_E_FINE_VOLSLIDE_UP:
effect = IT_VOLUME_SLIDE;
value = EFFECT_VALUE(value, 0xF);
break;
case PTM_EBASE + PTM_E_FINE_VOLSLIDE_DOWN:
effect = IT_VOLUME_SLIDE;
value = EFFECT_VALUE(0xF, value);
break;
case PTM_EBASE + PTM_E_FINE_PORTA_UP:
effect = IT_PORTAMENTO_UP;
value = EFFECT_VALUE(0xF, value);
break;
case PTM_EBASE + PTM_E_FINE_PORTA_DOWN:
effect = IT_PORTAMENTO_DOWN;
value = EFFECT_VALUE(0xF, value);
break;
case PTM_EBASE + PTM_E_RETRIG_NOTE:
effect = IT_XM_RETRIGGER_NOTE;
value = EFFECT_VALUE(0, value);
break;
case PTM_EBASE + PTM_E_SET_VIBRATO_CONTROL:
effect = SBASE+IT_S_SET_VIBRATO_WAVEFORM;
value &= ~4; /** TODO: value&4 -> don't retrig wave */
break;
case PTM_EBASE + PTM_E_SET_TREMOLO_CONTROL:
effect = SBASE+IT_S_SET_TREMOLO_WAVEFORM;
value &= ~4; /** TODO: value&4 -> don't retrig wave */
break;
default:
/* user effect (often used in demos for synchronisation) */
entry->mask &= ~IT_ENTRY_EFFECT;
}
/* Inverse linearisation... */
if (effect >= SBASE && effect < SBASE+16) {
value = EFFECT_VALUE(effect-SBASE, value);
effect = IT_S;
}
entry->effect = effect;
entry->effectvalue = value;
}

View file

@ -0,0 +1,447 @@
/* _______ ____ __ ___ ___
* \ _ \ \ / \ / \ \ / / ' ' '
* | | \ \ | | || | \/ | . .
* | | | | | | || ||\ /| |
* | | | | | | || || \/ | | ' ' '
* | | | | | | || || | | . .
* | |_/ / \ \__// || | |
* /_______/ynamic \____/niversal /__\ /____\usic /| . . ibliotheque
* / \
* / . \
* read669.c - Code to read a 669 Composer module / / \ \
* from an open file. | < / \_
* | \/ /\ /
* By Chris Moeller. \_ / > /
* | \ / /
* | ' /
* \__/
*/
#include <stdlib.h>
#include <string.h>
#include <math.h>
#include "dumb.h"
#include "internal/it.h"
static int it_669_read_pattern(IT_PATTERN *pattern, DUMBFILE *f, int tempo, int breakpoint, unsigned char *buffer, int * used_channels)
{
int pos;
int channel;
int row;
IT_ENTRY *entry;
pattern->n_rows = 64;
if (dumbfile_getnc((char *)buffer, 64 * 3 * 8, f) < 64 * 3 * 8)
return -1;
/* compute number of entries */
pattern->n_entries = 64 + 1; /* Account for the row end markers, speed command */
if (breakpoint < 63) pattern->n_entries++; /* and break to row 0 */
pos = 0;
for (row = 0; row < 64; row++) {
for (channel = 0; channel < 8; channel++) {
if (buffer[pos+0] != 0xFF || buffer[pos+2] != 0xFF)
pattern->n_entries++;
pos += 3;
}
}
pattern->entry = malloc(pattern->n_entries * sizeof(*pattern->entry));
if (!pattern->entry)
return -1;
if (breakpoint == 63) breakpoint++;
entry = pattern->entry;
entry->channel = 8;
entry->mask = IT_ENTRY_EFFECT;
entry->effect = IT_SET_SPEED;
entry->effectvalue = tempo;
entry++;
pos = 0;
for (row = 0; row < 64; row++) {
if (row == breakpoint) {
entry->channel = 8;
entry->mask = IT_ENTRY_EFFECT;
entry->effect = IT_BREAK_TO_ROW;
entry->effectvalue = 0;
entry++;
}
for (channel = 0; channel < 8; channel++) {
if (buffer[pos+0] != 0xFF || buffer[pos+2] != 0xFF) {
entry->channel = channel;
entry->mask = 0;
if (buffer[pos+0] < 0xFE) {
entry->mask |= IT_ENTRY_NOTE | IT_ENTRY_INSTRUMENT;
entry->note = (buffer[pos+0] >> 2) + 36;
entry->instrument = (((buffer[pos+0] << 4) | (buffer[pos+1] >> 4)) & 0x3F) + 1;
}
if (buffer[pos+0] <= 0xFE) {
entry->mask |= IT_ENTRY_VOLPAN;
entry->volpan = ((buffer[pos+1] & 15) << 6) / 15;
if (*used_channels < channel + 1) *used_channels = channel + 1;
}
if (buffer[pos+2] != 0xFF) {
entry->mask |= IT_ENTRY_EFFECT;
entry->effectvalue = buffer[pos+2] & 15;
switch (buffer[pos+2] >> 4) {
case 0:
entry->effect = IT_PORTAMENTO_UP;
break;
case 1:
entry->effect = IT_PORTAMENTO_DOWN;
break;
case 2:
entry->effect = IT_TONE_PORTAMENTO;
break;
case 3:
entry->effect = IT_S;
entry->effectvalue += IT_S_FINETUNE * 16 + 8;
break;
case 4:
entry->effect = IT_VIBRATO;
// XXX speed unknown
entry->effectvalue |= 0x10;
break;
case 5:
if (entry->effectvalue) {
entry->effect = IT_SET_SPEED;
} else {
entry->mask &= ~IT_ENTRY_EFFECT;
}
break;
#if 0
/* dunno about this, really... */
case 6:
if (entry->effectvalue == 0) {
entry->effect = IT_PANNING_SLIDE;
entry->effectvalue = 0xFE;
} else if (entry->effectvalue == 1) {
entry->effect = IT_PANNING_SLIDE;
entry->effectvalue = 0xEF;
} else {
entry->mask &= ~IT_ENTRY_EFFECT;
}
break;
#endif
default:
entry->mask &= ~IT_ENTRY_EFFECT;
break;
}
if (*used_channels < channel + 1) *used_channels = channel + 1;
}
entry++;
}
pos += 3;
}
IT_SET_END_ROW(entry);
entry++;
}
return 0;
}
static int it_669_read_sample_header(IT_SAMPLE *sample, DUMBFILE *f)
{
dumbfile_getnc((char *)sample->name, 13, f);
sample->name[13] = 0;
sample->filename[0] = 0;
sample->length = dumbfile_igetl(f);
sample->loop_start = dumbfile_igetl(f);
sample->loop_end = dumbfile_igetl(f);
if (dumbfile_error(f))
return -1;
if (sample->length <= 0) {
sample->flags = 0;
return 0;
}
sample->flags = IT_SAMPLE_EXISTS;
sample->global_volume = 64;
sample->default_volume = 64;
sample->default_pan = 0;
sample->C5_speed = 8363;
// the above line might be wrong
if ((sample->loop_end > sample->length) && !(sample->loop_start))
sample->loop_end = 0;
if (sample->loop_end > sample->length)
sample->loop_end = sample->length;
if (sample->loop_end - sample->loop_start > 2)
sample->flags |= IT_SAMPLE_LOOP;
sample->vibrato_speed = 0;
sample->vibrato_depth = 0;
sample->vibrato_rate = 0;
sample->vibrato_waveform = 0; // do we have to set _all_ these?
sample->finetune = 0;
sample->max_resampling_quality = -1;
return 0;
}
static int it_669_read_sample_data(IT_SAMPLE *sample, DUMBFILE *f)
{
long i;
long truncated_size;
/* let's get rid of the sample data coming after the end of the loop */
if ((sample->flags & IT_SAMPLE_LOOP) && sample->loop_end < sample->length) {
truncated_size = sample->length - sample->loop_end;
sample->length = sample->loop_end;
} else {
truncated_size = 0;
}
sample->data = malloc(sample->length);
if (!sample->data)
return -1;
if (sample->length)
{
i = dumbfile_getnc(sample->data, sample->length, f);
if (i < sample->length) {
//return -1;
// ficking truncated files
if (i <= 0) {
sample->flags = 0;
return 0;
}
sample->length = i;
if (sample->loop_end > i) sample->loop_end = i;
} else {
/* skip truncated data */
dumbfile_skip(f, truncated_size);
// Should we be truncating it?
if (dumbfile_error(f))
return -1;
}
for (i = 0; i < sample->length; i++)
((signed char *)sample->data)[i] ^= 0x80;
}
return 0;
}
static DUMB_IT_SIGDATA *it_669_load_sigdata(DUMBFILE *f, int * ext)
{
DUMB_IT_SIGDATA *sigdata;
int n_channels;
int i;
unsigned char tempolist[128];
unsigned char breaklist[128];
i = dumbfile_igetw(f);
if (i != 0x6669 && i != 0x4E4A) return NULL;
*ext = (i == 0x4E4A);
sigdata = malloc(sizeof(*sigdata));
if (!sigdata) {
return NULL;
}
if (dumbfile_getnc((char *)sigdata->name, 36, f) < 36) {
free(sigdata);
return NULL;
}
sigdata->name[36] = 0;
sigdata->order = NULL;
sigdata->instrument = NULL;
sigdata->pattern = NULL;
sigdata->midi = NULL;
sigdata->checkpoint = NULL;
sigdata->sample = NULL;
sigdata->n_instruments = 0;
sigdata->song_message = malloc(72 + 2 + 1);
if (!sigdata->song_message) {
free(sigdata);
return NULL;
}
if (dumbfile_getnc((char *)sigdata->song_message, 36, f) < 36) {
_dumb_it_unload_sigdata(sigdata);
return NULL;
}
sigdata->song_message[36] = 13;
sigdata->song_message[36 + 1] = 10;
if (dumbfile_getnc((char *)sigdata->song_message + 38, 36, f) < 36) {
_dumb_it_unload_sigdata(sigdata);
return NULL;
}
sigdata->song_message[38 + 36] = 0;
sigdata->n_samples = dumbfile_getc(f);
sigdata->n_patterns = dumbfile_getc(f);
sigdata->restart_position = dumbfile_getc(f);
if ((sigdata->n_samples) > 64 || (sigdata->n_patterns > 128)) {
_dumb_it_unload_sigdata(sigdata);
return NULL;
}
sigdata->order = malloc(128); /* We may need to scan the extra ones! */
if (!sigdata->order) {
_dumb_it_unload_sigdata(sigdata);
return NULL;
}
if (dumbfile_getnc((char *)sigdata->order, 128, f) < 128) {
_dumb_it_unload_sigdata(sigdata);
return NULL;
}
for (i = 0; i < 128; i++) {
if (sigdata->order[i] == 255) break;
if (sigdata->order[i] >= sigdata->n_patterns) {
_dumb_it_unload_sigdata(sigdata);
return NULL;
}
}
if (!i) {
_dumb_it_unload_sigdata(sigdata);
return NULL;
}
sigdata->n_orders = i;
if (dumbfile_getnc((char *)tempolist, 128, f) < 128) {
_dumb_it_unload_sigdata(sigdata);
return NULL;
}
if (dumbfile_getnc((char *)breaklist, 128, f) < 128) {
_dumb_it_unload_sigdata(sigdata);
return NULL;
}
sigdata->sample = malloc(sigdata->n_samples * sizeof(*sigdata->sample));
if (!sigdata->sample) {
_dumb_it_unload_sigdata(sigdata);
return NULL;
}
for (i = 0; i < sigdata->n_samples; i++)
sigdata->sample[i].data = NULL;
for (i = 0; i < sigdata->n_samples; i++) {
if (it_669_read_sample_header(&sigdata->sample[i], f)) {
_dumb_it_unload_sigdata(sigdata);
return NULL;
}
}
/* May as well try to save a tiny bit of memory. */
if (sigdata->n_orders < 128) {
unsigned char *order = realloc(sigdata->order, sigdata->n_orders);
if (order) sigdata->order = order;
}
sigdata->pattern = malloc(sigdata->n_patterns * sizeof(*sigdata->pattern));
if (!sigdata->pattern) {
_dumb_it_unload_sigdata(sigdata);
return NULL;
}
for (i = 0; i < sigdata->n_patterns; i++)
sigdata->pattern[i].entry = NULL;
n_channels = 0;
/* Read in the patterns */
{
unsigned char *buffer = malloc(64 * 3 * 8); /* 64 rows * 3 bytes * 8 channels */
if (!buffer) {
_dumb_it_unload_sigdata(sigdata);
return NULL;
}
for (i = 0; i < sigdata->n_patterns; i++) {
if (it_669_read_pattern(&sigdata->pattern[i], f, tempolist[i], breaklist[i], buffer, &n_channels) != 0) {
free(buffer);
_dumb_it_unload_sigdata(sigdata);
return NULL;
}
}
free(buffer);
}
sigdata->n_pchannels = n_channels;
/* And finally, the sample data */
for (i = 0; i < sigdata->n_samples; i++) {
if (it_669_read_sample_data(&sigdata->sample[i], f)) {
_dumb_it_unload_sigdata(sigdata);
return NULL;
}
}
/* Now let's initialise the remaining variables, and we're done! */
sigdata->flags = IT_OLD_EFFECTS | IT_LINEAR_SLIDES | IT_STEREO | IT_WAS_A_669;
sigdata->global_volume = 128;
sigdata->mixing_volume = 48;
sigdata->speed = 4;
sigdata->tempo = 78;
sigdata->pan_separation = 128;
memset(sigdata->channel_volume, 64, DUMB_IT_N_CHANNELS);
for (i = 0; i < DUMB_IT_N_CHANNELS; i += 2) {
sigdata->channel_pan[i+0] = 48;
sigdata->channel_pan[i+1] = 16;
}
_dumb_it_fix_invalid_orders(sigdata);
return sigdata;
}
DUH *dumb_read_669_quick(DUMBFILE *f)
{
sigdata_t *sigdata;
int ext;
DUH_SIGTYPE_DESC *descptr = &_dumb_sigtype_it;
sigdata = it_669_load_sigdata(f, &ext);
if (!sigdata)
return NULL;
{
const char *tag[2][2];
tag[0][0] = "TITLE";
tag[0][1] = (const char *)(((DUMB_IT_SIGDATA *)sigdata)->name);
tag[1][0] = "FORMAT";
tag[1][1] = ext ? "669 Extended" : "669";
return make_duh(-1, 2, (const char *const (*)[2])tag, 1, &descptr, &sigdata);
}
}

View file

@ -0,0 +1,29 @@
/* _______ ____ __ ___ ___
* \ _ \ \ / \ / \ \ / / ' ' '
* | | \ \ | | || | \/ | . .
* | | | | | | || ||\ /| |
* | | | | | | || || \/ | | ' ' '
* | | | | | | || || | | . .
* | |_/ / \ \__// || | |
* /_______/ynamic \____/niversal /__\ /____\usic /| . . ibliotheque
* / \
* / . \
* read6692.c - Code to read a 669 Composer module / / \ \
* from an open file, and do an initial | < / \_
* run-through. | \/ /\ /
* By Chris Moeller. \_ / > /
* | \ / /
* | ' /
* \__/
*/
#include "dumb.h"
DUH *dumb_read_669(DUMBFILE *f)
{
DUH *duh = dumb_read_669_quick(f);
dumb_it_do_initial_runthrough(duh);
return duh;
}

View file

@ -0,0 +1,787 @@
/* _______ ____ __ ___ ___
* \ _ \ \ / \ / \ \ / / ' ' '
* | | \ \ | | || | \/ | . .
* | | | | | | || ||\ /| |
* | | | | | | || || \/ | | ' ' '
* | | | | | | || || | | . .
* | |_/ / \ \__// || | |
* /_______/ynamic \____/niversal /__\ /____\usic /| . . ibliotheque
* / \
* / . \
* readam.c - Code to read a RIFF AM module / / \ \
* from a parsed RIFF structure. | < / \_
* | \/ /\ /
* By Chris Moeller. \_ / > /
* | \ / /
* | ' /
* \__/
*/
#include <stdlib.h>
#include <string.h>
#include "dumb.h"
#include "internal/it.h"
#include "internal/riff.h"
static int it_riff_am_process_sample( IT_SAMPLE * sample, DUMBFILE * f, int len, int ver )
{
int header_length;
int default_pan;
int default_volume;
int flags;
int length;
int length_bytes;
int loop_start;
int loop_end;
int sample_rate;
long start = dumbfile_pos( f );
if ( ver == 0 )
{
if ( len < 0x38 )
return -1;
header_length = 0x38;
dumbfile_getnc( (char *) sample->name, 28, f );
sample->name[ 28 ] = 0;
default_pan = dumbfile_getc( f );
default_volume = dumbfile_getc( f );
flags = dumbfile_igetw( f );
length = dumbfile_igetl( f );
loop_start = dumbfile_igetl( f );
loop_end = dumbfile_igetl( f );
sample_rate = dumbfile_igetl( f );
}
else
{
if (len < 4) return -1;
header_length = dumbfile_igetl( f );
if ( header_length < 0x40 )
return -1;
if ( header_length + 4 > len )
return -1;
start += 4;
len -= 4;
dumbfile_getnc( (char *) sample->name, 32, f );
default_pan = dumbfile_igetw( f );
default_volume = dumbfile_igetw( f );
flags = dumbfile_igetw( f );
dumbfile_skip( f, 2 );
length = dumbfile_igetl( f );
loop_start = dumbfile_igetl( f );
loop_end = dumbfile_igetl( f );
sample_rate = dumbfile_igetl( f );
if ( default_pan > 0x7FFF || default_volume > 0x7FFF )
return -1;
default_pan = default_pan * 64 / 32767;
default_volume = default_volume * 64 / 32767;
}
if ( ! length ) {
sample->flags &= ~IT_SAMPLE_EXISTS;
return 0;
}
if ( flags & ~( 0x8000 | 0x80 | 0x20 | 0x10 | 0x08 | 0x04 ) )
return -1;
length_bytes = length << ( ( flags & 0x04 ) >> 2 );
if ( length_bytes + header_length > len )
return -1;
sample->flags = 0;
if ( flags & 0x80 ) sample->flags |= IT_SAMPLE_EXISTS;
if ( flags & 0x04 ) sample->flags |= IT_SAMPLE_16BIT;
sample->length = length;
sample->loop_start = loop_start;
sample->loop_end = loop_end;
sample->C5_speed = sample_rate;
sample->default_volume = default_volume;
sample->default_pan = default_pan | ( ( flags & 0x20 ) << 2 );
sample->filename[0] = 0;
sample->global_volume = 64;
sample->vibrato_speed = 0;
sample->vibrato_depth = 0;
sample->vibrato_rate = 0;
sample->vibrato_waveform = IT_VIBRATO_SINE;
sample->finetune = 0;
sample->max_resampling_quality = -1;
if ( flags & 0x08 )
{
if (((unsigned int)sample->loop_end <= (unsigned int)sample->length) &&
((unsigned int)sample->loop_start < (unsigned int)sample->loop_end))
{
sample->length = sample->loop_end;
sample->flags |= IT_SAMPLE_LOOP;
if ( flags & 0x10 ) sample->flags |= IT_SAMPLE_PINGPONG_LOOP;
}
}
length_bytes = sample->length << ( ( flags & 0x04 ) >> 2 );
sample->data = malloc( length_bytes );
if ( ! sample->data )
return -1;
if ( dumbfile_seek( f, start + header_length, DFS_SEEK_SET ) )
return -1;
dumbfile_getnc( sample->data, length_bytes, f );
return 0;
}
static int it_riff_am_process_pattern( IT_PATTERN * pattern, DUMBFILE * f, int len, int ver )
{
int nrows, row;
long start, end;
unsigned flags;
int p, q, r;
IT_ENTRY * entry;
nrows = dumbfile_getc( f ) + 1;
pattern->n_rows = nrows;
len -= 1;
pattern->n_entries = 0;
row = 0;
start = dumbfile_pos( f );
end = start + len;
while ( (row < nrows) && !dumbfile_error( f ) && (dumbfile_pos( f ) < end) ) {
p = dumbfile_getc( f );
if ( ! p ) {
++ row;
continue;
}
flags = p & 0xE0;
if (flags) {
++ pattern->n_entries;
if (flags & 0x80) dumbfile_skip( f, 2 );
if (flags & 0x40) dumbfile_skip( f, 2 );
if (flags & 0x20) dumbfile_skip( f, 1 );
}
}
if ( ! pattern->n_entries ) return 0;
pattern->n_entries += nrows;
pattern->entry = malloc( pattern->n_entries * sizeof( * pattern->entry ) );
if ( ! pattern->entry ) return -1;
entry = pattern->entry;
row = 0;
dumbfile_seek( f, start, DFS_SEEK_SET );
while ( ( row < nrows ) && !dumbfile_error( f ) && ( dumbfile_pos( f ) < end ) )
{
p = dumbfile_getc( f );
if ( ! p )
{
IT_SET_END_ROW( entry );
++ entry;
++ row;
continue;
}
flags = p;
entry->channel = flags & 0x1F;
entry->mask = 0;
if (flags & 0xE0)
{
if ( flags & 0x80 )
{
q = dumbfile_getc( f );
r = dumbfile_getc( f );
_dumb_it_xm_convert_effect( r, q, entry, 0 );
}
if ( flags & 0x40 )
{
q = dumbfile_getc( f );
r = dumbfile_getc( f );
if ( q )
{
entry->mask |= IT_ENTRY_INSTRUMENT;
entry->instrument = q;
}
if ( r )
{
entry->mask |= IT_ENTRY_NOTE;
entry->note = r - 1;
}
}
if ( flags & 0x20 )
{
q = dumbfile_getc( f );
entry->mask |= IT_ENTRY_VOLPAN;
if ( ver == 0 ) entry->volpan = q;
else entry->volpan = q * 64 / 127;
}
if (entry->mask) entry++;
}
}
while ( row < nrows )
{
IT_SET_END_ROW( entry );
++ entry;
++ row;
}
pattern->n_entries = entry - pattern->entry;
if ( ! pattern->n_entries ) return -1;
return 0;
}
static DUMB_IT_SIGDATA *it_riff_amff_load_sigdata( DUMBFILE * f, struct riff * stream )
{
DUMB_IT_SIGDATA *sigdata;
int n, o, p, found;
if ( ! stream ) goto error;
if ( stream->type != DUMB_ID( 'A', 'M', 'F', 'F' ) ) goto error;
sigdata = malloc( sizeof( *sigdata ) );
if ( ! sigdata ) goto error;
sigdata->n_patterns = 0;
sigdata->n_samples = 0;
sigdata->name[0] = 0;
found = 0;
for ( n = 0; (unsigned)n < stream->chunk_count; ++n )
{
struct riff_chunk * c = stream->chunks + n;
switch( c->type )
{
case DUMB_ID( 'M', 'A', 'I', 'N' ):
/* initialization data */
if ( ( found & 1 ) || ( c->size < 0x48 ) ) goto error_sd;
found |= 1;
break;
case DUMB_ID( 'O', 'R', 'D', 'R' ):
if ( ( found & 2 ) || ( c->size < 1 ) ) goto error_sd;
found |= 2;
break;
case DUMB_ID( 'P', 'A', 'T', 'T' ):
if ( dumbfile_seek( f, c->offset, DFS_SEEK_SET ) ) goto error_sd;
o = dumbfile_getc( f );
if ( o >= sigdata->n_patterns ) sigdata->n_patterns = o + 1;
o = dumbfile_igetl( f );
if ( (unsigned)o + 5 > c->size ) goto error_sd;
break;
case DUMB_ID( 'I', 'N', 'S', 'T' ):
{
if ( c->size < 0xE1 ) goto error_sd;
if ( dumbfile_seek( f, c->offset + 1, DFS_SEEK_SET ) ) goto error_sd;
o = dumbfile_getc( f );
if ( o >= sigdata->n_samples ) sigdata->n_samples = o + 1;
if ( c->size >= 0x121 )
{
if ( dumbfile_seek( f, c->offset + 0xE1, DFS_SEEK_SET ) ) goto error_sd;
if ( dumbfile_mgetl( f ) == DUMB_ID('S','A','M','P') )
{
unsigned size = dumbfile_igetl( f );
if ( size + 0xE1 + 8 > c->size ) goto error_sd;
}
}
}
break;
}
}
if ( found != 3 || !sigdata->n_samples || !sigdata->n_patterns ) goto error_sd;
if ( sigdata->n_samples > 255 || sigdata->n_patterns > 255 ) goto error_sd;
sigdata->song_message = NULL;
sigdata->order = NULL;
sigdata->instrument = NULL;
sigdata->sample = NULL;
sigdata->pattern = NULL;
sigdata->midi = NULL;
sigdata->checkpoint = NULL;
sigdata->mixing_volume = 48;
sigdata->pan_separation = 128;
sigdata->n_instruments = 0;
sigdata->n_orders = 0;
sigdata->restart_position = 0;
memset(sigdata->channel_volume, 64, DUMB_IT_N_CHANNELS);
for (n = 0; n < DUMB_IT_N_CHANNELS; n += 4) {
sigdata->channel_pan[n ] = 16;
sigdata->channel_pan[n+1] = 48;
sigdata->channel_pan[n+2] = 48;
sigdata->channel_pan[n+3] = 16;
}
for ( n = 0; (unsigned)n < stream->chunk_count; ++n )
{
struct riff_chunk * c = stream->chunks + n;
switch ( c->type )
{
case DUMB_ID( 'M', 'A', 'I', 'N' ):
if ( dumbfile_seek( f, c->offset, DFS_SEEK_SET ) ) goto error_usd;
dumbfile_getnc( (char *) sigdata->name, 64, f );
sigdata->name[ 64 ] = 0;
sigdata->flags = IT_STEREO | IT_OLD_EFFECTS | IT_COMPATIBLE_GXX | IT_WAS_AN_S3M;
o = dumbfile_getc( f );
if ( ! ( o & 1 ) ) sigdata->flags |= IT_LINEAR_SLIDES;
if ( ( o & ~3 ) || ! ( o & 2 ) ) goto error_usd; // unknown flags
sigdata->n_pchannels = dumbfile_getc( f );
sigdata->speed = dumbfile_getc( f );
sigdata->tempo = dumbfile_getc( f );
dumbfile_skip( f, 4 );
sigdata->global_volume = dumbfile_getc( f );
if ( c->size < 0x48 + (unsigned)sigdata->n_pchannels ) goto error_usd;
for ( o = 0; o < sigdata->n_pchannels; ++o )
{
p = dumbfile_getc( f );
sigdata->channel_pan[ o ] = p;
if ( p >= 128 )
{
sigdata->channel_volume[ o ] = 0;
}
}
break;
}
}
sigdata->pattern = malloc( sigdata->n_patterns * sizeof( *sigdata->pattern ) );
if ( ! sigdata->pattern ) goto error_usd;
for ( n = 0; n < sigdata->n_patterns; ++n )
sigdata->pattern[ n ].entry = NULL;
sigdata->sample = malloc( sigdata->n_samples * sizeof( *sigdata->sample ) );
if ( ! sigdata->sample ) goto error_usd;
for ( n = 0; n < sigdata->n_samples; ++n )
{
IT_SAMPLE * sample = sigdata->sample + n;
sample->data = NULL;
sample->flags = 0;
sample->name[ 0 ] = 0;
}
for ( n = 0; (unsigned)n < stream->chunk_count; ++n )
{
struct riff_chunk * c = stream->chunks + n;
switch ( c->type )
{
case DUMB_ID( 'O', 'R', 'D', 'R' ):
if ( dumbfile_seek( f, c->offset, DFS_SEEK_SET ) ) goto error_usd;
sigdata->n_orders = dumbfile_getc( f ) + 1;
if ( (unsigned)sigdata->n_orders + 1 > c->size ) goto error_usd;
sigdata->order = malloc( sigdata->n_orders );
if ( ! sigdata->order ) goto error_usd;
dumbfile_getnc( (char *) sigdata->order, sigdata->n_orders, f );
break;
case DUMB_ID( 'P', 'A', 'T', 'T' ):
if ( dumbfile_seek( f, c->offset, DFS_SEEK_SET ) ) goto error_usd;
o = dumbfile_getc( f );
p = dumbfile_igetl( f );
if ( it_riff_am_process_pattern( sigdata->pattern + o, f, p, 0 ) ) goto error_usd;
break;
case DUMB_ID( 'I', 'N', 'S', 'T' ):
{
IT_SAMPLE * sample;
if ( dumbfile_seek( f, c->offset + 1, DFS_SEEK_SET ) ) goto error_usd;
sample = sigdata->sample + dumbfile_getc( f );
if ( c->size >= 0x121 )
{
if ( dumbfile_seek( f, c->offset + 0xE1, DFS_SEEK_SET ) ) goto error_usd;
if ( dumbfile_mgetl( f ) == DUMB_ID('S','A','M','P') )
{
unsigned size = dumbfile_igetl( f );
if ( it_riff_am_process_sample( sample, f, size, 0 ) ) goto error_usd;
break;
}
}
dumbfile_seek( f, c->offset + 2, DFS_SEEK_SET );
dumbfile_getnc( (char *) sample->name, 28, f );
sample->name[ 28 ] = 0;
}
break;
}
}
_dumb_it_fix_invalid_orders( sigdata );
return sigdata;
error_usd:
_dumb_it_unload_sigdata( sigdata );
goto error;
error_sd:
free( sigdata );
error:
return NULL;
}
static DUMB_IT_SIGDATA *it_riff_am_load_sigdata( DUMBFILE * f, struct riff * stream )
{
DUMB_IT_SIGDATA *sigdata;
int n, o, p, found;
if ( ! f || ! stream ) goto error;
if ( stream->type != DUMB_ID( 'A', 'M', ' ', ' ' ) ) goto error;
sigdata = malloc(sizeof(*sigdata));
if ( ! sigdata ) goto error;
sigdata->n_patterns = 0;
sigdata->n_samples = 0;
sigdata->name[0] = 0;
found = 0;
for ( n = 0; (unsigned)n < stream->chunk_count; ++n )
{
struct riff_chunk * c = stream->chunks + n;
switch( c->type )
{
case DUMB_ID( 'I' ,'N' ,'I' ,'T' ):
/* initialization data */
if ( ( found & 1 ) || ( c->size < 0x48 ) ) goto error_sd;
found |= 1;
break;
case DUMB_ID( 'O', 'R', 'D', 'R' ):
if ( ( found & 2 ) || ( c->size < 1 ) ) goto error_sd;
found |= 2;
break;
case DUMB_ID( 'P', 'A', 'T', 'T' ):
if ( dumbfile_seek( f, c->offset, DFS_SEEK_SET ) ) goto error_sd;
o = dumbfile_getc( f );
if ( o >= sigdata->n_patterns ) sigdata->n_patterns = o + 1;
o = dumbfile_igetl( f );
if ( (unsigned)o + 5 > c->size ) goto error_sd;
break;
case DUMB_ID( 'R', 'I', 'F', 'F' ):
{
struct riff * str = c->nested;
switch ( str->type )
{
case DUMB_ID( 'A', 'I', ' ', ' ' ):
for ( o = 0; (unsigned)o < str->chunk_count; ++o )
{
struct riff_chunk * chk = str->chunks + o;
switch( chk->type )
{
case DUMB_ID( 'I', 'N', 'S', 'T' ):
{
struct riff * temp;
unsigned size;
unsigned sample_found;
if ( dumbfile_seek( f, chk->offset, DFS_SEEK_SET ) ) goto error_sd;
size = dumbfile_igetl( f );
if ( size < 0x142 ) goto error_sd;
sample_found = 0;
dumbfile_skip( f, 1 );
p = dumbfile_getc( f );
if ( p >= sigdata->n_samples ) sigdata->n_samples = p + 1;
temp = riff_parse( f, chk->offset + 4 + size, chk->size - size - 4, 1 );
if ( temp )
{
if ( temp->type == DUMB_ID( 'A', 'S', ' ', ' ' ) )
{
for ( p = 0; (unsigned)p < temp->chunk_count; ++p )
{
if ( temp->chunks[ p ].type == DUMB_ID( 'S', 'A', 'M', 'P' ) )
{
if ( sample_found )
{
riff_free( temp );
goto error_sd;
}
sample_found = 1;
}
}
}
riff_free( temp );
}
}
}
}
}
}
break;
}
}
if ( found != 3 || !sigdata->n_samples || !sigdata->n_patterns ) goto error_sd;
if ( sigdata->n_samples > 255 || sigdata->n_patterns > 255 ) goto error_sd;
sigdata->song_message = NULL;
sigdata->order = NULL;
sigdata->instrument = NULL;
sigdata->sample = NULL;
sigdata->pattern = NULL;
sigdata->midi = NULL;
sigdata->checkpoint = NULL;
sigdata->mixing_volume = 48;
sigdata->pan_separation = 128;
sigdata->n_instruments = 0;
sigdata->n_orders = 0;
sigdata->restart_position = 0;
memset(sigdata->channel_volume, 64, DUMB_IT_N_CHANNELS);
for (n = 0; n < DUMB_IT_N_CHANNELS; n += 4) {
sigdata->channel_pan[n ] = 16;
sigdata->channel_pan[n+1] = 48;
sigdata->channel_pan[n+2] = 48;
sigdata->channel_pan[n+3] = 16;
}
for ( n = 0; (unsigned)n < stream->chunk_count; ++n )
{
struct riff_chunk * c = stream->chunks + n;
switch ( c->type )
{
case DUMB_ID( 'I', 'N', 'I', 'T' ):
if ( dumbfile_seek( f, c->offset, DFS_SEEK_SET ) ) goto error_usd;
dumbfile_getnc( (char *) sigdata->name, 64, f );
sigdata->name[ 64 ] = 0;
sigdata->flags = IT_STEREO | IT_OLD_EFFECTS | IT_COMPATIBLE_GXX | IT_WAS_AN_S3M;
o = dumbfile_getc( f );
if ( ! ( o & 1 ) ) sigdata->flags |= IT_LINEAR_SLIDES;
if ( ( o & ~3 ) || ! ( o & 2 ) ) goto error_usd; // unknown flags
sigdata->n_pchannels = dumbfile_getc( f );
sigdata->speed = dumbfile_getc( f );
sigdata->tempo = dumbfile_getc( f );
dumbfile_skip( f, 4 );
sigdata->global_volume = dumbfile_getc( f );
if ( c->size < 0x48 + (unsigned)sigdata->n_pchannels ) goto error_usd;
for ( o = 0; o < sigdata->n_pchannels; ++o )
{
p = dumbfile_getc( f );
if ( p <= 128 )
{
sigdata->channel_pan[ o ] = p / 2;
}
else
{
sigdata->channel_volume[ o ] = 0;
}
}
break;
}
}
sigdata->pattern = malloc( sigdata->n_patterns * sizeof( *sigdata->pattern ) );
if ( ! sigdata->pattern ) goto error_usd;
for ( n = 0; n < sigdata->n_patterns; ++n )
sigdata->pattern[ n ].entry = NULL;
sigdata->sample = malloc( sigdata->n_samples * sizeof( *sigdata->sample ) );
if ( ! sigdata->sample ) goto error_usd;
for ( n = 0; n < sigdata->n_samples; ++n )
{
IT_SAMPLE * sample = sigdata->sample + n;
sample->data = NULL;
sample->flags = 0;
sample->name[ 0 ] = 0;
}
for ( n = 0; (unsigned)n < stream->chunk_count; ++n )
{
struct riff_chunk * c = stream->chunks + n;
switch ( c->type )
{
case DUMB_ID( 'O', 'R', 'D', 'R' ):
if ( dumbfile_seek( f, c->offset, DFS_SEEK_SET ) ) goto error_usd;
sigdata->n_orders = dumbfile_getc( f ) + 1;
if ( (unsigned)sigdata->n_orders + 1 > c->size ) goto error_usd;
sigdata->order = malloc( sigdata->n_orders );
if ( ! sigdata->order ) goto error_usd;
dumbfile_getnc( (char *) sigdata->order, sigdata->n_orders, f );
break;
case DUMB_ID( 'P', 'A', 'T', 'T' ):
if ( dumbfile_seek( f, c->offset, DFS_SEEK_SET ) ) goto error_usd;
o = dumbfile_getc( f );
p = dumbfile_igetl( f );
if ( it_riff_am_process_pattern( sigdata->pattern + o, f, p, 1 ) ) goto error_usd;
break;
case DUMB_ID( 'R', 'I', 'F', 'F' ):
{
struct riff * str = c->nested;
switch ( str->type )
{
case DUMB_ID('A', 'I', ' ', ' '):
for ( o = 0; (unsigned)o < str->chunk_count; ++o )
{
struct riff_chunk * chk = str->chunks + o;
switch( chk->type )
{
case DUMB_ID( 'I', 'N', 'S', 'T' ):
{
struct riff * temp;
unsigned size;
unsigned sample_found;
IT_SAMPLE * sample;
if ( dumbfile_seek( f, chk->offset, DFS_SEEK_SET ) ) goto error_usd;
size = dumbfile_igetl( f );
dumbfile_skip( f, 1 );
p = dumbfile_getc( f );
temp = riff_parse( f, chk->offset + 4 + size, chk->size - size - 4, 1 );
sample_found = 0;
sample = sigdata->sample + p;
if ( temp )
{
if ( temp->type == DUMB_ID( 'A', 'S', ' ', ' ' ) )
{
for ( p = 0; (unsigned)p < temp->chunk_count; ++p )
{
struct riff_chunk * c = temp->chunks + p;
if ( c->type == DUMB_ID( 'S', 'A', 'M', 'P' ) )
{
if ( sample_found )
{
riff_free( temp );
goto error_usd;
}
if ( dumbfile_seek( f, c->offset, DFS_SEEK_SET ) )
{
riff_free( temp );
goto error_usd;
}
if ( it_riff_am_process_sample( sample, f, c->size, 1 ) )
{
riff_free( temp );
goto error_usd;
}
sample_found = 1;
}
}
}
riff_free( temp );
}
if ( ! sample_found )
{
dumbfile_seek( f, chk->offset + 6, DFS_SEEK_SET );
dumbfile_getnc( (char *) sample->name, 32, f );
sample->name[ 32 ] = 0;
}
}
}
}
}
}
break;
}
}
_dumb_it_fix_invalid_orders( sigdata );
return sigdata;
error_usd:
_dumb_it_unload_sigdata( sigdata );
goto error;
error_sd:
free( sigdata );
error:
return NULL;
}
DUH *dumb_read_riff_amff( DUMBFILE * f, struct riff * stream )
{
sigdata_t *sigdata;
long length;
DUH_SIGTYPE_DESC *descptr = &_dumb_sigtype_it;
sigdata = it_riff_amff_load_sigdata( f, stream );
if (!sigdata)
return NULL;
length = 0;/*_dumb_it_build_checkpoints(sigdata, 0);*/
{
const char *tag[2][2];
tag[0][0] = "TITLE";
tag[0][1] = (const char *)(((DUMB_IT_SIGDATA *)sigdata)->name);
tag[1][0] = "FORMAT";
tag[1][1] = "RIFF AMFF";
return make_duh( length, 2, ( const char * const (*) [ 2 ] ) tag, 1, & descptr, & sigdata );
}
}
DUH *dumb_read_riff_am( DUMBFILE * f, struct riff * stream )
{
sigdata_t *sigdata;
DUH_SIGTYPE_DESC *descptr = &_dumb_sigtype_it;
sigdata = it_riff_am_load_sigdata( f, stream );
if (!sigdata)
return NULL;
{
const char *tag[2][2];
tag[0][0] = "TITLE";
tag[0][1] = (const char *)(((DUMB_IT_SIGDATA *)sigdata)->name);
tag[1][0] = "FORMAT";
tag[1][1] = "RIFF AM";
return make_duh( -1, 2, ( const char * const (*) [ 2 ] ) tag, 1, & descptr, & sigdata );
}
}

View file

@ -0,0 +1,523 @@
/* _______ ____ __ ___ ___
* \ _ \ \ / \ / \ \ / / ' ' '
* | | \ \ | | || | \/ | . .
* | | | | | | || ||\ /| |
* | | | | | | || || \/ | | ' ' '
* | | | | | | || || | | . .
* | |_/ / \ \__// || | |
* /_______/ynamic \____/niversal /__\ /____\usic /| . . ibliotheque
* / \
* / . \
* readamf.c - Code to read a DSMI AMF module from / / \ \
* an open file. | < / \_
* | \/ /\ /
* By Chris Moeller. \_ / > /
* | \ / /
* | ' /
* \__/
*/
#include <stdlib.h>
#include <string.h>
#include <math.h>
#include "dumb.h"
#include "internal/it.h"
static void it_amf_process_track( IT_ENTRY *entry_table, unsigned char *track, int rows, int channels )
{
int last_instrument = 0;
int tracksize = track[ 0 ] + ( track[ 1 ] << 8 ) + ( track[ 2 ] << 16 );
track += 3;
while ( tracksize-- ) {
unsigned int row = track[ 0 ];
unsigned int command = track[ 1 ];
unsigned int argument = track[ 2 ];
IT_ENTRY * entry = entry_table + row * channels;
if ( row >= ( unsigned int ) rows ) break;
if ( command < 0x7F ) {
entry->mask |= IT_ENTRY_NOTE | IT_ENTRY_INSTRUMENT | IT_ENTRY_VOLPAN;
entry->note = command;
if ( ! entry->instrument ) entry->instrument = last_instrument;
entry->volpan = argument;
}
else if ( command == 0x7F ) {
signed char row_delta = ( signed char ) argument;
int row_source = ( int ) row + ( int ) row_delta;
if ( row_source >= 0 && row_source < ( int ) rows ) {
*entry = entry_table[ row_source * channels ];
}
}
else if ( command == 0x80 ) {
entry->mask |= IT_ENTRY_INSTRUMENT;
last_instrument = argument + 1;
entry->instrument = last_instrument;
}
else if ( command == 0x83 ) {
entry->mask |= IT_ENTRY_VOLPAN;
entry->volpan = argument;
}
else {
unsigned int effect = command & 0x7F;
unsigned int effectvalue = argument;
switch (effect) {
case 0x01: effect = IT_SET_SPEED; break;
case 0x02: effect = IT_VOLUME_SLIDE;
case 0x0A: if ( effect == 0x0A ) effect = IT_VOLSLIDE_TONEPORTA;
case 0x0B: if ( effect == 0x0B ) effect = IT_VOLSLIDE_VIBRATO;
if ( effectvalue & 0x80 ) effectvalue = ( -( signed char ) effectvalue ) & 0x0F;
else effectvalue = ( effectvalue & 0x0F ) << 4;
break;
case 0x04: if ( effectvalue & 0x80 ) { effect = IT_PORTAMENTO_UP; effectvalue = ( -( signed char ) effectvalue ) & 0x7F; }
else { effect = IT_PORTAMENTO_DOWN; }
break;
case 0x06: effect = IT_TONE_PORTAMENTO; break;
case 0x07: effect = IT_TREMOR; break;
case 0x08: effect = IT_ARPEGGIO; break;
case 0x09: effect = IT_VIBRATO; break;
case 0x0C: effect = IT_BREAK_TO_ROW; break;
case 0x0D: effect = IT_JUMP_TO_ORDER; break;
case 0x0F: effect = IT_RETRIGGER_NOTE; break;
case 0x10: effect = IT_SET_SAMPLE_OFFSET; break;
case 0x11: if ( effectvalue ) { effect = IT_VOLUME_SLIDE;
if ( effectvalue & 0x80 ) effectvalue = 0xF0 | ( ( -( signed char ) effectvalue ) & 0x0F );
else effectvalue = 0x0F | ( ( effectvalue & 0x0F ) << 4 );
} else effect = 0;
break;
case 0x12:
case 0x16: if ( effectvalue ) { int mask = ( effect == 0x16 ) ? 0xE0 : 0xF0;
effect = ( effectvalue & 0x80 ) ? IT_PORTAMENTO_UP : IT_PORTAMENTO_DOWN;
if ( effectvalue & 0x80 ) effectvalue = mask | ( ( -( signed char ) effectvalue ) & 0x0F );
else effectvalue = mask | ( effectvalue & 0x0F );
} else effect = 0;
break;
case 0x13: effect = IT_S; effectvalue = EFFECT_VALUE( IT_S_NOTE_DELAY, effectvalue & 0x0F ); break;
case 0x14: effect = IT_S; effectvalue = EFFECT_VALUE( IT_S_DELAYED_NOTE_CUT, effectvalue & 0x0F ); break;
case 0x15: effect = IT_SET_SONG_TEMPO; break;
case 0x17: effectvalue = ( effectvalue + 64 ) & 0x7F;
if ( entry->mask & IT_ENTRY_EFFECT ) { if ( !( entry->mask & IT_ENTRY_VOLPAN ) ) { entry->volpan = ( effectvalue / 2 ) + 128; } effect = 0; }
else { effect = IT_SET_PANNING; }
break;
default: effect = effectvalue = 0;
}
if ( effect ) {
entry->mask |= IT_ENTRY_EFFECT;
entry->effect = effect;
entry->effectvalue = effectvalue;
}
}
track += 3;
}
}
static int it_amf_process_pattern( IT_PATTERN *pattern, IT_ENTRY *entry_table, int rows, int channels )
{
int i, j;
int n_entries = rows;
IT_ENTRY * entry;
pattern->n_rows = rows;
for ( i = 0, j = channels * rows; i < j; i++ ) {
if ( entry_table[ i ].mask ) {
n_entries++;
}
}
pattern->n_entries = n_entries;
pattern->entry = entry = malloc( n_entries * sizeof( IT_ENTRY ) );
if ( !entry ) {
return -1;
}
for ( i = 0; i < rows; i++ ) {
for ( j = 0; j < channels; j++ ) {
if ( entry_table[ i * channels + j ].mask ) {
*entry = entry_table[ i * channels + j ];
entry->channel = j;
entry++;
}
}
IT_SET_END_ROW( entry );
entry++;
}
return 0;
}
static int it_amf_read_sample_header( IT_SAMPLE *sample, DUMBFILE *f, int * offset, int ver )
{
int exists;
exists = dumbfile_getc( f );
dumbfile_getnc( (char *) sample->name, 32, f );
sample->name[32] = 0;
dumbfile_getnc( (char *) sample->filename, 13, f );
sample->filename[13] = 0;
*offset = dumbfile_igetl( f );
sample->length = dumbfile_igetl( f );
sample->C5_speed = dumbfile_igetw( f );
sample->default_volume = dumbfile_getc( f );
sample->global_volume = 64;
if ( sample->default_volume > 64 ) sample->default_volume = 64;
if ( ver >= 11 ) {
sample->loop_start = dumbfile_igetl( f );
sample->loop_end = dumbfile_igetl( f );
} else {
sample->loop_start = dumbfile_igetw( f );
sample->loop_end = sample->length;
}
if ( sample->length <= 0 ) {
sample->flags = 0;
return 0;
}
sample->flags = exists == 1 ? IT_SAMPLE_EXISTS : 0;
sample->default_pan = 0;
sample->finetune = 0;
if ( sample->loop_start != 0 )
sample->flags |= IT_SAMPLE_LOOP;
sample->vibrato_speed = 0;
sample->vibrato_depth = 0;
sample->vibrato_rate = 0;
sample->vibrato_waveform = 0; // do we have to set _all_ these?
sample->max_resampling_quality = -1;
return dumbfile_error(f);
}
static int it_amf_read_sample_data( IT_SAMPLE *sample, DUMBFILE *f )
{
int i, read_length = 0;
sample->data = malloc( sample->length );
if ( !sample->data )
return -1;
if ( sample->length )
read_length = dumbfile_getnc( sample->data, sample->length, f );
for ( i = 0; i < read_length; i++ ) {
( ( char * ) sample->data )[ i ] ^= 0x80;
}
for ( i = read_length; i < sample->length; i++ ) {
( ( char * ) sample->data )[ i ] = 0;
}
return 0; /* Sometimes the last sample is truncated :( */
}
static DUMB_IT_SIGDATA *it_amf_load_sigdata(DUMBFILE *f, int * version)
{
DUMB_IT_SIGDATA *sigdata;
int i, j, ver, ntracks, realntracks, nchannels;
int maxsampleseekpos = 0;
int sampleseekpos[256];
unsigned short *orderstotracks;
unsigned short *trackmap;
unsigned int tracksize[256];
unsigned char **track;
static const char sig[] = "AMF";
char signature [3];
if ( dumbfile_getnc( signature, 3, f ) != 3 ||
memcmp( signature, sig, 3 ) ) {
return NULL;
}
*version = ver = dumbfile_getc( f );
if ( ver < 10 || ver > 14) {
return NULL;
}
sigdata = malloc(sizeof(*sigdata));
if (!sigdata) {
return NULL;
}
dumbfile_getnc( (char *) sigdata->name, 32, f );
sigdata->name[ 32 ] = 0;
sigdata->n_samples = dumbfile_getc( f );
sigdata->n_orders = dumbfile_getc( f );
ntracks = dumbfile_igetw( f );
nchannels = dumbfile_getc( f );
if ( dumbfile_error( f ) ||
sigdata->n_samples < 1 || sigdata->n_samples > 255 ||
sigdata->n_orders < 1 || sigdata->n_orders > 255 ||
! ntracks ||
nchannels < 1 || nchannels > 32 ) {
free( sigdata );
return NULL;
}
memset( sigdata->channel_volume, 64, DUMB_IT_N_CHANNELS );
if ( ver >= 11 ) {
int nchannels = ( ver >= 13 ) ? 32 : 16;
for ( i = 0; i < nchannels; i++ ) {
signed char panpos = dumbfile_getc( f );
int pan = ( panpos + 64 ) / 2;
if ( pan < 0 ) pan = 0;
else if ( pan > 64 ) pan = IT_SURROUND;
sigdata->channel_pan[ i ] = pan;
}
}
else {
for ( i = 0; i < 16; i++ ) {
sigdata->channel_pan[ i ] = ( dumbfile_getc( f ) & 1 ) ? 16 : 48;
}
}
sigdata->tempo = 125;
sigdata->speed = 6;
if ( ver >= 13 ) {
i = dumbfile_getc( f );
if ( i >= 32 ) sigdata->tempo = i;
i = dumbfile_getc( f );
if ( i <= 32 ) sigdata->speed = i;
}
sigdata->order = malloc( sigdata->n_orders );
if ( !sigdata->order ) {
free( sigdata );
return NULL;
}
orderstotracks = malloc( sigdata->n_orders * nchannels * sizeof( unsigned short ) );
if ( !orderstotracks ) {
free( sigdata->order );
free( sigdata );
return NULL;
}
for ( i = 0; i < sigdata->n_orders; i++ ) {
sigdata->order[ i ] = i;
tracksize[ i ] = 64;
if ( ver >= 14 ) {
tracksize[ i ] = dumbfile_igetw( f );
}
for ( j = 0; j < nchannels; j++ ) {
orderstotracks[ i * nchannels + j ] = dumbfile_igetw( f );
}
}
if ( dumbfile_error( f ) ) {
free( orderstotracks );
free( sigdata->order );
free( sigdata );
return NULL;
}
sigdata->sample = malloc( sigdata->n_samples * sizeof( *sigdata->sample ) );
if ( !sigdata->sample ) {
free( orderstotracks );
free( sigdata->order );
free( sigdata );
return NULL;
}
sigdata->restart_position = 0;
sigdata->song_message = NULL;
sigdata->instrument = NULL;
sigdata->pattern = NULL;
sigdata->midi = NULL;
sigdata->checkpoint = NULL;
sigdata->n_instruments = 0;
for ( i = 0; i < sigdata->n_samples; ++i )
sigdata->sample[i].data = NULL;
for ( i = 0; i < sigdata->n_samples; ++i ) {
int offset;
if ( it_amf_read_sample_header( &sigdata->sample[i], f, &offset, ver ) ) {
goto error_ott;
}
sampleseekpos[ i ] = offset;
if ( offset > maxsampleseekpos ) maxsampleseekpos = offset;
}
sigdata->n_patterns = sigdata->n_orders;
sigdata->pattern = malloc( sigdata->n_patterns * sizeof( *sigdata->pattern ) );
if ( !sigdata->pattern ) {
goto error_ott;
}
for (i = 0; i < sigdata->n_patterns; ++i)
sigdata->pattern[i].entry = NULL;
trackmap = malloc( ntracks * sizeof( unsigned short ) );
if ( !trackmap ) {
goto error_ott;
}
if ( dumbfile_getnc( ( char * ) trackmap, ntracks * sizeof( unsigned short ), f ) != (long)(ntracks * sizeof( unsigned short )) ) {
goto error_tm;
}
realntracks = 0;
for ( i = 0; i < ntracks; i++ ) {
if ( trackmap[ i ] > realntracks ) realntracks = trackmap[ i ];
}
track = calloc( realntracks, sizeof( unsigned char * ) );
if ( !track ) {
goto error_tm;
}
for ( i = 0; i < realntracks; i++ ) {
int tracksize = dumbfile_igetw( f );
tracksize += dumbfile_getc( f ) << 16;
track[ i ] = malloc( tracksize * 3 + 3 );
if ( !track[ i ] ) {
goto error_all;
}
track[ i ][ 0 ] = tracksize & 255;
track[ i ][ 1 ] = ( tracksize >> 8 ) & 255;
track[ i ][ 2 ] = ( tracksize >> 16 ) & 255;
if ( dumbfile_getnc( (char *) track[ i ] + 3, tracksize * 3, f ) != tracksize * 3 ) {
goto error_all;
}
}
for ( i = 1; i <= maxsampleseekpos; i++ ) {
for ( j = 0; j < sigdata->n_samples; j++ ) {
if ( sampleseekpos[ j ] == i ) {
if ( it_amf_read_sample_data( &sigdata->sample[ j ], f ) ) {
goto error_all;
}
break;
}
}
}
/* Process tracks into patterns */
for ( i = 0; i < sigdata->n_patterns; i++ ) {
IT_ENTRY * entry_table = calloc( tracksize[ i ] * nchannels, sizeof( IT_ENTRY ) );
if ( !entry_table ) {
goto error_all;
}
for ( j = 0; j < nchannels; j++ ) {
int ntrack = orderstotracks[ i * nchannels + j ];
if ( ntrack && ntrack <= ntracks ) {
int realtrack = trackmap[ ntrack - 1 ];
if ( realtrack ) {
realtrack--;
if ( realtrack < realntracks && track[ realtrack ] ) {
it_amf_process_track( entry_table + j, track[ realtrack ], tracksize[ i ], nchannels );
}
}
}
}
if ( it_amf_process_pattern( &sigdata->pattern[ i ], entry_table, tracksize[ i ], nchannels ) ) {
free( entry_table );
goto error_all;
}
free( entry_table );
}
/* Now let's initialise the remaining variables, and we're done! */
sigdata->flags = IT_OLD_EFFECTS | IT_COMPATIBLE_GXX | IT_STEREO;
sigdata->global_volume = 128;
sigdata->mixing_volume = 48;
sigdata->pan_separation = 128;
_dumb_it_fix_invalid_orders(sigdata);
for ( i = 0; i < realntracks; i++ ) {
if ( track[ i ] ) {
free( track[ i ] );
}
}
free( track );
free( trackmap );
free( orderstotracks );
return sigdata;
error_all:
for ( i = 0; i < realntracks; i++ ) {
if ( track[ i ] ) {
free( track[ i ] );
}
}
free( track );
error_tm:
free( trackmap );
error_ott:
free( orderstotracks );
_dumb_it_unload_sigdata( sigdata );
return NULL;
}
DUH *dumb_read_amf_quick(DUMBFILE *f)
{
sigdata_t *sigdata;
DUH_SIGTYPE_DESC *descptr = &_dumb_sigtype_it;
int version;
sigdata = it_amf_load_sigdata(f, &version);
if (!sigdata)
return NULL;
{
const char *tag[2][2];
char ver_string[14];
tag[0][0] = "TITLE";
tag[0][1] = (const char *)(((DUMB_IT_SIGDATA *)sigdata)->name);
tag[1][0] = "FORMAT";
memcpy( ver_string, "DSMI AMF v", 10 );
ver_string[10] = '0' + version / 10;
ver_string[11] = '.';
ver_string[12] = '0' + version % 10;
ver_string[13] = 0;
tag[1][1] = ver_string;
return make_duh(-1, 2, (const char *const (*)[2])tag, 1, &descptr, &sigdata);
}
}

View file

@ -0,0 +1,29 @@
/* _______ ____ __ ___ ___
* \ _ \ \ / \ / \ \ / / ' ' '
* | | \ \ | | || | \/ | . .
* | | | | | | || ||\ /| |
* | | | | | | || || \/ | | ' ' '
* | | | | | | || || | | . .
* | |_/ / \ \__// || | |
* /_______/ynamic \____/niversal /__\ /____\usic /| . . ibliotheque
* / \
* / . \
* readamf2.c - Function to read a DSMI AMF module / / \ \
* from an open file and do an initial | < / \_
* run-through. | \/ /\ /
* \_ / > /
* | \ / /
* | ' /
* \__/
*/
#include "dumb.h"
DUH *dumb_read_amf(DUMBFILE *f)
{
DUH *duh = dumb_read_amf_quick(f);
dumb_it_do_initial_runthrough(duh);
return duh;
}

View file

@ -0,0 +1,132 @@
/* _______ ____ __ ___ ___
* \ _ \ \ / \ / \ \ / / ' ' '
* | | \ \ | | || | \/ | . .
* | | | | | | || ||\ /| |
* | | | | | | || || \/ | | ' ' '
* | | | | | | || || | | . .
* | |_/ / \ \__// || | |
* /_______/ynamic \____/niversal /__\ /____\usic /| . . ibliotheque
* / \
* / . \
* readany.c - Code to detect and read any of the / / \ \
* module formats supported by DUMB. | < / \_
* | \/ /\ /
* By Chris Moeller. \_ / > /
* | \ / /
* | ' /
* \__/
*/
#include <stdlib.h>
#include <string.h>
#include "dumb.h"
#ifdef _MSC_VER
#define strnicmp _strnicmp
#else
#if defined(unix) || defined(__unix__) || defined(__unix)
#include <strings.h>
#endif
#define strnicmp strncasecmp
#endif
enum { maximum_signature_size = 0x30 };
DUH *dumb_read_any_quick(DUMBFILE *f, int restrict_, int subsong)
{
unsigned char signature[ maximum_signature_size ];
unsigned long signature_size;
DUH * duh = NULL;
signature_size = dumbfile_get_size(f);
signature_size = dumbfile_getnc( (char *)signature, maximum_signature_size, f );
dumbfile_seek( f, 0, DFS_SEEK_SET );
if (signature_size >= 4 &&
signature[0] == 'I' && signature[1] == 'M' &&
signature[2] == 'P' && signature[3] == 'M')
{
duh = dumb_read_it_quick( f );
}
else if (signature_size >= 17 && !memcmp(signature, "Extended Module: ", 17))
{
duh = dumb_read_xm_quick( f );
}
else if (signature_size >= 0x30 &&
signature[0x2C] == 'S' && signature[0x2D] == 'C' &&
signature[0x2E] == 'R' && signature[0x2F] == 'M')
{
duh = dumb_read_s3m_quick( f );
}
else if (signature_size >= 30 &&
/*signature[28] == 0x1A &&*/ signature[29] == 2 &&
( ! strnicmp( ( const char * ) signature + 20, "!Scream!", 8 ) ||
! strnicmp( ( const char * ) signature + 20, "BMOD2STM", 8 ) ||
! strnicmp( ( const char * ) signature + 20, "WUZAMOD!", 8 ) ) )
{
duh = dumb_read_stm_quick( f );
}
else if (signature_size >= 2 &&
((signature[0] == 0x69 && signature[1] == 0x66) ||
(signature[0] == 0x4A && signature[1] == 0x4E)))
{
duh = dumb_read_669_quick( f );
}
else if (signature_size >= 0x30 &&
signature[0x2C] == 'P' && signature[0x2D] == 'T' &&
signature[0x2E] == 'M' && signature[0x2F] == 'F')
{
duh = dumb_read_ptm_quick( f );
}
else if (signature_size >= 4 &&
signature[0] == 'P' && signature[1] == 'S' &&
signature[2] == 'M' && signature[3] == ' ')
{
duh = dumb_read_psm_quick( f, subsong );
}
else if (signature_size >= 4 &&
signature[0] == 'P' && signature[1] == 'S' &&
signature[2] == 'M' && signature[3] == 254)
{
duh = dumb_read_old_psm_quick( f );
}
else if (signature_size >= 3 &&
signature[0] == 'M' && signature[1] == 'T' &&
signature[2] == 'M')
{
duh = dumb_read_mtm_quick( f );
}
else if ( signature_size >= 4 &&
signature[0] == 'R' && signature[1] == 'I' &&
signature[2] == 'F' && signature[3] == 'F')
{
duh = dumb_read_riff_quick( f );
}
else if ( signature_size >= 24 &&
!memcmp( signature, "ASYLUM Music Format", 19 ) &&
!memcmp( signature + 19, " V1.0", 5 ) )
{
duh = dumb_read_asy_quick( f );
}
else if ( signature_size >= 3 &&
signature[0] == 'A' && signature[1] == 'M' &&
signature[2] == 'F')
{
duh = dumb_read_amf_quick( f );
}
else if ( signature_size >= 8 &&
!memcmp( signature, "OKTASONG", 8 ) )
{
duh = dumb_read_okt_quick( f );
}
if ( !duh )
{
dumbfile_seek( f, 0, DFS_SEEK_SET );
duh = dumb_read_mod_quick( f, restrict_ );
}
return duh;
}

View file

@ -0,0 +1,29 @@
/* _______ ____ __ ___ ___
* \ _ \ \ / \ / \ \ / / ' ' '
* | | \ \ | | || | \/ | . .
* | | | | | | || ||\ /| |
* | | | | | | || || \/ | | ' ' '
* | | | | | | || || | | . .
* | |_/ / \ \__// || | |
* /_______/ynamic \____/niversal /__\ /____\usic /| . . ibliotheque
* / \
* / . \
* readany2.c - Code to detect and read any of the / / \ \
* module formats supported by DUMB | < / \_
* from an open file and do an initial | \/ /\ /
* run-through. \_ / > /
* | \ / /
* by Chris Moeller. | ' /
* \__/
*/
#include "dumb.h"
DUH *dumb_read_any(DUMBFILE *f, int restrict_, int subsong)
{
DUH *duh = dumb_read_any_quick(f, restrict_, subsong);
dumb_it_do_initial_runthrough(duh);
return duh;
}

View file

@ -0,0 +1,331 @@
/* _______ ____ __ ___ ___
* \ _ \ \ / \ / \ \ / / ' ' '
* | | \ \ | | || | \/ | . .
* | | | | | | || ||\ /| |
* | | | | | | || || \/ | | ' ' '
* | | | | | | || || | | . .
* | |_/ / \ \__// || | |
* /_______/ynamic \____/niversal /__\ /____\usic /| . . ibliotheque
* / \
* / . \
* readasy.c - Code to read an ASYLUM Music Format / / \ \
* module from an open file. | < / \_
* | \/ /\ /
* By Chris Moeller. \_ / > /
* | \ / /
* | ' /
* \__/
*/
#include <stdlib.h>
#include <string.h>
#include <math.h>
#include "dumb.h"
#include "internal/it.h"
static int it_asy_read_pattern( IT_PATTERN *pattern, DUMBFILE *f, unsigned char *buffer )
{
int pos;
int channel;
int row;
IT_ENTRY *entry;
pattern->n_rows = 64;
if ( dumbfile_getnc( (char *) buffer, 64 * 8 * 4, f ) != 64 * 8 * 4 )
return -1;
/* compute number of entries */
pattern->n_entries = 64; /* Account for the row end markers */
pos = 0;
for ( row = 0; row < 64; ++row ) {
for ( channel = 0; channel < 8; ++channel ) {
if ( buffer[ pos + 0 ] | buffer[ pos + 1 ] | buffer[ pos + 2 ] | buffer[ pos + 3 ] )
++pattern->n_entries;
pos += 4;
}
}
pattern->entry = malloc( pattern->n_entries * sizeof( *pattern->entry ) );
if ( !pattern->entry )
return -1;
entry = pattern->entry;
pos = 0;
for ( row = 0; row < 64; ++row ) {
for ( channel = 0; channel < 8; ++channel ) {
if ( buffer[ pos + 0 ] | buffer[ pos + 1 ] | buffer[ pos + 2 ] | buffer[ pos + 3 ] ) {
entry->channel = channel;
entry->mask = 0;
if ( buffer[ pos + 0 ] && buffer[ pos + 0 ] < 96 ) {
entry->note = buffer[ pos + 0 ];
entry->mask |= IT_ENTRY_NOTE;
}
if ( buffer[ pos + 1 ] && buffer[ pos + 1 ] <= 64 ) {
entry->instrument = buffer[ pos + 1 ];
entry->mask |= IT_ENTRY_INSTRUMENT;
}
_dumb_it_xm_convert_effect( buffer[ pos + 2 ], buffer[ pos + 3 ], entry, 1 );
if ( entry->mask ) ++entry;
}
pos += 4;
}
IT_SET_END_ROW( entry );
++entry;
}
pattern->n_entries = entry - pattern->entry;
return 0;
}
static int it_asy_read_sample_header( IT_SAMPLE *sample, DUMBFILE *f )
{
int finetune, key_offset;
/**
21 22 Chars Sample 1 name. If the name is not a full
22 chars in length, it will be null
terminated.
If
the sample name begins with a '#' character (ASCII $23 (35)) then this is
assumed not to be an instrument name, and is probably a message.
*/
dumbfile_getnc( (char *) sample->name, 22, f );
sample->name[22] = 0;
sample->filename[0] = 0;
/** Each finetune step changes the note 1/8th of a semitone. */
finetune = ( signed char ) ( dumbfile_getc( f ) << 4 ) >> 4; /* signed nibble */
sample->default_volume = dumbfile_getc( f ); // Should we be setting global_volume to this instead?
sample->global_volume = 64;
if ( sample->default_volume > 64 ) sample->default_volume = 64;
key_offset = ( signed char ) dumbfile_getc( f ); /* base key offset */
sample->length = dumbfile_igetl( f );
sample->loop_start = dumbfile_igetl( f );
sample->loop_end = sample->loop_start + dumbfile_igetl( f );
if ( sample->length <= 0 ) {
sample->flags = 0;
return 0;
}
sample->flags = IT_SAMPLE_EXISTS;
sample->default_pan = 0;
sample->C5_speed = (int)( AMIGA_CLOCK / 214.0 * pow( DUMB_SEMITONE_BASE, key_offset ) );//( long )( 16726.0 * pow( DUMB_PITCH_BASE, finetune * 32 ) );
sample->finetune = finetune * 32;
// the above line might be wrong
if ( ( sample->loop_end - sample->loop_start > 2 ) && ( sample->loop_end <= sample->length ) )
sample->flags |= IT_SAMPLE_LOOP;
sample->vibrato_speed = 0;
sample->vibrato_depth = 0;
sample->vibrato_rate = 0;
sample->vibrato_waveform = 0; // do we have to set _all_ these?
sample->max_resampling_quality = -1;
return dumbfile_error(f);
}
static int it_asy_read_sample_data( IT_SAMPLE *sample, DUMBFILE *f )
{
long truncated_size;
/* let's get rid of the sample data coming after the end of the loop */
if ( ( sample->flags & IT_SAMPLE_LOOP ) && sample->loop_end < sample->length ) {
truncated_size = sample->length - sample->loop_end;
sample->length = sample->loop_end;
} else {
truncated_size = 0;
}
sample->data = malloc( sample->length );
if ( !sample->data )
return -1;
if ( sample->length )
dumbfile_getnc( sample->data, sample->length, f );
dumbfile_skip( f, truncated_size );
return dumbfile_error( f );
}
static DUMB_IT_SIGDATA *it_asy_load_sigdata(DUMBFILE *f)
{
DUMB_IT_SIGDATA *sigdata;
int i;
static const char sig_part[] = "ASYLUM Music Format";
static const char sig_rest[] = " V1.0"; /* whee, string space optimization with format type below */
char signature [32];
if ( dumbfile_getnc( signature, 32, f ) != 32 ||
memcmp( signature, sig_part, 19 ) ||
memcmp( signature + 19, sig_rest, 5 ) ) {
return NULL;
}
sigdata = malloc(sizeof(*sigdata));
if (!sigdata) {
return NULL;
}
sigdata->speed = dumbfile_getc( f ); /* XXX seems to fit the files I have */
sigdata->tempo = dumbfile_getc( f ); /* ditto */
sigdata->n_samples = dumbfile_getc( f ); /* ditto */
sigdata->n_patterns = dumbfile_getc( f );
sigdata->n_orders = dumbfile_getc( f );
sigdata->restart_position = dumbfile_getc( f );
if ( dumbfile_error( f ) || !sigdata->n_samples || sigdata->n_samples > 64 || !sigdata->n_patterns ||
!sigdata->n_orders ) {
free( sigdata );
return NULL;
}
if ( sigdata->restart_position > sigdata->n_orders ) /* XXX */
sigdata->restart_position = 0;
sigdata->order = malloc( sigdata->n_orders );
if ( !sigdata->order ) {
free( sigdata );
return NULL;
}
if ( dumbfile_getnc( (char *) sigdata->order, sigdata->n_orders, f ) != sigdata->n_orders ||
dumbfile_skip( f, 256 - sigdata->n_orders ) ) {
free( sigdata->order );
free( sigdata );
return NULL;
}
sigdata->sample = malloc( sigdata->n_samples * sizeof( *sigdata->sample ) );
if ( !sigdata->sample ) {
free( sigdata->order );
free( sigdata );
return NULL;
}
sigdata->song_message = NULL;
sigdata->instrument = NULL;
sigdata->pattern = NULL;
sigdata->midi = NULL;
sigdata->checkpoint = NULL;
sigdata->n_instruments = 0;
for ( i = 0; i < sigdata->n_samples; ++i )
sigdata->sample[i].data = NULL;
for ( i = 0; i < sigdata->n_samples; ++i ) {
if ( it_asy_read_sample_header( &sigdata->sample[i], f ) ) {
_dumb_it_unload_sigdata( sigdata );
return NULL;
}
}
if ( dumbfile_skip( f, 37 * ( 64 - sigdata->n_samples ) ) ) {
_dumb_it_unload_sigdata( sigdata );
return NULL;
}
sigdata->pattern = malloc( sigdata->n_patterns * sizeof( *sigdata->pattern ) );
if ( !sigdata->pattern ) {
_dumb_it_unload_sigdata( sigdata );
return NULL;
}
for (i = 0; i < sigdata->n_patterns; ++i)
sigdata->pattern[i].entry = NULL;
/* Read in the patterns */
{
unsigned char *buffer = malloc( 64 * 8 * 4 ); /* 64 rows * 8 channels * 4 bytes */
if ( !buffer ) {
_dumb_it_unload_sigdata( sigdata );
return NULL;
}
for ( i = 0; i < sigdata->n_patterns; ++i ) {
if ( it_asy_read_pattern( &sigdata->pattern[i], f, buffer ) != 0 ) {
free( buffer );
_dumb_it_unload_sigdata( sigdata );
return NULL;
}
}
free( buffer );
}
/* And finally, the sample data */
for ( i = 0; i < sigdata->n_samples; ++i ) {
if ( it_asy_read_sample_data( &sigdata->sample[i], f ) ) {
_dumb_it_unload_sigdata( sigdata );
return NULL;
}
}
/* Now let's initialise the remaining variables, and we're done! */
sigdata->flags = IT_WAS_AN_XM | IT_WAS_A_MOD | IT_OLD_EFFECTS | IT_COMPATIBLE_GXX | IT_STEREO;
sigdata->global_volume = 128;
sigdata->mixing_volume = 48;
sigdata->pan_separation = 128;
sigdata->n_pchannels = 8;
sigdata->name[0] = 0;
memset(sigdata->channel_volume, 64, DUMB_IT_N_CHANNELS);
for (i = 0; i < DUMB_IT_N_CHANNELS; i += 4) {
sigdata->channel_pan[i+0] = 16;
sigdata->channel_pan[i+1] = 48;
sigdata->channel_pan[i+2] = 48;
sigdata->channel_pan[i+3] = 16;
}
_dumb_it_fix_invalid_orders(sigdata);
return sigdata;
}
DUH *dumb_read_asy_quick(DUMBFILE *f)
{
sigdata_t *sigdata;
DUH_SIGTYPE_DESC *descptr = &_dumb_sigtype_it;
sigdata = it_asy_load_sigdata(f);
if (!sigdata)
return NULL;
{
const char *tag[2][2];
tag[0][0] = "TITLE";
tag[0][1] = (const char *)(((DUMB_IT_SIGDATA *)sigdata)->name);
tag[1][0] = "FORMAT";
tag[1][1] = "ASYLUM Music Format";
return make_duh(-1, 2, (const char *const (*)[2])tag, 1, &descptr, &sigdata);
}
}

View file

@ -0,0 +1,382 @@
/* _______ ____ __ ___ ___
* \ _ \ \ / \ / \ \ / / ' ' '
* | | \ \ | | || | \/ | . .
* | | | | | | || ||\ /| |
* | | | | | | || || \/ | | ' ' '
* | | | | | | || || | | . .
* | |_/ / \ \__// || | |
* /_______/ynamic \____/niversal /__\ /____\usic /| . . ibliotheque
* / \
* / . \
* readam.c - Code to read a RIFF DSMF module / / \ \
* from a parsed RIFF structure. | < / \_
* | \/ /\ /
* By Chris Moeller. \_ / > /
* | \ / /
* | ' /
* \__/
*/
#include <stdlib.h>
#include <string.h>
#include "dumb.h"
#include "internal/it.h"
#include "internal/riff.h"
static int it_riff_dsmf_process_sample( IT_SAMPLE * sample, DUMBFILE * f, int len )
{
int flags;
dumbfile_getnc( (char *) sample->filename, 13, f );
sample->filename[ 14 ] = 0;
flags = dumbfile_igetw( f );
sample->default_volume = dumbfile_getc( f );
sample->length = dumbfile_igetl( f );
sample->loop_start = dumbfile_igetl( f );
sample->loop_end = dumbfile_igetl( f );
dumbfile_skip( f, 32 - 28 );
sample->C5_speed = dumbfile_igetw( f ) * 2;
dumbfile_skip( f, 36 - 34 );
dumbfile_getnc( (char *) sample->name, 28, f );
sample->name[ 28 ] = 0;
/*if ( data[ 0x38 ] || data[ 0x39 ] || data[ 0x3A ] || data[ 0x3B ] )
return -1;*/
if ( ! sample->length ) {
sample->flags &= ~IT_SAMPLE_EXISTS;
return 0;
}
/*if ( flags & ~( 2 | 1 ) )
return -1;*/
if ( sample->length + 64 > len )
return -1;
sample->flags = IT_SAMPLE_EXISTS;
sample->default_pan = 0;
sample->global_volume = 64;
sample->vibrato_speed = 0;
sample->vibrato_depth = 0;
sample->vibrato_rate = 0;
sample->vibrato_waveform = IT_VIBRATO_SINE;
sample->finetune = 0;
sample->max_resampling_quality = -1;
if ( flags & 1 )
{
if (((unsigned int)sample->loop_end <= (unsigned int)sample->length) &&
((unsigned int)sample->loop_start < (unsigned int)sample->loop_end))
{
sample->length = sample->loop_end;
sample->flags |= IT_SAMPLE_LOOP;
if ( flags & 0x10 ) sample->flags |= IT_SAMPLE_PINGPONG_LOOP;
}
}
sample->data = malloc( sample->length );
if ( ! sample->data )
return -1;
dumbfile_getnc( sample->data, sample->length, f );
if ( ! ( flags & 2 ) )
{
for ( flags = 0; flags < sample->length; ++flags )
( ( signed char * ) sample->data ) [ flags ] ^= 0x80;
}
return 0;
}
static int it_riff_dsmf_process_pattern( IT_PATTERN * pattern, DUMBFILE * f, int len )
{
int length, row;
unsigned flags;
long start, end;
int p, q, r;
IT_ENTRY * entry;
length = dumbfile_igetw( f );
if ( length > len ) return -1;
len = length - 2;
pattern->n_rows = 64;
pattern->n_entries = 64;
row = 0;
start = dumbfile_pos( f );
end = start + len;
while ( (row < 64) && !dumbfile_error( f ) && (dumbfile_pos( f ) < end) ) {
p = dumbfile_getc( f );
if ( ! p ) {
++ row;
continue;
}
flags = p & 0xF0;
if (flags) {
++ pattern->n_entries;
if (flags & 0x80) dumbfile_skip( f, 1 );
if (flags & 0x40) dumbfile_skip( f, 1 );
if (flags & 0x20) dumbfile_skip( f, 1 );
if (flags & 0x10) dumbfile_skip( f, 2 );
}
}
if ( pattern->n_entries == 64 ) return 0;
pattern->entry = malloc( pattern->n_entries * sizeof( * pattern->entry ) );
if ( ! pattern->entry ) return -1;
entry = pattern->entry;
row = 0;
if ( dumbfile_seek( f, start, DFS_SEEK_SET ) ) return -1;
while ( ( row < 64 ) && !dumbfile_error( f ) && ( dumbfile_pos( f ) < end ) )
{
p = dumbfile_getc( f );
if ( ! p )
{
IT_SET_END_ROW( entry );
++ entry;
++ row;
continue;
}
flags = p;
entry->channel = flags & 0x0F;
entry->mask = 0;
if ( flags & 0xF0 )
{
if ( flags & 0x80 )
{
q = dumbfile_getc( f );
if ( q )
{
entry->mask |= IT_ENTRY_NOTE;
entry->note = q - 1;
}
}
if ( flags & 0x40 )
{
q = dumbfile_getc( f );
if ( q )
{
entry->mask |= IT_ENTRY_INSTRUMENT;
entry->instrument = q;
}
}
if ( flags & 0x20 )
{
entry->mask |= IT_ENTRY_VOLPAN;
entry->volpan = dumbfile_getc( f );
}
if ( flags & 0x10 )
{
q = dumbfile_getc( f );
r = dumbfile_getc( f );
_dumb_it_xm_convert_effect( q, r, entry, 0 );
}
if (entry->mask) entry++;
}
}
while ( row < 64 )
{
IT_SET_END_ROW( entry );
++ entry;
++ row;
}
pattern->n_entries = entry - pattern->entry;
if ( ! pattern->n_entries ) return -1;
return 0;
}
static DUMB_IT_SIGDATA *it_riff_dsmf_load_sigdata( DUMBFILE * f, struct riff * stream )
{
DUMB_IT_SIGDATA *sigdata;
int n, o, found;
if ( ! stream ) goto error;
if ( stream->type != DUMB_ID( 'D', 'S', 'M', 'F' ) ) goto error;
sigdata = malloc(sizeof(*sigdata));
if ( ! sigdata ) goto error;
sigdata->n_patterns = 0;
sigdata->n_samples = 0;
sigdata->name[0] = 0;
found = 0;
for ( n = 0; (unsigned)n < stream->chunk_count; ++n )
{
struct riff_chunk * c = stream->chunks + n;
switch( c->type )
{
case DUMB_ID( 'S' ,'O' ,'N' ,'G' ):
/* initialization data */
if ( ( found ) || ( c->size < 192 ) ) goto error_sd;
found = 1;
break;
case DUMB_ID( 'P', 'A', 'T', 'T' ):
++ sigdata->n_patterns;
break;
case DUMB_ID( 'I', 'N', 'S', 'T' ):
++ sigdata->n_samples;
break;
}
}
if ( !found || !sigdata->n_samples || !sigdata->n_patterns ) goto error_sd;
if ( sigdata->n_samples > 255 || sigdata->n_patterns > 255 ) goto error_sd;
sigdata->song_message = NULL;
sigdata->order = NULL;
sigdata->instrument = NULL;
sigdata->sample = NULL;
sigdata->pattern = NULL;
sigdata->midi = NULL;
sigdata->checkpoint = NULL;
sigdata->mixing_volume = 48;
sigdata->pan_separation = 128;
sigdata->n_instruments = 0;
sigdata->n_orders = 0;
sigdata->restart_position = 0;
memset(sigdata->channel_volume, 64, DUMB_IT_N_CHANNELS);
for (n = 0; n < DUMB_IT_N_CHANNELS; n += 4) {
sigdata->channel_pan[n ] = 16;
sigdata->channel_pan[n+1] = 48;
sigdata->channel_pan[n+2] = 48;
sigdata->channel_pan[n+3] = 16;
}
for ( n = 0; (unsigned)n < stream->chunk_count; ++n )
{
struct riff_chunk * c = stream->chunks + n;
switch ( c->type )
{
case DUMB_ID( 'S', 'O', 'N', 'G' ):
if ( dumbfile_seek( f, c->offset, DFS_SEEK_SET ) ) goto error_usd;
dumbfile_getnc( (char *) sigdata->name, 28, f );
sigdata->name[ 28 ] = 0;
sigdata->flags = IT_STEREO | IT_OLD_EFFECTS | IT_COMPATIBLE_GXX;
dumbfile_skip( f, 36 - 28 );
sigdata->n_orders = dumbfile_igetw( f );
//sigdata->n_samples = ptr[ 38 ] | ( ptr[ 39 ] << 8 ); // whatever
//sigdata->n_patterns = ptr[ 40 ] | ( ptr[ 41 ] << 8 );
dumbfile_skip( f, 42 - 38 );
sigdata->n_pchannels = dumbfile_igetw( f );
sigdata->global_volume = dumbfile_getc( f );
sigdata->mixing_volume = dumbfile_getc( f );
sigdata->speed = dumbfile_getc( f );
sigdata->tempo = dumbfile_getc( f );
for ( o = 0; o < 16; ++o )
{
sigdata->channel_pan[ o ] = dumbfile_getc( f ) / 2;
}
sigdata->order = malloc( 128 );
if ( ! sigdata->order ) goto error_usd;
dumbfile_getnc( (char *) sigdata->order, 128, f );
break;
}
}
sigdata->pattern = malloc( sigdata->n_patterns * sizeof( *sigdata->pattern ) );
if ( ! sigdata->pattern ) goto error_usd;
for ( n = 0; n < sigdata->n_patterns; ++n )
sigdata->pattern[ n ].entry = NULL;
sigdata->sample = malloc( sigdata->n_samples * sizeof( *sigdata->sample ) );
if ( ! sigdata->sample ) goto error_usd;
for ( n = 0; n < sigdata->n_samples; ++n )
{
IT_SAMPLE * sample = sigdata->sample + n;
sample->data = NULL;
}
sigdata->n_samples = 0;
sigdata->n_patterns = 0;
for ( n = 0; (unsigned)n < stream->chunk_count; ++n )
{
struct riff_chunk * c = stream->chunks + n;
switch ( c->type )
{
case DUMB_ID( 'P', 'A', 'T', 'T' ):
if ( dumbfile_seek( f, c->offset, DFS_SEEK_SET ) ) goto error_usd;
if ( it_riff_dsmf_process_pattern( sigdata->pattern + sigdata->n_patterns, f, c->size ) ) goto error_usd;
++ sigdata->n_patterns;
break;
case DUMB_ID( 'I', 'N', 'S', 'T' ):
if ( dumbfile_seek( f, c->offset, DFS_SEEK_SET ) ) goto error_usd;
if ( it_riff_dsmf_process_sample( sigdata->sample + sigdata->n_samples, f, c->size ) ) goto error_usd;
++ sigdata->n_samples;
break;
}
}
_dumb_it_fix_invalid_orders( sigdata );
return sigdata;
error_usd:
_dumb_it_unload_sigdata( sigdata );
goto error;
error_sd:
free( sigdata );
error:
return NULL;
}
DUH *dumb_read_riff_dsmf( DUMBFILE * f, struct riff * stream )
{
sigdata_t *sigdata;
DUH_SIGTYPE_DESC *descptr = &_dumb_sigtype_it;
sigdata = it_riff_dsmf_load_sigdata( f, stream );
if (!sigdata)
return NULL;
{
const char *tag[2][2];
tag[0][0] = "TITLE";
tag[0][1] = (const char *)(((DUMB_IT_SIGDATA *)sigdata)->name);
tag[1][0] = "FORMAT";
tag[1][1] = "RIFF DSMF";
return make_duh( -1, 2, ( const char * const (*) [ 2 ] ) tag, 1, & descptr, & sigdata );
}
}

View file

@ -38,14 +38,14 @@ static int it_mod_read_pattern(IT_PATTERN *pattern, DUMBFILE *f, int n_channels,
if (n_channels == 0) {
/* Read the first four channels, leaving gaps for the rest. */
for (pos = 0; pos < 64*8*4; pos += 8*4)
dumbfile_getnc(buffer + pos, 4*4, f);
dumbfile_getnc((char *)buffer + pos, 4*4, f);
/* Read the other channels into the gaps we left. */
for (pos = 4*4; pos < 64*8*4; pos += 8*4)
dumbfile_getnc(buffer + pos, 4*4, f);
dumbfile_getnc((char *)buffer + pos, 4*4, f);
n_channels = 8;
} else
dumbfile_getnc(buffer, 64 * n_channels * 4, f);
dumbfile_getnc((char *)buffer, 64 * n_channels * 4, f);
if (dumbfile_error(f))
return -1;
@ -103,7 +103,7 @@ static int it_mod_read_pattern(IT_PATTERN *pattern, DUMBFILE *f, int n_channels,
entry->instrument = sample;
}
_dumb_it_xm_convert_effect(buffer[pos+2] & 0x0F, buffer[pos+3], entry);
_dumb_it_xm_convert_effect(buffer[pos+2] & 0x0F, buffer[pos+3], entry, 1);
entry++;
}
@ -118,9 +118,9 @@ static int it_mod_read_pattern(IT_PATTERN *pattern, DUMBFILE *f, int n_channels,
static int it_mod_read_sample_header(IT_SAMPLE *sample, DUMBFILE *f)
static int it_mod_read_sample_header(IT_SAMPLE *sample, DUMBFILE *f, int stk)
{
int finetune;
int finetune, loop_start, loop_length;
/**
21 22 Chars Sample 1 name. If the name is not a full
@ -131,7 +131,7 @@ If
the sample name begins with a '#' character (ASCII $23 (35)) then this is
assumed not to be an instrument name, and is probably a message.
*/
dumbfile_getnc(sample->name, 22, f);
dumbfile_getnc((char *)sample->name, 22, f);
sample->name[22] = 0;
sample->filename[0] = 0;
@ -141,8 +141,13 @@ assumed not to be an instrument name, and is probably a message.
/** Each finetune step changes the note 1/8th of a semitone. */
sample->global_volume = 64;
sample->default_volume = dumbfile_getc(f); // Should we be setting global_volume to this instead?
sample->loop_start = dumbfile_mgetw(f) << 1;
sample->loop_end = sample->loop_start + (dumbfile_mgetw(f) << 1);
loop_start = dumbfile_mgetw(f);
if ( !stk ) loop_start <<= 1;
loop_length = dumbfile_mgetw(f) << 1;
if ( loop_length > 2 && loop_start + loop_length > sample->length && loop_start / 2 + loop_length <= sample->length )
loop_start /= 2;
sample->loop_start = loop_start;
sample->loop_end = loop_start + loop_length;
/**
Once this sample has been played completely from beginning
to end, if the repeat length (next field) is greater than two bytes it
@ -160,7 +165,8 @@ told to stop.
sample->flags = IT_SAMPLE_EXISTS;
sample->default_pan = 0;
sample->C5_speed = (long)(16726.0*pow(DUMB_PITCH_BASE, finetune*32));
sample->C5_speed = (int)( AMIGA_CLOCK / 214.0 ); //(long)(16726.0*pow(DUMB_PITCH_BASE, finetune*32));
sample->finetune = finetune * 32;
// the above line might be wrong
if (sample->loop_end > sample->length)
@ -173,13 +179,14 @@ told to stop.
sample->vibrato_depth = 0;
sample->vibrato_rate = 0;
sample->vibrato_waveform = 0; // do we have to set _all_ these?
sample->max_resampling_quality = -1;
return dumbfile_error(f);
}
static int it_mod_read_sample_data(IT_SAMPLE *sample, DUMBFILE *f)
static int it_mod_read_sample_data(IT_SAMPLE *sample, DUMBFILE *f, unsigned long fft)
{
long i;
long truncated_size;
@ -199,159 +206,92 @@ static int it_mod_read_sample_data(IT_SAMPLE *sample, DUMBFILE *f)
return -1;
/* Sample data are stored in "8-bit two's compliment format" (sic). */
/*
for (i = 0; i < sample->length; i++)
((signed char *)sample->data)[i] = dumbfile_getc(f);
} else
sample->flags &= ~IT_SAMPLE_EXISTS;
/* skip truncated data */
dumbfile_skip(f, truncated_size);
// Should we be truncating it?
if (dumbfile_error(f))
((signed char *)sample->left)[i] = dumbfile_getc(f);
*/
/* F U Olivier Lapicque */
if (sample->length >= 5)
{
i = dumbfile_getnc(sample->data, 5, f);
if (i == 5)
{
if (!memcmp(sample->data, "ADPCM", 5))
{
if (_dumb_it_read_sample_data_adpcm4(sample, f) < 0)
return -1;
return 0;
}
typedef struct BUFFERED_MOD BUFFERED_MOD;
struct BUFFERED_MOD
else
{
unsigned char *buffered;
long ptr, len;
DUMBFILE *remaining;
};
static int buffer_mod_skip(void *f, long n)
{
BUFFERED_MOD *bm = f;
if (bm->buffered) {
bm->ptr += n;
if (bm->ptr >= bm->len) {
free(bm->buffered);
bm->buffered = NULL;
return dumbfile_skip(bm->remaining, bm->ptr - bm->len);
i += dumbfile_getnc(((char *)sample->data) + 5, sample->length - 5, f);
}
}
}
else
{
i = dumbfile_getnc(sample->data, sample->length, f);
}
if (i < sample->length)
{
if (i <= 0)
{
sample->flags = 0;
return 0;
}
return dumbfile_skip(bm->remaining, n);
sample->length = i;
if (sample->loop_end > i) sample->loop_end = i;
// holy crap!
if (sample->loop_start > i) sample->flags &= ~IT_SAMPLE_LOOP;
}
static int buffer_mod_getc(void *f)
else
{
BUFFERED_MOD *bm = f;
if (bm->buffered) {
int rv = bm->buffered[bm->ptr++];
if (bm->ptr >= bm->len) {
free(bm->buffered);
bm->buffered = NULL;
}
return rv;
}
return dumbfile_getc(bm->remaining);
/* skip truncated data */
int feh = dumbfile_error(f);
if (truncated_size) dumbfile_skip(f, truncated_size);
// Should we be truncating it?
if (feh)
return -1;
}
static long buffer_mod_getnc(char *ptr, long n, void *f)
{
BUFFERED_MOD *bm = f;
if (bm->buffered) {
int left = bm->len - bm->ptr;
if (n >= left) {
int rv;
memcpy(ptr, bm->buffered + bm->ptr, left);
free(bm->buffered);
bm->buffered = NULL;
rv = dumbfile_getnc(ptr + left, n - left, bm->remaining);
return left + MAX(rv, 0);
if (fft == DUMB_ID('M',0,0,0) || fft == DUMB_ID('8',0,0,0)) {
int delta = 0;
for (i = 0; i < sample->length; i++) {
delta += ((signed char *)sample->data)[i];
((signed char *)sample->data)[i] = delta;
}
memcpy(ptr, bm->buffered + bm->ptr, n);
bm->ptr += n;
return n;
}
return dumbfile_getnc(ptr, n, bm->remaining);
}
static void buffer_mod_close(void *f)
{
BUFFERED_MOD *bm = f;
if (bm->buffered) free(bm->buffered);
/* Do NOT close bm->remaining */
free(f);
return 0;
}
DUMBFILE_SYSTEM buffer_mod_dfs = {
NULL,
&buffer_mod_skip,
&buffer_mod_getc,
&buffer_mod_getnc,
&buffer_mod_close
};
#define MOD_FFT_OFFSET (20 + 31*(22+2+1+1+2+2) + 1 + 1 + 128)
static DUMBFILE *dumbfile_buffer_mod(DUMBFILE *f, unsigned long *fft)
{
BUFFERED_MOD *bm = malloc(sizeof(*bm));
if (!bm) return NULL;
bm->buffered = malloc(MOD_FFT_OFFSET + 4);
if (!bm->buffered) {
free(bm);
return NULL;
}
bm->len = dumbfile_getnc(bm->buffered, MOD_FFT_OFFSET + 4, f);
if (bm->len > 0) {
if (bm->len >= MOD_FFT_OFFSET + 4)
*fft = (unsigned long)bm->buffered[MOD_FFT_OFFSET ] << 24
| (unsigned long)bm->buffered[MOD_FFT_OFFSET+1] << 16
| (unsigned long)bm->buffered[MOD_FFT_OFFSET+2] << 8
| (unsigned long)bm->buffered[MOD_FFT_OFFSET+3];
else
*fft = 0;
bm->ptr = 0;
} else {
free(bm->buffered);
bm->buffered = NULL;
}
bm->remaining = f;
return dumbfile_open_ex(bm, &buffer_mod_dfs);
}
static DUMB_IT_SIGDATA *it_mod_load_sigdata(DUMBFILE *f)
static DUMB_IT_SIGDATA *it_mod_load_sigdata(DUMBFILE *f, int restrict_)
{
DUMB_IT_SIGDATA *sigdata;
int n_channels;
int i;
unsigned long fft;
f = dumbfile_buffer_mod(f, &fft);
if (!f)
if ( dumbfile_seek(f, MOD_FFT_OFFSET, DFS_SEEK_SET) )
return NULL;
fft = dumbfile_mgetl(f);
if (dumbfile_error(f))
return NULL;
if ( dumbfile_seek(f, 0, DFS_SEEK_SET) )
return NULL;
sigdata = malloc(sizeof(*sigdata));
if (!sigdata) {
dumbfile_close(f);
return NULL;
}
@ -360,9 +300,8 @@ static DUMB_IT_SIGDATA *it_mod_load_sigdata(DUMBFILE *f)
full 20 chars in length, it will be null-
terminated.
*/
if (dumbfile_getnc(sigdata->name, 20, f) < 20) {
if (dumbfile_getnc((char *)sigdata->name, 20, f) < 20) {
free(sigdata);
dumbfile_close(f);
return NULL;
}
sigdata->name[20] = 0;
@ -374,7 +313,10 @@ static DUMB_IT_SIGDATA *it_mod_load_sigdata(DUMBFILE *f)
case DUMB_ID('M','!','K','!'):
case DUMB_ID('M','&','K','!'):
case DUMB_ID('N','.','T','.'):
case DUMB_ID('N','S','M','S'):
case DUMB_ID('F','L','T','4'):
case DUMB_ID('M',0,0,0):
case DUMB_ID('8',0,0,0):
n_channels = 4;
break;
case DUMB_ID('F','L','T','8'):
@ -383,8 +325,8 @@ static DUMB_IT_SIGDATA *it_mod_load_sigdata(DUMBFILE *f)
* combined into one eight-channel pattern. Pattern indexes must
* be halved. Why oh why do they obfuscate so?
*/
for (i = 0; i < 128; i++)
sigdata->order[i] >>= 1;
/*for (i = 0; i < 128; i++)
sigdata->order[i] >>= 1;*/
break;
case DUMB_ID('C','D','8','1'):
case DUMB_ID('O','C','T','A'):
@ -442,10 +384,18 @@ static DUMB_IT_SIGDATA *it_mod_load_sigdata(DUMBFILE *f)
}
}
// moo
if ( ( restrict_ & 1 ) && sigdata->n_samples == 15 )
{
free(sigdata);
return NULL;
}
sigdata->n_pchannels = n_channels ? n_channels : 8; /* special case for 0, see above */
sigdata->sample = malloc(sigdata->n_samples * sizeof(*sigdata->sample));
if (!sigdata->sample) {
free(sigdata);
dumbfile_close(f);
return NULL;
}
@ -462,9 +412,8 @@ static DUMB_IT_SIGDATA *it_mod_load_sigdata(DUMBFILE *f)
sigdata->sample[i].data = NULL;
for (i = 0; i < sigdata->n_samples; i++) {
if (it_mod_read_sample_header(&sigdata->sample[i], f)) {
if (it_mod_read_sample_header(&sigdata->sample[i], f, sigdata->n_samples == 15)) {
_dumb_it_unload_sigdata(sigdata);
dumbfile_close(f);
return NULL;
}
}
@ -473,11 +422,10 @@ static DUMB_IT_SIGDATA *it_mod_load_sigdata(DUMBFILE *f)
sigdata->restart_position = dumbfile_getc(f);
// what if this is >= 127? what about with Fast Tracker II?
if (sigdata->n_orders <= 0 || sigdata->n_orders > 128) { // is this right?
/* if (sigdata->n_orders <= 0 || sigdata->n_orders > 128) { // is this right?
_dumb_it_unload_sigdata(sigdata);
dumbfile_close(f);
return NULL;
}
}*/
//if (sigdata->restart_position >= sigdata->n_orders)
//sigdata->restart_position = 0;
@ -485,15 +433,22 @@ static DUMB_IT_SIGDATA *it_mod_load_sigdata(DUMBFILE *f)
sigdata->order = malloc(128); /* We may need to scan the extra ones! */
if (!sigdata->order) {
_dumb_it_unload_sigdata(sigdata);
dumbfile_close(f);
return NULL;
}
if (dumbfile_getnc(sigdata->order, 128, f) < 128) {
if (dumbfile_getnc((char *)sigdata->order, 128, f) < 128) {
_dumb_it_unload_sigdata(sigdata);
dumbfile_close(f);
return NULL;
}
if (sigdata->n_orders <= 0 || sigdata->n_orders > 128) { // is this right?
sigdata->n_orders = 128;
//while (sigdata->n_orders > 1 && !sigdata->order[sigdata->n_orders - 1]) sigdata->n_orders--;
}
if ( ! n_channels )
for (i = 0; i < 128; i++)
sigdata->order[i] >>= 1;
/* "The old NST format contains only 15 samples (instead of 31). Further
* it doesn't contain a file format tag (id). So Pattern data offset is
* at 20+15*30+1+1+128."
@ -503,12 +458,71 @@ static DUMB_IT_SIGDATA *it_mod_load_sigdata(DUMBFILE *f)
if (sigdata->n_samples == 31)
dumbfile_skip(f, 4);
/* Work out how many patterns there are. */
sigdata->n_patterns = -1;
if ( ( restrict_ & 2 ) )
{
unsigned char buffer[5];
long sample_number;
long total_sample_size;
long offset = dumbfile_pos(f);
long remain = dumbfile_get_size(f) - offset;
if ( dumbfile_error( f ) ||
dumbfile_seek( f, 0, SEEK_END ) ) {
_dumb_it_unload_sigdata(sigdata);
return NULL;
}
sample_number = sigdata->n_samples - 1;
total_sample_size = 0;
while (dumbfile_pos(f) > offset && sample_number >= 0) {
if (sigdata->sample[sample_number].flags & IT_SAMPLE_EXISTS) {
if ( dumbfile_seek(f, -((sigdata->sample[sample_number].length + 1) / 2 + 5 + 16), DFS_SEEK_CUR) ||
dumbfile_getnc((char *)buffer, 5, f) < 5 ) {
_dumb_it_unload_sigdata(sigdata);
return NULL;
}
if ( !memcmp( buffer, "ADPCM", 5 ) ) { /* BAH */
total_sample_size += (sigdata->sample[sample_number].length + 1) / 2 + 5 + 16;
if ( dumbfile_seek(f, -5, DFS_SEEK_CUR) ) {
_dumb_it_unload_sigdata(sigdata);
return NULL;
}
} else {
total_sample_size += sigdata->sample[sample_number].length;
if ( dumbfile_seek(f, -(sigdata->sample[sample_number].length - ((sigdata->sample[sample_number].length + 1) / 2 + 5 + 16) + 5), DFS_SEEK_CUR) ) {
_dumb_it_unload_sigdata(sigdata);
return NULL;
}
}
}
--sample_number;
}
if (remain > total_sample_size) {
sigdata->n_patterns = ( remain - total_sample_size + 4 ) / ( 256 * sigdata->n_pchannels );
if (fft == DUMB_ID('M',0,0,0) || fft == DUMB_ID('8',0,0,0)) {
remain -= sigdata->n_patterns * 256 * sigdata->n_pchannels;
if (dumbfile_skip(f, remain - total_sample_size)) {
_dumb_it_unload_sigdata(sigdata);
return NULL;
}
}
}
}
else
{
for (i = 0; i < 128; i++)
if (sigdata->n_patterns < sigdata->order[i])
{
if (sigdata->order[i] > sigdata->n_patterns)
sigdata->n_patterns = sigdata->order[i];
}
sigdata->n_patterns++;
}
if ( sigdata->n_patterns <= 0 ) {
_dumb_it_unload_sigdata(sigdata);
return NULL;
}
/* May as well try to save a tiny bit of memory. */
if (sigdata->n_orders < 128) {
@ -519,7 +533,6 @@ static DUMB_IT_SIGDATA *it_mod_load_sigdata(DUMBFILE *f)
sigdata->pattern = malloc(sigdata->n_patterns * sizeof(*sigdata->pattern));
if (!sigdata->pattern) {
_dumb_it_unload_sigdata(sigdata);
dumbfile_close(f);
return NULL;
}
for (i = 0; i < sigdata->n_patterns; i++)
@ -527,17 +540,15 @@ static DUMB_IT_SIGDATA *it_mod_load_sigdata(DUMBFILE *f)
/* Read in the patterns */
{
unsigned char *buffer = malloc(256 * n_channels); /* 64 rows * 4 bytes */
unsigned char *buffer = malloc(256 * sigdata->n_pchannels); /* 64 rows * 4 bytes */
if (!buffer) {
_dumb_it_unload_sigdata(sigdata);
dumbfile_close(f);
return NULL;
}
for (i = 0; i < sigdata->n_patterns; i++) {
if (it_mod_read_pattern(&sigdata->pattern[i], f, n_channels, buffer) != 0) {
free(buffer);
_dumb_it_unload_sigdata(sigdata);
dumbfile_close(f);
return NULL;
}
}
@ -546,13 +557,29 @@ static DUMB_IT_SIGDATA *it_mod_load_sigdata(DUMBFILE *f)
/* And finally, the sample data */
for (i = 0; i < sigdata->n_samples; i++) {
if (it_mod_read_sample_data(&sigdata->sample[i], f)) {
continue;
if (it_mod_read_sample_data(&sigdata->sample[i], f, fft)) {
_dumb_it_unload_sigdata(sigdata);
return NULL;
}
}
dumbfile_close(f); /* Destroy the BUFFERED_MOD DUMBFILE we were using. */
/* The DUMBFILE originally passed to our function is intact. */
/* w00t! */
/*if ( n_channels == 4 &&
( sigdata->n_samples == 15 ||
( ( fft & 240 ) != DUMB_ID( 0, 0, 'C', 0 ) &&
( fft & 240 ) != DUMB_ID( 0, 0, 'H', 0 ) &&
( fft & 240 ) != 0 ) ) ) {
for ( i = 0; i < sigdata->n_samples; ++i ) {
IT_SAMPLE * sample = &sigdata->sample [i];
if ( sample && ( sample->flags & IT_SAMPLE_EXISTS ) ) {
int n, o;
o = sample->length;
if ( o > 4 ) o = 4;
for ( n = 0; n < o; ++n )
( ( char * ) sample->data ) [n] = 0;
}
}
}*/
/* Now let's initialise the remaining variables, and we're done! */
sigdata->flags = IT_WAS_AN_XM | IT_WAS_A_MOD | IT_OLD_EFFECTS | IT_COMPATIBLE_GXX | IT_STEREO;
@ -582,21 +609,23 @@ static DUMB_IT_SIGDATA *it_mod_load_sigdata(DUMBFILE *f)
DUH *dumb_read_mod_quick(DUMBFILE *f)
DUH *dumb_read_mod_quick(DUMBFILE *f, int restrict_)
{
sigdata_t *sigdata;
DUH_SIGTYPE_DESC *descptr = &_dumb_sigtype_it;
sigdata = it_mod_load_sigdata(f);
sigdata = it_mod_load_sigdata(f, restrict_);
if (!sigdata)
return NULL;
{
const char *tag[1][2];
const char *tag[2][2];
tag[0][0] = "TITLE";
tag[0][1] = ((DUMB_IT_SIGDATA *)sigdata)->name;
return make_duh(-1, 1, (const char *const (*)[2])tag, 1, &descptr, &sigdata);
tag[0][1] = (const char *)(((DUMB_IT_SIGDATA *)sigdata)->name);
tag[1][0] = "FORMAT";
tag[1][1] = "MOD";
return make_duh(-1, 2, (const char *const (*)[2])tag, 1, &descptr, &sigdata);
}
}

View file

@ -21,9 +21,9 @@
DUH *dumb_read_mod(DUMBFILE *f)
DUH *dumb_read_mod(DUMBFILE *f, int restrict_)
{
DUH *duh = dumb_read_mod_quick(f);
DUH *duh = dumb_read_mod_quick(f, restrict_);
dumb_it_do_initial_runthrough(duh);
return duh;
}

View file

@ -0,0 +1,412 @@
/* _______ ____ __ ___ ___
* \ _ \ \ / \ / \ \ / / ' ' '
* | | \ \ | | || | \/ | . .
* | | | | | | || ||\ /| |
* | | | | | | || || \/ | | ' ' '
* | | | | | | || || | | . .
* | |_/ / \ \__// || | |
* /_______/ynamic \____/niversal /__\ /____\usic /| . . ibliotheque
* / \
* / . \
* readmtm.c - Code to read a MultiTracker Module / / \ \
* from an open file. | < / \_
* | \/ /\ /
* By Chris Moeller. \_ / > /
* | \ / /
* | ' /
* \__/
*/
#include <stdlib.h>
#include <string.h>
#include <math.h>
#include "dumb.h"
#include "internal/it.h"
size_t strlen_max(const char * ptr, size_t max)
{
const char * end, * start;
if (ptr==0) return 0;
start = ptr;
end = ptr + max;
while(*ptr && ptr < end) ptr++;
return ptr - start;
}
static int it_mtm_assemble_pattern(IT_PATTERN *pattern, const unsigned char * track, const unsigned short * sequence, int n_rows)
{
int n, o, note, sample;
const unsigned char * t;
IT_ENTRY * entry;
pattern->n_rows = n_rows;
pattern->n_entries = n_rows;
for (n = 0; n < 32; n++) {
if (sequence[n]) {
t = &track[192 * (sequence[n] - 1)];
for (o = 0; o < n_rows; o++) {
if (t[0] || t[1] || t[2]) pattern->n_entries++;
t += 3;
}
}
}
entry = malloc(pattern->n_entries * sizeof(*entry));
if (!entry) return -1;
pattern->entry = entry;
for (n = 0; n < n_rows; n++) {
for (o = 0; o < 32; o++) {
if (sequence[o]) {
t = &track[192 * (sequence[o] - 1) + (n * 3)];
if (t[0] || t[1] || t[2]) {
entry->channel = o;
entry->mask = 0;
note = t[0] >> 2;
sample = ((t[0] << 4) | (t[1] >> 4)) & 0x3F;
if (note) {
entry->mask |= IT_ENTRY_NOTE;
entry->note = note + 24;
}
if (sample) {
entry->mask |= IT_ENTRY_INSTRUMENT;
entry->instrument = sample;
}
_dumb_it_xm_convert_effect(t[1] & 0xF, t[2], entry, 1);
if (entry->mask) entry++;
}
}
}
IT_SET_END_ROW(entry);
entry++;
}
pattern->n_entries = entry - pattern->entry;
return 0;
}
static int it_mtm_read_sample_header(IT_SAMPLE *sample, DUMBFILE *f)
{
int finetune, flags;
dumbfile_getnc((char *)sample->name, 22, f);
sample->name[22] = 0;
sample->filename[0] = 0;
sample->length = dumbfile_igetl(f);
sample->loop_start = dumbfile_igetl(f);
sample->loop_end = dumbfile_igetl(f);
finetune = (signed char)(dumbfile_getc(f) << 4) >> 4; /* signed nibble */
sample->global_volume = 64;
sample->default_volume = dumbfile_getc(f);
flags = dumbfile_getc(f);
if (sample->length <= 0) {
sample->flags = 0;
return 0;
}
sample->flags = IT_SAMPLE_EXISTS;
if (flags & 1) {
sample->flags |= IT_SAMPLE_16BIT;
sample->length >>= 1;
sample->loop_start >>= 1;
sample->loop_end >>= 1;
}
sample->default_pan = 0;
sample->C5_speed = (int)( AMIGA_CLOCK / 214.0 );//(long)(16726.0*pow(DUMB_PITCH_BASE, finetune*32));
sample->finetune = finetune * 32;
// the above line might be wrong
if (sample->loop_end > sample->length)
sample->loop_end = sample->length;
if (sample->loop_end - sample->loop_start > 2)
sample->flags |= IT_SAMPLE_LOOP;
sample->vibrato_speed = 0;
sample->vibrato_depth = 0;
sample->vibrato_rate = 0;
sample->vibrato_waveform = 0; // do we have to set _all_ these?
sample->max_resampling_quality = -1;
return dumbfile_error(f);
}
static int it_mtm_read_sample_data(IT_SAMPLE *sample, DUMBFILE *f)
{
long i;
long truncated_size;
/* let's get rid of the sample data coming after the end of the loop */
if ((sample->flags & IT_SAMPLE_LOOP) && sample->loop_end < sample->length) {
truncated_size = sample->length - sample->loop_end;
sample->length = sample->loop_end;
} else {
truncated_size = 0;
}
sample->data = malloc(sample->length);
if (!sample->data)
return -1;
dumbfile_getnc((char *)sample->data, sample->length, f);
dumbfile_skip(f, truncated_size);
if (dumbfile_error(f))
return -1;
for (i = 0; i < sample->length; i++)
((signed char *)sample->data)[i] ^= 0x80;
return 0;
}
static DUMB_IT_SIGDATA *it_mtm_load_sigdata(DUMBFILE *f, int * version)
{
DUMB_IT_SIGDATA *sigdata;
int n, o, n_tracks, l_comment, n_rows, n_channels;
unsigned char * track;
unsigned short * sequence;
char * comment;
if (dumbfile_getc(f) != 'M' ||
dumbfile_getc(f) != 'T' ||
dumbfile_getc(f) != 'M') goto error;
*version = dumbfile_getc(f);
sigdata = malloc(sizeof(*sigdata));
if (!sigdata) goto error;
dumbfile_getnc((char *)sigdata->name, 20, f);
sigdata->name[20] = 0;
n_tracks = dumbfile_igetw(f);
sigdata->n_patterns = dumbfile_getc(f) + 1;
sigdata->n_orders = dumbfile_getc(f) + 1;
l_comment = dumbfile_igetw(f);
sigdata->n_samples = dumbfile_getc(f);
//if (dumbfile_getc(f)) goto error_sd;
dumbfile_getc(f);
n_rows = dumbfile_getc(f);
n_channels = dumbfile_getc(f);
if (dumbfile_error(f) ||
(n_tracks <= 0) ||
(sigdata->n_samples <= 0) ||
(n_rows <= 0 || n_rows > 64) ||
(n_channels <= 0 || n_channels > 32)) goto error_sd;
memset(sigdata->channel_volume, 64, DUMB_IT_N_CHANNELS);
if (dumbfile_getnc((char *)sigdata->channel_pan, 32, f) < 32) goto error_sd;
for (n = 0; n < 32; n++) {
if (sigdata->channel_pan[n] <= 15) {
sigdata->channel_pan[n] -= (sigdata->channel_pan[n] & 8) >> 3;
sigdata->channel_pan[n] = (sigdata->channel_pan[n] * 32) / 7;
} else {
sigdata->channel_volume[n] = 0;
sigdata->channel_pan[n] = 7;
}
}
for (n = 32; n < DUMB_IT_N_CHANNELS; n += 4) {
sigdata->channel_pan[n ] = 16;
sigdata->channel_pan[n+1] = 48;
sigdata->channel_pan[n+2] = 48;
sigdata->channel_pan[n+3] = 16;
}
sigdata->sample = malloc(sigdata->n_samples * sizeof(*sigdata->sample));
if (!sigdata->sample) goto error_sd;
sigdata->flags = IT_WAS_AN_XM | IT_WAS_A_MOD | IT_STEREO | IT_OLD_EFFECTS | IT_COMPATIBLE_GXX;
sigdata->global_volume = 128;
sigdata->mixing_volume = 48;
sigdata->speed = 6;
sigdata->tempo = 125;
sigdata->pan_separation = 128;
sigdata->song_message = NULL;
sigdata->order = NULL;
sigdata->instrument = NULL;
sigdata->pattern = NULL;
sigdata->midi = NULL;
sigdata->checkpoint = NULL;
sigdata->n_instruments = 0;
sigdata->restart_position = 0;
sigdata->n_pchannels = n_channels;
for (n = 0; n < sigdata->n_samples; n++)
sigdata->sample[n].data = NULL;
for (n = 0; n < sigdata->n_samples; n++) {
if (it_mtm_read_sample_header(&sigdata->sample[n], f)) goto error_usd;
}
sigdata->order = malloc(sigdata->n_orders);
if (!sigdata->order) goto error_usd;
if (dumbfile_getnc((char *)sigdata->order, sigdata->n_orders, f) < sigdata->n_orders) goto error_usd;
if (sigdata->n_orders < 128)
if (dumbfile_skip(f, 128 - sigdata->n_orders)) goto error_usd;
track = malloc(192 * n_tracks);
if (!track) goto error_usd;
if (dumbfile_getnc((char *)track, 192 * n_tracks, f) < 192 * n_tracks) goto error_ft;
sigdata->pattern = malloc(sigdata->n_patterns * sizeof(*sigdata->pattern));
if (!sigdata->pattern) goto error_ft;
for (n = 0; n < sigdata->n_patterns; n++)
sigdata->pattern[n].entry = NULL;
sequence = malloc(sigdata->n_patterns * 32 * sizeof(*sequence));
if (!sequence) goto error_ft;
for (n = 0; n < sigdata->n_patterns; n++) {
for (o = 0; o < 32; o++) {
sequence[(n * 32) + o] = dumbfile_igetw(f);
if (sequence[(n * 32) + o] > n_tracks)
{
//goto error_fs;
// illegal track number, silence instead of rejecting the file
sequence[(n * 32) + o] = 0;
}
}
}
for (n = 0; n < sigdata->n_patterns; n++) {
if (it_mtm_assemble_pattern(&sigdata->pattern[n], track, &sequence[n * 32], n_rows)) goto error_fs;
}
if (l_comment) {
comment = malloc(l_comment);
if (!comment) goto error_fs;
if (dumbfile_getnc(comment, l_comment, f) < l_comment) goto error_fc;
/* Time for annoying "logic", yes. We want each line which has text,
* and each blank line in between all the valid lines.
*/
/* Find last actual line. */
for (o = -1, n = 0; n < l_comment; n += 40) {
if (comment[n]) o = n;
}
if (o >= 0) {
int l, m;
for (l = 0, n = 0; n <= o; n += 40) {
l += strlen_max(&comment[n], 40) + 2;
}
l -= 1;
sigdata->song_message = malloc(l);
if (!sigdata->song_message) goto error_fc;
for (m = 0, n = 0; n <= o; n += 40) {
int p = strlen_max(&comment[n], 40);
if (p) {
memcpy(sigdata->song_message + m, &comment[n], p);
m += p;
}
if (l - m > 1) {
sigdata->song_message[m++] = 13;
sigdata->song_message[m++] = 10;
}
}
sigdata->song_message[m] = 0;
}
free(comment);
}
for (n = 0; n < sigdata->n_samples; n++) {
if (it_mtm_read_sample_data(&sigdata->sample[n], f)) goto error_fs;
}
_dumb_it_fix_invalid_orders(sigdata);
free(sequence);
free(track);
return sigdata;
error_fc:
free(comment);
error_fs:
free(sequence);
error_ft:
free(track);
error_usd:
_dumb_it_unload_sigdata(sigdata);
return NULL;
error_sd:
free(sigdata);
error:
return NULL;
}
static char hexdigit(int in)
{
if (in < 10) return in + '0';
else return in + 'A' - 10;
}
DUH *dumb_read_mtm_quick(DUMBFILE *f)
{
sigdata_t *sigdata;
int ver;
DUH_SIGTYPE_DESC *descptr = &_dumb_sigtype_it;
sigdata = it_mtm_load_sigdata(f, &ver);
if (!sigdata)
return NULL;
{
char version[16];
const char *tag[2][2];
tag[0][0] = "TITLE";
tag[0][1] = (const char *)(((DUMB_IT_SIGDATA *)sigdata)->name);
tag[1][0] = "FORMAT";
version[0] = 'M';
version[1] = 'T';
version[2] = 'M';
version[3] = ' ';
version[4] = 'v';
version[5] = hexdigit(ver >> 4);
version[6] = '.';
version[7] = hexdigit(ver & 15);
version[8] = 0;
tag[1][1] = (const char *) &version;
return make_duh(-1, 2, (const char *const (*)[2])tag, 1, &descptr, &sigdata);
}
}

View file

@ -0,0 +1,558 @@
/* _______ ____ __ ___ ___
* \ _ \ \ / \ / \ \ / / ' ' '
* | | \ \ | | || | \/ | . .
* | | | | | | || ||\ /| |
* | | | | | | || || \/ | | ' ' '
* | | | | | | || || | | . .
* | |_/ / \ \__// || | |
* /_______/ynamic \____/niversal /__\ /____\usic /| . . ibliotheque
* / \
* / . \
* readokt.c - Code to read an Oktalyzer module / / \ \
* from an open file. | < / \_
* | \/ /\ /
* By Chris Moeller. \_ / > /
* | \ / /
* | ' /
* \__/
*/
#include <stdlib.h>
#include <string.h>
#include <math.h>
#include "dumb.h"
#include "internal/it.h"
static int it_okt_read_pattern(IT_PATTERN *pattern, const unsigned char *data, int length, int n_channels)
{
int pos;
int channel;
int row;
int n_rows;
IT_ENTRY *entry;
if (length < 2) return -1;
n_rows = (data[0] << 8) | data[1];
if (!n_rows) n_rows = 64;
if (length < 2 + (n_rows * n_channels * 4)) return -1;
pattern->n_rows = n_rows;
/* compute number of entries */
pattern->n_entries = n_rows; /* Account for the row end markers */
pos = 2;
for (row = 0; row < pattern->n_rows; row++) {
for (channel = 0; channel < n_channels; channel++) {
if (data[pos+0] | data[pos+2])
pattern->n_entries++;
pos += 4;
}
}
pattern->entry = (IT_ENTRY *) malloc(pattern->n_entries * sizeof(*pattern->entry));
if (!pattern->entry)
return -1;
entry = pattern->entry;
pos = 2;
for (row = 0; row < n_rows; row++) {
for (channel = 0; channel < n_channels; channel++) {
if (data[pos+0] | data[pos+2]) {
entry->channel = channel;
entry->mask = 0;
if (data[pos+0] > 0 && data[pos+0] <= 36) {
entry->mask |= IT_ENTRY_NOTE | IT_ENTRY_INSTRUMENT;
entry->note = data[pos+0] + 35;
entry->instrument = data[pos+1] + 1;
}
entry->effect = 0;
entry->effectvalue = data[pos+3];
switch (data[pos+2]) {
case 2: if (data[pos+3]) entry->effect = IT_PORTAMENTO_DOWN; break; // XXX code calls this rs_portu, but it's adding to the period, which decreases the pitch
case 13: if (data[pos+3]) entry->effect = IT_OKT_NOTE_SLIDE_DOWN; break;
case 21: if (data[pos+3]) entry->effect = IT_OKT_NOTE_SLIDE_DOWN_ROW; break;
case 1: if (data[pos+3]) entry->effect = IT_PORTAMENTO_UP; break; // XXX same deal here, increasing the pitch
case 17: if (data[pos+3]) entry->effect = IT_OKT_NOTE_SLIDE_UP; break;
case 30: if (data[pos+3]) entry->effect = IT_OKT_NOTE_SLIDE_UP_ROW; break;
case 10: if (data[pos+3]) entry->effect = IT_OKT_ARPEGGIO_3; break;
case 11: if (data[pos+3]) entry->effect = IT_OKT_ARPEGGIO_4; break;
case 12: if (data[pos+3]) entry->effect = IT_OKT_ARPEGGIO_5; break;
case 15: entry->effect = IT_S; entry->effectvalue = EFFECT_VALUE(IT_S_SET_FILTER, data[pos+3] & 0x0F); break;
case 25: entry->effect = IT_JUMP_TO_ORDER; break;
case 27: entry->note = IT_NOTE_OFF; entry->mask |= IT_ENTRY_NOTE; break;
case 28: entry->effect = IT_SET_SPEED; break;
case 31:
if ( data[pos+3] <= 0x40 ) entry->effect = IT_SET_CHANNEL_VOLUME;
else if ( data[pos+3] <= 0x50 ) { entry->effect = IT_OKT_VOLUME_SLIDE_DOWN; entry->effectvalue = data[pos+3] - 0x40; }
else if ( data[pos+3] <= 0x60 ) { entry->effect = IT_OKT_VOLUME_SLIDE_UP; entry->effectvalue = data[pos+3] - 0x50; }
else if ( data[pos+3] <= 0x70 ) { entry->effect = IT_OKT_VOLUME_SLIDE_DOWN; entry->effectvalue = data[pos+3] - 0x50; }
else if ( data[pos+3] <= 0x80 ) { entry->effect = IT_OKT_VOLUME_SLIDE_UP; entry->effectvalue = data[pos+3] - 0x60; }
break;
}
if ( entry->effect ) entry->mask |= IT_ENTRY_EFFECT;
entry++;
}
pos += 4;
}
IT_SET_END_ROW(entry);
entry++;
}
return 0;
}
static void it_okt_read_sample_header(IT_SAMPLE *sample, const unsigned char * data)
{
int loop_start, loop_length;
memcpy(sample->name, data, 20);
sample->name[20] = 0;
sample->filename[0] = 0;
sample->length = (data[20] << 24) | (data[21] << 16) | (data[22] << 8) | data[23];
sample->global_volume = 64;
sample->default_volume = data[29];
loop_start = ((data[24] << 8) | data[25]) << 1;
loop_length = ((data[26] << 8) | data[27]) << 1;
sample->sus_loop_start = loop_start;
sample->sus_loop_end = loop_start + loop_length;
if (sample->length <= 0) {
sample->flags = 0;
return;
}
sample->flags = IT_SAMPLE_EXISTS;
sample->default_pan = 0;
sample->C5_speed = (int)( AMIGA_CLOCK / 214.0 ); //(long)(16726.0*pow(DUMB_PITCH_BASE, finetune*32));
sample->finetune = 0;
if (sample->sus_loop_end > sample->length)
sample->sus_loop_end = sample->length;
if (loop_length > 2)
sample->flags |= IT_SAMPLE_SUS_LOOP;
sample->vibrato_speed = 0;
sample->vibrato_depth = 0;
sample->vibrato_rate = 0;
sample->vibrato_waveform = 0; // do we have to set _all_ these?
sample->max_resampling_quality = -1;
}
static int it_okt_read_sample_data(IT_SAMPLE *sample, const char * data, int length)
{
if (length && sample->length) {
if (length < sample->length) {
sample->length = length;
if (length < sample->sus_loop_end) sample->sus_loop_end = length;
}
sample->data = malloc(length);
if (!sample->data)
return -1;
memcpy(sample->data, data, length);
}
return 0;
}
typedef struct IFF_CHUNK IFF_CHUNK;
typedef struct IFF_CHUNKED IFF_CHUNKED;
struct IFF_CHUNK
{
unsigned type;
unsigned char * data;
unsigned size;
};
struct IFF_CHUNKED
{
unsigned chunk_count;
IFF_CHUNK * chunks;
};
static IFF_CHUNKED *dumbfile_read_okt(DUMBFILE *f)
{
IFF_CHUNKED *mod = (IFF_CHUNKED *) malloc(sizeof(*mod));
if (!mod) return NULL;
mod->chunk_count = 0;
mod->chunks = 0;
for (;;)
{
long bytes_read;
IFF_CHUNK * chunk = ( IFF_CHUNK * ) realloc( mod->chunks, ( mod->chunk_count + 1 ) * sizeof( IFF_CHUNK ) );
if ( !chunk )
{
if ( mod->chunks ) free( mod->chunks );
free( mod );
return NULL;
}
mod->chunks = chunk;
chunk += mod->chunk_count;
bytes_read = dumbfile_mgetl( f );
if ( bytes_read < 0 ) break;
chunk->type = bytes_read;
chunk->size = dumbfile_mgetl( f );
if ( dumbfile_error( f ) ) break;
chunk->data = (unsigned char *) malloc( chunk->size );
if ( !chunk->data )
{
free( mod->chunks );
free( mod );
return NULL;
}
bytes_read = dumbfile_getnc( ( char * ) chunk->data, chunk->size, f );
if ( bytes_read < chunk->size )
{
if ( bytes_read <= 0 ) {
free( chunk->data );
break;
} else {
chunk->size = bytes_read;
mod->chunk_count++;
break;
}
}
mod->chunk_count++;
}
if ( !mod->chunk_count ) {
if ( mod->chunks ) free(mod->chunks);
free(mod);
mod = NULL;
}
return mod;
}
void free_okt(IFF_CHUNKED * mod)
{
unsigned i;
if (mod)
{
if (mod->chunks)
{
for (i = 0; i < mod->chunk_count; i++)
{
if (mod->chunks[i].data) free(mod->chunks[i].data);
}
free(mod->chunks);
}
free(mod);
}
}
const IFF_CHUNK * get_chunk_by_type(IFF_CHUNKED * mod, unsigned type, unsigned offset)
{
unsigned i;
if (mod)
{
if (mod->chunks)
{
for (i = 0; i < mod->chunk_count; i++)
{
if (mod->chunks[i].type == type)
{
if (!offset) return &mod->chunks[i];
else offset--;
}
}
}
}
return NULL;
}
unsigned get_chunk_count(IFF_CHUNKED *mod, unsigned type)
{
unsigned i, count = 0;
if (mod)
{
if (mod->chunks)
{
for (i = 0; i < mod->chunk_count; i++)
{
if (mod->chunks[i].type == type) count++;
}
}
}
return count;
}
static DUMB_IT_SIGDATA *it_okt_load_sigdata(DUMBFILE *f)
{
DUMB_IT_SIGDATA *sigdata;
int n_channels;
int i, j, k, l;
IFF_CHUNKED *mod;
const IFF_CHUNK *chunk;
char signature[8];
if (dumbfile_getnc(signature, 8, f) < 8 ||
memcmp(signature, "OKTASONG", 8)) {
return NULL;
}
mod = dumbfile_read_okt(f);
if (!mod)
return NULL;
sigdata = (DUMB_IT_SIGDATA *) malloc(sizeof(*sigdata));
if (!sigdata) {
free_okt(mod);
return NULL;
}
sigdata->name[0] = 0;
chunk = get_chunk_by_type(mod, DUMB_ID('S','P','E','E'), 0);
if (!chunk || chunk->size < 2) {
free(sigdata);
free_okt(mod);
return NULL;
}
sigdata->speed = (chunk->data[0] << 8) | chunk->data[1];
chunk = get_chunk_by_type(mod, DUMB_ID('S','A','M','P'), 0);
if (!chunk || chunk->size < 32) {
free(sigdata);
free_okt(mod);
return NULL;
}
sigdata->n_samples = chunk->size / 32;
chunk = get_chunk_by_type(mod, DUMB_ID('C','M','O','D'), 0);
if (!chunk || chunk->size < 8) {
free(sigdata);
free_okt(mod);
return NULL;
}
n_channels = 0;
for (i = 0; i < 4; i++) {
j = (chunk->data[i * 2] << 8) | chunk->data[i * 2 + 1];
if (!j) n_channels++;
else if (j == 1) n_channels += 2;
}
if (!n_channels) {
free(sigdata);
free_okt(mod);
return NULL;
}
sigdata->n_pchannels = n_channels;
sigdata->sample = (IT_SAMPLE *) malloc(sigdata->n_samples * sizeof(*sigdata->sample));
if (!sigdata->sample) {
free(sigdata);
free_okt(mod);
return NULL;
}
sigdata->song_message = NULL;
sigdata->order = NULL;
sigdata->instrument = NULL;
sigdata->pattern = NULL;
sigdata->midi = NULL;
sigdata->checkpoint = NULL;
sigdata->n_instruments = 0;
for (i = 0; i < sigdata->n_samples; i++)
sigdata->sample[i].data = NULL;
chunk = get_chunk_by_type(mod, DUMB_ID('S','A','M','P'), 0);
for (i = 0; i < sigdata->n_samples; i++) {
it_okt_read_sample_header(&sigdata->sample[i], chunk->data + 32 * i);
}
sigdata->restart_position = 0;
chunk = get_chunk_by_type(mod, DUMB_ID('P','L','E','N'), 0);
if (!chunk || chunk->size < 2) {
_dumb_it_unload_sigdata(sigdata);
free_okt(mod);
return NULL;
}
sigdata->n_orders = (chunk->data[0] << 8) | chunk->data[1];
// what if this is > 128?
if (sigdata->n_orders <= 0 || sigdata->n_orders > 128) {
_dumb_it_unload_sigdata(sigdata);
free_okt(mod);
return NULL;
}
chunk = get_chunk_by_type(mod, DUMB_ID('P','A','T','T'), 0);
if (!chunk || chunk->size < (unsigned)sigdata->n_orders) {
_dumb_it_unload_sigdata(sigdata);
free_okt(mod);
return NULL;
}
sigdata->order = (unsigned char *) malloc(sigdata->n_orders);
if (!sigdata->order) {
_dumb_it_unload_sigdata(sigdata);
free_okt(mod);
return NULL;
}
memcpy(sigdata->order, chunk->data, sigdata->n_orders);
/* Work out how many patterns there are. */
chunk = get_chunk_by_type(mod, DUMB_ID('S','L','E','N'), 0);
if (!chunk || chunk->size < 2) {
_dumb_it_unload_sigdata(sigdata);
free_okt(mod);
return NULL;
}
sigdata->n_patterns = (chunk->data[0] << 8) | chunk->data[1];
j = get_chunk_count(mod, DUMB_ID('P','B','O','D'));
if (sigdata->n_patterns > j) sigdata->n_patterns = j;
if (!sigdata->n_patterns) {
_dumb_it_unload_sigdata(sigdata);
free_okt(mod);
return NULL;
}
sigdata->pattern = (IT_PATTERN *) malloc(sigdata->n_patterns * sizeof(*sigdata->pattern));
if (!sigdata->pattern) {
_dumb_it_unload_sigdata(sigdata);
free_okt(mod);
return NULL;
}
for (i = 0; i < sigdata->n_patterns; i++)
sigdata->pattern[i].entry = NULL;
/* Read in the patterns */
for (i = 0; i < sigdata->n_patterns; i++) {
chunk = get_chunk_by_type(mod, DUMB_ID('P','B','O','D'), i);
if (it_okt_read_pattern(&sigdata->pattern[i], chunk->data, chunk->size, n_channels) != 0) {
_dumb_it_unload_sigdata(sigdata);
free_okt(mod);
return NULL;
}
}
/* And finally, the sample data */
k = get_chunk_count(mod, DUMB_ID('S','B','O','D'));
for (i = 0, j = 0; i < sigdata->n_samples && j < k; i++) {
if (sigdata->sample[i].flags & IT_SAMPLE_EXISTS) {
chunk = get_chunk_by_type(mod, DUMB_ID('S','B','O','D'), j);
if (it_okt_read_sample_data(&sigdata->sample[i], (const char *)chunk->data, chunk->size)) {
_dumb_it_unload_sigdata(sigdata);
free_okt(mod);
return NULL;
}
j++;
}
}
for (; i < sigdata->n_samples; i++) {
sigdata->sample[i].flags = 0;
}
chunk = get_chunk_by_type(mod, DUMB_ID('C','M','O','D'), 0);
for (i = 0, j = 0; i < n_channels && j < 4; j++) {
k = (chunk->data[j * 2] << 8) | chunk->data[j * 2 + 1];
l = (j == 1 || j == 2) ? 48 : 16;
if (k == 0) {
sigdata->channel_pan[i++] = l;
}
else if (k == 1) {
sigdata->channel_pan[i++] = l;
sigdata->channel_pan[i++] = l;
}
}
free_okt(mod);
/* Now let's initialise the remaining variables, and we're done! */
sigdata->flags = IT_WAS_AN_OKT | IT_WAS_AN_XM | IT_WAS_A_MOD | IT_OLD_EFFECTS | IT_COMPATIBLE_GXX | IT_STEREO;
sigdata->global_volume = 128;
sigdata->mixing_volume = 48;
/* We want 50 ticks per second; 50/6 row advances per second;
* 50*10=500 row advances per minute; 500/4=125 beats per minute.
*/
sigdata->tempo = 125;
sigdata->pan_separation = 128;
memset(sigdata->channel_volume, 64, DUMB_IT_N_CHANNELS);
memset(sigdata->channel_pan + n_channels, 32, DUMB_IT_N_CHANNELS - n_channels);
_dumb_it_fix_invalid_orders(sigdata);
return sigdata;
}
DUH *dumb_read_okt_quick(DUMBFILE *f)
{
sigdata_t *sigdata;
DUH_SIGTYPE_DESC *descptr = &_dumb_sigtype_it;
sigdata = it_okt_load_sigdata(f);
if (!sigdata)
return NULL;
{
const char *tag[1][2];
tag[0][0] = "FORMAT";
tag[0][1] = "Oktalyzer";
return make_duh(-1, 1, (const char *const (*)[2])tag, 1, &descptr, &sigdata);
}
}

View file

@ -0,0 +1,29 @@
/* _______ ____ __ ___ ___
* \ _ \ \ / \ / \ \ / / ' ' '
* | | \ \ | | || | \/ | . .
* | | | | | | || ||\ /| |
* | | | | | | || || \/ | | ' ' '
* | | | | | | || || | | . .
* | |_/ / \ \__// || | |
* /_______/ynamic \____/niversal /__\ /____\usic /| . . ibliotheque
* / \
* / . \
* readokt2.c - Function to read an Oktalyzer / / \ \
* module from an open file and do | < / \_
* an initial run-through. | \/ /\ /
* \_ / > /
* | \ / /
* By Chris Moeller. | ' /
* \__/
*/
#include "dumb.h"
DUH *dumb_read_okt(DUMBFILE *f)
{
DUH *duh = dumb_read_okt_quick(f);
dumb_it_do_initial_runthrough(duh);
return duh;
}

View file

@ -0,0 +1,688 @@
/* _______ ____ __ ___ ___
* \ _ \ \ / \ / \ \ / / ' ' '
* | | \ \ | | || | \/ | . .
* | | | | | | || ||\ /| |
* | | | | | | || || \/ | | ' ' '
* | | | | | | || || | | . .
* | |_/ / \ \__// || | |
* /_______/ynamic \____/niversal /__\ /____\usic /| . . ibliotheque
* / \
* / . \
* readpsm.c - Code to read an old Protracker / / \ \
* Studio module from an open file. | < / \_
* | \/ /\ /
* By Chris Moeller. \_ / > /
* | \ / /
* | ' /
* \__/
*/
#include <stdlib.h>
#include <string.h>
#include <math.h>
#include "dumb.h"
#include "internal/it.h"
static int psm_sample_compare(const void *e1, const void *e2)
{
const unsigned char * pa = e1;
const unsigned char * pb = e2;
int a = pa[37] | (pa[38] << 8) | (pa[39] << 16) | (pa[40] << 24);
int b = pb[37] | (pb[38] << 8) | (pb[39] << 16) | (pb[40] << 24);
return a - b;
}
static int it_old_psm_read_samples(IT_SAMPLE ** sample, DUMBFILE * f, int * num)
{
int n, o, count = *num, true_num, snum, offset, flags, finetune, delta;
unsigned char * buffer;
const unsigned char * sdata;
long sample_bytes;
buffer = malloc(count * 64);
if (!buffer) goto error;
if (dumbfile_getnc((char *)buffer, count * 64, f) < count * 64) goto error_fb;
true_num = 0;
for (n = 0; n < count; n++) {
snum = buffer[(n * 64) + 45] | (buffer[(n * 64) + 46] << 8);
if ((snum < 1) || (snum > 255)) goto error_fb;
if (true_num < snum) true_num = snum;
}
if (true_num > count) {
IT_SAMPLE * meh = realloc(*sample, true_num * sizeof(*meh));
if (!meh) goto error_fb;
for (n = count; n < true_num; n++) {
meh[n].data = NULL;
}
*sample = meh;
*num = true_num;
}
qsort(buffer, count, 64, &psm_sample_compare);
for (n = 0; n < true_num; n++) {
(*sample)[n].flags = 0;
}
for (n = 0; n < count; n++) {
IT_SAMPLE * s;
snum = buffer[(n * 64) + 45] | (buffer[(n * 64) + 46] << 8);
s = &((*sample)[snum - 1]);
memcpy(s->filename, buffer + (n * 64), 13);
s->filename[13] = 0;
memcpy(s->name, buffer + (n * 64) + 13, 24);
s->name[24] = 0;
offset = buffer[(n * 64) + 37] | (buffer[(n * 64) + 38] << 8) |
(buffer[(n * 64) + 39] << 16) | (buffer[(n * 64) + 40] << 24);
flags = buffer[(n * 64) + 47];
s->length = buffer[(n * 64) + 48] | (buffer[(n * 64) + 49] << 8) |
(buffer[(n * 64) + 50] << 16) | (buffer[(n * 64) + 51] << 24);
s->loop_start = buffer[(n * 64) + 52] | (buffer[(n * 64) + 53] << 8) |
(buffer[(n * 64) + 54] << 16) | (buffer[(n * 64) + 55] << 24);
s->loop_end = buffer[(n * 64) + 56] | (buffer[(n * 64) + 57] << 8) |
(buffer[(n * 64) + 58] << 16) | (buffer[(n * 64) + 59] << 24);
if (s->length <= 0) continue;
finetune = buffer[(n * 64) + 60];
s->default_volume = buffer[(n * 64) + 61];
s->C5_speed = buffer[(n * 64) + 62] | (buffer[(n * 64) + 63] << 8);
if (finetune & 15) {
finetune &= 15;
if (finetune >= 8) finetune -= 16;
//s->C5_speed = (long)((double)s->C5_speed * pow(DUMB_PITCH_BASE, finetune*32));
s->finetune = finetune * 32;
}
else s->finetune = 0;
s->flags |= IT_SAMPLE_EXISTS;
if (flags & 0x41) {
s->flags &= ~IT_SAMPLE_EXISTS;
continue;
}
if (flags & 0x20) s->flags |= IT_SAMPLE_PINGPONG_LOOP;
if (flags & 4) s->flags |= IT_SAMPLE_16BIT;
if (flags & 0x80) {
s->flags |= IT_SAMPLE_LOOP;
if ((unsigned int)s->loop_end > (unsigned int)s->length)
s->loop_end = s->length;
else if ((unsigned int)s->loop_start >= (unsigned int)s->loop_end)
s->flags &= ~IT_SAMPLE_LOOP;
else
s->length = s->loop_end;
}
s->global_volume = 64;
s->vibrato_speed = 0;
s->vibrato_depth = 0;
s->vibrato_rate = 0;
s->vibrato_waveform = IT_VIBRATO_SINE;
s->max_resampling_quality = -1;
sample_bytes = s->length * ((flags & 4) ? 2 : 1);
s->data = malloc(sample_bytes);
if (!s->data) goto error_fb;
if (dumbfile_seek(f, offset, DFS_SEEK_SET) || dumbfile_getnc(s->data, sample_bytes, f) < sample_bytes) goto error_fb;
sdata = ( const unsigned char * ) s->data;
if (flags & 0x10) {
if (flags & 8) {
if (flags & 4) {
for (o = 0; o < s->length; o++)
((short *)s->data)[o] = (sdata[o * 2] | (sdata[(o * 2) + 1] << 8)) ^ 0x8000;
} else {
for (o = 0; o < s->length; o++)
((signed char *)s->data)[o] = sdata[o] ^ 0x80;
}
} else {
if (flags & 4) {
for (o = 0; o < s->length; o++)
((short *)s->data)[o] = sdata[o * 2] | (sdata[(o * 2) + 1] << 8);
} else {
memcpy(s->data, sdata, s->length);
}
}
} else {
delta = 0;
if (flags & 8) {
/* unsigned delta? mehhh, does anything even use this? */
if (flags & 4) {
for (o = 0; o < s->length; o++) {
delta += (short)(sdata[o * 2] | (sdata[(o * 2) + 1] << 8));
((short *)s->data)[o] = delta ^ 0x8000;
}
} else {
for (o = 0; o < s->length; o++) {
delta += (signed char)sdata[o];
((signed char *)s->data)[o] = delta ^ 0x80;
}
}
} else {
if (flags & 4) {
for (o = 0; o < s->length; o++) {
delta += (short)(sdata[o * 2] | (sdata[(o * 2) + 1] << 8));
((short *)s->data)[o] = delta;
}
} else {
for (o = 0; o < s->length; o++) {
delta += (signed char)sdata[o];
((signed char *)s->data)[o] = delta;
}
}
}
}
}
free(buffer);
return 0;
error_fb:
free(buffer);
error:
return -1;
}
static int it_old_psm_read_patterns(IT_PATTERN * pattern, DUMBFILE * f, int num, int size, int pchans)
{
int n, offset, psize, rows, chans, row, flags, channel;
unsigned char * buffer, * ptr, * end;
IT_ENTRY * entry;
buffer = malloc(size);
if (!buffer) goto error;
if (dumbfile_getnc((char *)buffer, size, f) < size) goto error_fb;
offset = 0;
for (n = 0; n < num; n++) {
IT_PATTERN * p = &pattern[n];
if (offset >= size) goto error_fb;
ptr = buffer + offset;
psize = ptr[0] | (ptr[1] << 8);
rows = ptr[2];
chans = ptr[3];
if (!rows || !chans) {
p->n_rows = 1;
p->n_entries = 0;
continue;
}
psize = (psize + 15) & ~15;
end = ptr + psize;
ptr += 4;
p->n_rows = rows;
p->n_entries = rows;
row = 0;
while ((row < rows) && (ptr < end)) {
flags = *ptr++;
if (!flags) {
row++;
continue;
}
if (flags & 0xE0) {
p->n_entries++;
if (flags & 0x80) ptr += 2;
if (flags & 0x40) ptr++;
if (flags & 0x20) {
ptr++;
if (*ptr == 40) ptr += 3;
else ptr++;
}
}
}
entry = malloc(p->n_entries * sizeof(*p->entry));
if (!entry) goto error_fb;
p->entry = entry;
ptr = buffer + offset + 4;
row = 0;
while ((row < rows) && (ptr < end)) {
flags = *ptr++;
if (!flags) {
IT_SET_END_ROW(entry);
entry++;
row++;
continue;
}
if (flags & 0xE0) {
entry->mask = 0;
entry->channel = channel = flags & 0x1F;
if (channel >= chans)
{
//channel = 0;
//goto error_fb;
}
if (flags & 0x80) {
if ((*ptr < 60) && (channel < pchans)) {
entry->mask |= IT_ENTRY_NOTE;
entry->note = *ptr + 35;
}
ptr++;
if (*ptr) {
entry->mask |= IT_ENTRY_INSTRUMENT;
entry->instrument = *ptr;
}
ptr++;
}
if (flags & 0x40) {
if (*ptr <= 64) {
entry->mask |= IT_ENTRY_VOLPAN;
entry->volpan = *ptr;
}
ptr++;
}
if (flags & 0x20) {
entry->mask |= IT_ENTRY_EFFECT;
switch (*ptr) {
case 1:
entry->effect = IT_XM_FINE_VOLSLIDE_UP;
entry->effectvalue = ptr[1];
break;
case 2:
entry->effect = IT_VOLUME_SLIDE;
entry->effectvalue = (ptr[1] << 4) & 0xF0;
break;
case 3:
entry->effect = IT_XM_FINE_VOLSLIDE_DOWN;
entry->effectvalue = ptr[1];
break;
case 4:
entry->effect = IT_VOLUME_SLIDE;
entry->effectvalue = ptr[1] & 0xF;
break;
case 10:
entry->effect = IT_PORTAMENTO_UP;
entry->effectvalue = EFFECT_VALUE(0xF, ptr[1]);
break;
case 11:
entry->effect = IT_PORTAMENTO_UP;
entry->effectvalue = ptr[1];
break;
case 12:
entry->effect = IT_PORTAMENTO_DOWN;
entry->effectvalue = EFFECT_VALUE(ptr[1], 0xF);
break;
case 13:
entry->effect = IT_PORTAMENTO_DOWN;
entry->effectvalue = ptr[1];
break;
case 14:
entry->effect = IT_TONE_PORTAMENTO;
entry->effectvalue = ptr[1];
break;
case 15:
entry->effect = IT_S;
entry->effectvalue = EFFECT_VALUE(IT_S_SET_GLISSANDO_CONTROL, ptr[1] & 15);
break;
case 16:
entry->effect = IT_VOLSLIDE_TONEPORTA;
entry->effectvalue = ptr[1] << 4;
break;
case 17:
entry->effect = IT_VOLSLIDE_TONEPORTA;
entry->effectvalue = ptr[1] & 0xF;
break;
case 20:
entry->effect = IT_VIBRATO;
entry->effectvalue = ptr[1];
break;
case 21:
entry->effect = IT_S;
entry->effectvalue = EFFECT_VALUE(IT_S_SET_VIBRATO_WAVEFORM, ptr[1] & 11);
break;
case 22:
entry->effect = IT_VOLSLIDE_VIBRATO;
entry->effectvalue = ptr[1] << 4;
break;
case 23:
entry->effect = IT_VOLSLIDE_VIBRATO;
entry->effectvalue = ptr[1] & 0xF;
break;
case 30:
entry->effect = IT_TREMOLO;
entry->effectvalue = ptr[1];
break;
case 31:
entry->effect = IT_S;
entry->effectvalue = EFFECT_VALUE(IT_S_SET_TREMOLO_WAVEFORM, ptr[1] & 11);
break;
case 40:
entry->effect = IT_SET_SAMPLE_OFFSET;
entry->effectvalue = ptr[2];
ptr += 2;
break;
case 41:
entry->effect = IT_XM_RETRIGGER_NOTE;
entry->effectvalue = ptr[1];
break;
case 42:
entry->effect = IT_S;
entry->effectvalue = EFFECT_VALUE(IT_S_DELAYED_NOTE_CUT, ptr[1] & 0xF);
break;
case 43:
entry->effect = IT_S;
entry->effectvalue = EFFECT_VALUE(IT_S_NOTE_DELAY, ptr[1] & 0xF);
break;
case 50:
entry->effect = IT_JUMP_TO_ORDER;
entry->effectvalue = ptr[1];
break;
case 51:
entry->effect = IT_BREAK_TO_ROW;
entry->effectvalue = ptr[1];
break;
case 52:
entry->effect = IT_S;
entry->effectvalue = EFFECT_VALUE(IT_S_PATTERN_LOOP, ptr[1] & 0xF);
break;
case 53:
entry->effect = IT_S;
entry->effectvalue = EFFECT_VALUE(IT_S_PATTERN_DELAY, ptr[1] & 0xF);
break;
case 60:
entry->effect = IT_SET_SPEED;
entry->effectvalue = ptr[1];
break;
case 61:
entry->effect = IT_SET_SONG_TEMPO;
entry->effectvalue = ptr[1];
break;
case 70:
entry->effect = IT_ARPEGGIO;
entry->effectvalue = ptr[1];
break;
case 71:
entry->effect = IT_S;
entry->effectvalue = EFFECT_VALUE(IT_S_FINETUNE, ptr[1] & 0xF);
break;
case 72:
/* "balance" ... panning? */
entry->effect = IT_SET_PANNING;
entry->effectvalue = ((ptr[1] - ((ptr[1] & 8) >> 3)) << 5) / 7;
break;
default:
entry->mask &= ~IT_ENTRY_EFFECT;
}
ptr += 2;
}
if (entry->mask) entry++;
}
}
p->n_entries = entry - p->entry;
offset += psize;
}
free(buffer);
return 0;
error_fb:
free(buffer);
error:
return -1;
}
#define PSM_COMPONENT_ORDERS 0
#define PSM_COMPONENT_PANPOS 1
#define PSM_COMPONENT_PATTERNS 2
#define PSM_COMPONENT_SAMPLE_HEADERS 3
#define PSM_COMPONENT_COMMENTS 4
typedef struct PSM_COMPONENT
{
unsigned char type;
long offset;
}
PSM_COMPONENT;
static int psm_component_compare(const void *e1, const void *e2)
{
return ((const PSM_COMPONENT *)e1)->offset -
((const PSM_COMPONENT *)e2)->offset;
}
static DUMB_IT_SIGDATA *it_old_psm_load_sigdata(DUMBFILE *f)
{
DUMB_IT_SIGDATA *sigdata;
PSM_COMPONENT *component;
int n_components = 0;
int n, flags, version, pver, n_orders, n_channels, total_pattern_size;
if (dumbfile_mgetl(f) != DUMB_ID('P','S','M',254)) goto error;
sigdata = malloc(sizeof(*sigdata));
if (!sigdata) goto error;
if (dumbfile_getnc((char *)sigdata->name, 60, f) < 60 ||
sigdata->name[59] != 0x1A) goto error_sd;
sigdata->name[59] = 0;
flags = dumbfile_getc(f);
version = dumbfile_getc(f);
pver = dumbfile_getc(f);
sigdata->speed = dumbfile_getc(f);
sigdata->tempo = dumbfile_getc(f);
sigdata->mixing_volume = dumbfile_getc(f);
sigdata->n_orders = dumbfile_igetw(f);
n_orders = dumbfile_igetw(f);
sigdata->n_patterns = dumbfile_igetw(f);
sigdata->n_samples = dumbfile_igetw(f);
sigdata->n_pchannels = dumbfile_igetw(f);
n_channels = dumbfile_igetw(f);
if (dumbfile_error(f) ||
(flags & 1) ||
(version != 1 && version != 0x10) ||
(pver) ||
(sigdata->n_orders <= 0) ||
(sigdata->n_orders > 255) ||
(n_orders > 255) ||
(n_orders < sigdata->n_orders) ||
(sigdata->n_patterns > 255) ||
(sigdata->n_samples > 255) ||
(sigdata->n_pchannels > DUMB_IT_N_CHANNELS) ||
(sigdata->n_pchannels > n_channels) ||
(n_channels > DUMB_IT_N_CHANNELS))
goto error_sd;
sigdata->flags = IT_STEREO | IT_OLD_EFFECTS | IT_COMPATIBLE_GXX;
sigdata->global_volume = 128;
sigdata->pan_separation = 128;
sigdata->song_message = NULL;
sigdata->order = NULL;
sigdata->instrument = NULL;
sigdata->sample = NULL;
sigdata->pattern = NULL;
sigdata->midi = NULL;
sigdata->checkpoint = NULL;
sigdata->n_instruments = 0;
sigdata->restart_position = 0;
sigdata->order = malloc(sigdata->n_orders);
if (!sigdata->order) goto error_usd;
if (sigdata->n_samples) {
sigdata->sample = malloc(sigdata->n_samples * sizeof(*sigdata->sample));
if (!sigdata->sample) goto error_usd;
for (n = 0; n < sigdata->n_samples; n++)
sigdata->sample[n].data = NULL;
}
if (sigdata->n_patterns) {
sigdata->pattern = malloc(sigdata->n_patterns * sizeof(*sigdata->pattern));
if (!sigdata->pattern) goto error_usd;
for (n = 0; n < sigdata->n_patterns; n++)
sigdata->pattern[n].entry = NULL;
}
component = malloc(5 * sizeof(*component));
if (!component) goto error_usd;
for (n = 0; n < 5; n++) {
component[n_components].offset = dumbfile_igetl(f);
if (component[n_components].offset) {
component[n_components].type = n;
n_components++;
}
}
if (!n_components) goto error_fc;
total_pattern_size = dumbfile_igetl(f);
if (!total_pattern_size) goto error_fc;
qsort(component, n_components, sizeof(PSM_COMPONENT), &psm_component_compare);
memset(sigdata->channel_volume, 64, DUMB_IT_N_CHANNELS);
for (n = 0; n < DUMB_IT_N_CHANNELS; n += 4) {
sigdata->channel_pan[n ] = 16;
sigdata->channel_pan[n+1] = 48;
sigdata->channel_pan[n+2] = 48;
sigdata->channel_pan[n+3] = 16;
}
for (n = 0; n < n_components; n++)
{
int o;
if ( dumbfile_seek(f, component[n].offset, DFS_SEEK_SET) ) goto error_fc;
switch (component[n].type) {
case PSM_COMPONENT_ORDERS:
if (dumbfile_getnc((char *)sigdata->order, sigdata->n_orders, f) < sigdata->n_orders) goto error_fc;
if (n_orders > sigdata->n_orders)
if (dumbfile_skip(f, n_orders - sigdata->n_orders))
goto error_fc;
if (dumbfile_igetw(f)) goto error_fc;
break;
case PSM_COMPONENT_PANPOS:
if (dumbfile_getnc((char *)sigdata->channel_pan, sigdata->n_pchannels, f) < sigdata->n_pchannels) goto error_fc;
for (o = 0; o < sigdata->n_pchannels; o++) {
sigdata->channel_pan[o] -= (sigdata->channel_pan[o] & 8) >> 3;
sigdata->channel_pan[o] = ((int)sigdata->channel_pan[o] << 5) / 7;
}
break;
case PSM_COMPONENT_PATTERNS:
if (it_old_psm_read_patterns(sigdata->pattern, f, sigdata->n_patterns, total_pattern_size, sigdata->n_pchannels)) goto error_fc;
break;
case PSM_COMPONENT_SAMPLE_HEADERS:
if (it_old_psm_read_samples(&sigdata->sample, f, &sigdata->n_samples)) goto error_fc;
break;
case PSM_COMPONENT_COMMENTS:
if (dumbfile_mgetl(f) == DUMB_ID('T','E','X','T')) {
o = dumbfile_igetw(f);
if (o > 0) {
sigdata->song_message = malloc(o + 1);
if (dumbfile_getnc((char *)sigdata->song_message, o, f) < o) goto error_fc;
sigdata->song_message[o] = 0;
}
}
break;
}
}
_dumb_it_fix_invalid_orders(sigdata);
free(component);
return sigdata;
error_fc:
free(component);
error_usd:
_dumb_it_unload_sigdata(sigdata);
return NULL;
error_sd:
free(sigdata);
error:
return NULL;
}
DUH *dumb_read_old_psm_quick(DUMBFILE *f)
{
sigdata_t *sigdata;
DUH_SIGTYPE_DESC *descptr = &_dumb_sigtype_it;
sigdata = it_old_psm_load_sigdata(f);
if (!sigdata)
return NULL;
{
const char *tag[2][2];
tag[0][0] = "TITLE";
tag[0][1] = (const char *)(((DUMB_IT_SIGDATA *)sigdata)->name);
tag[1][0] = "FORMAT";
tag[1][1] = "PSM (old)";
return make_duh(-1, 2, (const char *const (*)[2])tag, 1, &descptr, &sigdata);
}
}

File diff suppressed because it is too large Load diff

View file

@ -0,0 +1,551 @@
/* _______ ____ __ ___ ___
* \ _ \ \ / \ / \ \ / / ' ' '
* | | \ \ | | || | \/ | . .
* | | | | | | || ||\ /| |
* | | | | | | || || \/ | | ' ' '
* | | | | | | || || | | . .
* | |_/ / \ \__// || | |
* /_______/ynamic \____/niversal /__\ /____\usic /| . . ibliotheque
* / \
* / . \
* readptm.c - Code to read a Poly Tracker v2.03 / / \ \
* module from an open file. | < / \_
* | \/ /\ /
* By Chris Moeller. Based on reads3m.c \_ / > /
* by entheh. | \ / /
* | ' /
* \__/
*/
// IT_STEREO... :o
#include <stdlib.h>
#include <string.h>
#include "dumb.h"
#include "internal/it.h"
static int it_ptm_read_sample_header(IT_SAMPLE *sample, long *offset, DUMBFILE *f)
{
int flags;
flags = dumbfile_getc(f);
dumbfile_getnc((char *)sample->filename, 12, f);
sample->filename[12] = 0;
sample->default_volume = dumbfile_getc(f);
sample->C5_speed = dumbfile_igetw(f) << 1;
dumbfile_skip(f, 2); /* segment */
*offset = dumbfile_igetl(f);
sample->length = dumbfile_igetl(f);
sample->loop_start = dumbfile_igetl(f);
sample->loop_end = dumbfile_igetl(f);
/* GUSBegin, GUSLStart, GUSLEnd, GUSLoop, reserverd */
dumbfile_skip(f, 4+4+4+1+1);
dumbfile_getnc((char *)sample->name, 28, f);
sample->name[28] = 0;
/*
if (dumbfile_mgetl(f) != DUMB_ID('P','T','M','S'))
return -1;
*/
/* BLAH! Shit likes to have broken or missing sample IDs */
dumbfile_skip(f, 4);
if ((flags & 3) == 0) {
/* Looks like no sample */
sample->flags &= ~IT_SAMPLE_EXISTS;
return dumbfile_error(f);
}
sample->global_volume = 64;
sample->flags = IT_SAMPLE_EXISTS;
if (flags & 4) sample->flags |= IT_SAMPLE_LOOP;
if (flags & 8) sample->flags |= IT_SAMPLE_PINGPONG_LOOP;
if (flags & 16) {
sample->flags |= IT_SAMPLE_16BIT;
sample->length >>= 1;
sample->loop_start >>= 1;
sample->loop_end >>= 1;
}
if (sample->loop_end) sample->loop_end--;
sample->default_pan = 0; // 0 = don't use, or 160 = centre?
if (sample->length <= 0)
sample->flags &= ~IT_SAMPLE_EXISTS;
else if (sample->flags & IT_SAMPLE_LOOP) {
if ((unsigned int)sample->loop_end > (unsigned int)sample->length)
sample->flags &= ~IT_SAMPLE_LOOP;
else if ((unsigned int)sample->loop_start >= (unsigned int)sample->loop_end)
sample->flags &= ~IT_SAMPLE_LOOP;
else
sample->length = sample->loop_end;
}
//Do we need to set all these?
sample->vibrato_speed = 0;
sample->vibrato_depth = 0;
sample->vibrato_rate = 0;
sample->vibrato_waveform = IT_VIBRATO_SINE;
sample->finetune = 0;
sample->max_resampling_quality = -1;
return dumbfile_error(f);
}
static int it_ptm_read_byte(DUMBFILE *f)
{
int meh = dumbfile_getc(f);
if (meh < 0) return 0;
return meh;
}
static int it_ptm_read_sample_data(IT_SAMPLE *sample, int last, DUMBFILE *f)
{
long n;
int s;
sample->data = malloc(sample->length * (sample->flags & IT_SAMPLE_16BIT ? 2 : 1));
if (!sample->data)
return -1;
s = 0;
if (sample->flags & IT_SAMPLE_16BIT) {
unsigned char a, b;
for (n = 0; n < sample->length; n++) {
a = s += (signed char) it_ptm_read_byte(f);
b = s += (signed char) it_ptm_read_byte(f);
((short *)sample->data)[n] = a | (b << 8);
}
} else {
for (n = 0; n < sample->length; n++) {
s += (signed char) it_ptm_read_byte(f);
((signed char *)sample->data)[n] = s;
}
}
if (dumbfile_error(f) && !last)
return -1;
return 0;
}
static int it_ptm_read_pattern(IT_PATTERN *pattern, DUMBFILE *f, unsigned char *buffer, int length)
{
int buflen = 0;
int bufpos = 0;
int effect, effectvalue;
IT_ENTRY *entry;
unsigned char channel;
if (!length)
return -1;
pattern->n_rows = 0;
pattern->n_entries = 0;
/* Read in the pattern data, little by little, and work out how many
* entries we need room for. Sorry, but this is just so funny...
*/
for (;;) {
unsigned char b = buffer[buflen++] = dumbfile_getc(f);
#if 1
static const unsigned char used[8] = {0, 2, 2, 4, 1, 3, 3, 5};
channel = b & 31;
b >>= 5;
pattern->n_entries++;
if (b) {
if (buflen + used[b] >= 65536) return -1;
dumbfile_getnc((char *)buffer + buflen, used[b], f);
buflen += used[b];
} else {
/* End of row */
if (++pattern->n_rows == 64) break;
if (buflen >= 65536) return -1;
}
#else
if (b == 0) {
/* End of row */
pattern->n_entries++;
if (++pattern->n_rows == 64) break;
if (buflen >= 65536) return -1;
} else {
static const unsigned char used[8] = {0, 2, 2, 4, 1, 3, 3, 5};
channel = b & 31;
b >>= 5;
if (b) {
pattern->n_entries++;
if (buflen + used[b] >= 65536) return -1;
dumbfile_getnc(buffer + buflen, used[b], f);
buflen += used[b];
}
}
#endif
/* We have ensured that buflen < 65536 at this point, so it is safe
* to iterate and read at least one more byte without checking.
* However, now would be a good time to check for errors reading from
* the file.
*/
if (dumbfile_error(f))
return -1;
/* Great. We ran out of data, but there should be data for more rows.
* Fill the rest with null data...
*/
if (buflen >= length && pattern->n_rows < 64)
{
while (pattern->n_rows < 64)
{
if (buflen >= 65536) return -1;
buffer[buflen++] = 0;
pattern->n_entries++;
pattern->n_rows++;
}
break;
}
}
pattern->entry = malloc(pattern->n_entries * sizeof(*pattern->entry));
if (!pattern->entry)
return -1;
entry = pattern->entry;
while (bufpos < buflen) {
unsigned char b = buffer[bufpos++];
if (b == 0)
{
/* End of row */
IT_SET_END_ROW(entry);
entry++;
continue;
}
channel = b & 31;
if (b & 224) {
entry->mask = 0;
entry->channel = channel;
if (b & 32) {
unsigned char n = buffer[bufpos++];
if (n == 254 || (n >= 1 && n <= 120)) {
if (n == 254)
entry->note = IT_NOTE_CUT;
else
entry->note = n - 1;
entry->mask |= IT_ENTRY_NOTE;
}
entry->instrument = buffer[bufpos++];
if (entry->instrument)
entry->mask |= IT_ENTRY_INSTRUMENT;
}
if (b & 64) {
effect = buffer[bufpos++];
effectvalue = buffer[bufpos++];
_dumb_it_ptm_convert_effect(effect, effectvalue, entry);
}
if (b & 128) {
entry->volpan = buffer[bufpos++];
if (entry->volpan <= 64)
entry->mask |= IT_ENTRY_VOLPAN;
}
entry++;
}
}
ASSERT(entry == pattern->entry + pattern->n_entries);
return 0;
}
/** WARNING: this is duplicated in itread.c - also bad practice to use the same struct name unless they are unified in a header */
/* Currently we assume the sample data are stored after the sample headers in
* module files. This assumption may be unjustified; let me know if you have
* trouble.
*/
#define PTM_COMPONENT_INSTRUMENT 1
#define PTM_COMPONENT_PATTERN 2
#define PTM_COMPONENT_SAMPLE 3
typedef struct PTM_COMPONENT
{
unsigned char type;
unsigned char n;
long offset;
}
PTM_COMPONENT;
static int ptm_component_compare(const void *e1, const void *e2)
{
return ((const PTM_COMPONENT *)e1)->offset -
((const PTM_COMPONENT *)e2)->offset;
}
static DUMB_IT_SIGDATA *it_ptm_load_sigdata(DUMBFILE *f)
{
DUMB_IT_SIGDATA *sigdata;
PTM_COMPONENT *component;
int n_components = 0;
int n;
unsigned char *buffer;
sigdata = malloc(sizeof(*sigdata));
if (!sigdata) return NULL;
/* Skip song name. */
dumbfile_getnc((char *)sigdata->name, 28, f);
sigdata->name[28] = 0;
if (dumbfile_getc(f) != 0x1A || dumbfile_igetw(f) != 0x203) {
free(sigdata);
return NULL;
}
dumbfile_skip(f, 1);
sigdata->song_message = NULL;
sigdata->order = NULL;
sigdata->instrument = NULL;
sigdata->sample = NULL;
sigdata->pattern = NULL;
sigdata->midi = NULL;
sigdata->checkpoint = NULL;
sigdata->n_orders = dumbfile_igetw(f);
sigdata->n_instruments = 0;
sigdata->n_samples = dumbfile_igetw(f);
sigdata->n_patterns = dumbfile_igetw(f);
if (dumbfile_error(f) || sigdata->n_orders <= 0 || sigdata->n_samples > 255 || sigdata->n_patterns > 128) {
_dumb_it_unload_sigdata(sigdata);
return NULL;
}
sigdata->n_pchannels = dumbfile_igetw(f);
if (dumbfile_igetw(f) != 0) {
_dumb_it_unload_sigdata(sigdata);
return NULL;
}
dumbfile_skip(f, 2);
if (dumbfile_mgetl(f) != DUMB_ID('P','T','M','F')) {
_dumb_it_unload_sigdata(sigdata);
return NULL;
}
dumbfile_skip(f, 16);
sigdata->order = malloc(sigdata->n_orders);
if (!sigdata->order) {
_dumb_it_unload_sigdata(sigdata);
return NULL;
}
if (sigdata->n_samples) {
sigdata->sample = malloc(sigdata->n_samples * sizeof(*sigdata->sample));
if (!sigdata->sample) {
_dumb_it_unload_sigdata(sigdata);
return NULL;
}
for (n = 0; n < sigdata->n_samples; n++)
sigdata->sample[n].data = NULL;
}
if (sigdata->n_patterns) {
sigdata->pattern = malloc(sigdata->n_patterns * sizeof(*sigdata->pattern));
if (!sigdata->pattern) {
_dumb_it_unload_sigdata(sigdata);
return NULL;
}
for (n = 0; n < sigdata->n_patterns; n++)
sigdata->pattern[n].entry = NULL;
}
/** WARNING: which ones? */
sigdata->flags = IT_STEREO | IT_OLD_EFFECTS | IT_COMPATIBLE_GXX | IT_WAS_A_PTM;
sigdata->global_volume = 128;
sigdata->speed = 6;
sigdata->tempo = 125;
sigdata->mixing_volume = 48;
/* Panning positions for 32 channels */
{
int i;
for (i = 0; i < 32; i++) {
int c = dumbfile_getc(f);
if (c <= 15) {
sigdata->channel_volume[i] = 64;
sigdata->channel_pan[i] = c;
} else {
/** WARNING: this could be improved if we support channel muting... */
sigdata->channel_volume[i] = 0;
sigdata->channel_pan[i] = 7;
}
}
}
/* Orders, byte each, length = sigdata->n_orders (should be even) */
dumbfile_getnc((char *)sigdata->order, sigdata->n_orders, f);
sigdata->restart_position = 0;
component = malloc(768*sizeof(*component));
if (!component) {
_dumb_it_unload_sigdata(sigdata);
return NULL;
}
if (dumbfile_seek(f, 352, DFS_SEEK_SET)) {
_dumb_it_unload_sigdata(sigdata);
return NULL;
}
for (n = 0; n < sigdata->n_patterns; n++) {
component[n_components].type = PTM_COMPONENT_PATTERN;
component[n_components].n = n;
component[n_components].offset = dumbfile_igetw(f) << 4;
n_components++;
}
if (dumbfile_seek(f, 608, DFS_SEEK_SET)) {
_dumb_it_unload_sigdata(sigdata);
return NULL;
}
for (n = 0; n < sigdata->n_samples; n++) {
if (it_ptm_read_sample_header(&sigdata->sample[n], &component[n_components].offset, f)) {
_dumb_it_unload_sigdata(sigdata);
return NULL;
}
if (!(sigdata->sample[n].flags & IT_SAMPLE_EXISTS)) continue;
component[n_components].type = PTM_COMPONENT_SAMPLE;
component[n_components].n = n;
n_components++;
}
qsort(component, n_components, sizeof(PTM_COMPONENT), &ptm_component_compare);
{
int i;
for (i = 0; i < 32; i++) {
sigdata->channel_pan[i] -= (sigdata->channel_pan[i] & 8) >> 3;
sigdata->channel_pan[i] = ((int)sigdata->channel_pan[i] << 5) / 7;
if (sigdata->channel_pan[i] > 64) sigdata->channel_pan[i] = 64;
}
}
sigdata->pan_separation = 128;
if (dumbfile_error(f)) {
free(component);
_dumb_it_unload_sigdata(sigdata);
return NULL;
}
buffer = malloc(65536);
if (!buffer) {
free(component);
_dumb_it_unload_sigdata(sigdata);
return NULL;
}
for (n = 0; n < n_components; n++) {
if (dumbfile_seek(f, component[n].offset, DFS_SEEK_SET)) {
free(buffer);
free(component);
_dumb_it_unload_sigdata(sigdata);
return NULL;
}
switch (component[n].type) {
case PTM_COMPONENT_PATTERN:
if (it_ptm_read_pattern(&sigdata->pattern[component[n].n], f, buffer, (n + 1 < n_components) ? (component[n+1].offset - component[n].offset) : 0)) {
free(buffer);
free(component);
_dumb_it_unload_sigdata(sigdata);
return NULL;
}
break;
case PTM_COMPONENT_SAMPLE:
if (it_ptm_read_sample_data(&sigdata->sample[component[n].n], (n + 1 == n_components), f)) {
free(buffer);
free(component);
_dumb_it_unload_sigdata(sigdata);
return NULL;
}
}
}
free(buffer);
free(component);
_dumb_it_fix_invalid_orders(sigdata);
return sigdata;
}
DUH *dumb_read_ptm_quick(DUMBFILE *f)
{
sigdata_t *sigdata;
DUH_SIGTYPE_DESC *descptr = &_dumb_sigtype_it;
sigdata = it_ptm_load_sigdata(f);
if (!sigdata)
return NULL;
{
const char *tag[2][2];
tag[0][0] = "TITLE";
tag[0][1] = (const char *)(((DUMB_IT_SIGDATA *)sigdata)->name);
tag[1][0] = "FORMAT";
tag[1][1] = "PTM";
return make_duh(-1, 2, (const char *const (*)[2])tag, 1, &descptr, &sigdata);
}
}

View file

@ -0,0 +1,57 @@
/* _______ ____ __ ___ ___
* \ _ \ \ / \ / \ \ / / ' ' '
* | | \ \ | | || | \/ | . .
* | | | | | | || ||\ /| |
* | | | | | | || || \/ | | ' ' '
* | | | | | | || || | | . .
* | |_/ / \ \__// || | |
* /_______/ynamic \____/niversal /__\ /____\usic /| . . ibliotheque
* / \
* / . \
* readriff.c - Code to read a RIFF module file / / \ \
* from memory. | < / \_
* | \/ /\ /
* \_ / > /
* By Chris Moeller. | \ / /
* | ' /
* \__/
*/
#include "dumb.h"
#include "internal/it.h"
#include "internal/riff.h"
DUH *dumb_read_riff_amff( DUMBFILE * f, struct riff * stream );
DUH *dumb_read_riff_am( DUMBFILE * f, struct riff * stream );
DUH *dumb_read_riff_dsmf( DUMBFILE * f, struct riff * stream );
/* dumb_read_riff_quick(): reads a RIFF file into a DUH struct, returning a
* pointer to the DUH struct. When you have finished with it, you must pass
* the pointer to unload_duh() so that the memory can be freed.
*/
DUH *dumb_read_riff_quick( DUMBFILE * f )
{
DUH * duh;
struct riff * stream;
long size;
size = dumbfile_get_size(f);
stream = riff_parse( f, 0, size, 1 );
if ( ! stream ) stream = riff_parse( f, 0, size, 0 );
if ( ! stream ) return 0;
if ( stream->type == DUMB_ID( 'A', 'M', ' ', ' ' ) )
duh = dumb_read_riff_am( f, stream );
else if ( stream->type == DUMB_ID( 'A', 'M', 'F', 'F' ) )
duh = dumb_read_riff_amff( f, stream );
else if ( stream->type == DUMB_ID( 'D', 'S', 'M', 'F' ) )
duh = dumb_read_riff_dsmf( f, stream );
else duh = 0;
riff_free( stream );
return duh;
}

View file

@ -24,40 +24,28 @@
#include "dumb.h"
#include "internal/it.h"
/** WARNING: this is duplicated in itread.c */
static int it_seek(DUMBFILE *f, long offset)
{
long pos = dumbfile_pos(f);
if (pos > offset)
return -1;
if (pos < offset)
if (dumbfile_skip(f, offset - pos))
return -1;
return 0;
}
static int it_s3m_read_sample_header(IT_SAMPLE *sample, long *offset, DUMBFILE *f)
static int it_s3m_read_sample_header(IT_SAMPLE *sample, long *offset, unsigned char *pack, int cwtv, DUMBFILE *f)
{
unsigned char type;
int flags;
type = dumbfile_getc(f);
dumbfile_getnc((char *)sample->filename, 12, f);
sample->filename[12] = 0;
if (type > 1) {
/** WARNING: no adlib support */
dumbfile_skip(f, 3 + 12 + 1 + 1 + 2 + 2 + 2 + 12);
dumbfile_getnc((char *)sample->name, 28, f);
sample->name[28] = 0;
dumbfile_skip(f, 4);
sample->flags &= ~IT_SAMPLE_EXISTS;
return dumbfile_error(f);
}
dumbfile_getnc(sample->filename, 13, f);
sample->filename[13] = 0;
*offset = dumbfile_igetw(f) << 4;
*offset = dumbfile_getc(f) << 20;
*offset += dumbfile_igetw(f) << 4;
sample->length = dumbfile_igetl(f);
sample->loop_start = dumbfile_igetl(f);
@ -67,12 +55,16 @@ static int it_s3m_read_sample_header(IT_SAMPLE *sample, long *offset, DUMBFILE *
dumbfile_skip(f, 1);
if (dumbfile_getc(f) != 0)
flags = dumbfile_getc(f);
if (flags < 0 || (flags != 0 && flags != 4))
/* Sample is packed apparently (or error reading from file). We don't
* know how to read packed samples.
*/
return -1;
*pack = flags;
flags = dumbfile_getc(f);
sample->C5_speed = dumbfile_igetl(f) << 1;
@ -80,10 +72,10 @@ static int it_s3m_read_sample_header(IT_SAMPLE *sample, long *offset, DUMBFILE *
/* Skip four unused bytes and three internal variables. */
dumbfile_skip(f, 4+2+2+4);
dumbfile_getnc(sample->name, 28, f);
dumbfile_getnc((char *)sample->name, 28, f);
sample->name[28] = 0;
if (type == 0) {
if (type == 0 || sample->length <= 0) {
/* Looks like no-existy. Anyway, there's for sure no 'SCRS' ... */
sample->flags &= ~IT_SAMPLE_EXISTS;
return dumbfile_error(f);
@ -96,16 +88,35 @@ static int it_s3m_read_sample_header(IT_SAMPLE *sample, long *offset, DUMBFILE *
sample->flags = IT_SAMPLE_EXISTS;
if (flags & 1) sample->flags |= IT_SAMPLE_LOOP;
if (flags & 2) sample->flags |= IT_SAMPLE_STEREO;
if (flags & 4) sample->flags |= IT_SAMPLE_16BIT;
/* The ST3 TECH.DOC is unclear on this, but IMAGO Orpheus is not. Piece of crap. */
if (flags & 2) {
sample->flags |= IT_SAMPLE_STEREO;
if ((cwtv & 0xF000) == 0x2000) {
sample->length >>= 1;
sample->loop_start >>= 1;
sample->loop_end >>= 1;
}
}
if (flags & 4) {
sample->flags |= IT_SAMPLE_16BIT;
if ((cwtv & 0xF000) == 0x2000) {
sample->length >>= 1;
sample->loop_start >>= 1;
sample->loop_end >>= 1;
}
}
sample->default_pan = 0; // 0 = don't use, or 160 = centre?
if (sample->length <= 0)
sample->flags &= ~IT_SAMPLE_EXISTS;
else if (sample->flags & IT_SAMPLE_LOOP) {
if (sample->flags & IT_SAMPLE_LOOP) {
if ((unsigned int)sample->loop_end > (unsigned int)sample->length)
sample->flags &= ~IT_SAMPLE_LOOP;
/*sample->flags &= ~IT_SAMPLE_LOOP;*/
sample->loop_end = sample->length;
else if ((unsigned int)sample->loop_start >= (unsigned int)sample->loop_end)
sample->flags &= ~IT_SAMPLE_LOOP;
else
@ -123,13 +134,15 @@ static int it_s3m_read_sample_header(IT_SAMPLE *sample, long *offset, DUMBFILE *
sample->vibrato_depth = 0;
sample->vibrato_rate = 0;
sample->vibrato_waveform = IT_VIBRATO_SINE;
sample->finetune = 0;
sample->max_resampling_quality = -1;
return dumbfile_error(f);
}
static int it_s3m_read_sample_data(IT_SAMPLE *sample, int ffi, DUMBFILE *f)
static int it_s3m_read_sample_data(IT_SAMPLE *sample, int ffi, unsigned char pack, DUMBFILE *f)
{
long n;
@ -140,7 +153,11 @@ static int it_s3m_read_sample_data(IT_SAMPLE *sample, int ffi, DUMBFILE *f)
if (!sample->data)
return -1;
if (sample->flags & IT_SAMPLE_STEREO) {
if (pack == 4) {
if (_dumb_it_read_sample_data_adpcm4(sample, f) < 0)
return -1;
}
else if (sample->flags & IT_SAMPLE_STEREO) {
if (sample->flags & IT_SAMPLE_16BIT) {
for (n = 0; n < datasize; n += 2)
((short *)sample->data)[n] = dumbfile_igetw(f);
@ -179,6 +196,7 @@ static int it_s3m_read_sample_data(IT_SAMPLE *sample, int ffi, DUMBFILE *f)
static int it_s3m_read_pattern(IT_PATTERN *pattern, DUMBFILE *f, unsigned char *buffer)
{
int length;
int buflen = 0;
int bufpos = 0;
@ -208,12 +226,14 @@ static int it_s3m_read_pattern(IT_PATTERN *pattern, DUMBFILE *f, unsigned char *
* against buffer overflow, this method should work with all sensibly
* written S3M files. If you find one for which it does not work, please
* let me know at entheh@users.sf.net so I can look at it.
*
* "for a good reason" ? What's this nonsense? -kode54
*
*/
/* Discard the length. */
dumbfile_skip(f, 2);
length = dumbfile_igetw(f);
if (dumbfile_error(f))
if (dumbfile_error(f) || !length)
return -1;
pattern->n_rows = 0;
@ -232,7 +252,10 @@ static int it_s3m_read_pattern(IT_PATTERN *pattern, DUMBFILE *f, unsigned char *
pattern->n_entries++;
if (b) {
if (buflen + used[b] >= 65536) return -1;
dumbfile_getnc(buffer + buflen, used[b], f);
if (buflen + used[b] <= length)
dumbfile_getnc((char *)buffer + buflen, used[b], f);
else
memset(buffer + buflen, 0, used[b]);
buflen += used[b];
} else {
/* End of row */
@ -266,6 +289,21 @@ static int it_s3m_read_pattern(IT_PATTERN *pattern, DUMBFILE *f, unsigned char *
if (dumbfile_error(f))
return -1;
/* Great. We ran out of data, but there should be data for more rows.
* Fill the rest with null data...
*/
if (buflen >= length && pattern->n_rows < 64)
{
while (pattern->n_rows < 64)
{
if (buflen >= 65536) return -1;
buffer[buflen++] = 0;
pattern->n_entries++;
pattern->n_rows++;
}
break;
}
}
pattern->entry = malloc(pattern->n_entries * sizeof(*pattern->entry));
@ -320,10 +358,35 @@ static int it_s3m_read_pattern(IT_PATTERN *pattern, DUMBFILE *f, unsigned char *
if (b & 128) {
entry->effect = buffer[bufpos++];
entry->effectvalue = buffer[bufpos++];
if (entry->effect != 255) {
// XXX woot
if (entry->effect && entry->effect < IT_MIDI_MACRO /*!= 255*/) {
entry->mask |= IT_ENTRY_EFFECT;
if (entry->effect == IT_BREAK_TO_ROW)
switch (entry->effect) {
case IT_BREAK_TO_ROW:
entry->effectvalue -= (entry->effectvalue >> 4) * 6;
break;
case IT_SET_CHANNEL_VOLUME:
case IT_CHANNEL_VOLUME_SLIDE:
case IT_PANNING_SLIDE:
case IT_GLOBAL_VOLUME_SLIDE:
case IT_PANBRELLO:
case IT_MIDI_MACRO:
entry->mask &= ~IT_ENTRY_EFFECT;
break;
case IT_S:
switch (entry->effectvalue >> 4) {
case IT_S_SET_PANBRELLO_WAVEFORM:
case IT_S_FINE_PATTERN_DELAY:
case IT_S7:
case IT_S_SET_SURROUND_SOUND:
case IT_S_SET_MIDI_MACRO:
entry->mask &= ~IT_ENTRY_EFFECT;
break;
}
break;
}
}
/** WARNING: ARGH! CONVERT TEH EFFECTS!@~ */
}
@ -345,11 +408,11 @@ static int it_s3m_read_pattern(IT_PATTERN *pattern, DUMBFILE *f, unsigned char *
* trouble.
*/
#define IT_COMPONENT_INSTRUMENT 1
#define IT_COMPONENT_PATTERN 2
#define IT_COMPONENT_SAMPLE 3
#define S3M_COMPONENT_INSTRUMENT 1
#define S3M_COMPONENT_PATTERN 2
#define S3M_COMPONENT_SAMPLE 3
typedef struct IT_COMPONENT
typedef struct S3M_COMPONENT
{
unsigned char type;
unsigned char n;
@ -357,26 +420,30 @@ typedef struct IT_COMPONENT
short sampfirst; /* component[sampfirst] = first sample data after this */
short sampnext; /* sampnext is used to create linked lists of sample data */
}
IT_COMPONENT;
S3M_COMPONENT;
static int it_component_compare(const void *e1, const void *e2)
static int s3m_component_compare(const void *e1, const void *e2)
{
return ((const IT_COMPONENT *)e1)->offset -
((const IT_COMPONENT *)e2)->offset;
return ((const S3M_COMPONENT *)e1)->offset -
((const S3M_COMPONENT *)e2)->offset;
}
static DUMB_IT_SIGDATA *it_s3m_load_sigdata(DUMBFILE *f)
static DUMB_IT_SIGDATA *it_s3m_load_sigdata(DUMBFILE *f, int * cwtv)
{
DUMB_IT_SIGDATA *sigdata;
int flags, cwtv, ffi;
int flags, ffi;
int default_pan_present;
IT_COMPONENT *component;
int master_volume;
unsigned char sample_pack[256];
S3M_COMPONENT *component;
int n_components = 0;
int n;
@ -386,10 +453,17 @@ static DUMB_IT_SIGDATA *it_s3m_load_sigdata(DUMBFILE *f)
sigdata = malloc(sizeof(*sigdata));
if (!sigdata) return NULL;
dumbfile_getnc(sigdata->name, 28, f);
dumbfile_getnc((char *)sigdata->name, 28, f);
sigdata->name[28] = 0;
if (dumbfile_getc(f) != 0x1A || dumbfile_getc(f) != 16) {
n = dumbfile_getc(f);
if (n != 0x1A && n != 0) {
free(sigdata);
return NULL;
}
if (dumbfile_getc(f) != 16) {
free(sigdata);
return NULL;
}
@ -442,29 +516,31 @@ static DUMB_IT_SIGDATA *it_s3m_load_sigdata(DUMBFILE *f)
flags = dumbfile_igetw(f);
cwtv = dumbfile_igetw(f);
*cwtv = dumbfile_igetw(f);
if (cwtv == 0x1300) {
if (*cwtv == 0x1300) {
/** WARNING: volume slides on every frame */
}
ffi = dumbfile_igetw(f);
/** WARNING: which ones? */
sigdata->flags = IT_STEREO | IT_OLD_EFFECTS | IT_COMPATIBLE_GXX;
sigdata->flags = IT_OLD_EFFECTS | IT_COMPATIBLE_GXX | IT_WAS_AN_S3M;
if (dumbfile_mgetl(f) != DUMB_ID('S','C','R','M')) {
_dumb_it_unload_sigdata(sigdata);
return NULL;
}
sigdata->global_volume = dumbfile_getc(f) << 1;
sigdata->global_volume = dumbfile_getc(f);
if ( !sigdata->global_volume || sigdata->global_volume > 64 ) sigdata->global_volume = 64;
sigdata->speed = dumbfile_getc(f);
if (sigdata->speed == 0) sigdata->speed = 6; // Should we? What about tempo?
sigdata->tempo = dumbfile_getc(f);
/*master_volume = */dumbfile_getc(f); // 7 bits; +128 for stereo
//what do we do with master_volume? it's not the same as mixing volume...
sigdata->mixing_volume = 48;
master_volume = dumbfile_getc(f); // 7 bits; +128 for stereo
sigdata->mixing_volume = master_volume & 127;
if (master_volume & 128) sigdata->flags |= IT_STEREO;
/* Skip GUS Ultra Click Removal byte. */
dumbfile_getc(f);
@ -477,12 +553,14 @@ static DUMB_IT_SIGDATA *it_s3m_load_sigdata(DUMBFILE *f)
/** WARNING: investigate this? */
dumbfile_igetw(f);
sigdata->n_pchannels = 0;
/* Channel settings for 32 channels, 255=unused, +128=disabled */
{
int i;
for (i = 0; i < 32; i++) {
int c = dumbfile_getc(f);
if (!(c & (128 | 16))) { /* +128=disabled, +16=Adlib */
if (sigdata->n_pchannels < i + 1) sigdata->n_pchannels = i + 1;
sigdata->channel_volume[i] = 64;
sigdata->channel_pan[i] = c & 8 ? 12 : 3;
/** WARNING: ah, but it should be 7 for mono... */
@ -495,7 +573,7 @@ static DUMB_IT_SIGDATA *it_s3m_load_sigdata(DUMBFILE *f)
}
/* Orders, byte each, length = sigdata->n_orders (should be even) */
dumbfile_getnc(sigdata->order, sigdata->n_orders, f);
dumbfile_getnc((char *)sigdata->order, sigdata->n_orders, f);
sigdata->restart_position = 0;
component = malloc(768*sizeof(*component));
@ -505,7 +583,7 @@ static DUMB_IT_SIGDATA *it_s3m_load_sigdata(DUMBFILE *f)
}
for (n = 0; n < sigdata->n_samples; n++) {
component[n_components].type = IT_COMPONENT_SAMPLE;
component[n_components].type = S3M_COMPONENT_SAMPLE;
component[n_components].n = n;
component[n_components].offset = dumbfile_igetw(f) << 4;
component[n_components].sampfirst = -1;
@ -515,7 +593,7 @@ static DUMB_IT_SIGDATA *it_s3m_load_sigdata(DUMBFILE *f)
for (n = 0; n < sigdata->n_patterns; n++) {
long offset = dumbfile_igetw(f) << 4;
if (offset) {
component[n_components].type = IT_COMPONENT_PATTERN;
component[n_components].type = S3M_COMPONENT_PATTERN;
component[n_components].n = n;
component[n_components].offset = offset;
component[n_components].sampfirst = -1;
@ -527,7 +605,7 @@ static DUMB_IT_SIGDATA *it_s3m_load_sigdata(DUMBFILE *f)
}
}
qsort(component, n_components, sizeof(IT_COMPONENT), &it_component_compare);
qsort(component, n_components, sizeof(S3M_COMPONENT), &s3m_component_compare);
/* I found a really dumb S3M file that claimed to contain default pan
* data but didn't contain any. Programs would load it by reading part of
@ -573,7 +651,8 @@ static DUMB_IT_SIGDATA *it_s3m_load_sigdata(DUMBFILE *f)
long offset;
int m;
if (it_seek(f, component[n].offset)) {
offset = 0;
if (dumbfile_seek(f, component[n].offset, DFS_SEEK_SET)) {
free(buffer);
free(component);
_dumb_it_unload_sigdata(sigdata);
@ -582,7 +661,7 @@ static DUMB_IT_SIGDATA *it_s3m_load_sigdata(DUMBFILE *f)
switch (component[n].type) {
case IT_COMPONENT_PATTERN:
case S3M_COMPONENT_PATTERN:
if (it_s3m_read_pattern(&sigdata->pattern[component[n].n], f, buffer)) {
free(buffer);
free(component);
@ -591,8 +670,8 @@ static DUMB_IT_SIGDATA *it_s3m_load_sigdata(DUMBFILE *f)
}
break;
case IT_COMPONENT_SAMPLE:
if (it_s3m_read_sample_header(&sigdata->sample[component[n].n], &offset, f)) {
case S3M_COMPONENT_SAMPLE:
if (it_s3m_read_sample_header(&sigdata->sample[component[n].n], &offset, &sample_pack[component[n].n], *cwtv, f)) {
free(buffer);
free(component);
_dumb_it_unload_sigdata(sigdata);
@ -622,14 +701,15 @@ static DUMB_IT_SIGDATA *it_s3m_load_sigdata(DUMBFILE *f)
m = component[n].sampfirst;
while (m >= 0) {
if (it_seek(f, component[m].offset)) {
// XXX
if (dumbfile_seek(f, component[m].offset, DFS_SEEK_SET)) {
free(buffer);
free(component);
_dumb_it_unload_sigdata(sigdata);
return NULL;
}
if (it_s3m_read_sample_data(&sigdata->sample[component[m].n], ffi, f)) {
if (it_s3m_read_sample_data(&sigdata->sample[component[m].n], ffi, sample_pack[component[m].n], f)) {
free(buffer);
free(component);
_dumb_it_unload_sigdata(sigdata);
@ -648,23 +728,38 @@ static DUMB_IT_SIGDATA *it_s3m_load_sigdata(DUMBFILE *f)
return sigdata;
}
static char hexdigit(int in)
{
if (in < 10) return in + '0';
else return in + 'A' - 10;
}
DUH *dumb_read_s3m_quick(DUMBFILE *f)
{
sigdata_t *sigdata;
int cwtv;
DUH_SIGTYPE_DESC *descptr = &_dumb_sigtype_it;
sigdata = it_s3m_load_sigdata(f);
sigdata = it_s3m_load_sigdata(f, &cwtv);
if (!sigdata)
return NULL;
{
const char *tag[1][2];
char version[8];
const char *tag[3][2];
tag[0][0] = "TITLE";
tag[0][1] = ((DUMB_IT_SIGDATA *)sigdata)->name;
return make_duh(-1, 1, (const char *const (*)[2])tag, 1, &descptr, &sigdata);
tag[0][1] = (const char *)(((DUMB_IT_SIGDATA *)sigdata)->name);
tag[1][0] = "FORMAT";
tag[1][1] = "S3M";
tag[2][0] = "TRACKERVERSION";
version[0] = hexdigit((cwtv >> 8) & 15);
version[1] = '.';
version[2] = hexdigit((cwtv >> 4) & 15);
version[3] = hexdigit(cwtv & 15);
version[4] = 0;
tag[2][1] = (const char *) &version;
return make_duh(-1, 3, (const char *const (*)[2])tag, 1, &descptr, &sigdata);
}
}

View file

@ -0,0 +1,395 @@
/* _______ ____ __ ___ ___
* \ _ \ \ / \ / \ \ / / ' ' '
* | | \ \ | | || | \/ | . .
* | | | | | | || ||\ /| |
* | | | | | | || || \/ | | ' ' '
* | | | | | | || || | | . .
* | |_/ / \ \__// || | |
* /_______/ynamic \____/niversal /__\ /____\usic /| . . ibliotheque
* / \
* / . \
* readstm.c - Code to read a ScreamTracker 2 / / \ \
* module from an open file. | < / \_
* | \/ /\ /
* By Chris Moeller. \_ / > /
* | \ / /
* | ' /
* \__/
*/
// IT_STEREO... :o
#include <stdlib.h>
#include <string.h>
#include <limits.h>
#include "dumb.h"
#include "internal/it.h"
#ifdef _MSC_VER
#define strnicmp _strnicmp
#else
#if defined(unix) || defined(__unix__) || defined(__unix)
#include <strings.h>
#endif
#define strnicmp strncasecmp
#endif
static int it_stm_read_sample_header( IT_SAMPLE *sample, DUMBFILE *f, unsigned short *offset )
{
dumbfile_getnc( (char *) sample->filename, 12, f );
sample->filename[12] = 0;
memcpy( sample->name, sample->filename, 13 );
dumbfile_skip( f, 2 );
*offset = dumbfile_igetw( f );
sample->length = dumbfile_igetw( f );
sample->loop_start = dumbfile_igetw( f );
sample->loop_end = dumbfile_igetw( f );
sample->default_volume = dumbfile_getc( f );
dumbfile_skip( f, 1 );
sample->C5_speed = dumbfile_igetw( f ) << 3;
dumbfile_skip( f, 6 );
if ( sample->length < 4 || !sample->default_volume ) {
/* Looks like no-existy. */
sample->flags &= ~IT_SAMPLE_EXISTS;
sample->length = 0;
return dumbfile_error( f );
}
sample->flags = IT_SAMPLE_EXISTS;
sample->global_volume = 64;
sample->default_pan = 0; // 0 = don't use, or 160 = centre?
if ( ( sample->loop_start < sample->length ) &&
( sample->loop_end > sample->loop_start ) &&
( sample->loop_end != 0xFFFF ) ) {
sample->flags |= IT_SAMPLE_LOOP;
if ( sample->loop_end > sample->length ) sample->loop_end = sample->length;
}
//Do we need to set all these?
sample->vibrato_speed = 0;
sample->vibrato_depth = 0;
sample->vibrato_rate = 0;
sample->vibrato_waveform = IT_VIBRATO_SINE;
sample->finetune = 0;
sample->max_resampling_quality = -1;
return dumbfile_error(f);
}
static int it_stm_read_sample_data( IT_SAMPLE *sample, DUMBFILE * f )
{
if ( ! sample->length ) return 0;
sample->data = malloc( sample->length );
if (!sample->data)
return -1;
dumbfile_getnc( sample->data, sample->length, f );
return dumbfile_error( f );
}
static int it_stm_read_pattern( IT_PATTERN *pattern, DUMBFILE *f, unsigned char *buffer )
{
int pos;
int channel;
int row;
IT_ENTRY *entry;
pattern->n_rows = 64;
if ( dumbfile_getnc( (char *) buffer, 64 * 4 * 4, f ) != 64 * 4 * 4 )
return -1;
pattern->n_entries = 64;
pos = 0;
for ( row = 0; row < 64; ++row ) {
for ( channel = 0; channel < 4; ++channel ) {
if ( buffer[ pos + 0 ] | buffer[ pos + 1 ] | buffer[ pos + 2 ] | buffer[ pos + 3 ] )
++pattern->n_entries;
pos += 4;
}
}
pattern->entry = malloc( pattern->n_entries * sizeof( *pattern->entry ) );
if ( !pattern->entry )
return -1;
entry = pattern->entry;
pos = 0;
for ( row = 0; row < 64; ++row ) {
for ( channel = 0; channel < 4; ++channel ) {
if ( buffer[ pos + 0 ] | buffer[ pos + 1 ] | buffer[ pos + 2 ] | buffer[ pos + 3 ] ) {
unsigned note;
note = buffer[ pos + 0 ];
entry->channel = channel;
entry->mask = 0;
entry->instrument = buffer[ pos + 1 ] >> 3;
entry->volpan = ( buffer[ pos + 1 ] & 0x07 ) + ( buffer[ pos + 2 ] >> 1 );
entry->effect = buffer[ pos + 2 ] & 0x0F;
entry->effectvalue = buffer[ pos + 3 ];
if ( entry->instrument && entry->instrument < 32 )
entry->mask |= IT_ENTRY_INSTRUMENT;
if ( note < 251 ) {
entry->mask |= IT_ENTRY_NOTE;
entry->note = ( note >> 4 ) * 12 + ( note & 0x0F );
}
if ( entry->volpan <= 64 )
entry->mask |= IT_ENTRY_VOLPAN;
entry->mask |= IT_ENTRY_EFFECT;
switch ( entry->effect ) {
case IT_SET_SPEED:
/* taken care of in the renderer */
break;
case IT_BREAK_TO_ROW:
entry->effectvalue -= (entry->effectvalue >> 4) * 6;
break;
case IT_JUMP_TO_ORDER:
case IT_VOLUME_SLIDE:
case IT_PORTAMENTO_DOWN:
case IT_PORTAMENTO_UP:
case IT_TONE_PORTAMENTO:
case IT_VIBRATO:
case IT_TREMOR:
case IT_ARPEGGIO:
case IT_VOLSLIDE_VIBRATO:
case IT_VOLSLIDE_TONEPORTA:
break;
default:
entry->mask &= ~IT_ENTRY_EFFECT;
break;
}
if ( entry->mask ) ++entry;
}
pos += 4;
}
IT_SET_END_ROW(entry);
++entry;
}
pattern->n_entries = entry - pattern->entry;
return 0;
}
static DUMB_IT_SIGDATA *it_stm_load_sigdata(DUMBFILE *f, int * version)
{
DUMB_IT_SIGDATA *sigdata;
char tracker_name[ 8 ];
unsigned short sample_offset[ 31 ];
int n;
sigdata = malloc(sizeof(*sigdata));
if (!sigdata) return NULL;
/* Skip song name. */
dumbfile_getnc((char *)sigdata->name, 20, f);
sigdata->name[20] = 0;
dumbfile_getnc(tracker_name, 8, f);
n = dumbfile_getc(f);
if ( n != 0x02 && n != 0x1A && n != 0x1B )
{
free( sigdata );
return NULL;
}
if ( dumbfile_getc(f) != 2 ) /* only support modules */
{
free( sigdata );
return NULL;
}
if ( strnicmp( tracker_name, "!Scream!", 8 ) &&
strnicmp( tracker_name, "BMOD2STM", 8 ) &&
strnicmp( tracker_name, "WUZAMOD!", 8 ) )
{
free( sigdata );
return NULL;
}
*version = dumbfile_mgetw(f);
sigdata->song_message = NULL;
sigdata->order = NULL;
sigdata->instrument = NULL;
sigdata->sample = NULL;
sigdata->pattern = NULL;
sigdata->midi = NULL;
sigdata->checkpoint = NULL;
sigdata->n_instruments = 0;
sigdata->n_samples = 31;
sigdata->n_pchannels = 4;
sigdata->tempo = 125;
sigdata->mixing_volume = 48;
sigdata->pan_separation = 128;
/** WARNING: which ones? */
sigdata->flags = IT_OLD_EFFECTS | IT_COMPATIBLE_GXX | IT_WAS_AN_S3M | IT_WAS_AN_STM | IT_STEREO;
n = dumbfile_getc(f);
if ( n < 32 ) n = 32;
sigdata->speed = n;
sigdata->n_patterns = dumbfile_getc(f);
sigdata->global_volume = dumbfile_getc(f) << 1;
if ( sigdata->global_volume > 128 ) sigdata->global_volume = 128;
dumbfile_skip(f, 13);
if ( dumbfile_error(f) || sigdata->n_patterns < 1 || sigdata->n_patterns > 99 ) {
_dumb_it_unload_sigdata(sigdata);
return NULL;
}
sigdata->sample = malloc(sigdata->n_samples * sizeof(*sigdata->sample));
if (!sigdata->sample) {
_dumb_it_unload_sigdata(sigdata);
return NULL;
}
for (n = 0; n < sigdata->n_samples; n++)
sigdata->sample[n].data = NULL;
if (sigdata->n_patterns) {
sigdata->pattern = malloc(sigdata->n_patterns * sizeof(*sigdata->pattern));
if (!sigdata->pattern) {
_dumb_it_unload_sigdata(sigdata);
return NULL;
}
for (n = 0; n < sigdata->n_patterns; n++)
sigdata->pattern[n].entry = NULL;
}
memset( sigdata->channel_volume, 64, 4 );
sigdata->channel_pan[ 0 ] = 48;
sigdata->channel_pan[ 1 ] = 16;
sigdata->channel_pan[ 2 ] = 48;
sigdata->channel_pan[ 3 ] = 16;
for ( n = 0; n < sigdata->n_samples; ++n ) {
if ( it_stm_read_sample_header( &sigdata->sample[ n ], f, &sample_offset[ n ] ) ) {
_dumb_it_unload_sigdata( sigdata );
return NULL;
}
}
sigdata->order = malloc( 128 );
if ( !sigdata->order ) {
_dumb_it_unload_sigdata( sigdata );
return NULL;
}
/* Orders, byte each, length = sigdata->n_orders (should be even) */
dumbfile_getnc( (char *) sigdata->order, *version >= 0x200 ? 128 : 64, f );
if (*version < 0x200) memset( sigdata->order + 64, 0xFF, 64 );
sigdata->restart_position = 0;
for ( n = 127; n >= 0; --n ) {
if ( sigdata->order[ n ] < sigdata->n_patterns ) break;
}
if ( n < 0 ) {
_dumb_it_unload_sigdata( sigdata );
return NULL;
}
sigdata->n_orders = n + 1;
for ( n = 0; n < 128; ++n ) {
if ( sigdata->order[ n ] >= 99 ) sigdata->order[ n ] = 0xFF;
}
if ( sigdata->n_patterns ) {
unsigned char * buffer = malloc( 64 * 4 * 4 );
if ( ! buffer ) {
_dumb_it_unload_sigdata( sigdata );
return NULL;
}
for ( n = 0; n < sigdata->n_patterns; ++n ) {
if ( it_stm_read_pattern( &sigdata->pattern[ n ], f, buffer ) ) {
free( buffer );
_dumb_it_unload_sigdata( sigdata );
return NULL;
}
}
free( buffer );
}
for ( n = 0; n < sigdata->n_samples; ++n ) {
if ( sample_offset[ n ] )
{
if ( dumbfile_seek( f, sample_offset[ n ] * 16, DFS_SEEK_SET ) ||
it_stm_read_sample_data( &sigdata->sample[ n ], f ) ) {
_dumb_it_unload_sigdata( sigdata );
return NULL;
}
}
else
{
sigdata->sample[ n ].flags = 0;
sigdata->sample[ n ].length = 0;
}
}
_dumb_it_fix_invalid_orders(sigdata);
return sigdata;
}
DUH *dumb_read_stm_quick(DUMBFILE *f)
{
sigdata_t *sigdata;
int ver;
DUH_SIGTYPE_DESC *descptr = &_dumb_sigtype_it;
sigdata = it_stm_load_sigdata(f , &ver);
if (!sigdata)
return NULL;
{
char version[16];
const char *tag[2][2];
tag[0][0] = "TITLE";
tag[0][1] = (const char *)(((DUMB_IT_SIGDATA *)sigdata)->name);
tag[1][0] = "FORMAT";
version[0] = 'S';
version[1] = 'T';
version[2] = 'M';
version[3] = ' ';
version[4] = 'v';
version[5] = '0' + ((ver >> 8) & 15);
version[6] = '.';
if ((ver & 255) > 99)
{
version[7] = '0' + ((ver & 255) / 100 );
version[8] = '0' + (((ver & 255) / 10) % 10);
version[9] = '0' + ((ver & 255) % 10);
version[10] = 0;
}
else
{
version[7] = '0' + ((ver & 255) / 10);
version[8] = '0' + ((ver & 255) % 10);
version[9] = 0;
}
tag[1][1] = (const char *) &version;
return make_duh(-1, 2, (const char *const (*)[2])tag, 1, &descptr, &sigdata);
}
}

View file

@ -0,0 +1,29 @@
/* _______ ____ __ ___ ___
* \ _ \ \ / \ / \ \ / / ' ' '
* | | \ \ | | || | \/ | . .
* | | | | | | || ||\ /| |
* | | | | | | || || \/ | | ' ' '
* | | | | | | || || | | . .
* | |_/ / \ \__// || | |
* /_______/ynamic \____/niversal /__\ /____\usic /| . . ibliotheque
* / \
* / . \
* readstm2.c - Function to read a ScreamTracker 2 / / \ \
* module from an open file and do an | < / \_
* initial run-through. | \/ /\ /
* \_ / > /
* By Chris Moeller. | \ / /
* | ' /
* \__/
*/
#include "dumb.h"
DUH *dumb_read_stm(DUMBFILE *f)
{
DUH *duh = dumb_read_stm_quick(f);
dumb_it_do_initial_runthrough(duh);
return duh;
}

View file

@ -23,13 +23,13 @@
#include "dumb.h"
#include "internal/it.h"
#include "internal/dumbfile.h"
/** TODO:
* XM_TREMOLO doesn't sound quite right...
* XM_E_SET_FINETUNE done but not tested yet.
* XM_SET_ENVELOPE_POSITION todo.
* VIBRATO conversion needs to be checked (sample/effect/volume). Plus check
@ -87,11 +87,12 @@
/* Probably useless :) */
static const char xm_convert_vibrato[] = {
const char xm_convert_vibrato[] = {
IT_VIBRATO_SINE,
IT_VIBRATO_SQUARE,
IT_VIBRATO_SAWTOOTH,
IT_VIBRATO_SAWTOOTH
IT_VIBRATO_XM_SQUARE,
IT_VIBRATO_RAMP_DOWN,
IT_VIBRATO_RAMP_UP,
IT_VIBRATO_RANDOM
};
@ -108,11 +109,20 @@ typedef struct XM_INSTRUMENT_EXTRA
int vibrato_sweep; /* 0-0xFF */
int vibrato_depth; /* 0-0x0F */
int vibrato_speed; /* 0-0x3F */
int sample_header_size;
}
XM_INSTRUMENT_EXTRA;
/* Trims off trailing white space, usually added by the tracker on file creation
*/
static void trim_whitespace(char *ptr, size_t size)
{
char *p = ptr + size - 1;
while (p >= ptr && *p <= 0x20) *p-- = '\0';
}
/* Frees the original block if it can't resize it or if size is 0, and acts
* as malloc if ptr is NULL.
*/
@ -173,7 +183,7 @@ static void it_xm_convert_volume(int volume, IT_ENTRY *entry)
static int it_xm_read_pattern(IT_PATTERN *pattern, DUMBFILE *f, int n_channels, unsigned char *buffer)
static int it_xm_read_pattern(IT_PATTERN *pattern, DUMBFILE *f, int n_channels, unsigned char *buffer, int version)
{
int size;
int pos;
@ -183,7 +193,7 @@ static int it_xm_read_pattern(IT_PATTERN *pattern, DUMBFILE *f, int n_channels,
IT_ENTRY *entry;
/* pattern header size */
if (dumbfile_igetl(f) != 0x09) {
if (dumbfile_igetl(f) != ( version == 0x0102 ? 0x08 : 0x09 ) ) {
TRACE("XM error: unexpected pattern header size\n");
return -1;
}
@ -194,6 +204,9 @@ static int it_xm_read_pattern(IT_PATTERN *pattern, DUMBFILE *f, int n_channels,
return -1;
}
if ( version == 0x0102 )
pattern->n_rows = dumbfile_getc(f) + 1;
else
pattern->n_rows = dumbfile_igetw(f); /* 1..256 */
size = dumbfile_igetw(f);
pattern->n_entries = 0;
@ -209,7 +222,7 @@ static int it_xm_read_pattern(IT_PATTERN *pattern, DUMBFILE *f, int n_channels,
return -1;
}
if (dumbfile_getnc(buffer, size, f) < size)
if (dumbfile_getnc((char *)buffer, size, f) < size)
return -1;
/* compute number of entries */
@ -235,11 +248,19 @@ static int it_xm_read_pattern(IT_PATTERN *pattern, DUMBFILE *f, int n_channels,
}
}
if (row != pattern->n_rows) {
if (row > pattern->n_rows) {
TRACE("XM error: wrong number of rows in pattern data\n");
return -1;
}
/* Whoops, looks like some modules may be short, a few channels, maybe even rows... */
while (row < pattern->n_rows)
{
pattern->n_entries++;
row++;
}
pattern->entry = malloc(pattern->n_entries * sizeof(*pattern->entry));
if (!pattern->entry)
return -1;
@ -278,7 +299,7 @@ static int it_xm_read_pattern(IT_PATTERN *pattern, DUMBFILE *f, int n_channels,
effect = effectvalue = 0;
if (mask & XM_ENTRY_EFFECT) effect = buffer[pos++];
if (mask & XM_ENTRY_EFFECTVALUE) effectvalue = buffer[pos++];
_dumb_it_xm_convert_effect(effect, effectvalue, entry);
_dumb_it_xm_convert_effect(effect, effectvalue, entry, 0);
entry++;
}
@ -292,6 +313,13 @@ static int it_xm_read_pattern(IT_PATTERN *pattern, DUMBFILE *f, int n_channels,
}
}
while (row < pattern->n_rows)
{
row++;
IT_SET_END_ROW(entry);
entry++;
}
return 0;
}
@ -299,23 +327,30 @@ static int it_xm_read_pattern(IT_PATTERN *pattern, DUMBFILE *f, int n_channels,
static int it_xm_make_envelope(IT_ENVELOPE *envelope, const unsigned short *data, int y_offset)
{
int i, pos;
int i, pos, val;
if (envelope->n_nodes > 12) {
/* XXX
TRACE("XM error: wrong number of envelope nodes (%d)\n", envelope->n_nodes);
envelope->n_nodes = 0;
return -1;
return -1; */
envelope->n_nodes = 12;
}
if (envelope->sus_loop_start >= 12) envelope->flags &= ~IT_ENVELOPE_SUSTAIN_LOOP;
if (envelope->loop_end >= 12) envelope->loop_end = 0;
if (envelope->loop_start >= envelope->loop_end) envelope->flags &= ~IT_ENVELOPE_LOOP_ON;
pos = 0;
for (i = 0; i < envelope->n_nodes; i++) {
envelope->node_t[i] = data[pos++];
if (data[pos] > 64) {
TRACE("XM error: out-of-range envelope node (node_y[%d]=%d)\n", i, data[pos]);
envelope->n_nodes = 0;
return -1;
val = data[pos++];
if (val > 64) {
TRACE("XM error: out-of-range envelope node (node_y[%d]=%d)\n", i, val);
/* FT2 seems to simply clip the value */
val = 64;
}
envelope->node_y[i] = (signed char)(data[pos++] + y_offset);
envelope->node_y[i] = (signed char)(val + y_offset);
}
return 0;
@ -323,21 +358,164 @@ static int it_xm_make_envelope(IT_ENVELOPE *envelope, const unsigned short *data
typedef struct LIMITED_XM LIMITED_XM;
struct LIMITED_XM
{
unsigned char *buffered;
long ptr, limit, allocated;
DUMBFILE *remaining;
};
static int limit_xm_resize(void *f, long n)
{
DUMBFILE *df = f;
LIMITED_XM *lx = df->file;
if (lx->buffered || n) {
if (n > lx->allocated) {
unsigned char *buffered = realloc( lx->buffered, n );
if ( !buffered ) return -1;
lx->buffered = buffered;
memset( buffered + lx->allocated, 0, n - lx->allocated );
lx->allocated = n;
}
if ( dumbfile_getnc( (char *)lx->buffered, n, lx->remaining ) < n ) return -1;
} else if (!n) {
if ( lx->buffered ) free( lx->buffered );
lx->buffered = NULL;
lx->allocated = 0;
}
lx->limit = n;
lx->ptr = 0;
return 0;
}
static int limit_xm_skip_end(void *f, long n)
{
DUMBFILE *df = f;
LIMITED_XM *lx = df->file;
return dumbfile_skip( lx->remaining, n );
}
static int limit_xm_skip(void *f, long n)
{
LIMITED_XM *lx = f;
lx->ptr += n;
return 0;
}
static int limit_xm_getc(void *f)
{
LIMITED_XM *lx = f;
if (lx->ptr >= lx->allocated) {
return 0;
}
return lx->buffered[lx->ptr++];
}
static long limit_xm_getnc(char *ptr, long n, void *f)
{
LIMITED_XM *lx = f;
int left;
left = lx->allocated - lx->ptr;
if (n > left) {
if (left > 0) {
memcpy( ptr, lx->buffered + lx->ptr, left );
memset( ptr + left, 0, n - left );
} else {
memset( ptr, 0, n );
}
} else {
memcpy( ptr, lx->buffered + lx->ptr, n );
}
lx->ptr += n;
return n;
}
static void limit_xm_close(void *f)
{
LIMITED_XM *lx = f;
if (lx->buffered) free(lx->buffered);
/* Do NOT close lx->remaining */
free(f);
}
/* These two can be stubs since this implementation doesn't use seeking */
static int limit_xm_seek(void *f, long n)
{
(void)f;
(void)n;
return 1;
}
static long limit_xm_get_size(void *f)
{
(void)f;
return 0;
}
DUMBFILE_SYSTEM limit_xm_dfs = {
NULL,
&limit_xm_skip,
&limit_xm_getc,
&limit_xm_getnc,
&limit_xm_close,
&limit_xm_seek,
&limit_xm_get_size
};
static DUMBFILE *dumbfile_limit_xm(DUMBFILE *f)
{
LIMITED_XM * lx = malloc(sizeof(*lx));
lx->remaining = f;
lx->buffered = NULL;
lx->ptr = 0;
lx->limit = 0;
lx->allocated = 0;
return dumbfile_open_ex( lx, &limit_xm_dfs );
}
static int it_xm_read_instrument(IT_INSTRUMENT *instrument, XM_INSTRUMENT_EXTRA *extra, DUMBFILE *f)
{
unsigned long size, bytes_read;
unsigned short vol_points[24];
unsigned short pan_points[24];
int i, type;
const unsigned long max_size = 4 + 22 + 1 + 2 + 4 + 96 + 48 + 48 + 1 * 14 + 2 + 2;
unsigned long skip_end = 0;
/* Header size. Tends to be more than the actual size of the structure.
* So unread bytes must be skipped before reading the first sample
* header.
*/
if ( limit_xm_resize( f, 4 ) < 0 ) return -1;
size = dumbfile_igetl(f);
dumbfile_getnc(instrument->name, 22, f);
if ( size == 0 ) size = max_size;
else if ( size > max_size )
{
skip_end = size - max_size;
size = max_size;
}
if ( limit_xm_resize( f, size - 4 ) < 0 ) return -1;
dumbfile_getnc((char *)instrument->name, 22, f);
instrument->name[22] = 0;
trim_whitespace((char *)instrument->name, 22);
instrument->filename[0] = 0;
dumbfile_skip(f, 1); /* Instrument type. Should be 0, but seems random. */
extra->n_samples = dumbfile_igetw(f);
@ -349,10 +527,11 @@ static int it_xm_read_instrument(IT_INSTRUMENT *instrument, XM_INSTRUMENT_EXTRA
if (extra->n_samples) {
/* sample header size */
if (dumbfile_igetl(f) != 0x28) {
TRACE("XM error: unexpected sample header size\n");
return -1;
}
/*i = dumbfile_igetl(f);
if (!i || i > 0x28) i = 0x28;*/
dumbfile_skip(f, 4);
i = 0x28;
extra->sample_header_size = i;
/* sample map */
for (i = 0; i < 96; i++) {
@ -425,7 +604,7 @@ static int it_xm_read_instrument(IT_INSTRUMENT *instrument, XM_INSTRUMENT_EXTRA
extra->vibrato_depth = dumbfile_getc(f);
extra->vibrato_speed = dumbfile_getc(f);
if (dumbfile_error(f) || extra->vibrato_type >= 4)
if (dumbfile_error(f) || extra->vibrato_type > 4) // XXX
return -1;
/** WARNING: lossy approximation */
@ -438,7 +617,10 @@ static int it_xm_read_instrument(IT_INSTRUMENT *instrument, XM_INSTRUMENT_EXTRA
for (i = 0; i < 96; i++)
instrument->map_sample[i] = 0;
if (dumbfile_skip(f, size - bytes_read))
if (size > bytes_read && dumbfile_skip(f, size - bytes_read))
return -1;
if (skip_end && limit_xm_skip_end(f, skip_end))
return -1;
instrument->new_note_action = NNA_NOTE_CUT;
@ -477,6 +659,7 @@ static int it_xm_read_sample_header(IT_SAMPLE *sample, DUMBFILE *f)
int finetune;
int roguebytes;
int roguebytesmask;
int reserved;
sample->length = dumbfile_igetl(f);
sample->loop_start = dumbfile_igetl(f);
@ -488,22 +671,34 @@ static int it_xm_read_sample_header(IT_SAMPLE *sample, DUMBFILE *f)
sample->default_pan = dumbfile_getc(f); /* 0-255 */
relative_note_number = (signed char)dumbfile_getc(f);
dumbfile_skip(f, 1); /* reserved */
reserved = dumbfile_getc(f);
dumbfile_getnc(sample->name, 22, f);
dumbfile_getnc((char *)sample->name, 22, f);
sample->name[22] = 0;
trim_whitespace((char *)sample->name, 22);
sample->filename[0] = 0;
if (dumbfile_error(f))
return -1;
sample->C5_speed = (long)(16726.0*pow(DUMB_SEMITONE_BASE, relative_note_number)*pow(DUMB_PITCH_BASE, finetune*2));
sample->C5_speed = (long)(16726.0*pow(DUMB_SEMITONE_BASE, relative_note_number) /**pow(DUMB_PITCH_BASE, )*/ );
sample->finetune = finetune*2;
sample->flags = IT_SAMPLE_EXISTS;
if (reserved == 0xAD &&
(!(type & (XM_SAMPLE_16BIT | XM_SAMPLE_STEREO))))
{
/* F U Olivier Lapicque */
roguebytes = 4;
roguebytesmask = 4 << 2;
}
else
{
roguebytes = (int)sample->length;
roguebytesmask = 3;
}
if (type & XM_SAMPLE_16BIT) {
sample->flags |= IT_SAMPLE_16BIT;
@ -552,7 +747,7 @@ static int it_xm_read_sample_data(IT_SAMPLE *sample, unsigned char roguebytes, D
return dumbfile_skip(f, roguebytes);
/* let's get rid of the sample data coming after the end of the loop */
if ((sample->flags & IT_SAMPLE_LOOP) && sample->loop_end < sample->length) {
if ((sample->flags & IT_SAMPLE_LOOP) && sample->loop_end < sample->length && roguebytes != 4) {
truncated_size = sample->length - sample->loop_end;
sample->length = sample->loop_end;
} else {
@ -566,6 +761,14 @@ static int it_xm_read_sample_data(IT_SAMPLE *sample, unsigned char roguebytes, D
if (!sample->data)
return -1;
if (roguebytes == 4)
{
if (_dumb_it_read_sample_data_adpcm4(sample, f) < 0)
return -1;
roguebytes = 0;
}
else
{
/* sample data is stored as signed delta values */
old = 0;
if (sample->flags & IT_SAMPLE_16BIT)
@ -574,6 +777,7 @@ static int it_xm_read_sample_data(IT_SAMPLE *sample, unsigned char roguebytes, D
else
for (i = 0; i < sample->length; i++)
((signed char *)sample->data)[i*n_channels] = old += dumbfile_getc(f);
}
/* skip truncated data */
dumbfile_skip(f, (sample->flags & IT_SAMPLE_16BIT) ? (2*truncated_size) : (truncated_size));
@ -607,11 +811,12 @@ static int it_xm_read_sample_data(IT_SAMPLE *sample, unsigned char roguebytes, D
* (Never trust the documentation provided with a tracker.
* Real files are the only truth...)
*/
static DUMB_IT_SIGDATA *it_xm_load_sigdata(DUMBFILE *f)
static DUMB_IT_SIGDATA *it_xm_load_sigdata(DUMBFILE *f, int * version)
{
DUMB_IT_SIGDATA *sigdata;
char id_text[18];
int header_size;
int flags;
int n_channels;
int total_samples;
@ -631,11 +836,12 @@ static DUMB_IT_SIGDATA *it_xm_load_sigdata(DUMBFILE *f)
return NULL;
/* song name */
if (dumbfile_getnc(sigdata->name, 20, f) < 20) {
if (dumbfile_getnc((char *)sigdata->name, 20, f) < 20) {
free(sigdata);
return NULL;
}
sigdata->name[20] = 0;
trim_whitespace((char *)sigdata->name, 20);
if (dumbfile_getc(f) != 0x1A) {
TRACE("XM error: 0x1A not found\n");
@ -650,7 +856,8 @@ static DUMB_IT_SIGDATA *it_xm_load_sigdata(DUMBFILE *f)
}
/* version number */
if (dumbfile_igetw(f) != 0x0104) {
* version = dumbfile_igetw(f);
if (* version > 0x0104 || * version < 0x0102) {
TRACE("XM error: wrong format version\n");
free(sigdata);
return NULL;
@ -663,7 +870,8 @@ static DUMB_IT_SIGDATA *it_xm_load_sigdata(DUMBFILE *f)
*/
/* header size */
if (dumbfile_igetl(f) != 0x0114) {
header_size = dumbfile_igetl(f);
if (header_size < (4 + 2*8 + 1) || header_size > 0x114) {
TRACE("XM error: unexpected header size\n");
free(sigdata);
return NULL;
@ -681,15 +889,18 @@ static DUMB_IT_SIGDATA *it_xm_load_sigdata(DUMBFILE *f)
sigdata->n_orders = dumbfile_igetw(f);
sigdata->restart_position = dumbfile_igetw(f);
n_channels = dumbfile_igetw(f); /* max 32 but we'll be lenient */
sigdata->n_pchannels = n_channels;
sigdata->n_patterns = dumbfile_igetw(f);
sigdata->n_instruments = dumbfile_igetw(f); /* max 128 */
sigdata->n_instruments = dumbfile_igetw(f); /* max 128 */ /* XXX upped to 256 */
flags = dumbfile_igetw(f);
sigdata->speed = dumbfile_igetw(f);
if (sigdata->speed == 0) sigdata->speed = 6; // Should we? What about tempo?
sigdata->tempo = dumbfile_igetw(f);
/* sanity checks */
if (dumbfile_error(f) || sigdata->n_orders <= 0 || sigdata->n_orders > 256 || sigdata->n_patterns > 256 || sigdata->n_instruments > 128 || n_channels > DUMB_IT_N_CHANNELS) {
// XXX
i = header_size - 4 - 2 * 8; /* Maximum number of orders expected */
if (dumbfile_error(f) || sigdata->n_orders <= 0 || sigdata->n_orders > i || sigdata->n_patterns > 256 || sigdata->n_instruments > 256 || n_channels > DUMB_IT_N_CHANNELS) {
_dumb_it_unload_sigdata(sigdata);
return NULL;
}
@ -703,14 +914,15 @@ static DUMB_IT_SIGDATA *it_xm_load_sigdata(DUMBFILE *f)
_dumb_it_unload_sigdata(sigdata);
return NULL;
}
dumbfile_getnc(sigdata->order, sigdata->n_orders, f);
dumbfile_skip(f, 256 - sigdata->n_orders);
dumbfile_getnc((char *)sigdata->order, sigdata->n_orders, f);
dumbfile_skip(f, i - sigdata->n_orders);
if (dumbfile_error(f)) {
_dumb_it_unload_sigdata(sigdata);
return NULL;
}
if ( * version > 0x103 ) {
/*
--------------------
--- Patterns ---
@ -732,7 +944,7 @@ static DUMB_IT_SIGDATA *it_xm_load_sigdata(DUMBFILE *f)
return NULL;
}
for (i = 0; i < sigdata->n_patterns; i++) {
if (it_xm_read_pattern(&sigdata->pattern[i], f, n_channels, buffer) != 0) {
if (it_xm_read_pattern(&sigdata->pattern[i], f, n_channels, buffer, * version) != 0) {
free(buffer);
_dumb_it_unload_sigdata(sigdata);
return NULL;
@ -770,12 +982,29 @@ static DUMB_IT_SIGDATA *it_xm_load_sigdata(DUMBFILE *f)
for (i = 0; i < sigdata->n_instruments; i++) {
XM_INSTRUMENT_EXTRA extra;
if (it_xm_read_instrument(&sigdata->instrument[i], &extra, f) < 0) {
TRACE("XM error: instrument %d\n", i+1);
DUMBFILE * lf = dumbfile_limit_xm( f );
if ( !lf ) {
_dumb_it_unload_sigdata(sigdata);
return NULL;
}
if (it_xm_read_instrument(&sigdata->instrument[i], &extra, lf) < 0) {
// XXX
if ( ! i )
{
TRACE("XM error: instrument %d\n", i+1);
dumbfile_close( lf );
_dumb_it_unload_sigdata(sigdata);
return NULL;
}
else
{
dumbfile_close( lf );
sigdata->n_instruments = i;
break;
}
}
if (extra.n_samples) {
unsigned char roguebytes[XM_MAX_SAMPLES_PER_INSTRUMENT];
@ -785,17 +1014,31 @@ static DUMB_IT_SIGDATA *it_xm_load_sigdata(DUMBFILE *f)
sigdata->sample = safe_realloc(sigdata->sample, sizeof(*sigdata->sample)*(total_samples+extra.n_samples));
if (!sigdata->sample) {
dumbfile_close( lf );
_dumb_it_unload_sigdata(sigdata);
return NULL;
}
for (j = total_samples; j < total_samples+extra.n_samples; j++)
sigdata->sample[j].data = NULL;
if ( limit_xm_resize( lf, 0 ) < 0 ) {
dumbfile_close( lf );
_dumb_it_unload_sigdata( sigdata );
return NULL;
}
/* read instrument's samples */
for (j = 0; j < extra.n_samples; j++) {
IT_SAMPLE *sample = &sigdata->sample[total_samples+j];
int b = it_xm_read_sample_header(sample, f);
int b;
if ( limit_xm_resize( lf, extra.sample_header_size ) < 0 ) {
dumbfile_close( lf );
_dumb_it_unload_sigdata( sigdata );
return NULL;
}
b = it_xm_read_sample_header(sample, lf);
if (b < 0) {
dumbfile_close( lf );
_dumb_it_unload_sigdata(sigdata);
return NULL;
}
@ -808,18 +1051,167 @@ static DUMB_IT_SIGDATA *it_xm_load_sigdata(DUMBFILE *f)
* accounted for in itrender.c.
*/
sample->vibrato_waveform = xm_convert_vibrato[extra.vibrato_type];
sample->max_resampling_quality = -1;
}
for (j = 0; j < extra.n_samples; j++) {
if (it_xm_read_sample_data(&sigdata->sample[total_samples+j], roguebytes[j], f) != 0) {
dumbfile_close( lf );
_dumb_it_unload_sigdata(sigdata);
return NULL;
}
}
total_samples += extra.n_samples;
}
dumbfile_close( lf );
}
sigdata->n_samples = total_samples;
} else {
// ahboy! old layout!
// first instruments and sample headers, then patterns, then sample data!
/*
-----------------------------------
--- Instruments and Samples ---
-----------------------------------
*/
unsigned char * roguebytes = malloc( sigdata->n_instruments * XM_MAX_SAMPLES_PER_INSTRUMENT );
if (!roguebytes) {
_dumb_it_unload_sigdata(sigdata);
return NULL;
}
sigdata->instrument = malloc(sigdata->n_instruments * sizeof(*sigdata->instrument));
if (!sigdata->instrument) {
_dumb_it_unload_sigdata(sigdata);
return NULL;
}
total_samples = 0;
sigdata->sample = NULL;
for (i = 0; i < sigdata->n_instruments; i++) {
XM_INSTRUMENT_EXTRA extra;
DUMBFILE * lf = dumbfile_limit_xm( f );
if ( !lf ) {
free(roguebytes);
_dumb_it_unload_sigdata(sigdata);
return NULL;
}
if (it_xm_read_instrument(&sigdata->instrument[i], &extra, lf) < 0) {
TRACE("XM error: instrument %d\n", i+1);
dumbfile_close(lf);
free(roguebytes);
_dumb_it_unload_sigdata(sigdata);
return NULL;
}
if (extra.n_samples) {
/* adjust instrument sample map (make indices absolute) */
for (j = 0; j < 96; j++)
sigdata->instrument[i].map_sample[j] += total_samples;
sigdata->sample = safe_realloc(sigdata->sample, sizeof(*sigdata->sample)*(total_samples+extra.n_samples));
if (!sigdata->sample) {
dumbfile_close( lf );
free(roguebytes);
_dumb_it_unload_sigdata(sigdata);
return NULL;
}
for (j = total_samples; j < total_samples+extra.n_samples; j++)
sigdata->sample[j].data = NULL;
if ( limit_xm_resize( lf, 0 ) < 0 ) {
dumbfile_close( lf );
free( roguebytes );
_dumb_it_unload_sigdata( sigdata );
return NULL;
}
/* read instrument's samples */
for (j = 0; j < extra.n_samples; j++) {
IT_SAMPLE *sample = &sigdata->sample[total_samples+j];
int b;
if ( limit_xm_resize( lf, extra.sample_header_size ) < 0 ) {
dumbfile_close( lf );
free( roguebytes );
_dumb_it_unload_sigdata( sigdata );
return NULL;
}
b = it_xm_read_sample_header(sample, lf);
if (b < 0) {
free(roguebytes);
_dumb_it_unload_sigdata(sigdata);
return NULL;
}
roguebytes[total_samples+j] = b;
// Any reason why these can't be set inside it_xm_read_sample_header()?
sample->vibrato_speed = extra.vibrato_speed;
sample->vibrato_depth = extra.vibrato_depth;
sample->vibrato_rate = extra.vibrato_sweep;
/* Rate and sweep don't match, but the difference is
* accounted for in itrender.c.
*/
sample->vibrato_waveform = xm_convert_vibrato[extra.vibrato_type];
sample->max_resampling_quality = -1;
}
total_samples += extra.n_samples;
}
dumbfile_close( lf );
}
sigdata->n_samples = total_samples;
/*
--------------------
--- Patterns ---
--------------------
*/
sigdata->pattern = malloc(sigdata->n_patterns * sizeof(*sigdata->pattern));
if (!sigdata->pattern) {
free(roguebytes);
_dumb_it_unload_sigdata(sigdata);
return NULL;
}
for (i = 0; i < sigdata->n_patterns; i++)
sigdata->pattern[i].entry = NULL;
{
unsigned char *buffer = malloc(1280 * n_channels); /* 256 rows * 5 bytes */
if (!buffer) {
free(roguebytes);
_dumb_it_unload_sigdata(sigdata);
return NULL;
}
for (i = 0; i < sigdata->n_patterns; i++) {
if (it_xm_read_pattern(&sigdata->pattern[i], f, n_channels, buffer, * version) != 0) {
free(buffer);
free(roguebytes);
_dumb_it_unload_sigdata(sigdata);
return NULL;
}
}
free(buffer);
}
// and now we load the sample data
for (j = 0; j < total_samples; j++) {
if (it_xm_read_sample_data(&sigdata->sample[j], roguebytes[j], f) != 0) {
free(roguebytes);
_dumb_it_unload_sigdata(sigdata);
return NULL;
}
}
free(roguebytes);
}
sigdata->flags = IT_WAS_AN_XM | IT_OLD_EFFECTS | IT_COMPATIBLE_GXX | IT_STEREO | IT_USE_INSTRUMENTS;
// Are we OK with IT_COMPATIBLE_GXX off?
@ -986,22 +1378,40 @@ long it_compute_length(const DUMB_IT_SIGDATA *sigdata)
#endif /* 0 */
static char hexdigit(int in)
{
if (in < 10) return in + '0';
else return in + 'A' - 10;
}
DUH *dumb_read_xm_quick(DUMBFILE *f)
{
sigdata_t *sigdata;
int ver;
DUH_SIGTYPE_DESC *descptr = &_dumb_sigtype_it;
sigdata = it_xm_load_sigdata(f);
sigdata = it_xm_load_sigdata(f, &ver);
if (!sigdata)
return NULL;
{
const char *tag[1][2];
char version[16];
const char *tag[2][2];
tag[0][0] = "TITLE";
tag[0][1] = ((DUMB_IT_SIGDATA *)sigdata)->name;
return make_duh(-1, 1, (const char *const (*)[2])tag, 1, &descptr, &sigdata);
tag[0][1] = (const char *)(((DUMB_IT_SIGDATA *)sigdata)->name);
tag[1][0] = "FORMAT";
version[0] = 'X';
version[1] = 'M';
version[2] = ' ';
version[3] = 'v';
version[4] = hexdigit( ( ver >> 8 ) & 15 );
version[5] = '.';
version[6] = hexdigit( ( ver >> 4 ) & 15 );
version[7] = hexdigit( ver & 15 );
version[8] = 0;
tag[1][1] = ( const char * ) & version;
return make_duh(-1, 2, (const char *const (*)[2])tag, 1, &descptr, &sigdata);
}
}

View file

@ -25,8 +25,6 @@
#include "dumb.h"
#include "internal/it.h"
#if 0
unsigned char **_dumb_malloc2(int w, int h)
{
@ -76,7 +74,7 @@ static const char xm_has_memory[] = {
/* Effects marked with 'special' are handled specifically in itrender.c */
void _dumb_it_xm_convert_effect(int effect, int value, IT_ENTRY *entry)
void _dumb_it_xm_convert_effect(int effect, int value, IT_ENTRY *entry, int mod)
{
const int log = 0;
@ -126,7 +124,7 @@ if (log) printf(" - %2d %02X", effect, value);
case XM_APPREGIO: effect = IT_ARPEGGIO; break;
case XM_VIBRATO: effect = IT_VIBRATO; break;
case XM_TONE_PORTAMENTO: effect = IT_TONE_PORTAMENTO; break; /** TODO: glissando control */
case XM_TONE_PORTAMENTO: effect = IT_TONE_PORTAMENTO; break;
case XM_TREMOLO: effect = IT_TREMOLO; break;
case XM_SET_PANNING: effect = IT_SET_PANNING; break;
case XM_SAMPLE_OFFSET: effect = IT_SET_SAMPLE_OFFSET; break;
@ -142,6 +140,7 @@ if (log) printf(" - %2d %02X", effect, value);
case XM_PATTERN_BREAK:
effect = IT_BREAK_TO_ROW;
value = BCD_TO_NORMAL(value);
if (value > 63) value = 0; /* FT2, maybe ProTracker? */
break;
case XM_VOLUME_SLIDE: /* special */
@ -151,8 +150,8 @@ if (log) printf(" - %2d %02X", effect, value);
case XM_PANNING_SLIDE:
effect = IT_PANNING_SLIDE;
value = HIGH(value) ? EFFECT_VALUE(HIGH(value), 0) : EFFECT_VALUE(0, LOW(value));
//value = HIGH(value) ? EFFECT_VALUE(0, HIGH(value)) : EFFECT_VALUE(LOW(value), 0);
//value = HIGH(value) ? EFFECT_VALUE(HIGH(value), 0) : EFFECT_VALUE(0, LOW(value));
value = HIGH(value) ? EFFECT_VALUE(0, HIGH(value)) : EFFECT_VALUE(LOW(value), 0);
break;
case XM_GLOBAL_VOLUME_SLIDE: /* special */
@ -161,12 +160,14 @@ if (log) printf(" - %2d %02X", effect, value);
break;
case XM_SET_TEMPO_BPM:
effect = (value < 0x20) ? (IT_SET_SPEED) : (IT_SET_SONG_TEMPO);
if (mod) effect = (value <= 0x20) ? (IT_SET_SPEED) : (IT_SET_SONG_TEMPO);
else effect = (value < 0x20) ? (IT_SET_SPEED) : (IT_SET_SONG_TEMPO);
break;
case XM_SET_GLOBAL_VOLUME:
effect = IT_SET_GLOBAL_VOLUME;
value *= 2;
if (value > 128) value = 128;
break;
case XM_KEY_OFF:
@ -179,13 +180,15 @@ if (log) printf(" - %2d %02X", effect, value);
case EBASE+XM_E_SET_FILTER: effect = SBASE+IT_S_SET_FILTER; break;
case EBASE+XM_E_SET_GLISSANDO_CONTROL: effect = SBASE+IT_S_SET_GLISSANDO_CONTROL; break; /** TODO */
case EBASE+XM_E_SET_FINETUNE: effect = SBASE+IT_S_FINETUNE; break; /** TODO */
case EBASE+XM_E_SET_FINETUNE: effect = SBASE+IT_S_FINETUNE; break;
case EBASE+XM_E_SET_LOOP: effect = SBASE+IT_S_PATTERN_LOOP; break;
case EBASE+XM_E_NOTE_CUT: effect = SBASE+IT_S_DELAYED_NOTE_CUT; break;
case EBASE+XM_E_NOTE_DELAY: effect = SBASE+IT_S_NOTE_DELAY; break;
case EBASE+XM_E_PATTERN_DELAY: effect = SBASE+IT_S_PATTERN_DELAY; break;
case EBASE+XM_E_SET_PANNING: effect = SBASE+IT_S_SET_PAN; break;
case EBASE+XM_E_FINE_VOLSLIDE_UP: effect = IT_XM_FINE_VOLSLIDE_UP; break;
case EBASE+XM_E_FINE_VOLSLIDE_DOWN: effect = IT_XM_FINE_VOLSLIDE_DOWN; break;
case EBASE+XM_E_SET_MIDI_MACRO: effect = SBASE+IT_S_SET_MIDI_MACRO; break;
case EBASE + XM_E_FINE_PORTA_UP:
effect = IT_PORTAMENTO_UP;
@ -204,12 +207,12 @@ if (log) printf(" - %2d %02X", effect, value);
case EBASE + XM_E_SET_VIBRATO_CONTROL:
effect = SBASE+IT_S_SET_VIBRATO_WAVEFORM;
value &= ~4; /** TODO: value&4 -> don't retrig wave */
value &= ~4;
break;
case EBASE + XM_E_SET_TREMOLO_CONTROL:
effect = SBASE+IT_S_SET_TREMOLO_WAVEFORM;
value &= ~4; /** TODO: value&4 -> don't retrig wave */
value &= ~4;
break;
case XBASE + XM_X_EXTRAFINE_PORTA_UP:

View file

@ -0,0 +1,3 @@
*.user
Debug
Release

File diff suppressed because it is too large Load diff

View file

@ -0,0 +1,221 @@
<?xml version="1.0" encoding="utf-8"?>
<Project DefaultTargets="Build" ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<ItemGroup Label="ProjectConfigurations">
<ProjectConfiguration Include="Debug|Win32">
<Configuration>Debug</Configuration>
<Platform>Win32</Platform>
</ProjectConfiguration>
<ProjectConfiguration Include="Release|Win32">
<Configuration>Release</Configuration>
<Platform>Win32</Platform>
</ProjectConfiguration>
</ItemGroup>
<PropertyGroup Label="Globals">
<ProjectGuid>{612D360C-A51B-4B34-8F49-33F42A2957F5}</ProjectGuid>
<RootNamespace>dumb</RootNamespace>
<SccProjectName>
</SccProjectName>
<SccLocalPath>
</SccLocalPath>
<SccProvider>
</SccProvider>
<SccAuxPath>
</SccAuxPath>
</PropertyGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="Configuration">
<ConfigurationType>StaticLibrary</ConfigurationType>
<WholeProgramOptimization>true</WholeProgramOptimization>
<PlatformToolset>v110_xp</PlatformToolset>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration">
<ConfigurationType>StaticLibrary</ConfigurationType>
<PlatformToolset>v110_xp</PlatformToolset>
</PropertyGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" />
<ImportGroup Label="ExtensionSettings">
</ImportGroup>
<ImportGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="PropertySheets">
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" />
</ImportGroup>
<ImportGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="PropertySheets">
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" />
</ImportGroup>
<PropertyGroup Label="UserMacros" />
<PropertyGroup>
<_ProjectFileVersion>10.0.21006.1</_ProjectFileVersion>
<CodeAnalysisRuleSet Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">AllRules.ruleset</CodeAnalysisRuleSet>
<CodeAnalysisRules Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" />
<CodeAnalysisRuleAssemblies Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" />
<CodeAnalysisRuleSet Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">AllRules.ruleset</CodeAnalysisRuleSet>
<CodeAnalysisRules Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" />
<CodeAnalysisRuleAssemblies Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" />
</PropertyGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
<ClCompile>
<Optimization>Disabled</Optimization>
<AdditionalIncludeDirectories>../../include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
<PreprocessorDefinitions>_USE_SSE;_DEBUG;WIN32;_LIB;DUMB_DECLARE_DEPRECATED;DEBUGMODE=1;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<BasicRuntimeChecks>EnableFastChecks</BasicRuntimeChecks>
<RuntimeLibrary>MultiThreadedDebug</RuntimeLibrary>
<WarningLevel>Level3</WarningLevel>
<SuppressStartupBanner>true</SuppressStartupBanner>
<DebugInformationFormat>EditAndContinue</DebugInformationFormat>
<CompileAs>Default</CompileAs>
</ClCompile>
<ResourceCompile>
<PreprocessorDefinitions>_DEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<Culture>0x0409</Culture>
</ResourceCompile>
<Lib>
<SuppressStartupBanner>true</SuppressStartupBanner>
</Lib>
</ItemDefinitionGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
<ClCompile>
<Optimization>MaxSpeed</Optimization>
<InlineFunctionExpansion>AnySuitable</InlineFunctionExpansion>
<AdditionalIncludeDirectories>../../include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
<PreprocessorDefinitions>_USE_SSE;NDEBUG;WIN32;_LIB;DUMB_DECLARE_DEPRECATED;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<StringPooling>true</StringPooling>
<RuntimeLibrary>MultiThreaded</RuntimeLibrary>
<FunctionLevelLinking>true</FunctionLevelLinking>
<WarningLevel>Level3</WarningLevel>
<SuppressStartupBanner>true</SuppressStartupBanner>
<DebugInformationFormat>ProgramDatabase</DebugInformationFormat>
<CompileAs>Default</CompileAs>
<FloatingPointModel>Fast</FloatingPointModel>
<EnableEnhancedInstructionSet>NoExtensions</EnableEnhancedInstructionSet>
</ClCompile>
<ResourceCompile>
<PreprocessorDefinitions>NDEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<Culture>0x0409</Culture>
</ResourceCompile>
<Lib>
<SuppressStartupBanner>true</SuppressStartupBanner>
</Lib>
</ItemDefinitionGroup>
<ItemGroup>
<ClCompile Include="..\..\src\core\atexit.c" />
<ClCompile Include="..\..\src\core\duhlen.c" />
<ClCompile Include="..\..\src\core\duhtag.c" />
<ClCompile Include="..\..\src\core\dumbfile.c" />
<ClCompile Include="..\..\src\core\loadduh.c" />
<ClCompile Include="..\..\src\core\makeduh.c" />
<ClCompile Include="..\..\src\core\rawsig.c" />
<ClCompile Include="..\..\src\core\readduh.c" />
<ClCompile Include="..\..\src\core\register.c" />
<ClCompile Include="..\..\src\core\rendduh.c" />
<ClCompile Include="..\..\src\core\rendsig.c" />
<ClCompile Include="..\..\src\core\unload.c" />
<ClCompile Include="..\..\src\helpers\barray.c" />
<ClCompile Include="..\..\src\helpers\blip_buf.c" />
<ClCompile Include="..\..\src\helpers\clickrem.c" />
<ClCompile Include="..\..\src\helpers\fir_resampler.c" />
<ClCompile Include="..\..\src\helpers\lanczos_resampler.c" />
<ClCompile Include="..\..\src\helpers\lpc.c" />
<ClCompile Include="..\..\src\helpers\memfile.c" />
<ClCompile Include="..\..\src\helpers\resample.c" />
<ClCompile Include="..\..\src\helpers\riff.c" />
<ClCompile Include="..\..\src\helpers\sampbuf.c" />
<ClCompile Include="..\..\src\helpers\silence.c" />
<ClCompile Include="..\..\src\helpers\stdfile.c" />
<ClCompile Include="..\..\src\helpers\tarray.c" />
<ClCompile Include="..\..\src\it\itmisc.c" />
<ClCompile Include="..\..\src\it\itorder.c" />
<ClCompile Include="..\..\src\it\itrender.c" />
<ClCompile Include="..\..\src\it\itunload.c" />
<ClCompile Include="..\..\src\it\loadany.c" />
<ClCompile Include="..\..\src\it\loadany2.c" />
<ClCompile Include="..\..\src\it\loadokt.c" />
<ClCompile Include="..\..\src\it\loadokt2.c" />
<ClCompile Include="..\..\src\it\ptmeffect.c" />
<ClCompile Include="..\..\src\it\readany.c" />
<ClCompile Include="..\..\src\it\readany2.c" />
<ClCompile Include="..\..\src\it\readokt.c" />
<ClCompile Include="..\..\src\it\readokt2.c" />
<ClCompile Include="..\..\src\it\xmeffect.c" />
<ClCompile Include="..\..\src\it\itload.c" />
<ClCompile Include="..\..\src\it\itload2.c" />
<ClCompile Include="..\..\src\it\load669.c" />
<ClCompile Include="..\..\src\it\load6692.c" />
<ClCompile Include="..\..\src\it\loadamf.c" />
<ClCompile Include="..\..\src\it\loadamf2.c" />
<ClCompile Include="..\..\src\it\loadasy.c" />
<ClCompile Include="..\..\src\it\loadasy2.c" />
<ClCompile Include="..\..\src\it\loadmod.c" />
<ClCompile Include="..\..\src\it\loadmod2.c" />
<ClCompile Include="..\..\src\it\loadmtm.c" />
<ClCompile Include="..\..\src\it\loadmtm2.c" />
<ClCompile Include="..\..\src\it\loadoldpsm.c" />
<ClCompile Include="..\..\src\it\loadoldpsm2.c" />
<ClCompile Include="..\..\src\it\loadpsm.c" />
<ClCompile Include="..\..\src\it\loadpsm2.c" />
<ClCompile Include="..\..\src\it\loadptm.c" />
<ClCompile Include="..\..\src\it\loadptm2.c" />
<ClCompile Include="..\..\src\it\loadriff.c" />
<ClCompile Include="..\..\src\it\loadriff2.c" />
<ClCompile Include="..\..\src\it\loads3m.c" />
<ClCompile Include="..\..\src\it\loads3m2.c" />
<ClCompile Include="..\..\src\it\loadstm.c" />
<ClCompile Include="..\..\src\it\loadstm2.c" />
<ClCompile Include="..\..\src\it\loadxm.c" />
<ClCompile Include="..\..\src\it\loadxm2.c" />
<ClCompile Include="..\..\src\it\itread.c" />
<ClCompile Include="..\..\src\it\itread2.c" />
<ClCompile Include="..\..\src\it\read669.c" />
<ClCompile Include="..\..\src\it\read6692.c" />
<ClCompile Include="..\..\src\it\readam.c" />
<ClCompile Include="..\..\src\it\readamf.c" />
<ClCompile Include="..\..\src\it\readamf2.c" />
<ClCompile Include="..\..\src\it\readasy.c" />
<ClCompile Include="..\..\src\it\readdsmf.c" />
<ClCompile Include="..\..\src\it\readmod.c" />
<ClCompile Include="..\..\src\it\readmod2.c" />
<ClCompile Include="..\..\src\it\readmtm.c" />
<ClCompile Include="..\..\src\it\readoldpsm.c" />
<ClCompile Include="..\..\src\it\readpsm.c" />
<ClCompile Include="..\..\src\it\readptm.c" />
<ClCompile Include="..\..\src\it\readriff.c" />
<ClCompile Include="..\..\src\it\reads3m.c" />
<ClCompile Include="..\..\src\it\reads3m2.c" />
<ClCompile Include="..\..\src\it\readstm.c" />
<ClCompile Include="..\..\src\it\readstm2.c" />
<ClCompile Include="..\..\src\it\readxm.c" />
<ClCompile Include="..\..\src\it\readxm2.c" />
</ItemGroup>
<ItemGroup>
<CustomBuild Include="..\..\src\helpers\resamp2.inc">
<FileType>Document</FileType>
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">true</ExcludedFromBuild>
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">true</ExcludedFromBuild>
</CustomBuild>
<CustomBuild Include="..\..\src\helpers\resamp3.inc">
<FileType>Document</FileType>
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">true</ExcludedFromBuild>
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">true</ExcludedFromBuild>
</CustomBuild>
<CustomBuild Include="..\..\src\helpers\resample.inc">
<FileType>Document</FileType>
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">true</ExcludedFromBuild>
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">true</ExcludedFromBuild>
</CustomBuild>
</ItemGroup>
<ItemGroup>
<ClInclude Include="..\..\include\dumb.h" />
<ClInclude Include="..\..\include\internal\barray.h" />
<ClInclude Include="..\..\include\internal\blip_buf.h" />
<ClInclude Include="..\..\include\internal\dumb.h" />
<ClInclude Include="..\..\include\internal\dumbfile.h" />
<ClInclude Include="..\..\include\internal\fir_resampler.h" />
<ClInclude Include="..\..\include\internal\it.h" />
<ClInclude Include="..\..\include\internal\lanczos_resampler.h" />
<ClInclude Include="..\..\include\internal\lpc.h" />
<ClInclude Include="..\..\include\internal\riff.h" />
<ClInclude Include="..\..\include\internal\stack_alloc.h" />
<ClInclude Include="..\..\include\internal\tarray.h" />
</ItemGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
<ImportGroup Label="ExtensionTargets">
</ImportGroup>
</Project>

View file

@ -0,0 +1,341 @@
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<ItemGroup>
<Filter Include="include">
<UniqueIdentifier>{419c5e1f-2bf4-473a-b2e5-2e531285aa62}</UniqueIdentifier>
</Filter>
<Filter Include="include\internal">
<UniqueIdentifier>{44b333b3-1607-4820-82bc-e4c21a40e31a}</UniqueIdentifier>
</Filter>
<Filter Include="src">
<UniqueIdentifier>{0b122556-3781-4ef3-87fe-ffa5fb50b493}</UniqueIdentifier>
</Filter>
<Filter Include="src\core">
<UniqueIdentifier>{e961cd19-26f6-4df0-b895-e099d3e81db9}</UniqueIdentifier>
</Filter>
<Filter Include="src\helpers">
<UniqueIdentifier>{82e35139-08ff-4e99-a3ce-2254d7427ec4}</UniqueIdentifier>
</Filter>
<Filter Include="src\it">
<UniqueIdentifier>{5f7fc0f6-4008-4166-83ad-e5d914718bd0}</UniqueIdentifier>
</Filter>
<Filter Include="src\it\loaders">
<UniqueIdentifier>{0fd0715e-5824-4419-aa5b-2d4272d222ce}</UniqueIdentifier>
</Filter>
<Filter Include="src\it\readers">
<UniqueIdentifier>{b9e26fe7-6056-4580-b2c6-10e6116d4129}</UniqueIdentifier>
</Filter>
</ItemGroup>
<ItemGroup>
<ClCompile Include="..\..\src\core\atexit.c">
<Filter>src\core</Filter>
</ClCompile>
<ClCompile Include="..\..\src\core\duhlen.c">
<Filter>src\core</Filter>
</ClCompile>
<ClCompile Include="..\..\src\core\duhtag.c">
<Filter>src\core</Filter>
</ClCompile>
<ClCompile Include="..\..\src\core\dumbfile.c">
<Filter>src\core</Filter>
</ClCompile>
<ClCompile Include="..\..\src\core\loadduh.c">
<Filter>src\core</Filter>
</ClCompile>
<ClCompile Include="..\..\src\core\makeduh.c">
<Filter>src\core</Filter>
</ClCompile>
<ClCompile Include="..\..\src\core\rawsig.c">
<Filter>src\core</Filter>
</ClCompile>
<ClCompile Include="..\..\src\core\readduh.c">
<Filter>src\core</Filter>
</ClCompile>
<ClCompile Include="..\..\src\core\register.c">
<Filter>src\core</Filter>
</ClCompile>
<ClCompile Include="..\..\src\core\rendduh.c">
<Filter>src\core</Filter>
</ClCompile>
<ClCompile Include="..\..\src\core\rendsig.c">
<Filter>src\core</Filter>
</ClCompile>
<ClCompile Include="..\..\src\core\unload.c">
<Filter>src\core</Filter>
</ClCompile>
<ClCompile Include="..\..\src\helpers\barray.c">
<Filter>src\helpers</Filter>
</ClCompile>
<ClCompile Include="..\..\src\helpers\clickrem.c">
<Filter>src\helpers</Filter>
</ClCompile>
<ClCompile Include="..\..\src\helpers\fir_resampler.c">
<Filter>src\helpers</Filter>
</ClCompile>
<ClCompile Include="..\..\src\helpers\lpc.c">
<Filter>src\helpers</Filter>
</ClCompile>
<ClCompile Include="..\..\src\helpers\memfile.c">
<Filter>src\helpers</Filter>
</ClCompile>
<ClCompile Include="..\..\src\helpers\resample.c">
<Filter>src\helpers</Filter>
</ClCompile>
<ClCompile Include="..\..\src\helpers\riff.c">
<Filter>src\helpers</Filter>
</ClCompile>
<ClCompile Include="..\..\src\helpers\sampbuf.c">
<Filter>src\helpers</Filter>
</ClCompile>
<ClCompile Include="..\..\src\helpers\silence.c">
<Filter>src\helpers</Filter>
</ClCompile>
<ClCompile Include="..\..\src\helpers\stdfile.c">
<Filter>src\helpers</Filter>
</ClCompile>
<ClCompile Include="..\..\src\it\itload.c">
<Filter>src\it\loaders</Filter>
</ClCompile>
<ClCompile Include="..\..\src\it\itload2.c">
<Filter>src\it\loaders</Filter>
</ClCompile>
<ClCompile Include="..\..\src\it\itmisc.c">
<Filter>src\it</Filter>
</ClCompile>
<ClCompile Include="..\..\src\it\itorder.c">
<Filter>src\it</Filter>
</ClCompile>
<ClCompile Include="..\..\src\it\itread.c">
<Filter>src\it\readers</Filter>
</ClCompile>
<ClCompile Include="..\..\src\it\itread2.c">
<Filter>src\it\readers</Filter>
</ClCompile>
<ClCompile Include="..\..\src\it\itrender.c">
<Filter>src\it</Filter>
</ClCompile>
<ClCompile Include="..\..\src\it\itunload.c">
<Filter>src\it</Filter>
</ClCompile>
<ClCompile Include="..\..\src\it\load669.c">
<Filter>src\it\loaders</Filter>
</ClCompile>
<ClCompile Include="..\..\src\it\load6692.c">
<Filter>src\it\loaders</Filter>
</ClCompile>
<ClCompile Include="..\..\src\it\loadamf.c">
<Filter>src\it\loaders</Filter>
</ClCompile>
<ClCompile Include="..\..\src\it\loadamf2.c">
<Filter>src\it\loaders</Filter>
</ClCompile>
<ClCompile Include="..\..\src\it\loadasy.c">
<Filter>src\it\loaders</Filter>
</ClCompile>
<ClCompile Include="..\..\src\it\loadasy2.c">
<Filter>src\it\loaders</Filter>
</ClCompile>
<ClCompile Include="..\..\src\it\loadmod.c">
<Filter>src\it\loaders</Filter>
</ClCompile>
<ClCompile Include="..\..\src\it\loadmod2.c">
<Filter>src\it\loaders</Filter>
</ClCompile>
<ClCompile Include="..\..\src\it\loadmtm.c">
<Filter>src\it\loaders</Filter>
</ClCompile>
<ClCompile Include="..\..\src\it\loadmtm2.c">
<Filter>src\it\loaders</Filter>
</ClCompile>
<ClCompile Include="..\..\src\it\loadoldpsm.c">
<Filter>src\it\loaders</Filter>
</ClCompile>
<ClCompile Include="..\..\src\it\loadoldpsm2.c">
<Filter>src\it\loaders</Filter>
</ClCompile>
<ClCompile Include="..\..\src\it\loadpsm.c">
<Filter>src\it\loaders</Filter>
</ClCompile>
<ClCompile Include="..\..\src\it\loadpsm2.c">
<Filter>src\it\loaders</Filter>
</ClCompile>
<ClCompile Include="..\..\src\it\loadptm.c">
<Filter>src\it\loaders</Filter>
</ClCompile>
<ClCompile Include="..\..\src\it\loadptm2.c">
<Filter>src\it\loaders</Filter>
</ClCompile>
<ClCompile Include="..\..\src\it\loadriff.c">
<Filter>src\it\loaders</Filter>
</ClCompile>
<ClCompile Include="..\..\src\it\loadriff2.c">
<Filter>src\it\loaders</Filter>
</ClCompile>
<ClCompile Include="..\..\src\it\loads3m.c">
<Filter>src\it\loaders</Filter>
</ClCompile>
<ClCompile Include="..\..\src\it\loads3m2.c">
<Filter>src\it\loaders</Filter>
</ClCompile>
<ClCompile Include="..\..\src\it\loadstm.c">
<Filter>src\it\loaders</Filter>
</ClCompile>
<ClCompile Include="..\..\src\it\loadstm2.c">
<Filter>src\it\loaders</Filter>
</ClCompile>
<ClCompile Include="..\..\src\it\loadxm.c">
<Filter>src\it\loaders</Filter>
</ClCompile>
<ClCompile Include="..\..\src\it\loadxm2.c">
<Filter>src\it\loaders</Filter>
</ClCompile>
<ClCompile Include="..\..\src\it\ptmeffect.c">
<Filter>src\it</Filter>
</ClCompile>
<ClCompile Include="..\..\src\it\read669.c">
<Filter>src\it\readers</Filter>
</ClCompile>
<ClCompile Include="..\..\src\it\read6692.c">
<Filter>src\it\readers</Filter>
</ClCompile>
<ClCompile Include="..\..\src\it\readam.c">
<Filter>src\it\readers</Filter>
</ClCompile>
<ClCompile Include="..\..\src\it\readamf.c">
<Filter>src\it\readers</Filter>
</ClCompile>
<ClCompile Include="..\..\src\it\readamf2.c">
<Filter>src\it\readers</Filter>
</ClCompile>
<ClCompile Include="..\..\src\it\readasy.c">
<Filter>src\it\readers</Filter>
</ClCompile>
<ClCompile Include="..\..\src\it\readdsmf.c">
<Filter>src\it\readers</Filter>
</ClCompile>
<ClCompile Include="..\..\src\it\readmod.c">
<Filter>src\it\readers</Filter>
</ClCompile>
<ClCompile Include="..\..\src\it\readmod2.c">
<Filter>src\it\readers</Filter>
</ClCompile>
<ClCompile Include="..\..\src\it\readmtm.c">
<Filter>src\it\readers</Filter>
</ClCompile>
<ClCompile Include="..\..\src\it\readoldpsm.c">
<Filter>src\it\readers</Filter>
</ClCompile>
<ClCompile Include="..\..\src\it\readpsm.c">
<Filter>src\it\readers</Filter>
</ClCompile>
<ClCompile Include="..\..\src\it\readptm.c">
<Filter>src\it\readers</Filter>
</ClCompile>
<ClCompile Include="..\..\src\it\readriff.c">
<Filter>src\it\readers</Filter>
</ClCompile>
<ClCompile Include="..\..\src\it\reads3m.c">
<Filter>src\it\readers</Filter>
</ClCompile>
<ClCompile Include="..\..\src\it\reads3m2.c">
<Filter>src\it\readers</Filter>
</ClCompile>
<ClCompile Include="..\..\src\it\readstm.c">
<Filter>src\it\readers</Filter>
</ClCompile>
<ClCompile Include="..\..\src\it\readstm2.c">
<Filter>src\it\readers</Filter>
</ClCompile>
<ClCompile Include="..\..\src\it\readxm.c">
<Filter>src\it\readers</Filter>
</ClCompile>
<ClCompile Include="..\..\src\it\readxm2.c">
<Filter>src\it\readers</Filter>
</ClCompile>
<ClCompile Include="..\..\src\it\xmeffect.c">
<Filter>src\it</Filter>
</ClCompile>
<ClCompile Include="..\..\src\helpers\blip_buf.c">
<Filter>src\helpers</Filter>
</ClCompile>
<ClCompile Include="..\..\src\it\readokt.c">
<Filter>src\it\readers</Filter>
</ClCompile>
<ClCompile Include="..\..\src\it\readokt2.c">
<Filter>src\it\readers</Filter>
</ClCompile>
<ClCompile Include="..\..\src\it\loadokt.c">
<Filter>src\it\loaders</Filter>
</ClCompile>
<ClCompile Include="..\..\src\it\loadokt2.c">
<Filter>src\it\loaders</Filter>
</ClCompile>
<ClCompile Include="..\..\src\it\loadany.c">
<Filter>src\it\loaders</Filter>
</ClCompile>
<ClCompile Include="..\..\src\it\loadany2.c">
<Filter>src\it\loaders</Filter>
</ClCompile>
<ClCompile Include="..\..\src\it\readany.c">
<Filter>src\it\readers</Filter>
</ClCompile>
<ClCompile Include="..\..\src\it\readany2.c">
<Filter>src\it\readers</Filter>
</ClCompile>
<ClCompile Include="..\..\src\helpers\lanczos_resampler.c">
<Filter>src\helpers</Filter>
</ClCompile>
<ClCompile Include="..\..\src\helpers\tarray.c">
<Filter>src\helpers</Filter>
</ClCompile>
</ItemGroup>
<ItemGroup>
<ClInclude Include="..\..\include\dumb.h">
<Filter>include</Filter>
</ClInclude>
<ClInclude Include="..\..\include\internal\barray.h">
<Filter>include\internal</Filter>
</ClInclude>
<ClInclude Include="..\..\include\internal\dumb.h">
<Filter>include\internal</Filter>
</ClInclude>
<ClInclude Include="..\..\include\internal\dumbfile.h">
<Filter>include\internal</Filter>
</ClInclude>
<ClInclude Include="..\..\include\internal\fir_resampler.h">
<Filter>include\internal</Filter>
</ClInclude>
<ClInclude Include="..\..\include\internal\it.h">
<Filter>include\internal</Filter>
</ClInclude>
<ClInclude Include="..\..\include\internal\lpc.h">
<Filter>include\internal</Filter>
</ClInclude>
<ClInclude Include="..\..\include\internal\riff.h">
<Filter>include\internal</Filter>
</ClInclude>
<ClInclude Include="..\..\include\internal\stack_alloc.h">
<Filter>include\internal</Filter>
</ClInclude>
<ClInclude Include="..\..\include\internal\blip_buf.h">
<Filter>include\internal</Filter>
</ClInclude>
<ClInclude Include="..\..\include\internal\lanczos_resampler.h">
<Filter>include\internal</Filter>
</ClInclude>
<ClInclude Include="..\..\include\internal\tarray.h">
<Filter>include\internal</Filter>
</ClInclude>
</ItemGroup>
<ItemGroup>
<CustomBuild Include="..\..\src\helpers\resamp3.inc">
<Filter>src\helpers</Filter>
</CustomBuild>
<CustomBuild Include="..\..\src\helpers\resamp2.inc">
<Filter>src\helpers</Filter>
</CustomBuild>
<CustomBuild Include="..\..\src\helpers\resample.inc">
<Filter>src\helpers</Filter>
</CustomBuild>
</ItemGroup>
</Project>

View file

@ -420,9 +420,15 @@
/* Begin PBXProject section */
0867D690FE84028FC02AAC07 /* Project object */ = {
isa = PBXProject;
attributes = {
};
buildConfigurationList = 1DEB91B108733DA50010E9CD /* Build configuration list for PBXProject "flac" */;
compatibilityVersion = "Xcode 2.4";
developmentRegion = English;
hasScannedForEncodings = 1;
knownRegions = (
en,
);
mainGroup = 0867D691FE84028FC02AAC07 /* flac */;
productRefGroup = 034768DFFF38A50411DB9C8B /* Products */;
projectDirPath = "";
@ -503,6 +509,7 @@
PRIVATE_HEADERS_FOLDER_PATH = "$(CONTENTS_FOLDER_PATH)/PrivateHeaders";
PRODUCT_NAME = FLAC;
PUBLIC_HEADERS_FOLDER_PATH = "$(CONTENTS_FOLDER_PATH)/Headers";
SDKROOT = macosx10.6;
USER_HEADER_SEARCH_PATHS = "";
USE_SEPERATE_HEADERMAPS = YES;
WRAPPER_EXTENSION = framework;
@ -543,6 +550,7 @@
PRIVATE_HEADERS_FOLDER_PATH = "$(CONTENTS_FOLDER_PATH)/PrivateHeaders";
PRODUCT_NAME = FLAC;
PUBLIC_HEADERS_FOLDER_PATH = "$(CONTENTS_FOLDER_PATH)/Headers";
SDKROOT = macosx10.6;
USER_HEADER_SEARCH_PATHS = "";
USE_SEPERATE_HEADERMAPS = YES;
WRAPPER_EXTENSION = framework;

View file

@ -10,7 +10,6 @@
17C8F1F40CBED286008D969D /* Ay_Apu.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 17C8F18B0CBED286008D969D /* Ay_Apu.cpp */; };
17C8F1F50CBED286008D969D /* Ay_Apu.h in Headers */ = {isa = PBXBuildFile; fileRef = 17C8F18C0CBED286008D969D /* Ay_Apu.h */; };
17C8F1F60CBED286008D969D /* Ay_Cpu.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 17C8F18D0CBED286008D969D /* Ay_Cpu.cpp */; };
17C8F1F70CBED286008D969D /* Ay_Cpu.h in Headers */ = {isa = PBXBuildFile; fileRef = 17C8F18E0CBED286008D969D /* Ay_Cpu.h */; };
17C8F1F80CBED286008D969D /* Ay_Emu.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 17C8F18F0CBED286008D969D /* Ay_Emu.cpp */; };
17C8F1F90CBED286008D969D /* Ay_Emu.h in Headers */ = {isa = PBXBuildFile; fileRef = 17C8F1900CBED286008D969D /* Ay_Emu.h */; };
17C8F1FA0CBED286008D969D /* blargg_common.h in Headers */ = {isa = PBXBuildFile; fileRef = 17C8F1910CBED286008D969D /* blargg_common.h */; };
@ -31,7 +30,6 @@
17C8F2090CBED286008D969D /* Fir_Resampler.h in Headers */ = {isa = PBXBuildFile; fileRef = 17C8F1A00CBED286008D969D /* Fir_Resampler.h */; };
17C8F20A0CBED286008D969D /* Gb_Apu.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 17C8F1A10CBED286008D969D /* Gb_Apu.cpp */; };
17C8F20B0CBED286008D969D /* Gb_Apu.h in Headers */ = {isa = PBXBuildFile; fileRef = 17C8F1A20CBED286008D969D /* Gb_Apu.h */; };
17C8F20C0CBED286008D969D /* gb_cpu_io.h in Headers */ = {isa = PBXBuildFile; fileRef = 17C8F1A30CBED286008D969D /* gb_cpu_io.h */; };
17C8F20D0CBED286008D969D /* Gb_Cpu.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 17C8F1A40CBED286008D969D /* Gb_Cpu.cpp */; };
17C8F20E0CBED286008D969D /* Gb_Cpu.h in Headers */ = {isa = PBXBuildFile; fileRef = 17C8F1A50CBED286008D969D /* Gb_Cpu.h */; };
17C8F20F0CBED286008D969D /* Gb_Oscs.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 17C8F1A60CBED286008D969D /* Gb_Oscs.cpp */; };
@ -46,13 +44,11 @@
17C8F2190CBED286008D969D /* Gym_Emu.h in Headers */ = {isa = PBXBuildFile; fileRef = 17C8F1B00CBED286008D969D /* Gym_Emu.h */; };
17C8F21A0CBED286008D969D /* Hes_Apu.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 17C8F1B10CBED286008D969D /* Hes_Apu.cpp */; };
17C8F21B0CBED286008D969D /* Hes_Apu.h in Headers */ = {isa = PBXBuildFile; fileRef = 17C8F1B20CBED286008D969D /* Hes_Apu.h */; };
17C8F21C0CBED286008D969D /* hes_cpu_io.h in Headers */ = {isa = PBXBuildFile; fileRef = 17C8F1B30CBED286008D969D /* hes_cpu_io.h */; };
17C8F21D0CBED286008D969D /* Hes_Cpu.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 17C8F1B40CBED286008D969D /* Hes_Cpu.cpp */; };
17C8F21E0CBED286008D969D /* Hes_Cpu.h in Headers */ = {isa = PBXBuildFile; fileRef = 17C8F1B50CBED286008D969D /* Hes_Cpu.h */; };
17C8F21F0CBED286008D969D /* Hes_Emu.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 17C8F1B60CBED286008D969D /* Hes_Emu.cpp */; };
17C8F2200CBED286008D969D /* Hes_Emu.h in Headers */ = {isa = PBXBuildFile; fileRef = 17C8F1B70CBED286008D969D /* Hes_Emu.h */; };
17C8F2210CBED286008D969D /* Kss_Cpu.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 17C8F1B80CBED286008D969D /* Kss_Cpu.cpp */; };
17C8F2220CBED286008D969D /* Kss_Cpu.h in Headers */ = {isa = PBXBuildFile; fileRef = 17C8F1B90CBED286008D969D /* Kss_Cpu.h */; };
17C8F2230CBED286008D969D /* Kss_Emu.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 17C8F1BA0CBED286008D969D /* Kss_Emu.cpp */; };
17C8F2240CBED286008D969D /* Kss_Emu.h in Headers */ = {isa = PBXBuildFile; fileRef = 17C8F1BB0CBED286008D969D /* Kss_Emu.h */; };
17C8F2250CBED286008D969D /* Kss_Scc_Apu.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 17C8F1BC0CBED286008D969D /* Kss_Scc_Apu.cpp */; };
@ -65,7 +61,6 @@
17C8F22D0CBED286008D969D /* Music_Emu.h in Headers */ = {isa = PBXBuildFile; fileRef = 17C8F1C40CBED286008D969D /* Music_Emu.h */; };
17C8F22E0CBED286008D969D /* Nes_Apu.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 17C8F1C50CBED286008D969D /* Nes_Apu.cpp */; };
17C8F22F0CBED286008D969D /* Nes_Apu.h in Headers */ = {isa = PBXBuildFile; fileRef = 17C8F1C60CBED286008D969D /* Nes_Apu.h */; };
17C8F2300CBED286008D969D /* nes_cpu_io.h in Headers */ = {isa = PBXBuildFile; fileRef = 17C8F1C70CBED286008D969D /* nes_cpu_io.h */; };
17C8F2310CBED286008D969D /* Nes_Cpu.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 17C8F1C80CBED286008D969D /* Nes_Cpu.cpp */; };
17C8F2320CBED286008D969D /* Nes_Cpu.h in Headers */ = {isa = PBXBuildFile; fileRef = 17C8F1C90CBED286008D969D /* Nes_Cpu.h */; };
17C8F2330CBED286008D969D /* Nes_Fme7_Apu.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 17C8F1CA0CBED286008D969D /* Nes_Fme7_Apu.cpp */; };
@ -82,14 +77,11 @@
17C8F23E0CBED286008D969D /* Nsfe_Emu.h in Headers */ = {isa = PBXBuildFile; fileRef = 17C8F1D50CBED286008D969D /* Nsfe_Emu.h */; };
17C8F23F0CBED286008D969D /* Sap_Apu.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 17C8F1D60CBED286008D969D /* Sap_Apu.cpp */; };
17C8F2400CBED286008D969D /* Sap_Apu.h in Headers */ = {isa = PBXBuildFile; fileRef = 17C8F1D70CBED286008D969D /* Sap_Apu.h */; };
17C8F2410CBED286008D969D /* sap_cpu_io.h in Headers */ = {isa = PBXBuildFile; fileRef = 17C8F1D80CBED286008D969D /* sap_cpu_io.h */; };
17C8F2420CBED286008D969D /* Sap_Cpu.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 17C8F1D90CBED286008D969D /* Sap_Cpu.cpp */; };
17C8F2430CBED286008D969D /* Sap_Cpu.h in Headers */ = {isa = PBXBuildFile; fileRef = 17C8F1DA0CBED286008D969D /* Sap_Cpu.h */; };
17C8F2440CBED286008D969D /* Sap_Emu.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 17C8F1DB0CBED286008D969D /* Sap_Emu.cpp */; };
17C8F2450CBED286008D969D /* Sap_Emu.h in Headers */ = {isa = PBXBuildFile; fileRef = 17C8F1DC0CBED286008D969D /* Sap_Emu.h */; };
17C8F2460CBED286008D969D /* Sms_Apu.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 17C8F1DD0CBED286008D969D /* Sms_Apu.cpp */; };
17C8F2470CBED286008D969D /* Sms_Apu.h in Headers */ = {isa = PBXBuildFile; fileRef = 17C8F1DE0CBED286008D969D /* Sms_Apu.h */; };
17C8F2480CBED286008D969D /* Sms_Oscs.h in Headers */ = {isa = PBXBuildFile; fileRef = 17C8F1DF0CBED286008D969D /* Sms_Oscs.h */; };
17C8F2490CBED286008D969D /* Snes_Spc.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 17C8F1E00CBED286008D969D /* Snes_Spc.cpp */; };
17C8F24A0CBED286008D969D /* Snes_Spc.h in Headers */ = {isa = PBXBuildFile; fileRef = 17C8F1E10CBED286008D969D /* Snes_Spc.h */; };
17C8F24B0CBED286008D969D /* Spc_Cpu.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 17C8F1E20CBED286008D969D /* Spc_Cpu.cpp */; };
@ -98,14 +90,171 @@
17C8F24E0CBED286008D969D /* Spc_Dsp.h in Headers */ = {isa = PBXBuildFile; fileRef = 17C8F1E50CBED286008D969D /* Spc_Dsp.h */; };
17C8F24F0CBED286008D969D /* Spc_Emu.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 17C8F1E60CBED286008D969D /* Spc_Emu.cpp */; };
17C8F2500CBED286008D969D /* Spc_Emu.h in Headers */ = {isa = PBXBuildFile; fileRef = 17C8F1E70CBED286008D969D /* Spc_Emu.h */; };
17C8F2510CBED286008D969D /* Vgm_Emu_Impl.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 17C8F1E80CBED286008D969D /* Vgm_Emu_Impl.cpp */; };
17C8F2520CBED286008D969D /* Vgm_Emu_Impl.h in Headers */ = {isa = PBXBuildFile; fileRef = 17C8F1E90CBED286008D969D /* Vgm_Emu_Impl.h */; };
17C8F2530CBED286008D969D /* Vgm_Emu.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 17C8F1EA0CBED286008D969D /* Vgm_Emu.cpp */; };
17C8F2540CBED286008D969D /* Vgm_Emu.h in Headers */ = {isa = PBXBuildFile; fileRef = 17C8F1EB0CBED286008D969D /* Vgm_Emu.h */; };
17C8F2550CBED286008D969D /* Ym2413_Emu.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 17C8F1EC0CBED286008D969D /* Ym2413_Emu.cpp */; };
17C8F2560CBED286008D969D /* Ym2413_Emu.h in Headers */ = {isa = PBXBuildFile; fileRef = 17C8F1ED0CBED286008D969D /* Ym2413_Emu.h */; };
17C8F2570CBED286008D969D /* Ym2612_Emu.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 17C8F1EE0CBED286008D969D /* Ym2612_Emu.cpp */; };
17C8F2580CBED286008D969D /* Ym2612_Emu.h in Headers */ = {isa = PBXBuildFile; fileRef = 17C8F1EF0CBED286008D969D /* Ym2612_Emu.h */; };
8370B72F17F615FE001A4D7A /* adlib.h in Headers */ = {isa = PBXBuildFile; fileRef = 8370B68C17F615FD001A4D7A /* adlib.h */; };
8370B73017F615FE001A4D7A /* Ay_Core.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 8370B68D17F615FD001A4D7A /* Ay_Core.cpp */; };
8370B73117F615FE001A4D7A /* Ay_Core.h in Headers */ = {isa = PBXBuildFile; fileRef = 8370B68E17F615FD001A4D7A /* Ay_Core.h */; };
8370B73217F615FE001A4D7A /* blargg_common.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 8370B68F17F615FD001A4D7A /* blargg_common.cpp */; };
8370B73317F615FE001A4D7A /* blargg_errors.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 8370B69017F615FD001A4D7A /* blargg_errors.cpp */; };
8370B73417F615FE001A4D7A /* blargg_errors.h in Headers */ = {isa = PBXBuildFile; fileRef = 8370B69117F615FD001A4D7A /* blargg_errors.h */; };
8370B73517F615FE001A4D7A /* Blip_Buffer_impl.h in Headers */ = {isa = PBXBuildFile; fileRef = 8370B69217F615FD001A4D7A /* Blip_Buffer_impl.h */; };
8370B73617F615FE001A4D7A /* Blip_Buffer_impl2.h in Headers */ = {isa = PBXBuildFile; fileRef = 8370B69317F615FD001A4D7A /* Blip_Buffer_impl2.h */; };
8370B73717F615FE001A4D7A /* Bml_Parser.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 8370B69417F615FD001A4D7A /* Bml_Parser.cpp */; };
8370B73817F615FE001A4D7A /* Bml_Parser.h in Headers */ = {isa = PBXBuildFile; fileRef = 8370B69517F615FD001A4D7A /* Bml_Parser.h */; };
8370B73917F615FE001A4D7A /* C140_Emu.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 8370B69617F615FD001A4D7A /* C140_Emu.cpp */; };
8370B73A17F615FE001A4D7A /* C140_Emu.h in Headers */ = {isa = PBXBuildFile; fileRef = 8370B69717F615FD001A4D7A /* C140_Emu.h */; };
8370B73B17F615FE001A4D7A /* c140.c in Sources */ = {isa = PBXBuildFile; fileRef = 8370B69817F615FD001A4D7A /* c140.c */; };
8370B73C17F615FE001A4D7A /* c140.h in Headers */ = {isa = PBXBuildFile; fileRef = 8370B69917F615FD001A4D7A /* c140.h */; };
8370B73D17F615FE001A4D7A /* Chip_Resampler.h in Headers */ = {isa = PBXBuildFile; fileRef = 8370B69A17F615FD001A4D7A /* Chip_Resampler.h */; };
8370B73E17F615FE001A4D7A /* dac_control.c in Sources */ = {isa = PBXBuildFile; fileRef = 8370B69B17F615FD001A4D7A /* dac_control.c */; };
8370B73F17F615FE001A4D7A /* dac_control.h in Headers */ = {isa = PBXBuildFile; fileRef = 8370B69C17F615FD001A4D7A /* dac_control.h */; };
8370B74017F615FE001A4D7A /* dbopl.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 8370B69D17F615FD001A4D7A /* dbopl.cpp */; };
8370B74117F615FE001A4D7A /* dbopl.h in Headers */ = {isa = PBXBuildFile; fileRef = 8370B69E17F615FD001A4D7A /* dbopl.h */; };
8370B74217F615FE001A4D7A /* divfix.h in Headers */ = {isa = PBXBuildFile; fileRef = 8370B69F17F615FD001A4D7A /* divfix.h */; };
8370B74317F615FE001A4D7A /* Downsampler.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 8370B6A017F615FD001A4D7A /* Downsampler.cpp */; };
8370B74417F615FE001A4D7A /* Downsampler.h in Headers */ = {isa = PBXBuildFile; fileRef = 8370B6A117F615FD001A4D7A /* Downsampler.h */; };
8370B74517F615FE001A4D7A /* emuconfig.h in Headers */ = {isa = PBXBuildFile; fileRef = 8370B6A217F615FD001A4D7A /* emuconfig.h */; };
8370B74617F615FE001A4D7A /* fm.c in Sources */ = {isa = PBXBuildFile; fileRef = 8370B6A317F615FD001A4D7A /* fm.c */; };
8370B74717F615FE001A4D7A /* fm.h in Headers */ = {isa = PBXBuildFile; fileRef = 8370B6A417F615FD001A4D7A /* fm.h */; };
8370B74817F615FE001A4D7A /* fm2612.c in Sources */ = {isa = PBXBuildFile; fileRef = 8370B6A517F615FD001A4D7A /* fm2612.c */; };
8370B74917F615FE001A4D7A /* fmopl.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 8370B6A617F615FD001A4D7A /* fmopl.cpp */; };
8370B74A17F615FE001A4D7A /* fmopl.h in Headers */ = {isa = PBXBuildFile; fileRef = 8370B6A717F615FD001A4D7A /* fmopl.h */; };
8370B74B17F615FE001A4D7A /* Gb_Cpu_run.h in Headers */ = {isa = PBXBuildFile; fileRef = 8370B6A817F615FD001A4D7A /* Gb_Cpu_run.h */; };
8370B74C17F615FE001A4D7A /* Gbs_Core.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 8370B6A917F615FD001A4D7A /* Gbs_Core.cpp */; };
8370B74D17F615FE001A4D7A /* Gbs_Core.h in Headers */ = {isa = PBXBuildFile; fileRef = 8370B6AA17F615FD001A4D7A /* Gbs_Core.h */; };
8370B74E17F615FE001A4D7A /* Gbs_Cpu.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 8370B6AB17F615FD001A4D7A /* Gbs_Cpu.cpp */; };
8370B75117F615FE001A4D7A /* Gme_Loader.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 8370B6AE17F615FD001A4D7A /* Gme_Loader.cpp */; };
8370B75217F615FE001A4D7A /* Gme_Loader.h in Headers */ = {isa = PBXBuildFile; fileRef = 8370B6AF17F615FD001A4D7A /* Gme_Loader.h */; };
8370B75317F615FE001A4D7A /* Hes_Apu_Adpcm.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 8370B6B017F615FD001A4D7A /* Hes_Apu_Adpcm.cpp */; };
8370B75417F615FE001A4D7A /* Hes_Apu_Adpcm.h in Headers */ = {isa = PBXBuildFile; fileRef = 8370B6B117F615FD001A4D7A /* Hes_Apu_Adpcm.h */; };
8370B75517F615FE001A4D7A /* Hes_Core.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 8370B6B217F615FD001A4D7A /* Hes_Core.cpp */; };
8370B75617F615FE001A4D7A /* Hes_Core.h in Headers */ = {isa = PBXBuildFile; fileRef = 8370B6B317F615FD001A4D7A /* Hes_Core.h */; };
8370B75717F615FE001A4D7A /* Hes_Cpu_run.h in Headers */ = {isa = PBXBuildFile; fileRef = 8370B6B417F615FD001A4D7A /* Hes_Cpu_run.h */; };
8370B75817F615FE001A4D7A /* i_fmpac.h in Headers */ = {isa = PBXBuildFile; fileRef = 8370B6B517F615FD001A4D7A /* i_fmpac.h */; };
8370B75917F615FE001A4D7A /* i_fmunit.h in Headers */ = {isa = PBXBuildFile; fileRef = 8370B6B617F615FD001A4D7A /* i_fmunit.h */; };
8370B75A17F615FE001A4D7A /* i_vrc7.h in Headers */ = {isa = PBXBuildFile; fileRef = 8370B6B717F615FD001A4D7A /* i_vrc7.h */; };
8370B75B17F615FE001A4D7A /* K051649_Emu.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 8370B6B817F615FD001A4D7A /* K051649_Emu.cpp */; };
8370B75C17F615FE001A4D7A /* K051649_Emu.h in Headers */ = {isa = PBXBuildFile; fileRef = 8370B6B917F615FD001A4D7A /* K051649_Emu.h */; };
8370B75D17F615FE001A4D7A /* k051649.c in Sources */ = {isa = PBXBuildFile; fileRef = 8370B6BA17F615FD001A4D7A /* k051649.c */; };
8370B75E17F615FE001A4D7A /* k051649.h in Headers */ = {isa = PBXBuildFile; fileRef = 8370B6BB17F615FD001A4D7A /* k051649.h */; };
8370B75F17F615FE001A4D7A /* K053260_Emu.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 8370B6BC17F615FD001A4D7A /* K053260_Emu.cpp */; };
8370B76017F615FE001A4D7A /* K053260_Emu.h in Headers */ = {isa = PBXBuildFile; fileRef = 8370B6BD17F615FD001A4D7A /* K053260_Emu.h */; };
8370B76117F615FE001A4D7A /* k053260.c in Sources */ = {isa = PBXBuildFile; fileRef = 8370B6BE17F615FD001A4D7A /* k053260.c */; };
8370B76217F615FE001A4D7A /* k053260.h in Headers */ = {isa = PBXBuildFile; fileRef = 8370B6BF17F615FD001A4D7A /* k053260.h */; };
8370B76317F615FE001A4D7A /* K054539_Emu.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 8370B6C017F615FD001A4D7A /* K054539_Emu.cpp */; };
8370B76417F615FE001A4D7A /* K054539_Emu.h in Headers */ = {isa = PBXBuildFile; fileRef = 8370B6C117F615FD001A4D7A /* K054539_Emu.h */; };
8370B76517F615FE001A4D7A /* k054539.c in Sources */ = {isa = PBXBuildFile; fileRef = 8370B6C217F615FD001A4D7A /* k054539.c */; };
8370B76617F615FE001A4D7A /* k054539.h in Headers */ = {isa = PBXBuildFile; fileRef = 8370B6C317F615FD001A4D7A /* k054539.h */; };
8370B76717F615FE001A4D7A /* kmsnddev.h in Headers */ = {isa = PBXBuildFile; fileRef = 8370B6C417F615FD001A4D7A /* kmsnddev.h */; };
8370B76817F615FE001A4D7A /* Kss_Core.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 8370B6C517F615FD001A4D7A /* Kss_Core.cpp */; };
8370B76917F615FE001A4D7A /* Kss_Core.h in Headers */ = {isa = PBXBuildFile; fileRef = 8370B6C617F615FD001A4D7A /* Kss_Core.h */; };
8370B76A17F615FE001A4D7A /* mamedef.h in Headers */ = {isa = PBXBuildFile; fileRef = 8370B6C717F615FD001A4D7A /* mamedef.h */; };
8370B76B17F615FE001A4D7A /* mathdefs.h in Headers */ = {isa = PBXBuildFile; fileRef = 8370B6C817F615FD001A4D7A /* mathdefs.h */; };
8370B76C17F615FE001A4D7A /* Nes_Cpu_run.h in Headers */ = {isa = PBXBuildFile; fileRef = 8370B6C917F615FD001A4D7A /* Nes_Cpu_run.h */; };
8370B76D17F615FE001A4D7A /* Nes_Fds_Apu.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 8370B6CA17F615FD001A4D7A /* Nes_Fds_Apu.cpp */; };
8370B76E17F615FE001A4D7A /* Nes_Fds_Apu.h in Headers */ = {isa = PBXBuildFile; fileRef = 8370B6CB17F615FD001A4D7A /* Nes_Fds_Apu.h */; };
8370B76F17F615FE001A4D7A /* Nes_Mmc5_Apu.h in Headers */ = {isa = PBXBuildFile; fileRef = 8370B6CC17F615FD001A4D7A /* Nes_Mmc5_Apu.h */; };
8370B77017F615FE001A4D7A /* Nes_Vrc7_Apu.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 8370B6CD17F615FD001A4D7A /* Nes_Vrc7_Apu.cpp */; };
8370B77117F615FE001A4D7A /* Nes_Vrc7_Apu.h in Headers */ = {isa = PBXBuildFile; fileRef = 8370B6CE17F615FD001A4D7A /* Nes_Vrc7_Apu.h */; };
8370B77217F615FE001A4D7A /* nestypes.h in Headers */ = {isa = PBXBuildFile; fileRef = 8370B6CF17F615FD001A4D7A /* nestypes.h */; };
8370B77317F615FE001A4D7A /* Nsf_Core.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 8370B6D017F615FD001A4D7A /* Nsf_Core.cpp */; };
8370B77417F615FE001A4D7A /* Nsf_Core.h in Headers */ = {isa = PBXBuildFile; fileRef = 8370B6D117F615FD001A4D7A /* Nsf_Core.h */; };
8370B77517F615FE001A4D7A /* Nsf_Cpu.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 8370B6D217F615FD001A4D7A /* Nsf_Cpu.cpp */; };
8370B77617F615FE001A4D7A /* Nsf_Impl.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 8370B6D317F615FD001A4D7A /* Nsf_Impl.cpp */; };
8370B77717F615FE001A4D7A /* Nsf_Impl.h in Headers */ = {isa = PBXBuildFile; fileRef = 8370B6D417F615FD001A4D7A /* Nsf_Impl.h */; };
8370B77817F615FE001A4D7A /* Okim6258_Emu.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 8370B6D517F615FD001A4D7A /* Okim6258_Emu.cpp */; };
8370B77917F615FE001A4D7A /* Okim6258_Emu.h in Headers */ = {isa = PBXBuildFile; fileRef = 8370B6D617F615FD001A4D7A /* Okim6258_Emu.h */; };
8370B77A17F615FE001A4D7A /* okim6258.c in Sources */ = {isa = PBXBuildFile; fileRef = 8370B6D717F615FD001A4D7A /* okim6258.c */; };
8370B77B17F615FE001A4D7A /* okim6258.h in Headers */ = {isa = PBXBuildFile; fileRef = 8370B6D817F615FD001A4D7A /* okim6258.h */; };
8370B77C17F615FE001A4D7A /* Okim6295_Emu.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 8370B6D917F615FD001A4D7A /* Okim6295_Emu.cpp */; };
8370B77D17F615FE001A4D7A /* Okim6295_Emu.h in Headers */ = {isa = PBXBuildFile; fileRef = 8370B6DA17F615FD001A4D7A /* Okim6295_Emu.h */; };
8370B77E17F615FE001A4D7A /* okim6295.c in Sources */ = {isa = PBXBuildFile; fileRef = 8370B6DB17F615FD001A4D7A /* okim6295.c */; };
8370B77F17F615FE001A4D7A /* okim6295.h in Headers */ = {isa = PBXBuildFile; fileRef = 8370B6DC17F615FD001A4D7A /* okim6295.h */; };
8370B78017F615FE001A4D7A /* Opl_Apu.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 8370B6DD17F615FD001A4D7A /* Opl_Apu.cpp */; };
8370B78117F615FE001A4D7A /* Opl_Apu.h in Headers */ = {isa = PBXBuildFile; fileRef = 8370B6DE17F615FE001A4D7A /* Opl_Apu.h */; };
8370B78217F615FE001A4D7A /* Pwm_Emu.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 8370B6DF17F615FE001A4D7A /* Pwm_Emu.cpp */; };
8370B78317F615FE001A4D7A /* Pwm_Emu.h in Headers */ = {isa = PBXBuildFile; fileRef = 8370B6E017F615FE001A4D7A /* Pwm_Emu.h */; };
8370B78417F615FE001A4D7A /* pwm.c in Sources */ = {isa = PBXBuildFile; fileRef = 8370B6E117F615FE001A4D7A /* pwm.c */; };
8370B78517F615FE001A4D7A /* pwm.h in Headers */ = {isa = PBXBuildFile; fileRef = 8370B6E217F615FE001A4D7A /* pwm.h */; };
8370B78617F615FE001A4D7A /* qmix.c in Sources */ = {isa = PBXBuildFile; fileRef = 8370B6E317F615FE001A4D7A /* qmix.c */; };
8370B78717F615FE001A4D7A /* qmix.h in Headers */ = {isa = PBXBuildFile; fileRef = 8370B6E417F615FE001A4D7A /* qmix.h */; };
8370B78817F615FE001A4D7A /* Qsound_Apu.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 8370B6E517F615FE001A4D7A /* Qsound_Apu.cpp */; };
8370B78917F615FE001A4D7A /* Qsound_Apu.h in Headers */ = {isa = PBXBuildFile; fileRef = 8370B6E617F615FE001A4D7A /* Qsound_Apu.h */; };
8370B78A17F615FE001A4D7A /* Resampler.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 8370B6E717F615FE001A4D7A /* Resampler.cpp */; };
8370B78B17F615FE001A4D7A /* Resampler.h in Headers */ = {isa = PBXBuildFile; fileRef = 8370B6E817F615FE001A4D7A /* Resampler.h */; };
8370B78C17F615FE001A4D7A /* Rf5C68_Emu.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 8370B6E917F615FE001A4D7A /* Rf5C68_Emu.cpp */; };
8370B78D17F615FE001A4D7A /* Rf5C68_Emu.h in Headers */ = {isa = PBXBuildFile; fileRef = 8370B6EA17F615FE001A4D7A /* Rf5C68_Emu.h */; };
8370B78E17F615FE001A4D7A /* rf5c68.c in Sources */ = {isa = PBXBuildFile; fileRef = 8370B6EB17F615FE001A4D7A /* rf5c68.c */; };
8370B78F17F615FE001A4D7A /* rf5c68.h in Headers */ = {isa = PBXBuildFile; fileRef = 8370B6EC17F615FE001A4D7A /* rf5c68.h */; };
8370B79017F615FE001A4D7A /* Rf5C164_Emu.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 8370B6ED17F615FE001A4D7A /* Rf5C164_Emu.cpp */; };
8370B79117F615FE001A4D7A /* Rf5C164_Emu.h in Headers */ = {isa = PBXBuildFile; fileRef = 8370B6EE17F615FE001A4D7A /* Rf5C164_Emu.h */; };
8370B79217F615FE001A4D7A /* Rom_Data.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 8370B6EF17F615FE001A4D7A /* Rom_Data.cpp */; };
8370B79317F615FE001A4D7A /* Rom_Data.h in Headers */ = {isa = PBXBuildFile; fileRef = 8370B6F017F615FE001A4D7A /* Rom_Data.h */; };
8370B79417F615FE001A4D7A /* s_deltat.c in Sources */ = {isa = PBXBuildFile; fileRef = 8370B6F117F615FE001A4D7A /* s_deltat.c */; };
8370B79517F615FE001A4D7A /* s_deltat.h in Headers */ = {isa = PBXBuildFile; fileRef = 8370B6F217F615FE001A4D7A /* s_deltat.h */; };
8370B79617F615FE001A4D7A /* s_logtbl.c in Sources */ = {isa = PBXBuildFile; fileRef = 8370B6F317F615FE001A4D7A /* s_logtbl.c */; };
8370B79717F615FE001A4D7A /* s_logtbl.h in Headers */ = {isa = PBXBuildFile; fileRef = 8370B6F417F615FE001A4D7A /* s_logtbl.h */; };
8370B79817F615FE001A4D7A /* s_opl.c in Sources */ = {isa = PBXBuildFile; fileRef = 8370B6F517F615FE001A4D7A /* s_opl.c */; };
8370B79917F615FE001A4D7A /* s_opl.h in Headers */ = {isa = PBXBuildFile; fileRef = 8370B6F617F615FE001A4D7A /* s_opl.h */; };
8370B79A17F615FE001A4D7A /* s_opltbl.c in Sources */ = {isa = PBXBuildFile; fileRef = 8370B6F717F615FE001A4D7A /* s_opltbl.c */; };
8370B79B17F615FE001A4D7A /* s_opltbl.h in Headers */ = {isa = PBXBuildFile; fileRef = 8370B6F817F615FE001A4D7A /* s_opltbl.h */; };
8370B79C17F615FE001A4D7A /* Sap_Core.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 8370B6F917F615FE001A4D7A /* Sap_Core.cpp */; };
8370B79D17F615FE001A4D7A /* Sap_Core.h in Headers */ = {isa = PBXBuildFile; fileRef = 8370B6FA17F615FE001A4D7A /* Sap_Core.h */; };
8370B79E17F615FE001A4D7A /* scd_pcm.c in Sources */ = {isa = PBXBuildFile; fileRef = 8370B6FB17F615FE001A4D7A /* scd_pcm.c */; };
8370B79F17F615FE001A4D7A /* scd_pcm.h in Headers */ = {isa = PBXBuildFile; fileRef = 8370B6FC17F615FE001A4D7A /* scd_pcm.h */; };
8370B7A017F615FE001A4D7A /* SegaPcm_Emu.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 8370B6FD17F615FE001A4D7A /* SegaPcm_Emu.cpp */; };
8370B7A117F615FE001A4D7A /* SegaPcm_Emu.h in Headers */ = {isa = PBXBuildFile; fileRef = 8370B6FE17F615FE001A4D7A /* SegaPcm_Emu.h */; };
8370B7A217F615FE001A4D7A /* segapcm.c in Sources */ = {isa = PBXBuildFile; fileRef = 8370B6FF17F615FE001A4D7A /* segapcm.c */; };
8370B7A317F615FE001A4D7A /* segapcm.h in Headers */ = {isa = PBXBuildFile; fileRef = 8370B70017F615FE001A4D7A /* segapcm.h */; };
8370B7A417F615FE001A4D7A /* Sgc_Core.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 8370B70117F615FE001A4D7A /* Sgc_Core.cpp */; };
8370B7A517F615FE001A4D7A /* Sgc_Core.h in Headers */ = {isa = PBXBuildFile; fileRef = 8370B70217F615FE001A4D7A /* Sgc_Core.h */; };
8370B7A617F615FE001A4D7A /* Sgc_Cpu.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 8370B70317F615FE001A4D7A /* Sgc_Cpu.cpp */; };
8370B7A717F615FE001A4D7A /* Sgc_Emu.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 8370B70417F615FE001A4D7A /* Sgc_Emu.cpp */; };
8370B7A817F615FE001A4D7A /* Sgc_Emu.h in Headers */ = {isa = PBXBuildFile; fileRef = 8370B70517F615FE001A4D7A /* Sgc_Emu.h */; };
8370B7A917F615FE001A4D7A /* Sgc_Impl.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 8370B70617F615FE001A4D7A /* Sgc_Impl.cpp */; };
8370B7AA17F615FE001A4D7A /* Sgc_Impl.h in Headers */ = {isa = PBXBuildFile; fileRef = 8370B70717F615FE001A4D7A /* Sgc_Impl.h */; };
8370B7AB17F615FE001A4D7A /* Sms_Fm_Apu.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 8370B70817F615FE001A4D7A /* Sms_Fm_Apu.cpp */; };
8370B7AC17F615FE001A4D7A /* Sms_Fm_Apu.h in Headers */ = {isa = PBXBuildFile; fileRef = 8370B70917F615FE001A4D7A /* Sms_Fm_Apu.h */; };
8370B7AD17F615FE001A4D7A /* Spc_Filter.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 8370B70A17F615FE001A4D7A /* Spc_Filter.cpp */; };
8370B7AE17F615FE001A4D7A /* Spc_Filter.h in Headers */ = {isa = PBXBuildFile; fileRef = 8370B70B17F615FE001A4D7A /* Spc_Filter.h */; };
8370B7AF17F615FE001A4D7A /* Spc_Sfm.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 8370B70C17F615FE001A4D7A /* Spc_Sfm.cpp */; };
8370B7B017F615FE001A4D7A /* Spc_Sfm.h in Headers */ = {isa = PBXBuildFile; fileRef = 8370B70D17F615FE001A4D7A /* Spc_Sfm.h */; };
8370B7B117F615FE001A4D7A /* Track_Filter.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 8370B70E17F615FE001A4D7A /* Track_Filter.cpp */; };
8370B7B217F615FE001A4D7A /* Track_Filter.h in Headers */ = {isa = PBXBuildFile; fileRef = 8370B70F17F615FE001A4D7A /* Track_Filter.h */; };
8370B7B317F615FE001A4D7A /* Upsampler.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 8370B71017F615FE001A4D7A /* Upsampler.cpp */; };
8370B7B417F615FE001A4D7A /* Upsampler.h in Headers */ = {isa = PBXBuildFile; fileRef = 8370B71117F615FE001A4D7A /* Upsampler.h */; };
8370B7B517F615FE001A4D7A /* Vgm_Core.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 8370B71217F615FE001A4D7A /* Vgm_Core.cpp */; };
8370B7B617F615FE001A4D7A /* Vgm_Core.h in Headers */ = {isa = PBXBuildFile; fileRef = 8370B71317F615FE001A4D7A /* Vgm_Core.h */; };
8370B7B717F615FE001A4D7A /* Ym2151_Emu.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 8370B71417F615FE001A4D7A /* Ym2151_Emu.cpp */; };
8370B7B817F615FE001A4D7A /* Ym2151_Emu.h in Headers */ = {isa = PBXBuildFile; fileRef = 8370B71517F615FE001A4D7A /* Ym2151_Emu.h */; };
8370B7B917F615FE001A4D7A /* ym2151.c in Sources */ = {isa = PBXBuildFile; fileRef = 8370B71617F615FE001A4D7A /* ym2151.c */; };
8370B7BA17F615FE001A4D7A /* ym2151.h in Headers */ = {isa = PBXBuildFile; fileRef = 8370B71717F615FE001A4D7A /* ym2151.h */; };
8370B7BB17F615FE001A4D7A /* Ym2203_Emu.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 8370B71817F615FE001A4D7A /* Ym2203_Emu.cpp */; };
8370B7BC17F615FE001A4D7A /* Ym2203_Emu.h in Headers */ = {isa = PBXBuildFile; fileRef = 8370B71917F615FE001A4D7A /* Ym2203_Emu.h */; };
8370B7BD17F615FE001A4D7A /* ym2413.c in Sources */ = {isa = PBXBuildFile; fileRef = 8370B71A17F615FE001A4D7A /* ym2413.c */; };
8370B7BE17F615FE001A4D7A /* ym2413.h in Headers */ = {isa = PBXBuildFile; fileRef = 8370B71B17F615FE001A4D7A /* ym2413.h */; };
8370B7BF17F615FE001A4D7A /* Ym2608_Emu.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 8370B71C17F615FE001A4D7A /* Ym2608_Emu.cpp */; };
8370B7C017F615FE001A4D7A /* Ym2608_Emu.h in Headers */ = {isa = PBXBuildFile; fileRef = 8370B71D17F615FE001A4D7A /* Ym2608_Emu.h */; };
8370B7C117F615FE001A4D7A /* Ym2610b_Emu.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 8370B71E17F615FE001A4D7A /* Ym2610b_Emu.cpp */; };
8370B7C217F615FE001A4D7A /* Ym2610b_Emu.h in Headers */ = {isa = PBXBuildFile; fileRef = 8370B71F17F615FE001A4D7A /* Ym2610b_Emu.h */; };
8370B7C517F615FE001A4D7A /* Ym3812_Emu.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 8370B72217F615FE001A4D7A /* Ym3812_Emu.cpp */; };
8370B7C617F615FE001A4D7A /* Ym3812_Emu.h in Headers */ = {isa = PBXBuildFile; fileRef = 8370B72317F615FE001A4D7A /* Ym3812_Emu.h */; };
8370B7C717F615FE001A4D7A /* ymdeltat.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 8370B72417F615FE001A4D7A /* ymdeltat.cpp */; };
8370B7C817F615FE001A4D7A /* ymdeltat.h in Headers */ = {isa = PBXBuildFile; fileRef = 8370B72517F615FE001A4D7A /* ymdeltat.h */; };
8370B7C917F615FE001A4D7A /* Ymf262_Emu.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 8370B72617F615FE001A4D7A /* Ymf262_Emu.cpp */; };
8370B7CA17F615FE001A4D7A /* Ymf262_Emu.h in Headers */ = {isa = PBXBuildFile; fileRef = 8370B72717F615FE001A4D7A /* Ymf262_Emu.h */; };
8370B7CB17F615FE001A4D7A /* Ymz280b_Emu.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 8370B72817F615FE001A4D7A /* Ymz280b_Emu.cpp */; };
8370B7CC17F615FE001A4D7A /* Ymz280b_Emu.h in Headers */ = {isa = PBXBuildFile; fileRef = 8370B72917F615FE001A4D7A /* Ymz280b_Emu.h */; };
8370B7CD17F615FE001A4D7A /* ymz280b.c in Sources */ = {isa = PBXBuildFile; fileRef = 8370B72A17F615FE001A4D7A /* ymz280b.c */; };
8370B7CE17F615FE001A4D7A /* ymz280b.h in Headers */ = {isa = PBXBuildFile; fileRef = 8370B72B17F615FE001A4D7A /* ymz280b.h */; };
8370B7CF17F615FE001A4D7A /* Z80_Cpu_run.h in Headers */ = {isa = PBXBuildFile; fileRef = 8370B72C17F615FE001A4D7A /* Z80_Cpu_run.h */; };
8370B7D017F615FE001A4D7A /* Z80_Cpu.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 8370B72D17F615FE001A4D7A /* Z80_Cpu.cpp */; };
8370B7D117F615FE001A4D7A /* Z80_Cpu.h in Headers */ = {isa = PBXBuildFile; fileRef = 8370B72E17F615FE001A4D7A /* Z80_Cpu.h */; };
8DC2EF530486A6940098B216 /* InfoPlist.strings in Resources */ = {isa = PBXBuildFile; fileRef = 089C1666FE841158C02AAC07 /* InfoPlist.strings */; };
8DC2EF570486A6940098B216 /* Cocoa.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 1058C7B1FEA5585E11CA2CBB /* Cocoa.framework */; };
/* End PBXBuildFile section */
@ -118,7 +267,6 @@
17C8F18B0CBED286008D969D /* Ay_Apu.cpp */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.cpp.cpp; name = Ay_Apu.cpp; path = gme/Ay_Apu.cpp; sourceTree = "<group>"; };
17C8F18C0CBED286008D969D /* Ay_Apu.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; name = Ay_Apu.h; path = gme/Ay_Apu.h; sourceTree = "<group>"; };
17C8F18D0CBED286008D969D /* Ay_Cpu.cpp */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.cpp.cpp; name = Ay_Cpu.cpp; path = gme/Ay_Cpu.cpp; sourceTree = "<group>"; };
17C8F18E0CBED286008D969D /* Ay_Cpu.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; name = Ay_Cpu.h; path = gme/Ay_Cpu.h; sourceTree = "<group>"; };
17C8F18F0CBED286008D969D /* Ay_Emu.cpp */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.cpp.cpp; name = Ay_Emu.cpp; path = gme/Ay_Emu.cpp; sourceTree = "<group>"; };
17C8F1900CBED286008D969D /* Ay_Emu.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; name = Ay_Emu.h; path = gme/Ay_Emu.h; sourceTree = "<group>"; };
17C8F1910CBED286008D969D /* blargg_common.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; name = blargg_common.h; path = gme/blargg_common.h; sourceTree = "<group>"; };
@ -139,7 +287,6 @@
17C8F1A00CBED286008D969D /* Fir_Resampler.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; name = Fir_Resampler.h; path = gme/Fir_Resampler.h; sourceTree = "<group>"; };
17C8F1A10CBED286008D969D /* Gb_Apu.cpp */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.cpp.cpp; name = Gb_Apu.cpp; path = gme/Gb_Apu.cpp; sourceTree = "<group>"; };
17C8F1A20CBED286008D969D /* Gb_Apu.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; name = Gb_Apu.h; path = gme/Gb_Apu.h; sourceTree = "<group>"; };
17C8F1A30CBED286008D969D /* gb_cpu_io.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; name = gb_cpu_io.h; path = gme/gb_cpu_io.h; sourceTree = "<group>"; };
17C8F1A40CBED286008D969D /* Gb_Cpu.cpp */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.cpp.cpp; name = Gb_Cpu.cpp; path = gme/Gb_Cpu.cpp; sourceTree = "<group>"; };
17C8F1A50CBED286008D969D /* Gb_Cpu.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; name = Gb_Cpu.h; path = gme/Gb_Cpu.h; sourceTree = "<group>"; };
17C8F1A60CBED286008D969D /* Gb_Oscs.cpp */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.cpp.cpp; name = Gb_Oscs.cpp; path = gme/Gb_Oscs.cpp; sourceTree = "<group>"; };
@ -154,13 +301,11 @@
17C8F1B00CBED286008D969D /* Gym_Emu.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; name = Gym_Emu.h; path = gme/Gym_Emu.h; sourceTree = "<group>"; };
17C8F1B10CBED286008D969D /* Hes_Apu.cpp */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.cpp.cpp; name = Hes_Apu.cpp; path = gme/Hes_Apu.cpp; sourceTree = "<group>"; };
17C8F1B20CBED286008D969D /* Hes_Apu.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; name = Hes_Apu.h; path = gme/Hes_Apu.h; sourceTree = "<group>"; };
17C8F1B30CBED286008D969D /* hes_cpu_io.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; name = hes_cpu_io.h; path = gme/hes_cpu_io.h; sourceTree = "<group>"; };
17C8F1B40CBED286008D969D /* Hes_Cpu.cpp */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.cpp.cpp; name = Hes_Cpu.cpp; path = gme/Hes_Cpu.cpp; sourceTree = "<group>"; };
17C8F1B50CBED286008D969D /* Hes_Cpu.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; name = Hes_Cpu.h; path = gme/Hes_Cpu.h; sourceTree = "<group>"; };
17C8F1B60CBED286008D969D /* Hes_Emu.cpp */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.cpp.cpp; name = Hes_Emu.cpp; path = gme/Hes_Emu.cpp; sourceTree = "<group>"; };
17C8F1B70CBED286008D969D /* Hes_Emu.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; name = Hes_Emu.h; path = gme/Hes_Emu.h; sourceTree = "<group>"; };
17C8F1B80CBED286008D969D /* Kss_Cpu.cpp */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.cpp.cpp; name = Kss_Cpu.cpp; path = gme/Kss_Cpu.cpp; sourceTree = "<group>"; };
17C8F1B90CBED286008D969D /* Kss_Cpu.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; name = Kss_Cpu.h; path = gme/Kss_Cpu.h; sourceTree = "<group>"; };
17C8F1BA0CBED286008D969D /* Kss_Emu.cpp */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.cpp.cpp; name = Kss_Emu.cpp; path = gme/Kss_Emu.cpp; sourceTree = "<group>"; };
17C8F1BB0CBED286008D969D /* Kss_Emu.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; name = Kss_Emu.h; path = gme/Kss_Emu.h; sourceTree = "<group>"; };
17C8F1BC0CBED286008D969D /* Kss_Scc_Apu.cpp */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.cpp.cpp; name = Kss_Scc_Apu.cpp; path = gme/Kss_Scc_Apu.cpp; sourceTree = "<group>"; };
@ -173,7 +318,6 @@
17C8F1C40CBED286008D969D /* Music_Emu.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; name = Music_Emu.h; path = gme/Music_Emu.h; sourceTree = "<group>"; };
17C8F1C50CBED286008D969D /* Nes_Apu.cpp */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.cpp.cpp; name = Nes_Apu.cpp; path = gme/Nes_Apu.cpp; sourceTree = "<group>"; };
17C8F1C60CBED286008D969D /* Nes_Apu.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; name = Nes_Apu.h; path = gme/Nes_Apu.h; sourceTree = "<group>"; };
17C8F1C70CBED286008D969D /* nes_cpu_io.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; name = nes_cpu_io.h; path = gme/nes_cpu_io.h; sourceTree = "<group>"; };
17C8F1C80CBED286008D969D /* Nes_Cpu.cpp */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.cpp.cpp; name = Nes_Cpu.cpp; path = gme/Nes_Cpu.cpp; sourceTree = "<group>"; };
17C8F1C90CBED286008D969D /* Nes_Cpu.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; name = Nes_Cpu.h; path = gme/Nes_Cpu.h; sourceTree = "<group>"; };
17C8F1CA0CBED286008D969D /* Nes_Fme7_Apu.cpp */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.cpp.cpp; name = Nes_Fme7_Apu.cpp; path = gme/Nes_Fme7_Apu.cpp; sourceTree = "<group>"; };
@ -190,14 +334,11 @@
17C8F1D50CBED286008D969D /* Nsfe_Emu.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; name = Nsfe_Emu.h; path = gme/Nsfe_Emu.h; sourceTree = "<group>"; };
17C8F1D60CBED286008D969D /* Sap_Apu.cpp */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.cpp.cpp; name = Sap_Apu.cpp; path = gme/Sap_Apu.cpp; sourceTree = "<group>"; };
17C8F1D70CBED286008D969D /* Sap_Apu.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; name = Sap_Apu.h; path = gme/Sap_Apu.h; sourceTree = "<group>"; };
17C8F1D80CBED286008D969D /* sap_cpu_io.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; name = sap_cpu_io.h; path = gme/sap_cpu_io.h; sourceTree = "<group>"; };
17C8F1D90CBED286008D969D /* Sap_Cpu.cpp */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.cpp.cpp; name = Sap_Cpu.cpp; path = gme/Sap_Cpu.cpp; sourceTree = "<group>"; };
17C8F1DA0CBED286008D969D /* Sap_Cpu.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; name = Sap_Cpu.h; path = gme/Sap_Cpu.h; sourceTree = "<group>"; };
17C8F1DB0CBED286008D969D /* Sap_Emu.cpp */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.cpp.cpp; name = Sap_Emu.cpp; path = gme/Sap_Emu.cpp; sourceTree = "<group>"; };
17C8F1DC0CBED286008D969D /* Sap_Emu.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; name = Sap_Emu.h; path = gme/Sap_Emu.h; sourceTree = "<group>"; };
17C8F1DD0CBED286008D969D /* Sms_Apu.cpp */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.cpp.cpp; name = Sms_Apu.cpp; path = gme/Sms_Apu.cpp; sourceTree = "<group>"; };
17C8F1DE0CBED286008D969D /* Sms_Apu.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; name = Sms_Apu.h; path = gme/Sms_Apu.h; sourceTree = "<group>"; };
17C8F1DF0CBED286008D969D /* Sms_Oscs.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; name = Sms_Oscs.h; path = gme/Sms_Oscs.h; sourceTree = "<group>"; };
17C8F1E00CBED286008D969D /* Snes_Spc.cpp */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.cpp.cpp; name = Snes_Spc.cpp; path = gme/Snes_Spc.cpp; sourceTree = "<group>"; };
17C8F1E10CBED286008D969D /* Snes_Spc.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; name = Snes_Spc.h; path = gme/Snes_Spc.h; sourceTree = "<group>"; };
17C8F1E20CBED286008D969D /* Spc_Cpu.cpp */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.cpp.cpp; name = Spc_Cpu.cpp; path = gme/Spc_Cpu.cpp; sourceTree = "<group>"; };
@ -206,14 +347,173 @@
17C8F1E50CBED286008D969D /* Spc_Dsp.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; name = Spc_Dsp.h; path = gme/Spc_Dsp.h; sourceTree = "<group>"; };
17C8F1E60CBED286008D969D /* Spc_Emu.cpp */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.cpp.cpp; name = Spc_Emu.cpp; path = gme/Spc_Emu.cpp; sourceTree = "<group>"; };
17C8F1E70CBED286008D969D /* Spc_Emu.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; name = Spc_Emu.h; path = gme/Spc_Emu.h; sourceTree = "<group>"; };
17C8F1E80CBED286008D969D /* Vgm_Emu_Impl.cpp */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.cpp.cpp; name = Vgm_Emu_Impl.cpp; path = gme/Vgm_Emu_Impl.cpp; sourceTree = "<group>"; };
17C8F1E90CBED286008D969D /* Vgm_Emu_Impl.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; name = Vgm_Emu_Impl.h; path = gme/Vgm_Emu_Impl.h; sourceTree = "<group>"; };
17C8F1EA0CBED286008D969D /* Vgm_Emu.cpp */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.cpp.cpp; name = Vgm_Emu.cpp; path = gme/Vgm_Emu.cpp; sourceTree = "<group>"; };
17C8F1EB0CBED286008D969D /* Vgm_Emu.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; name = Vgm_Emu.h; path = gme/Vgm_Emu.h; sourceTree = "<group>"; };
17C8F1EC0CBED286008D969D /* Ym2413_Emu.cpp */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.cpp.cpp; name = Ym2413_Emu.cpp; path = gme/Ym2413_Emu.cpp; sourceTree = "<group>"; };
17C8F1ED0CBED286008D969D /* Ym2413_Emu.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; name = Ym2413_Emu.h; path = gme/Ym2413_Emu.h; sourceTree = "<group>"; };
17C8F1EE0CBED286008D969D /* Ym2612_Emu.cpp */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.cpp.cpp; name = Ym2612_Emu.cpp; path = gme/Ym2612_Emu.cpp; sourceTree = "<group>"; };
17C8F1EF0CBED286008D969D /* Ym2612_Emu.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; name = Ym2612_Emu.h; path = gme/Ym2612_Emu.h; sourceTree = "<group>"; };
8370B68C17F615FD001A4D7A /* adlib.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = adlib.h; path = gme/adlib.h; sourceTree = "<group>"; };
8370B68D17F615FD001A4D7A /* Ay_Core.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = Ay_Core.cpp; path = gme/Ay_Core.cpp; sourceTree = "<group>"; };
8370B68E17F615FD001A4D7A /* Ay_Core.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = Ay_Core.h; path = gme/Ay_Core.h; sourceTree = "<group>"; };
8370B68F17F615FD001A4D7A /* blargg_common.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = blargg_common.cpp; path = gme/blargg_common.cpp; sourceTree = "<group>"; };
8370B69017F615FD001A4D7A /* blargg_errors.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = blargg_errors.cpp; path = gme/blargg_errors.cpp; sourceTree = "<group>"; };
8370B69117F615FD001A4D7A /* blargg_errors.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = blargg_errors.h; path = gme/blargg_errors.h; sourceTree = "<group>"; };
8370B69217F615FD001A4D7A /* Blip_Buffer_impl.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = Blip_Buffer_impl.h; path = gme/Blip_Buffer_impl.h; sourceTree = "<group>"; };
8370B69317F615FD001A4D7A /* Blip_Buffer_impl2.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = Blip_Buffer_impl2.h; path = gme/Blip_Buffer_impl2.h; sourceTree = "<group>"; };
8370B69417F615FD001A4D7A /* Bml_Parser.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = Bml_Parser.cpp; path = gme/Bml_Parser.cpp; sourceTree = "<group>"; };
8370B69517F615FD001A4D7A /* Bml_Parser.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = Bml_Parser.h; path = gme/Bml_Parser.h; sourceTree = "<group>"; };
8370B69617F615FD001A4D7A /* C140_Emu.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = C140_Emu.cpp; path = gme/C140_Emu.cpp; sourceTree = "<group>"; };
8370B69717F615FD001A4D7A /* C140_Emu.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = C140_Emu.h; path = gme/C140_Emu.h; sourceTree = "<group>"; };
8370B69817F615FD001A4D7A /* c140.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = c140.c; path = gme/c140.c; sourceTree = "<group>"; };
8370B69917F615FD001A4D7A /* c140.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = c140.h; path = gme/c140.h; sourceTree = "<group>"; };
8370B69A17F615FD001A4D7A /* Chip_Resampler.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = Chip_Resampler.h; path = gme/Chip_Resampler.h; sourceTree = "<group>"; };
8370B69B17F615FD001A4D7A /* dac_control.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = dac_control.c; path = gme/dac_control.c; sourceTree = "<group>"; };
8370B69C17F615FD001A4D7A /* dac_control.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = dac_control.h; path = gme/dac_control.h; sourceTree = "<group>"; };
8370B69D17F615FD001A4D7A /* dbopl.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = dbopl.cpp; path = gme/dbopl.cpp; sourceTree = "<group>"; };
8370B69E17F615FD001A4D7A /* dbopl.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = dbopl.h; path = gme/dbopl.h; sourceTree = "<group>"; };
8370B69F17F615FD001A4D7A /* divfix.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = divfix.h; path = gme/divfix.h; sourceTree = "<group>"; };
8370B6A017F615FD001A4D7A /* Downsampler.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = Downsampler.cpp; path = gme/Downsampler.cpp; sourceTree = "<group>"; };
8370B6A117F615FD001A4D7A /* Downsampler.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = Downsampler.h; path = gme/Downsampler.h; sourceTree = "<group>"; };
8370B6A217F615FD001A4D7A /* emuconfig.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = emuconfig.h; path = gme/emuconfig.h; sourceTree = "<group>"; };
8370B6A317F615FD001A4D7A /* fm.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = fm.c; path = gme/fm.c; sourceTree = "<group>"; };
8370B6A417F615FD001A4D7A /* fm.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = fm.h; path = gme/fm.h; sourceTree = "<group>"; };
8370B6A517F615FD001A4D7A /* fm2612.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = fm2612.c; path = gme/fm2612.c; sourceTree = "<group>"; };
8370B6A617F615FD001A4D7A /* fmopl.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = fmopl.cpp; path = gme/fmopl.cpp; sourceTree = "<group>"; };
8370B6A717F615FD001A4D7A /* fmopl.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = fmopl.h; path = gme/fmopl.h; sourceTree = "<group>"; };
8370B6A817F615FD001A4D7A /* Gb_Cpu_run.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = Gb_Cpu_run.h; path = gme/Gb_Cpu_run.h; sourceTree = "<group>"; };
8370B6A917F615FD001A4D7A /* Gbs_Core.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = Gbs_Core.cpp; path = gme/Gbs_Core.cpp; sourceTree = "<group>"; };
8370B6AA17F615FD001A4D7A /* Gbs_Core.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = Gbs_Core.h; path = gme/Gbs_Core.h; sourceTree = "<group>"; };
8370B6AB17F615FD001A4D7A /* Gbs_Cpu.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = Gbs_Cpu.cpp; path = gme/Gbs_Cpu.cpp; sourceTree = "<group>"; };
8370B6AE17F615FD001A4D7A /* Gme_Loader.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = Gme_Loader.cpp; path = gme/Gme_Loader.cpp; sourceTree = "<group>"; };
8370B6AF17F615FD001A4D7A /* Gme_Loader.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = Gme_Loader.h; path = gme/Gme_Loader.h; sourceTree = "<group>"; };
8370B6B017F615FD001A4D7A /* Hes_Apu_Adpcm.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = Hes_Apu_Adpcm.cpp; path = gme/Hes_Apu_Adpcm.cpp; sourceTree = "<group>"; };
8370B6B117F615FD001A4D7A /* Hes_Apu_Adpcm.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = Hes_Apu_Adpcm.h; path = gme/Hes_Apu_Adpcm.h; sourceTree = "<group>"; };
8370B6B217F615FD001A4D7A /* Hes_Core.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = Hes_Core.cpp; path = gme/Hes_Core.cpp; sourceTree = "<group>"; };
8370B6B317F615FD001A4D7A /* Hes_Core.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = Hes_Core.h; path = gme/Hes_Core.h; sourceTree = "<group>"; };
8370B6B417F615FD001A4D7A /* Hes_Cpu_run.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = Hes_Cpu_run.h; path = gme/Hes_Cpu_run.h; sourceTree = "<group>"; };
8370B6B517F615FD001A4D7A /* i_fmpac.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = i_fmpac.h; path = gme/i_fmpac.h; sourceTree = "<group>"; };
8370B6B617F615FD001A4D7A /* i_fmunit.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = i_fmunit.h; path = gme/i_fmunit.h; sourceTree = "<group>"; };
8370B6B717F615FD001A4D7A /* i_vrc7.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = i_vrc7.h; path = gme/i_vrc7.h; sourceTree = "<group>"; };
8370B6B817F615FD001A4D7A /* K051649_Emu.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = K051649_Emu.cpp; path = gme/K051649_Emu.cpp; sourceTree = "<group>"; };
8370B6B917F615FD001A4D7A /* K051649_Emu.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = K051649_Emu.h; path = gme/K051649_Emu.h; sourceTree = "<group>"; };
8370B6BA17F615FD001A4D7A /* k051649.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = k051649.c; path = gme/k051649.c; sourceTree = "<group>"; };
8370B6BB17F615FD001A4D7A /* k051649.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = k051649.h; path = gme/k051649.h; sourceTree = "<group>"; };
8370B6BC17F615FD001A4D7A /* K053260_Emu.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = K053260_Emu.cpp; path = gme/K053260_Emu.cpp; sourceTree = "<group>"; };
8370B6BD17F615FD001A4D7A /* K053260_Emu.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = K053260_Emu.h; path = gme/K053260_Emu.h; sourceTree = "<group>"; };
8370B6BE17F615FD001A4D7A /* k053260.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = k053260.c; path = gme/k053260.c; sourceTree = "<group>"; };
8370B6BF17F615FD001A4D7A /* k053260.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = k053260.h; path = gme/k053260.h; sourceTree = "<group>"; };
8370B6C017F615FD001A4D7A /* K054539_Emu.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = K054539_Emu.cpp; path = gme/K054539_Emu.cpp; sourceTree = "<group>"; };
8370B6C117F615FD001A4D7A /* K054539_Emu.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = K054539_Emu.h; path = gme/K054539_Emu.h; sourceTree = "<group>"; };
8370B6C217F615FD001A4D7A /* k054539.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = k054539.c; path = gme/k054539.c; sourceTree = "<group>"; };
8370B6C317F615FD001A4D7A /* k054539.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = k054539.h; path = gme/k054539.h; sourceTree = "<group>"; };
8370B6C417F615FD001A4D7A /* kmsnddev.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = kmsnddev.h; path = gme/kmsnddev.h; sourceTree = "<group>"; };
8370B6C517F615FD001A4D7A /* Kss_Core.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = Kss_Core.cpp; path = gme/Kss_Core.cpp; sourceTree = "<group>"; };
8370B6C617F615FD001A4D7A /* Kss_Core.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = Kss_Core.h; path = gme/Kss_Core.h; sourceTree = "<group>"; };
8370B6C717F615FD001A4D7A /* mamedef.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = mamedef.h; path = gme/mamedef.h; sourceTree = "<group>"; };
8370B6C817F615FD001A4D7A /* mathdefs.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = mathdefs.h; path = gme/mathdefs.h; sourceTree = "<group>"; };
8370B6C917F615FD001A4D7A /* Nes_Cpu_run.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = Nes_Cpu_run.h; path = gme/Nes_Cpu_run.h; sourceTree = "<group>"; };
8370B6CA17F615FD001A4D7A /* Nes_Fds_Apu.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = Nes_Fds_Apu.cpp; path = gme/Nes_Fds_Apu.cpp; sourceTree = "<group>"; };
8370B6CB17F615FD001A4D7A /* Nes_Fds_Apu.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = Nes_Fds_Apu.h; path = gme/Nes_Fds_Apu.h; sourceTree = "<group>"; };
8370B6CC17F615FD001A4D7A /* Nes_Mmc5_Apu.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = Nes_Mmc5_Apu.h; path = gme/Nes_Mmc5_Apu.h; sourceTree = "<group>"; };
8370B6CD17F615FD001A4D7A /* Nes_Vrc7_Apu.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = Nes_Vrc7_Apu.cpp; path = gme/Nes_Vrc7_Apu.cpp; sourceTree = "<group>"; };
8370B6CE17F615FD001A4D7A /* Nes_Vrc7_Apu.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = Nes_Vrc7_Apu.h; path = gme/Nes_Vrc7_Apu.h; sourceTree = "<group>"; };
8370B6CF17F615FD001A4D7A /* nestypes.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = nestypes.h; path = gme/nestypes.h; sourceTree = "<group>"; };
8370B6D017F615FD001A4D7A /* Nsf_Core.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = Nsf_Core.cpp; path = gme/Nsf_Core.cpp; sourceTree = "<group>"; };
8370B6D117F615FD001A4D7A /* Nsf_Core.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = Nsf_Core.h; path = gme/Nsf_Core.h; sourceTree = "<group>"; };
8370B6D217F615FD001A4D7A /* Nsf_Cpu.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = Nsf_Cpu.cpp; path = gme/Nsf_Cpu.cpp; sourceTree = "<group>"; };
8370B6D317F615FD001A4D7A /* Nsf_Impl.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = Nsf_Impl.cpp; path = gme/Nsf_Impl.cpp; sourceTree = "<group>"; };
8370B6D417F615FD001A4D7A /* Nsf_Impl.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = Nsf_Impl.h; path = gme/Nsf_Impl.h; sourceTree = "<group>"; };
8370B6D517F615FD001A4D7A /* Okim6258_Emu.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = Okim6258_Emu.cpp; path = gme/Okim6258_Emu.cpp; sourceTree = "<group>"; };
8370B6D617F615FD001A4D7A /* Okim6258_Emu.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = Okim6258_Emu.h; path = gme/Okim6258_Emu.h; sourceTree = "<group>"; };
8370B6D717F615FD001A4D7A /* okim6258.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = okim6258.c; path = gme/okim6258.c; sourceTree = "<group>"; };
8370B6D817F615FD001A4D7A /* okim6258.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = okim6258.h; path = gme/okim6258.h; sourceTree = "<group>"; };
8370B6D917F615FD001A4D7A /* Okim6295_Emu.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = Okim6295_Emu.cpp; path = gme/Okim6295_Emu.cpp; sourceTree = "<group>"; };
8370B6DA17F615FD001A4D7A /* Okim6295_Emu.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = Okim6295_Emu.h; path = gme/Okim6295_Emu.h; sourceTree = "<group>"; };
8370B6DB17F615FD001A4D7A /* okim6295.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = okim6295.c; path = gme/okim6295.c; sourceTree = "<group>"; };
8370B6DC17F615FD001A4D7A /* okim6295.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = okim6295.h; path = gme/okim6295.h; sourceTree = "<group>"; };
8370B6DD17F615FD001A4D7A /* Opl_Apu.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = Opl_Apu.cpp; path = gme/Opl_Apu.cpp; sourceTree = "<group>"; };
8370B6DE17F615FE001A4D7A /* Opl_Apu.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = Opl_Apu.h; path = gme/Opl_Apu.h; sourceTree = "<group>"; };
8370B6DF17F615FE001A4D7A /* Pwm_Emu.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = Pwm_Emu.cpp; path = gme/Pwm_Emu.cpp; sourceTree = "<group>"; };
8370B6E017F615FE001A4D7A /* Pwm_Emu.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = Pwm_Emu.h; path = gme/Pwm_Emu.h; sourceTree = "<group>"; };
8370B6E117F615FE001A4D7A /* pwm.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = pwm.c; path = gme/pwm.c; sourceTree = "<group>"; };
8370B6E217F615FE001A4D7A /* pwm.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = pwm.h; path = gme/pwm.h; sourceTree = "<group>"; };
8370B6E317F615FE001A4D7A /* qmix.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = qmix.c; path = gme/qmix.c; sourceTree = "<group>"; };
8370B6E417F615FE001A4D7A /* qmix.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = qmix.h; path = gme/qmix.h; sourceTree = "<group>"; };
8370B6E517F615FE001A4D7A /* Qsound_Apu.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = Qsound_Apu.cpp; path = gme/Qsound_Apu.cpp; sourceTree = "<group>"; };
8370B6E617F615FE001A4D7A /* Qsound_Apu.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = Qsound_Apu.h; path = gme/Qsound_Apu.h; sourceTree = "<group>"; };
8370B6E717F615FE001A4D7A /* Resampler.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = Resampler.cpp; path = gme/Resampler.cpp; sourceTree = "<group>"; };
8370B6E817F615FE001A4D7A /* Resampler.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = Resampler.h; path = gme/Resampler.h; sourceTree = "<group>"; };
8370B6E917F615FE001A4D7A /* Rf5C68_Emu.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = Rf5C68_Emu.cpp; path = gme/Rf5C68_Emu.cpp; sourceTree = "<group>"; };
8370B6EA17F615FE001A4D7A /* Rf5C68_Emu.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = Rf5C68_Emu.h; path = gme/Rf5C68_Emu.h; sourceTree = "<group>"; };
8370B6EB17F615FE001A4D7A /* rf5c68.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = rf5c68.c; path = gme/rf5c68.c; sourceTree = "<group>"; };
8370B6EC17F615FE001A4D7A /* rf5c68.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = rf5c68.h; path = gme/rf5c68.h; sourceTree = "<group>"; };
8370B6ED17F615FE001A4D7A /* Rf5C164_Emu.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = Rf5C164_Emu.cpp; path = gme/Rf5C164_Emu.cpp; sourceTree = "<group>"; };
8370B6EE17F615FE001A4D7A /* Rf5C164_Emu.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = Rf5C164_Emu.h; path = gme/Rf5C164_Emu.h; sourceTree = "<group>"; };
8370B6EF17F615FE001A4D7A /* Rom_Data.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = Rom_Data.cpp; path = gme/Rom_Data.cpp; sourceTree = "<group>"; };
8370B6F017F615FE001A4D7A /* Rom_Data.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = Rom_Data.h; path = gme/Rom_Data.h; sourceTree = "<group>"; };
8370B6F117F615FE001A4D7A /* s_deltat.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = s_deltat.c; path = gme/s_deltat.c; sourceTree = "<group>"; };
8370B6F217F615FE001A4D7A /* s_deltat.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = s_deltat.h; path = gme/s_deltat.h; sourceTree = "<group>"; };
8370B6F317F615FE001A4D7A /* s_logtbl.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = s_logtbl.c; path = gme/s_logtbl.c; sourceTree = "<group>"; };
8370B6F417F615FE001A4D7A /* s_logtbl.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = s_logtbl.h; path = gme/s_logtbl.h; sourceTree = "<group>"; };
8370B6F517F615FE001A4D7A /* s_opl.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = s_opl.c; path = gme/s_opl.c; sourceTree = "<group>"; };
8370B6F617F615FE001A4D7A /* s_opl.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = s_opl.h; path = gme/s_opl.h; sourceTree = "<group>"; };
8370B6F717F615FE001A4D7A /* s_opltbl.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = s_opltbl.c; path = gme/s_opltbl.c; sourceTree = "<group>"; };
8370B6F817F615FE001A4D7A /* s_opltbl.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = s_opltbl.h; path = gme/s_opltbl.h; sourceTree = "<group>"; };
8370B6F917F615FE001A4D7A /* Sap_Core.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = Sap_Core.cpp; path = gme/Sap_Core.cpp; sourceTree = "<group>"; };
8370B6FA17F615FE001A4D7A /* Sap_Core.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = Sap_Core.h; path = gme/Sap_Core.h; sourceTree = "<group>"; };
8370B6FB17F615FE001A4D7A /* scd_pcm.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = scd_pcm.c; path = gme/scd_pcm.c; sourceTree = "<group>"; };
8370B6FC17F615FE001A4D7A /* scd_pcm.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = scd_pcm.h; path = gme/scd_pcm.h; sourceTree = "<group>"; };
8370B6FD17F615FE001A4D7A /* SegaPcm_Emu.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = SegaPcm_Emu.cpp; path = gme/SegaPcm_Emu.cpp; sourceTree = "<group>"; };
8370B6FE17F615FE001A4D7A /* SegaPcm_Emu.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = SegaPcm_Emu.h; path = gme/SegaPcm_Emu.h; sourceTree = "<group>"; };
8370B6FF17F615FE001A4D7A /* segapcm.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = segapcm.c; path = gme/segapcm.c; sourceTree = "<group>"; };
8370B70017F615FE001A4D7A /* segapcm.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = segapcm.h; path = gme/segapcm.h; sourceTree = "<group>"; };
8370B70117F615FE001A4D7A /* Sgc_Core.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = Sgc_Core.cpp; path = gme/Sgc_Core.cpp; sourceTree = "<group>"; };
8370B70217F615FE001A4D7A /* Sgc_Core.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = Sgc_Core.h; path = gme/Sgc_Core.h; sourceTree = "<group>"; };
8370B70317F615FE001A4D7A /* Sgc_Cpu.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = Sgc_Cpu.cpp; path = gme/Sgc_Cpu.cpp; sourceTree = "<group>"; };
8370B70417F615FE001A4D7A /* Sgc_Emu.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = Sgc_Emu.cpp; path = gme/Sgc_Emu.cpp; sourceTree = "<group>"; };
8370B70517F615FE001A4D7A /* Sgc_Emu.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = Sgc_Emu.h; path = gme/Sgc_Emu.h; sourceTree = "<group>"; };
8370B70617F615FE001A4D7A /* Sgc_Impl.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = Sgc_Impl.cpp; path = gme/Sgc_Impl.cpp; sourceTree = "<group>"; };
8370B70717F615FE001A4D7A /* Sgc_Impl.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = Sgc_Impl.h; path = gme/Sgc_Impl.h; sourceTree = "<group>"; };
8370B70817F615FE001A4D7A /* Sms_Fm_Apu.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = Sms_Fm_Apu.cpp; path = gme/Sms_Fm_Apu.cpp; sourceTree = "<group>"; };
8370B70917F615FE001A4D7A /* Sms_Fm_Apu.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = Sms_Fm_Apu.h; path = gme/Sms_Fm_Apu.h; sourceTree = "<group>"; };
8370B70A17F615FE001A4D7A /* Spc_Filter.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = Spc_Filter.cpp; path = gme/Spc_Filter.cpp; sourceTree = "<group>"; };
8370B70B17F615FE001A4D7A /* Spc_Filter.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = Spc_Filter.h; path = gme/Spc_Filter.h; sourceTree = "<group>"; };
8370B70C17F615FE001A4D7A /* Spc_Sfm.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = Spc_Sfm.cpp; path = gme/Spc_Sfm.cpp; sourceTree = "<group>"; };
8370B70D17F615FE001A4D7A /* Spc_Sfm.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = Spc_Sfm.h; path = gme/Spc_Sfm.h; sourceTree = "<group>"; };
8370B70E17F615FE001A4D7A /* Track_Filter.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = Track_Filter.cpp; path = gme/Track_Filter.cpp; sourceTree = "<group>"; };
8370B70F17F615FE001A4D7A /* Track_Filter.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = Track_Filter.h; path = gme/Track_Filter.h; sourceTree = "<group>"; };
8370B71017F615FE001A4D7A /* Upsampler.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = Upsampler.cpp; path = gme/Upsampler.cpp; sourceTree = "<group>"; };
8370B71117F615FE001A4D7A /* Upsampler.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = Upsampler.h; path = gme/Upsampler.h; sourceTree = "<group>"; };
8370B71217F615FE001A4D7A /* Vgm_Core.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = Vgm_Core.cpp; path = gme/Vgm_Core.cpp; sourceTree = "<group>"; };
8370B71317F615FE001A4D7A /* Vgm_Core.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = Vgm_Core.h; path = gme/Vgm_Core.h; sourceTree = "<group>"; };
8370B71417F615FE001A4D7A /* Ym2151_Emu.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = Ym2151_Emu.cpp; path = gme/Ym2151_Emu.cpp; sourceTree = "<group>"; };
8370B71517F615FE001A4D7A /* Ym2151_Emu.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = Ym2151_Emu.h; path = gme/Ym2151_Emu.h; sourceTree = "<group>"; };
8370B71617F615FE001A4D7A /* ym2151.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = ym2151.c; path = gme/ym2151.c; sourceTree = "<group>"; };
8370B71717F615FE001A4D7A /* ym2151.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = ym2151.h; path = gme/ym2151.h; sourceTree = "<group>"; };
8370B71817F615FE001A4D7A /* Ym2203_Emu.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = Ym2203_Emu.cpp; path = gme/Ym2203_Emu.cpp; sourceTree = "<group>"; };
8370B71917F615FE001A4D7A /* Ym2203_Emu.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = Ym2203_Emu.h; path = gme/Ym2203_Emu.h; sourceTree = "<group>"; };
8370B71A17F615FE001A4D7A /* ym2413.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = ym2413.c; path = gme/ym2413.c; sourceTree = "<group>"; };
8370B71B17F615FE001A4D7A /* ym2413.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = ym2413.h; path = gme/ym2413.h; sourceTree = "<group>"; };
8370B71C17F615FE001A4D7A /* Ym2608_Emu.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = Ym2608_Emu.cpp; path = gme/Ym2608_Emu.cpp; sourceTree = "<group>"; };
8370B71D17F615FE001A4D7A /* Ym2608_Emu.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = Ym2608_Emu.h; path = gme/Ym2608_Emu.h; sourceTree = "<group>"; };
8370B71E17F615FE001A4D7A /* Ym2610b_Emu.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = Ym2610b_Emu.cpp; path = gme/Ym2610b_Emu.cpp; sourceTree = "<group>"; };
8370B71F17F615FE001A4D7A /* Ym2610b_Emu.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = Ym2610b_Emu.h; path = gme/Ym2610b_Emu.h; sourceTree = "<group>"; };
8370B72017F615FE001A4D7A /* Ym2612_Emu_Gens.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = Ym2612_Emu_Gens.cpp; path = gme/Ym2612_Emu_Gens.cpp; sourceTree = "<group>"; };
8370B72117F615FE001A4D7A /* Ym2612_Emu_MAME.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = Ym2612_Emu_MAME.cpp; path = gme/Ym2612_Emu_MAME.cpp; sourceTree = "<group>"; };
8370B72217F615FE001A4D7A /* Ym3812_Emu.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = Ym3812_Emu.cpp; path = gme/Ym3812_Emu.cpp; sourceTree = "<group>"; };
8370B72317F615FE001A4D7A /* Ym3812_Emu.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = Ym3812_Emu.h; path = gme/Ym3812_Emu.h; sourceTree = "<group>"; };
8370B72417F615FE001A4D7A /* ymdeltat.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = ymdeltat.cpp; path = gme/ymdeltat.cpp; sourceTree = "<group>"; };
8370B72517F615FE001A4D7A /* ymdeltat.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = ymdeltat.h; path = gme/ymdeltat.h; sourceTree = "<group>"; };
8370B72617F615FE001A4D7A /* Ymf262_Emu.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = Ymf262_Emu.cpp; path = gme/Ymf262_Emu.cpp; sourceTree = "<group>"; };
8370B72717F615FE001A4D7A /* Ymf262_Emu.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = Ymf262_Emu.h; path = gme/Ymf262_Emu.h; sourceTree = "<group>"; };
8370B72817F615FE001A4D7A /* Ymz280b_Emu.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = Ymz280b_Emu.cpp; path = gme/Ymz280b_Emu.cpp; sourceTree = "<group>"; };
8370B72917F615FE001A4D7A /* Ymz280b_Emu.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = Ymz280b_Emu.h; path = gme/Ymz280b_Emu.h; sourceTree = "<group>"; };
8370B72A17F615FE001A4D7A /* ymz280b.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = ymz280b.c; path = gme/ymz280b.c; sourceTree = "<group>"; };
8370B72B17F615FE001A4D7A /* ymz280b.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = ymz280b.h; path = gme/ymz280b.h; sourceTree = "<group>"; };
8370B72C17F615FE001A4D7A /* Z80_Cpu_run.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = Z80_Cpu_run.h; path = gme/Z80_Cpu_run.h; sourceTree = "<group>"; };
8370B72D17F615FE001A4D7A /* Z80_Cpu.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = Z80_Cpu.cpp; path = gme/Z80_Cpu.cpp; sourceTree = "<group>"; };
8370B72E17F615FE001A4D7A /* Z80_Cpu.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = Z80_Cpu.h; path = gme/Z80_Cpu.h; sourceTree = "<group>"; };
8DC2EF5A0486A6940098B216 /* Info.plist */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.plist; path = Info.plist; sourceTree = "<group>"; };
8DC2EF5B0486A6940098B216 /* GME.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; path = GME.framework; sourceTree = BUILT_PRODUCTS_DIR; };
D2F7E79907B2D74100F64583 /* CoreData.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = CoreData.framework; path = /System/Library/Frameworks/CoreData.framework; sourceTree = "<absolute>"; };
@ -298,10 +598,170 @@
17C8F1860CBED26C008D969D /* Source */ = {
isa = PBXGroup;
children = (
8370B68C17F615FD001A4D7A /* adlib.h */,
8370B68D17F615FD001A4D7A /* Ay_Core.cpp */,
8370B68E17F615FD001A4D7A /* Ay_Core.h */,
8370B68F17F615FD001A4D7A /* blargg_common.cpp */,
8370B69017F615FD001A4D7A /* blargg_errors.cpp */,
8370B69117F615FD001A4D7A /* blargg_errors.h */,
8370B69217F615FD001A4D7A /* Blip_Buffer_impl.h */,
8370B69317F615FD001A4D7A /* Blip_Buffer_impl2.h */,
8370B69417F615FD001A4D7A /* Bml_Parser.cpp */,
8370B69517F615FD001A4D7A /* Bml_Parser.h */,
8370B69617F615FD001A4D7A /* C140_Emu.cpp */,
8370B69717F615FD001A4D7A /* C140_Emu.h */,
8370B69817F615FD001A4D7A /* c140.c */,
8370B69917F615FD001A4D7A /* c140.h */,
8370B69A17F615FD001A4D7A /* Chip_Resampler.h */,
8370B69B17F615FD001A4D7A /* dac_control.c */,
8370B69C17F615FD001A4D7A /* dac_control.h */,
8370B69D17F615FD001A4D7A /* dbopl.cpp */,
8370B69E17F615FD001A4D7A /* dbopl.h */,
8370B69F17F615FD001A4D7A /* divfix.h */,
8370B6A017F615FD001A4D7A /* Downsampler.cpp */,
8370B6A117F615FD001A4D7A /* Downsampler.h */,
8370B6A217F615FD001A4D7A /* emuconfig.h */,
8370B6A317F615FD001A4D7A /* fm.c */,
8370B6A417F615FD001A4D7A /* fm.h */,
8370B6A517F615FD001A4D7A /* fm2612.c */,
8370B6A617F615FD001A4D7A /* fmopl.cpp */,
8370B6A717F615FD001A4D7A /* fmopl.h */,
8370B6A817F615FD001A4D7A /* Gb_Cpu_run.h */,
8370B6A917F615FD001A4D7A /* Gbs_Core.cpp */,
8370B6AA17F615FD001A4D7A /* Gbs_Core.h */,
8370B6AB17F615FD001A4D7A /* Gbs_Cpu.cpp */,
8370B6AE17F615FD001A4D7A /* Gme_Loader.cpp */,
8370B6AF17F615FD001A4D7A /* Gme_Loader.h */,
8370B6B017F615FD001A4D7A /* Hes_Apu_Adpcm.cpp */,
8370B6B117F615FD001A4D7A /* Hes_Apu_Adpcm.h */,
8370B6B217F615FD001A4D7A /* Hes_Core.cpp */,
8370B6B317F615FD001A4D7A /* Hes_Core.h */,
8370B6B417F615FD001A4D7A /* Hes_Cpu_run.h */,
8370B6B517F615FD001A4D7A /* i_fmpac.h */,
8370B6B617F615FD001A4D7A /* i_fmunit.h */,
8370B6B717F615FD001A4D7A /* i_vrc7.h */,
8370B6B817F615FD001A4D7A /* K051649_Emu.cpp */,
8370B6B917F615FD001A4D7A /* K051649_Emu.h */,
8370B6BA17F615FD001A4D7A /* k051649.c */,
8370B6BB17F615FD001A4D7A /* k051649.h */,
8370B6BC17F615FD001A4D7A /* K053260_Emu.cpp */,
8370B6BD17F615FD001A4D7A /* K053260_Emu.h */,
8370B6BE17F615FD001A4D7A /* k053260.c */,
8370B6BF17F615FD001A4D7A /* k053260.h */,
8370B6C017F615FD001A4D7A /* K054539_Emu.cpp */,
8370B6C117F615FD001A4D7A /* K054539_Emu.h */,
8370B6C217F615FD001A4D7A /* k054539.c */,
8370B6C317F615FD001A4D7A /* k054539.h */,
8370B6C417F615FD001A4D7A /* kmsnddev.h */,
8370B6C517F615FD001A4D7A /* Kss_Core.cpp */,
8370B6C617F615FD001A4D7A /* Kss_Core.h */,
8370B6C717F615FD001A4D7A /* mamedef.h */,
8370B6C817F615FD001A4D7A /* mathdefs.h */,
8370B6C917F615FD001A4D7A /* Nes_Cpu_run.h */,
8370B6CA17F615FD001A4D7A /* Nes_Fds_Apu.cpp */,
8370B6CB17F615FD001A4D7A /* Nes_Fds_Apu.h */,
8370B6CC17F615FD001A4D7A /* Nes_Mmc5_Apu.h */,
8370B6CD17F615FD001A4D7A /* Nes_Vrc7_Apu.cpp */,
8370B6CE17F615FD001A4D7A /* Nes_Vrc7_Apu.h */,
8370B6CF17F615FD001A4D7A /* nestypes.h */,
8370B6D017F615FD001A4D7A /* Nsf_Core.cpp */,
8370B6D117F615FD001A4D7A /* Nsf_Core.h */,
8370B6D217F615FD001A4D7A /* Nsf_Cpu.cpp */,
8370B6D317F615FD001A4D7A /* Nsf_Impl.cpp */,
8370B6D417F615FD001A4D7A /* Nsf_Impl.h */,
8370B6D517F615FD001A4D7A /* Okim6258_Emu.cpp */,
8370B6D617F615FD001A4D7A /* Okim6258_Emu.h */,
8370B6D717F615FD001A4D7A /* okim6258.c */,
8370B6D817F615FD001A4D7A /* okim6258.h */,
8370B6D917F615FD001A4D7A /* Okim6295_Emu.cpp */,
8370B6DA17F615FD001A4D7A /* Okim6295_Emu.h */,
8370B6DB17F615FD001A4D7A /* okim6295.c */,
8370B6DC17F615FD001A4D7A /* okim6295.h */,
8370B6DD17F615FD001A4D7A /* Opl_Apu.cpp */,
8370B6DE17F615FE001A4D7A /* Opl_Apu.h */,
8370B6DF17F615FE001A4D7A /* Pwm_Emu.cpp */,
8370B6E017F615FE001A4D7A /* Pwm_Emu.h */,
8370B6E117F615FE001A4D7A /* pwm.c */,
8370B6E217F615FE001A4D7A /* pwm.h */,
8370B6E317F615FE001A4D7A /* qmix.c */,
8370B6E417F615FE001A4D7A /* qmix.h */,
8370B6E517F615FE001A4D7A /* Qsound_Apu.cpp */,
8370B6E617F615FE001A4D7A /* Qsound_Apu.h */,
8370B6E717F615FE001A4D7A /* Resampler.cpp */,
8370B6E817F615FE001A4D7A /* Resampler.h */,
8370B6E917F615FE001A4D7A /* Rf5C68_Emu.cpp */,
8370B6EA17F615FE001A4D7A /* Rf5C68_Emu.h */,
8370B6EB17F615FE001A4D7A /* rf5c68.c */,
8370B6EC17F615FE001A4D7A /* rf5c68.h */,
8370B6ED17F615FE001A4D7A /* Rf5C164_Emu.cpp */,
8370B6EE17F615FE001A4D7A /* Rf5C164_Emu.h */,
8370B6EF17F615FE001A4D7A /* Rom_Data.cpp */,
8370B6F017F615FE001A4D7A /* Rom_Data.h */,
8370B6F117F615FE001A4D7A /* s_deltat.c */,
8370B6F217F615FE001A4D7A /* s_deltat.h */,
8370B6F317F615FE001A4D7A /* s_logtbl.c */,
8370B6F417F615FE001A4D7A /* s_logtbl.h */,
8370B6F517F615FE001A4D7A /* s_opl.c */,
8370B6F617F615FE001A4D7A /* s_opl.h */,
8370B6F717F615FE001A4D7A /* s_opltbl.c */,
8370B6F817F615FE001A4D7A /* s_opltbl.h */,
8370B6F917F615FE001A4D7A /* Sap_Core.cpp */,
8370B6FA17F615FE001A4D7A /* Sap_Core.h */,
8370B6FB17F615FE001A4D7A /* scd_pcm.c */,
8370B6FC17F615FE001A4D7A /* scd_pcm.h */,
8370B6FD17F615FE001A4D7A /* SegaPcm_Emu.cpp */,
8370B6FE17F615FE001A4D7A /* SegaPcm_Emu.h */,
8370B6FF17F615FE001A4D7A /* segapcm.c */,
8370B70017F615FE001A4D7A /* segapcm.h */,
8370B70117F615FE001A4D7A /* Sgc_Core.cpp */,
8370B70217F615FE001A4D7A /* Sgc_Core.h */,
8370B70317F615FE001A4D7A /* Sgc_Cpu.cpp */,
8370B70417F615FE001A4D7A /* Sgc_Emu.cpp */,
8370B70517F615FE001A4D7A /* Sgc_Emu.h */,
8370B70617F615FE001A4D7A /* Sgc_Impl.cpp */,
8370B70717F615FE001A4D7A /* Sgc_Impl.h */,
8370B70817F615FE001A4D7A /* Sms_Fm_Apu.cpp */,
8370B70917F615FE001A4D7A /* Sms_Fm_Apu.h */,
8370B70A17F615FE001A4D7A /* Spc_Filter.cpp */,
8370B70B17F615FE001A4D7A /* Spc_Filter.h */,
8370B70C17F615FE001A4D7A /* Spc_Sfm.cpp */,
8370B70D17F615FE001A4D7A /* Spc_Sfm.h */,
8370B70E17F615FE001A4D7A /* Track_Filter.cpp */,
8370B70F17F615FE001A4D7A /* Track_Filter.h */,
8370B71017F615FE001A4D7A /* Upsampler.cpp */,
8370B71117F615FE001A4D7A /* Upsampler.h */,
8370B71217F615FE001A4D7A /* Vgm_Core.cpp */,
8370B71317F615FE001A4D7A /* Vgm_Core.h */,
8370B71417F615FE001A4D7A /* Ym2151_Emu.cpp */,
8370B71517F615FE001A4D7A /* Ym2151_Emu.h */,
8370B71617F615FE001A4D7A /* ym2151.c */,
8370B71717F615FE001A4D7A /* ym2151.h */,
8370B71817F615FE001A4D7A /* Ym2203_Emu.cpp */,
8370B71917F615FE001A4D7A /* Ym2203_Emu.h */,
8370B71A17F615FE001A4D7A /* ym2413.c */,
8370B71B17F615FE001A4D7A /* ym2413.h */,
8370B71C17F615FE001A4D7A /* Ym2608_Emu.cpp */,
8370B71D17F615FE001A4D7A /* Ym2608_Emu.h */,
8370B71E17F615FE001A4D7A /* Ym2610b_Emu.cpp */,
8370B71F17F615FE001A4D7A /* Ym2610b_Emu.h */,
8370B72017F615FE001A4D7A /* Ym2612_Emu_Gens.cpp */,
8370B72117F615FE001A4D7A /* Ym2612_Emu_MAME.cpp */,
8370B72217F615FE001A4D7A /* Ym3812_Emu.cpp */,
8370B72317F615FE001A4D7A /* Ym3812_Emu.h */,
8370B72417F615FE001A4D7A /* ymdeltat.cpp */,
8370B72517F615FE001A4D7A /* ymdeltat.h */,
8370B72617F615FE001A4D7A /* Ymf262_Emu.cpp */,
8370B72717F615FE001A4D7A /* Ymf262_Emu.h */,
8370B72817F615FE001A4D7A /* Ymz280b_Emu.cpp */,
8370B72917F615FE001A4D7A /* Ymz280b_Emu.h */,
8370B72A17F615FE001A4D7A /* ymz280b.c */,
8370B72B17F615FE001A4D7A /* ymz280b.h */,
8370B72C17F615FE001A4D7A /* Z80_Cpu_run.h */,
8370B72D17F615FE001A4D7A /* Z80_Cpu.cpp */,
8370B72E17F615FE001A4D7A /* Z80_Cpu.h */,
17C8F18B0CBED286008D969D /* Ay_Apu.cpp */,
17C8F18C0CBED286008D969D /* Ay_Apu.h */,
17C8F18D0CBED286008D969D /* Ay_Cpu.cpp */,
17C8F18E0CBED286008D969D /* Ay_Cpu.h */,
17C8F18F0CBED286008D969D /* Ay_Emu.cpp */,
17C8F1900CBED286008D969D /* Ay_Emu.h */,
17C8F1910CBED286008D969D /* blargg_common.h */,
@ -322,7 +782,6 @@
17C8F1A00CBED286008D969D /* Fir_Resampler.h */,
17C8F1A10CBED286008D969D /* Gb_Apu.cpp */,
17C8F1A20CBED286008D969D /* Gb_Apu.h */,
17C8F1A30CBED286008D969D /* gb_cpu_io.h */,
17C8F1A40CBED286008D969D /* Gb_Cpu.cpp */,
17C8F1A50CBED286008D969D /* Gb_Cpu.h */,
17C8F1A60CBED286008D969D /* Gb_Oscs.cpp */,
@ -336,13 +795,11 @@
17C8F1B00CBED286008D969D /* Gym_Emu.h */,
17C8F1B10CBED286008D969D /* Hes_Apu.cpp */,
17C8F1B20CBED286008D969D /* Hes_Apu.h */,
17C8F1B30CBED286008D969D /* hes_cpu_io.h */,
17C8F1B40CBED286008D969D /* Hes_Cpu.cpp */,
17C8F1B50CBED286008D969D /* Hes_Cpu.h */,
17C8F1B60CBED286008D969D /* Hes_Emu.cpp */,
17C8F1B70CBED286008D969D /* Hes_Emu.h */,
17C8F1B80CBED286008D969D /* Kss_Cpu.cpp */,
17C8F1B90CBED286008D969D /* Kss_Cpu.h */,
17C8F1BA0CBED286008D969D /* Kss_Emu.cpp */,
17C8F1BB0CBED286008D969D /* Kss_Emu.h */,
17C8F1BC0CBED286008D969D /* Kss_Scc_Apu.cpp */,
@ -355,7 +812,6 @@
17C8F1C40CBED286008D969D /* Music_Emu.h */,
17C8F1C50CBED286008D969D /* Nes_Apu.cpp */,
17C8F1C60CBED286008D969D /* Nes_Apu.h */,
17C8F1C70CBED286008D969D /* nes_cpu_io.h */,
17C8F1C80CBED286008D969D /* Nes_Cpu.cpp */,
17C8F1C90CBED286008D969D /* Nes_Cpu.h */,
17C8F1CA0CBED286008D969D /* Nes_Fme7_Apu.cpp */,
@ -372,14 +828,11 @@
17C8F1D50CBED286008D969D /* Nsfe_Emu.h */,
17C8F1D60CBED286008D969D /* Sap_Apu.cpp */,
17C8F1D70CBED286008D969D /* Sap_Apu.h */,
17C8F1D80CBED286008D969D /* sap_cpu_io.h */,
17C8F1D90CBED286008D969D /* Sap_Cpu.cpp */,
17C8F1DA0CBED286008D969D /* Sap_Cpu.h */,
17C8F1DB0CBED286008D969D /* Sap_Emu.cpp */,
17C8F1DC0CBED286008D969D /* Sap_Emu.h */,
17C8F1DD0CBED286008D969D /* Sms_Apu.cpp */,
17C8F1DE0CBED286008D969D /* Sms_Apu.h */,
17C8F1DF0CBED286008D969D /* Sms_Oscs.h */,
17C8F1E00CBED286008D969D /* Snes_Spc.cpp */,
17C8F1E10CBED286008D969D /* Snes_Spc.h */,
17C8F1E20CBED286008D969D /* Spc_Cpu.cpp */,
@ -388,8 +841,6 @@
17C8F1E50CBED286008D969D /* Spc_Dsp.h */,
17C8F1E60CBED286008D969D /* Spc_Emu.cpp */,
17C8F1E70CBED286008D969D /* Spc_Emu.h */,
17C8F1E80CBED286008D969D /* Vgm_Emu_Impl.cpp */,
17C8F1E90CBED286008D969D /* Vgm_Emu_Impl.h */,
17C8F1EA0CBED286008D969D /* Vgm_Emu.cpp */,
17C8F1EB0CBED286008D969D /* Vgm_Emu.h */,
17C8F1EC0CBED286008D969D /* Ym2413_Emu.cpp */,
@ -407,59 +858,136 @@
isa = PBXHeadersBuildPhase;
buildActionMask = 2147483647;
files = (
8370B76C17F615FE001A4D7A /* Nes_Cpu_run.h in Headers */,
8370B75A17F615FE001A4D7A /* i_vrc7.h in Headers */,
8370B7A817F615FE001A4D7A /* Sgc_Emu.h in Headers */,
8370B74217F615FE001A4D7A /* divfix.h in Headers */,
8370B76717F615FE001A4D7A /* kmsnddev.h in Headers */,
8370B78D17F615FE001A4D7A /* Rf5C68_Emu.h in Headers */,
8370B7A317F615FE001A4D7A /* segapcm.h in Headers */,
8370B7CE17F615FE001A4D7A /* ymz280b.h in Headers */,
8370B74717F615FE001A4D7A /* fm.h in Headers */,
17C8F1F50CBED286008D969D /* Ay_Apu.h in Headers */,
17C8F1F70CBED286008D969D /* Ay_Cpu.h in Headers */,
17C8F1F90CBED286008D969D /* Ay_Emu.h in Headers */,
8370B74B17F615FE001A4D7A /* Gb_Cpu_run.h in Headers */,
8370B7A117F615FE001A4D7A /* SegaPcm_Emu.h in Headers */,
17C8F1FA0CBED286008D969D /* blargg_common.h in Headers */,
8370B75717F615FE001A4D7A /* Hes_Cpu_run.h in Headers */,
17C8F1FB0CBED286008D969D /* blargg_config.h in Headers */,
8370B78F17F615FE001A4D7A /* rf5c68.h in Headers */,
17C8F1FC0CBED286008D969D /* blargg_endian.h in Headers */,
17C8F1FD0CBED286008D969D /* blargg_source.h in Headers */,
8370B75617F615FE001A4D7A /* Hes_Core.h in Headers */,
8370B76017F615FE001A4D7A /* K053260_Emu.h in Headers */,
8370B78317F615FE001A4D7A /* Pwm_Emu.h in Headers */,
8370B73617F615FE001A4D7A /* Blip_Buffer_impl2.h in Headers */,
8370B76417F615FE001A4D7A /* K054539_Emu.h in Headers */,
8370B7BC17F615FE001A4D7A /* Ym2203_Emu.h in Headers */,
8370B78117F615FE001A4D7A /* Opl_Apu.h in Headers */,
8370B79517F615FE001A4D7A /* s_deltat.h in Headers */,
8370B77B17F615FE001A4D7A /* okim6258.h in Headers */,
8370B7B417F615FE001A4D7A /* Upsampler.h in Headers */,
8370B75417F615FE001A4D7A /* Hes_Apu_Adpcm.h in Headers */,
17C8F1FF0CBED286008D969D /* Blip_Buffer.h in Headers */,
8370B77417F615FE001A4D7A /* Nsf_Core.h in Headers */,
17C8F2010CBED286008D969D /* Classic_Emu.h in Headers */,
17C8F2030CBED286008D969D /* Data_Reader.h in Headers */,
17C8F2050CBED286008D969D /* Dual_Resampler.h in Headers */,
8370B76617F615FE001A4D7A /* k054539.h in Headers */,
8370B78717F615FE001A4D7A /* qmix.h in Headers */,
8370B73517F615FE001A4D7A /* Blip_Buffer_impl.h in Headers */,
8370B7CF17F615FE001A4D7A /* Z80_Cpu_run.h in Headers */,
17C8F2070CBED286008D969D /* Effects_Buffer.h in Headers */,
17C8F2090CBED286008D969D /* Fir_Resampler.h in Headers */,
8370B79317F615FE001A4D7A /* Rom_Data.h in Headers */,
8370B7B817F615FE001A4D7A /* Ym2151_Emu.h in Headers */,
8370B79B17F615FE001A4D7A /* s_opltbl.h in Headers */,
17C8F20B0CBED286008D969D /* Gb_Apu.h in Headers */,
17C8F20C0CBED286008D969D /* gb_cpu_io.h in Headers */,
8370B7A517F615FE001A4D7A /* Sgc_Core.h in Headers */,
8370B77217F615FE001A4D7A /* nestypes.h in Headers */,
17C8F20E0CBED286008D969D /* Gb_Cpu.h in Headers */,
17C8F2100CBED286008D969D /* Gb_Oscs.h in Headers */,
8370B75217F615FE001A4D7A /* Gme_Loader.h in Headers */,
8370B72F17F615FE001A4D7A /* adlib.h in Headers */,
8370B7B217F615FE001A4D7A /* Track_Filter.h in Headers */,
8370B74417F615FE001A4D7A /* Downsampler.h in Headers */,
17C8F2120CBED286008D969D /* Gbs_Emu.h in Headers */,
17C8F2140CBED286008D969D /* Gme_File.h in Headers */,
8370B76217F615FE001A4D7A /* k053260.h in Headers */,
8370B7C017F615FE001A4D7A /* Ym2608_Emu.h in Headers */,
8370B75C17F615FE001A4D7A /* K051649_Emu.h in Headers */,
8370B73F17F615FE001A4D7A /* dac_control.h in Headers */,
17C8F2160CBED286008D969D /* gme.h in Headers */,
17C8F2190CBED286008D969D /* Gym_Emu.h in Headers */,
17C8F21B0CBED286008D969D /* Hes_Apu.h in Headers */,
17C8F21C0CBED286008D969D /* hes_cpu_io.h in Headers */,
17C8F21E0CBED286008D969D /* Hes_Cpu.h in Headers */,
8370B76B17F615FE001A4D7A /* mathdefs.h in Headers */,
8370B7C817F615FE001A4D7A /* ymdeltat.h in Headers */,
17C8F2200CBED286008D969D /* Hes_Emu.h in Headers */,
17C8F2220CBED286008D969D /* Kss_Cpu.h in Headers */,
8370B78517F615FE001A4D7A /* pwm.h in Headers */,
8370B79717F615FE001A4D7A /* s_logtbl.h in Headers */,
8370B77117F615FE001A4D7A /* Nes_Vrc7_Apu.h in Headers */,
8370B74517F615FE001A4D7A /* emuconfig.h in Headers */,
8370B7B017F615FE001A4D7A /* Spc_Sfm.h in Headers */,
17C8F2240CBED286008D969D /* Kss_Emu.h in Headers */,
17C8F2260CBED286008D969D /* Kss_Scc_Apu.h in Headers */,
17C8F2290CBED286008D969D /* M3u_Playlist.h in Headers */,
17C8F22B0CBED286008D969D /* Multi_Buffer.h in Headers */,
8370B78B17F615FE001A4D7A /* Resampler.h in Headers */,
8370B74117F615FE001A4D7A /* dbopl.h in Headers */,
8370B74D17F615FE001A4D7A /* Gbs_Core.h in Headers */,
17C8F22D0CBED286008D969D /* Music_Emu.h in Headers */,
8370B7AC17F615FE001A4D7A /* Sms_Fm_Apu.h in Headers */,
8370B73D17F615FE001A4D7A /* Chip_Resampler.h in Headers */,
17C8F22F0CBED286008D969D /* Nes_Apu.h in Headers */,
17C8F2300CBED286008D969D /* nes_cpu_io.h in Headers */,
17C8F2320CBED286008D969D /* Nes_Cpu.h in Headers */,
8370B73817F615FE001A4D7A /* Bml_Parser.h in Headers */,
8370B79117F615FE001A4D7A /* Rf5C164_Emu.h in Headers */,
17C8F2340CBED286008D969D /* Nes_Fme7_Apu.h in Headers */,
8370B75817F615FE001A4D7A /* i_fmpac.h in Headers */,
8370B73A17F615FE001A4D7A /* C140_Emu.h in Headers */,
8370B77F17F615FE001A4D7A /* okim6295.h in Headers */,
17C8F2360CBED286008D969D /* Nes_Namco_Apu.h in Headers */,
8370B73417F615FE001A4D7A /* blargg_errors.h in Headers */,
17C8F2380CBED286008D969D /* Nes_Oscs.h in Headers */,
8370B74A17F615FE001A4D7A /* fmopl.h in Headers */,
17C8F23A0CBED286008D969D /* Nes_Vrc6_Apu.h in Headers */,
17C8F23C0CBED286008D969D /* Nsf_Emu.h in Headers */,
8370B75917F615FE001A4D7A /* i_fmunit.h in Headers */,
17C8F23E0CBED286008D969D /* Nsfe_Emu.h in Headers */,
8370B7BE17F615FE001A4D7A /* ym2413.h in Headers */,
8370B73117F615FE001A4D7A /* Ay_Core.h in Headers */,
8370B7D117F615FE001A4D7A /* Z80_Cpu.h in Headers */,
8370B76F17F615FE001A4D7A /* Nes_Mmc5_Apu.h in Headers */,
17C8F2400CBED286008D969D /* Sap_Apu.h in Headers */,
17C8F2410CBED286008D969D /* sap_cpu_io.h in Headers */,
17C8F2430CBED286008D969D /* Sap_Cpu.h in Headers */,
17C8F2450CBED286008D969D /* Sap_Emu.h in Headers */,
8370B73C17F615FE001A4D7A /* c140.h in Headers */,
8370B76E17F615FE001A4D7A /* Nes_Fds_Apu.h in Headers */,
17C8F2470CBED286008D969D /* Sms_Apu.h in Headers */,
17C8F2480CBED286008D969D /* Sms_Oscs.h in Headers */,
8370B79917F615FE001A4D7A /* s_opl.h in Headers */,
8370B78917F615FE001A4D7A /* Qsound_Apu.h in Headers */,
17C8F24A0CBED286008D969D /* Snes_Spc.h in Headers */,
8370B7AE17F615FE001A4D7A /* Spc_Filter.h in Headers */,
8370B7AA17F615FE001A4D7A /* Sgc_Impl.h in Headers */,
17C8F24C0CBED286008D969D /* Spc_Cpu.h in Headers */,
8370B7CA17F615FE001A4D7A /* Ymf262_Emu.h in Headers */,
8370B79D17F615FE001A4D7A /* Sap_Core.h in Headers */,
8370B75E17F615FE001A4D7A /* k051649.h in Headers */,
8370B77D17F615FE001A4D7A /* Okim6295_Emu.h in Headers */,
8370B7C617F615FE001A4D7A /* Ym3812_Emu.h in Headers */,
8370B77717F615FE001A4D7A /* Nsf_Impl.h in Headers */,
17C8F24E0CBED286008D969D /* Spc_Dsp.h in Headers */,
8370B79F17F615FE001A4D7A /* scd_pcm.h in Headers */,
8370B7C217F615FE001A4D7A /* Ym2610b_Emu.h in Headers */,
8370B77917F615FE001A4D7A /* Okim6258_Emu.h in Headers */,
8370B76917F615FE001A4D7A /* Kss_Core.h in Headers */,
8370B7B617F615FE001A4D7A /* Vgm_Core.h in Headers */,
17C8F2500CBED286008D969D /* Spc_Emu.h in Headers */,
17C8F2520CBED286008D969D /* Vgm_Emu_Impl.h in Headers */,
8370B7BA17F615FE001A4D7A /* ym2151.h in Headers */,
17C8F2540CBED286008D969D /* Vgm_Emu.h in Headers */,
17C8F2560CBED286008D969D /* Ym2413_Emu.h in Headers */,
8370B7CC17F615FE001A4D7A /* Ymz280b_Emu.h in Headers */,
8370B76A17F615FE001A4D7A /* mamedef.h in Headers */,
17C8F2580CBED286008D969D /* Ym2612_Emu.h in Headers */,
);
runOnlyForDeploymentPostprocessing = 0;
@ -491,9 +1019,15 @@
/* Begin PBXProject section */
0867D690FE84028FC02AAC07 /* Project object */ = {
isa = PBXProject;
attributes = {
};
buildConfigurationList = 1DEB91B108733DA50010E9CD /* Build configuration list for PBXProject "GME" */;
compatibilityVersion = "Xcode 2.4";
developmentRegion = English;
hasScannedForEncodings = 1;
knownRegions = (
en,
);
mainGroup = 0867D691FE84028FC02AAC07 /* GME */;
productRefGroup = 034768DFFF38A50411DB9C8B /* Products */;
projectDirPath = "";
@ -520,50 +1054,122 @@
isa = PBXSourcesBuildPhase;
buildActionMask = 2147483647;
files = (
8370B74917F615FE001A4D7A /* fmopl.cpp in Sources */,
8370B78A17F615FE001A4D7A /* Resampler.cpp in Sources */,
8370B77017F615FE001A4D7A /* Nes_Vrc7_Apu.cpp in Sources */,
8370B7B117F615FE001A4D7A /* Track_Filter.cpp in Sources */,
8370B74617F615FE001A4D7A /* fm.c in Sources */,
8370B76517F615FE001A4D7A /* k054539.c in Sources */,
8370B7BF17F615FE001A4D7A /* Ym2608_Emu.cpp in Sources */,
17C8F1F40CBED286008D969D /* Ay_Apu.cpp in Sources */,
8370B7A017F615FE001A4D7A /* SegaPcm_Emu.cpp in Sources */,
17C8F1F60CBED286008D969D /* Ay_Cpu.cpp in Sources */,
17C8F1F80CBED286008D969D /* Ay_Emu.cpp in Sources */,
8370B76D17F615FE001A4D7A /* Nes_Fds_Apu.cpp in Sources */,
8370B7B917F615FE001A4D7A /* ym2151.c in Sources */,
17C8F1FE0CBED286008D969D /* Blip_Buffer.cpp in Sources */,
8370B79C17F615FE001A4D7A /* Sap_Core.cpp in Sources */,
17C8F2000CBED286008D969D /* Classic_Emu.cpp in Sources */,
8370B7AF17F615FE001A4D7A /* Spc_Sfm.cpp in Sources */,
8370B79817F615FE001A4D7A /* s_opl.c in Sources */,
8370B79217F615FE001A4D7A /* Rom_Data.cpp in Sources */,
8370B7BB17F615FE001A4D7A /* Ym2203_Emu.cpp in Sources */,
8370B74E17F615FE001A4D7A /* Gbs_Cpu.cpp in Sources */,
17C8F2020CBED286008D969D /* Data_Reader.cpp in Sources */,
8370B7C117F615FE001A4D7A /* Ym2610b_Emu.cpp in Sources */,
8370B75F17F615FE001A4D7A /* K053260_Emu.cpp in Sources */,
17C8F2040CBED286008D969D /* Dual_Resampler.cpp in Sources */,
8370B73217F615FE001A4D7A /* blargg_common.cpp in Sources */,
8370B74817F615FE001A4D7A /* fm2612.c in Sources */,
8370B7A417F615FE001A4D7A /* Sgc_Core.cpp in Sources */,
8370B79417F615FE001A4D7A /* s_deltat.c in Sources */,
17C8F2060CBED286008D969D /* Effects_Buffer.cpp in Sources */,
17C8F2080CBED286008D969D /* Fir_Resampler.cpp in Sources */,
8370B77617F615FE001A4D7A /* Nsf_Impl.cpp in Sources */,
8370B76317F615FE001A4D7A /* K054539_Emu.cpp in Sources */,
8370B7C917F615FE001A4D7A /* Ymf262_Emu.cpp in Sources */,
17C8F20A0CBED286008D969D /* Gb_Apu.cpp in Sources */,
8370B74017F615FE001A4D7A /* dbopl.cpp in Sources */,
8370B7CD17F615FE001A4D7A /* ymz280b.c in Sources */,
17C8F20D0CBED286008D969D /* Gb_Cpu.cpp in Sources */,
8370B7A917F615FE001A4D7A /* Sgc_Impl.cpp in Sources */,
17C8F20F0CBED286008D969D /* Gb_Oscs.cpp in Sources */,
8370B75B17F615FE001A4D7A /* K051649_Emu.cpp in Sources */,
8370B74317F615FE001A4D7A /* Downsampler.cpp in Sources */,
17C8F2110CBED286008D969D /* Gbs_Emu.cpp in Sources */,
8370B73317F615FE001A4D7A /* blargg_errors.cpp in Sources */,
8370B73B17F615FE001A4D7A /* c140.c in Sources */,
8370B77C17F615FE001A4D7A /* Okim6295_Emu.cpp in Sources */,
17C8F2130CBED286008D969D /* Gme_File.cpp in Sources */,
17C8F2150CBED286008D969D /* gme.cpp in Sources */,
17C8F2180CBED286008D969D /* Gym_Emu.cpp in Sources */,
8370B78E17F615FE001A4D7A /* rf5c68.c in Sources */,
8370B74C17F615FE001A4D7A /* Gbs_Core.cpp in Sources */,
17C8F21A0CBED286008D969D /* Hes_Apu.cpp in Sources */,
17C8F21D0CBED286008D969D /* Hes_Cpu.cpp in Sources */,
17C8F21F0CBED286008D969D /* Hes_Emu.cpp in Sources */,
8370B78617F615FE001A4D7A /* qmix.c in Sources */,
17C8F2210CBED286008D969D /* Kss_Cpu.cpp in Sources */,
8370B76117F615FE001A4D7A /* k053260.c in Sources */,
8370B79A17F615FE001A4D7A /* s_opltbl.c in Sources */,
17C8F2230CBED286008D969D /* Kss_Emu.cpp in Sources */,
17C8F2250CBED286008D969D /* Kss_Scc_Apu.cpp in Sources */,
8370B7BD17F615FE001A4D7A /* ym2413.c in Sources */,
8370B79617F615FE001A4D7A /* s_logtbl.c in Sources */,
17C8F2280CBED286008D969D /* M3u_Playlist.cpp in Sources */,
17C8F22A0CBED286008D969D /* Multi_Buffer.cpp in Sources */,
8370B7C717F615FE001A4D7A /* ymdeltat.cpp in Sources */,
17C8F22C0CBED286008D969D /* Music_Emu.cpp in Sources */,
8370B7C517F615FE001A4D7A /* Ym3812_Emu.cpp in Sources */,
17C8F22E0CBED286008D969D /* Nes_Apu.cpp in Sources */,
17C8F2310CBED286008D969D /* Nes_Cpu.cpp in Sources */,
17C8F2330CBED286008D969D /* Nes_Fme7_Apu.cpp in Sources */,
8370B7A217F615FE001A4D7A /* segapcm.c in Sources */,
8370B7B517F615FE001A4D7A /* Vgm_Core.cpp in Sources */,
8370B78417F615FE001A4D7A /* pwm.c in Sources */,
17C8F2350CBED286008D969D /* Nes_Namco_Apu.cpp in Sources */,
8370B7A617F615FE001A4D7A /* Sgc_Cpu.cpp in Sources */,
8370B77A17F615FE001A4D7A /* okim6258.c in Sources */,
17C8F2370CBED286008D969D /* Nes_Oscs.cpp in Sources */,
17C8F2390CBED286008D969D /* Nes_Vrc6_Apu.cpp in Sources */,
8370B75317F615FE001A4D7A /* Hes_Apu_Adpcm.cpp in Sources */,
8370B78817F615FE001A4D7A /* Qsound_Apu.cpp in Sources */,
17C8F23B0CBED286008D969D /* Nsf_Emu.cpp in Sources */,
8370B78217F615FE001A4D7A /* Pwm_Emu.cpp in Sources */,
8370B78C17F615FE001A4D7A /* Rf5C68_Emu.cpp in Sources */,
8370B73017F615FE001A4D7A /* Ay_Core.cpp in Sources */,
8370B77317F615FE001A4D7A /* Nsf_Core.cpp in Sources */,
8370B77517F615FE001A4D7A /* Nsf_Cpu.cpp in Sources */,
8370B76817F615FE001A4D7A /* Kss_Core.cpp in Sources */,
17C8F23D0CBED286008D969D /* Nsfe_Emu.cpp in Sources */,
8370B77E17F615FE001A4D7A /* okim6295.c in Sources */,
8370B7A717F615FE001A4D7A /* Sgc_Emu.cpp in Sources */,
17C8F23F0CBED286008D969D /* Sap_Apu.cpp in Sources */,
8370B75117F615FE001A4D7A /* Gme_Loader.cpp in Sources */,
8370B73E17F615FE001A4D7A /* dac_control.c in Sources */,
8370B73917F615FE001A4D7A /* C140_Emu.cpp in Sources */,
17C8F2420CBED286008D969D /* Sap_Cpu.cpp in Sources */,
8370B73717F615FE001A4D7A /* Bml_Parser.cpp in Sources */,
17C8F2440CBED286008D969D /* Sap_Emu.cpp in Sources */,
8370B75517F615FE001A4D7A /* Hes_Core.cpp in Sources */,
8370B7D017F615FE001A4D7A /* Z80_Cpu.cpp in Sources */,
17C8F2460CBED286008D969D /* Sms_Apu.cpp in Sources */,
17C8F2490CBED286008D969D /* Snes_Spc.cpp in Sources */,
8370B7B317F615FE001A4D7A /* Upsampler.cpp in Sources */,
8370B77817F615FE001A4D7A /* Okim6258_Emu.cpp in Sources */,
8370B7AD17F615FE001A4D7A /* Spc_Filter.cpp in Sources */,
17C8F24B0CBED286008D969D /* Spc_Cpu.cpp in Sources */,
8370B7AB17F615FE001A4D7A /* Sms_Fm_Apu.cpp in Sources */,
8370B78017F615FE001A4D7A /* Opl_Apu.cpp in Sources */,
8370B7CB17F615FE001A4D7A /* Ymz280b_Emu.cpp in Sources */,
8370B79017F615FE001A4D7A /* Rf5C164_Emu.cpp in Sources */,
17C8F24D0CBED286008D969D /* Spc_Dsp.cpp in Sources */,
17C8F24F0CBED286008D969D /* Spc_Emu.cpp in Sources */,
17C8F2510CBED286008D969D /* Vgm_Emu_Impl.cpp in Sources */,
17C8F2530CBED286008D969D /* Vgm_Emu.cpp in Sources */,
17C8F2550CBED286008D969D /* Ym2413_Emu.cpp in Sources */,
8370B79E17F615FE001A4D7A /* scd_pcm.c in Sources */,
8370B75D17F615FE001A4D7A /* k051649.c in Sources */,
8370B7B717F615FE001A4D7A /* Ym2151_Emu.cpp in Sources */,
17C8F2570CBED286008D969D /* Ym2612_Emu.cpp in Sources */,
);
runOnlyForDeploymentPostprocessing = 0;
@ -595,10 +1201,12 @@
GCC_OPTIMIZATION_LEVEL = 0;
GCC_PRECOMPILE_PREFIX_HEADER = YES;
GCC_PREFIX_HEADER = "";
GCC_PREPROCESSOR_DEFINITIONS = HAVE_STDINT_H;
INFOPLIST_FILE = Info.plist;
INSTALL_PATH = "@loader_path/../Frameworks";
PRECOMPS_INCLUDE_HEADERS_FROM_BUILT_PRODUCTS_DIR = NO;
PRODUCT_NAME = GME;
SDKROOT = macosx10.6;
SHARED_PRECOMPS_DIR = "";
SYMROOT = ../../build;
WRAPPER_EXTENSION = framework;
@ -620,10 +1228,12 @@
GCC_MODEL_TUNING = G5;
GCC_PRECOMPILE_PREFIX_HEADER = YES;
GCC_PREFIX_HEADER = "";
GCC_PREPROCESSOR_DEFINITIONS = "HAVE_STDINT_H;NDEBUG";
INFOPLIST_FILE = Info.plist;
INSTALL_PATH = "@loader_path/../Frameworks";
PRECOMPS_INCLUDE_HEADERS_FROM_BUILT_PRODUCTS_DIR = NO;
PRODUCT_NAME = GME;
SDKROOT = macosx10.6;
SHARED_PRECOMPS_DIR = "";
SYMROOT = ../../build;
WRAPPER_EXTENSION = framework;

113
Frameworks/GME/gme/Ay_Apu.cpp Executable file → Normal file
View file

@ -1,8 +1,8 @@
// Game_Music_Emu 0.5.2. http://www.slack.net/~ant/
// $package. http://www.slack.net/~ant/
#include "Ay_Apu.h"
/* Copyright (C) 2006 Shay Green. This module is free software; you
/* Copyright (C) 2006-2008 Shay Green. This module is free software; you
can redistribute it and/or modify it under the terms of the GNU Lesser
General Public License as published by the Free Software Foundation; either
version 2.1 of the License, or (at your option) any later version. This
@ -22,7 +22,7 @@ Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA */
// Tones above this frequency are treated as disabled tone at half volume.
// Power of two is more efficient (avoids division).
unsigned const inaudible_freq = 16384;
int const inaudible_freq = 16384;
int const period_factor = 16;
@ -67,12 +67,18 @@ static byte const modes [8] =
MODE( 0,1, 0,0, 0,0 ),
};
void Ay_Apu::set_output( Blip_Buffer* b )
{
for ( int i = 0; i < osc_count; ++i )
set_output( i, b );
}
Ay_Apu::Ay_Apu()
{
// build full table of the upper 8 envelope waveforms
for ( int m = 8; m--; )
{
byte* out = env.modes [m];
byte* out = env_modes [m];
int flags = modes [m];
for ( int x = 3; --x >= 0; )
{
@ -89,19 +95,20 @@ Ay_Apu::Ay_Apu()
}
}
output( 0 );
type_ = Ay8910;
set_output( NULL );
volume( 1.0 );
reset();
}
void Ay_Apu::reset()
{
addr_ = 0;
last_time = 0;
noise.delay = 0;
noise.lfsr = 1;
noise_delay = 0;
noise_lfsr = 1;
osc_t* osc = &oscs [osc_count];
do
for ( osc_t* osc = &oscs [osc_count]; osc != oscs; )
{
osc--;
osc->period = period_factor;
@ -109,7 +116,6 @@ void Ay_Apu::reset()
osc->last_amp = 0;
osc->phase = 0;
}
while ( osc != oscs );
for ( int i = sizeof regs; --i >= 0; )
regs [i] = 0;
@ -117,25 +123,31 @@ void Ay_Apu::reset()
write_data_( 13, 0 );
}
int Ay_Apu::read()
{
static byte const masks [reg_count] = {
0xFF, 0x0F, 0xFF, 0x0F, 0xFF, 0x0F, 0x1F, 0x3F,
0x1F, 0x1F, 0x1F, 0xFF, 0xFF, 0x0F, 0x00, 0x00
};
if (!(type_ & 0x10)) return regs [addr_] & masks [addr_];
else return regs [addr_];
}
void Ay_Apu::write_data_( int addr, int data )
{
assert( (unsigned) addr < reg_count );
if ( (unsigned) addr >= 14 )
{
#ifdef dprintf
dprintf( "Wrote to I/O port %02X\n", (int) addr );
#endif
}
// envelope mode
if ( addr == 13 )
{
if ( !(data & 8) ) // convert modes 0-7 to proper equivalents
data = (data & 4) ? 15 : 9;
env.wave = env.modes [data - 7];
env.pos = -48;
env.delay = 0; // will get set to envelope period in run_until()
env_wave = env_modes [data - 7];
env_pos = -48;
env_delay = 0; // will get set to envelope period in run_until()
}
regs [addr] = data;
@ -143,7 +155,7 @@ void Ay_Apu::write_data_( int addr, int data )
int i = addr >> 1;
if ( i < osc_count )
{
blip_time_t period = (regs [i * 2 + 1] & 0x0F) * (0x100L * period_factor) +
blip_time_t period = (regs [i * 2 + 1] & 0x0F) * (0x100 * period_factor) +
regs [i * 2] * period_factor;
if ( !period )
period = period_factor;
@ -170,16 +182,17 @@ void Ay_Apu::run_until( blip_time_t final_end_time )
blip_time_t noise_period = (regs [6] & 0x1F) * noise_period_factor;
if ( !noise_period )
noise_period = noise_period_factor;
blip_time_t const old_noise_delay = noise.delay;
blargg_ulong const old_noise_lfsr = noise.lfsr;
blip_time_t const old_noise_delay = noise_delay;
unsigned const old_noise_lfsr = noise_lfsr;
// envelope period
blip_time_t const env_period_factor = period_factor * 2; // verified
blip_time_t env_period = (regs [12] * 0x100L + regs [11]) * env_period_factor;
int env_step_scale = ((type_ & 0xF0) == 0x00) ? 1 : 0;
blip_time_t const env_period_factor = period_factor << env_step_scale; // verified
blip_time_t env_period = (regs [12] * 0x100 + regs [11]) * env_period_factor;
if ( !env_period )
env_period = env_period_factor; // same as period 1 on my AY chip
if ( !env.delay )
env.delay = env_period;
if ( !env_delay )
env_delay = env_period;
// run each osc separately
for ( int index = 0; index < osc_count; index++ )
@ -195,8 +208,8 @@ void Ay_Apu::run_until( blip_time_t final_end_time )
// period
int half_vol = 0;
blip_time_t inaudible_period = (blargg_ulong) (osc_output->clock_rate() +
inaudible_freq) / (inaudible_freq * 2);
blip_time_t inaudible_period = (unsigned) (osc_output->clock_rate() +
inaudible_freq) / (unsigned) (inaudible_freq * 2);
if ( osc->period <= inaudible_period && !(osc_mode & tone_off) )
{
half_vol = 1; // Actually around 60%, but 50% is close enough
@ -207,15 +220,17 @@ void Ay_Apu::run_until( blip_time_t final_end_time )
blip_time_t start_time = last_time;
blip_time_t end_time = final_end_time;
int const vol_mode = regs [0x08 + index];
int volume = amp_table [vol_mode & 0x0F] >> half_vol;
int osc_env_pos = env.pos;
if ( vol_mode & 0x10 )
int const vol_mode_mask = type_ == Ay8914 ? 0x30 : 0x10;
int volume = amp_table [vol_mode & 0x0F] >> half_vol + env_step_scale;
int osc_env_pos = env_pos;
if ( vol_mode & vol_mode_mask )
{
volume = env.wave [osc_env_pos] >> half_vol;
volume = env_wave [osc_env_pos] >> half_vol + env_step_scale;
if ( type_ == Ay8914 ) volume >>= 3 - ( ( vol_mode & vol_mode_mask ) >> 4 );
// use envelope only if it's a repeating wave or a ramp that hasn't finished
if ( !(regs [13] & 1) || osc_env_pos < -32 )
{
end_time = start_time + env.delay;
end_time = start_time + env_delay;
if ( end_time >= final_end_time )
end_time = final_end_time;
@ -237,14 +252,14 @@ void Ay_Apu::run_until( blip_time_t final_end_time )
blip_time_t time = start_time + osc->delay;
if ( osc_mode & tone_off ) // maintain tone's phase when off
{
blargg_long count = (final_end_time - time + period - 1) / period;
int count = (final_end_time - time + period - 1) / period;
time += count * period;
osc->phase ^= count & 1;
}
// noise time
blip_time_t ntime = final_end_time;
blargg_ulong noise_lfsr = 1;
unsigned noise_lfsr = 1;
if ( !(osc_mode & noise_off) )
{
ntime = start_time + old_noise_delay;
@ -311,8 +326,8 @@ void Ay_Apu::run_until( blip_time_t final_end_time )
else
{
// 20 or more noise periods on average for some music
blargg_long remain = end - ntime;
blargg_long count = remain / noise_period;
int remain = end - ntime;
int count = remain / noise_period;
if ( remain >= 0 )
ntime += noise_period + count * noise_period;
}
@ -327,11 +342,12 @@ void Ay_Apu::run_until( blip_time_t final_end_time )
delta = -delta;
synth_.offset( time, delta, osc_output );
time += period;
// alternate (less-efficient) implementation
//phase ^= 1;
}
//assert( phase == (delta > 0) );
phase = unsigned (-delta) >> (CHAR_BIT * sizeof (unsigned) - 1);
// (delta > 0)
check( phase == (delta > 0) );
}
else
{
@ -358,7 +374,8 @@ void Ay_Apu::run_until( blip_time_t final_end_time )
// next envelope step
if ( ++osc_env_pos >= 0 )
osc_env_pos -= 32;
volume = env.wave [osc_env_pos] >> half_vol;
volume = env_wave [osc_env_pos] >> half_vol + env_step_scale;
if ( type_ == Ay8914 ) volume >>= 3 - ( ( vol_mode & vol_mode_mask ) >> 4 );
start_time = end_time;
end_time += env_period;
@ -369,27 +386,27 @@ void Ay_Apu::run_until( blip_time_t final_end_time )
if ( !(osc_mode & noise_off) )
{
noise.delay = ntime - final_end_time;
noise.lfsr = noise_lfsr;
noise_delay = ntime - final_end_time;
this->noise_lfsr = noise_lfsr;
}
}
// TODO: optimized saw wave envelope?
// maintain envelope phase
blip_time_t remain = final_end_time - last_time - env.delay;
blip_time_t remain = final_end_time - last_time - env_delay;
if ( remain >= 0 )
{
blargg_long count = (remain + env_period) / env_period;
env.pos += count;
if ( env.pos >= 0 )
env.pos = (env.pos & 31) - 32;
int count = (remain + env_period) / env_period;
env_pos += count;
if ( env_pos >= 0 )
env_pos = (env_pos & 31) - 32;
remain -= count * env_period;
assert( -remain <= env_period );
}
env.delay = -remain;
assert( env.delay > 0 );
assert( env.pos < 0 );
env_delay = -remain;
assert( env_delay > 0 );
assert( env_pos < 0 );
last_time = final_end_time;
}

124
Frameworks/GME/gme/Ay_Apu.h Executable file → Normal file
View file

@ -1,6 +1,6 @@
// AY-3-8910 sound chip emulator
// Game_Music_Emu 0.5.2
// $package
#ifndef AY_APU_H
#define AY_APU_H
@ -9,37 +9,70 @@
class Ay_Apu {
public:
// Set buffer to generate all sound into, or disable sound if NULL
void output( Blip_Buffer* );
// Basics
enum Ay_Apu_Type
{
Ay8910 = 0,
Ay8912,
Ay8913,
Ay8914,
Ym2149 = 0x10,
Ym3439,
Ymz284,
Ymz294,
Ym2203 = 0x20,
Ym2608,
Ym2610,
Ym2610b
};
// Reset sound chip
void set_type( Ay_Apu_Type type ) { type_ = type; }
// Sets buffer to generate sound into, or 0 to mute.
void set_output( Blip_Buffer* );
// Writes to address register
void write_addr( int data ) { addr_ = data & 0x0F; }
// Emulates to time t, then writes to current data register
void write_data( blip_time_t t, int data ) { run_until( t ); write_data_( addr_, data ); }
// Emulates to time t, then subtracts t from the current time.
// OK if previous write call had time slightly after t.
void end_frame( blip_time_t t );
// More features
// Reads from current data register
int read();
// Resets sound chip
void reset();
// Write to register at specified time
// Number of registers
enum { reg_count = 16 };
void write( blip_time_t time, int addr, int data );
// Run sound to specified time, end current time frame, then start a new
// time frame at time 0. Time frames have no effect on emulation and each
// can be whatever length is convenient.
void end_frame( blip_time_t length );
// Additional features
// Set sound output of specific oscillator to buffer, where index is
// 0, 1, or 2. If buffer is NULL, the specified oscillator is muted.
// Same as set_output(), but for a particular channel
enum { osc_count = 3 };
void osc_output( int index, Blip_Buffer* );
void set_output( int chan, Blip_Buffer* );
// Set overall volume (default is 1.0)
void volume( double );
// Sets overall volume, where 1.0 is normal
void volume( double v ) { synth_.volume( 0.7/osc_count/amp_range * v ); }
// Set treble equalization (see documentation)
void treble_eq( blip_eq_t const& );
// Sets treble equalization
void treble_eq( blip_eq_t const& eq ) { synth_.treble_eq( eq ); }
private:
// noncopyable
Ay_Apu( const Ay_Apu& );
Ay_Apu& operator = ( const Ay_Apu& );
// Implementation
public:
Ay_Apu();
typedef unsigned char byte;
BLARGG_DISABLE_NOTHROW
typedef BOOST::uint8_t byte;
private:
struct osc_t
{
@ -49,50 +82,33 @@ private:
short phase;
Blip_Buffer* output;
} oscs [osc_count];
Ay_Apu_Type type_;
blip_time_t last_time;
byte latch;
byte addr_;
byte regs [reg_count];
struct {
blip_time_t delay;
blargg_ulong lfsr;
} noise;
blip_time_t noise_delay;
unsigned noise_lfsr;
struct {
blip_time_t delay;
byte const* wave;
int pos;
byte modes [8] [48]; // values already passed through volume table
} env;
blip_time_t env_delay;
byte const* env_wave;
int env_pos;
byte env_modes [8] [48]; // values already passed through volume table
void run_until( blip_time_t );
void write_data_( int addr, int data );
void run_until( blip_time_t );
public:
enum { amp_range = 255 };
Blip_Synth<blip_good_quality,1> synth_;
Blip_Synth_Norm synth_; // used by Ay_Core for beeper sound
};
inline void Ay_Apu::volume( double v ) { synth_.volume( 0.7 / osc_count / amp_range * v ); }
inline void Ay_Apu::treble_eq( blip_eq_t const& eq ) { synth_.treble_eq( eq ); }
inline void Ay_Apu::write( blip_time_t time, int addr, int data )
{
run_until( time );
write_data_( addr, data );
}
inline void Ay_Apu::osc_output( int i, Blip_Buffer* buf )
inline void Ay_Apu::set_output( int i, Blip_Buffer* out )
{
assert( (unsigned) i < osc_count );
oscs [i].output = buf;
}
inline void Ay_Apu::output( Blip_Buffer* buf )
{
osc_output( 0, buf );
osc_output( 1, buf );
osc_output( 2, buf );
oscs [i].output = out;
}
inline void Ay_Apu::end_frame( blip_time_t time )
@ -100,8 +116,8 @@ inline void Ay_Apu::end_frame( blip_time_t time )
if ( time > last_time )
run_until( time );
assert( last_time >= time );
last_time -= time;
assert( last_time >= 0 );
}
#endif

1662
Frameworks/GME/gme/Ay_Cpu.cpp Executable file → Normal file

File diff suppressed because it is too large Load diff

Some files were not shown because too many files have changed in this diff Show more