Replaced st3play with modplay, which now brings ft2play support

CQTexperiment
Chris Moeller 2014-03-20 00:27:34 -07:00
parent f05e4764cb
commit a2ced7c506
18 changed files with 4391 additions and 389 deletions

View File

@ -139,6 +139,7 @@
8355D6B6180612F300D05687 /* NSData+MD5.m in Sources */ = {isa = PBXBuildFile; fileRef = 8355D6B5180612F300D05687 /* NSData+MD5.m */; };
8355D6B8180613FB00D05687 /* Security.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 8355D6B7180613FB00D05687 /* Security.framework */; };
8359009D17FF06570060F3ED /* ArchiveSource.bundle in CopyFiles */ = {isa = PBXBuildFile; fileRef = 8359FF3117FEF35D0060F3ED /* ArchiveSource.bundle */; };
835CBC8118DA7A520087A03E /* modplay.bundle in CopyFiles */ = {isa = PBXBuildFile; fileRef = 835CBC7618DA79F80087A03E /* modplay.bundle */; };
8360EF6D17F92E56005208A4 /* HighlyComplete.bundle in CopyFiles */ = {isa = PBXBuildFile; fileRef = 8360EF0517F92B24005208A4 /* HighlyComplete.bundle */; };
836D28A818086386005B7299 /* MiniModeMenuTitleTransformer.m in Sources */ = {isa = PBXBuildFile; fileRef = 836D28A718086386005B7299 /* MiniModeMenuTitleTransformer.m */; };
836F706218BDD1230095E648 /* vgmstream.bundle in CopyFiles */ = {isa = PBXBuildFile; fileRef = 836F6B2E18BDB80E0095E648 /* vgmstream.bundle */; };
@ -188,7 +189,6 @@
83E5E54D18087CA5001F3284 /* miniModeOnTemplate.pdf in Resources */ = {isa = PBXBuildFile; fileRef = 83E5E54B18087CA5001F3284 /* miniModeOnTemplate.pdf */; };
83E6B7621816136F00D4576D /* Sparkle.framework in CopyFiles */ = {isa = PBXBuildFile; fileRef = 83E6B759181612FD00D4576D /* Sparkle.framework */; };
83E6B7651816178200D4576D /* Sparkle.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 83E6B759181612FD00D4576D /* Sparkle.framework */; };
83F4D58318D827BB009B2DE6 /* st3play.bundle in CopyFiles */ = {isa = PBXBuildFile; fileRef = 83F4D52F18D8206A009B2DE6 /* st3play.bundle */; };
8D11072B0486CEB800E47090 /* InfoPlist.strings in Resources */ = {isa = PBXBuildFile; fileRef = 089C165CFE840E0CC02AAC07 /* InfoPlist.strings */; };
8D11072D0486CEB800E47090 /* main.m in Sources */ = {isa = PBXBuildFile; fileRef = 29B97316FDCFA39411CA2CEA /* main.m */; settings = {ATTRIBUTES = (); }; };
8D11072F0486CEB800E47090 /* Cocoa.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 1058C7A1FEA54F0111CA2CBB /* Cocoa.framework */; };
@ -429,6 +429,13 @@
remoteGlobalIDString = 8359FF1717FEF35C0060F3ED;
remoteInfo = ArchiveSource;
};
835CBC7518DA79F80087A03E /* PBXContainerItemProxy */ = {
isa = PBXContainerItemProxy;
containerPortal = 835CBC7118DA79F80087A03E /* modplay.xcodeproj */;
proxyType = 2;
remoteGlobalIDString = 83F4D51518D8206A009B2DE6;
remoteInfo = modplay;
};
8360EF0417F92B24005208A4 /* PBXContainerItemProxy */ = {
isa = PBXContainerItemProxy;
containerPortal = 8360EF0017F92B23005208A4 /* HighlyComplete.xcodeproj */;
@ -576,13 +583,6 @@
remoteGlobalIDString = 8DC2EF4F0486A6940098B216;
remoteInfo = Sparkle;
};
83F4D52E18D8206A009B2DE6 /* PBXContainerItemProxy */ = {
isa = PBXContainerItemProxy;
containerPortal = 83F4D52A18D8206A009B2DE6 /* st3play.xcodeproj */;
proxyType = 2;
remoteGlobalIDString = 83F4D51518D8206A009B2DE6;
remoteInfo = st3play;
};
8E8D40860CBB036600135C1B /* PBXContainerItemProxy */ = {
isa = PBXContainerItemProxy;
containerPortal = 8E8D40820CBB036600135C1B /* M3u.xcodeproj */;
@ -636,7 +636,7 @@
dstPath = "";
dstSubfolderSpec = 13;
files = (
83F4D58318D827BB009B2DE6 /* st3play.bundle in CopyFiles */,
835CBC8118DA7A520087A03E /* modplay.bundle in CopyFiles */,
836F706218BDD1230095E648 /* vgmstream.bundle in CopyFiles */,
836FB5A718206F2500B3AD2D /* Hively.bundle in CopyFiles */,
83A0F4E31816DBF900119DB4 /* playptmod.bundle in CopyFiles */,
@ -881,6 +881,7 @@
8355D6B5180612F300D05687 /* NSData+MD5.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = "NSData+MD5.m"; sourceTree = "<group>"; };
8355D6B7180613FB00D05687 /* Security.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = Security.framework; path = System/Library/Frameworks/Security.framework; sourceTree = SDKROOT; };
8359FF2C17FEF35C0060F3ED /* ArchiveSource.xcodeproj */ = {isa = PBXFileReference; lastKnownFileType = "wrapper.pb-project"; name = ArchiveSource.xcodeproj; path = Plugins/ArchiveSource/ArchiveSource.xcodeproj; sourceTree = "<group>"; };
835CBC7118DA79F80087A03E /* modplay.xcodeproj */ = {isa = PBXFileReference; lastKnownFileType = "wrapper.pb-project"; name = modplay.xcodeproj; path = Plugins/modplay/modplay.xcodeproj; sourceTree = "<group>"; };
8360EF0017F92B23005208A4 /* HighlyComplete.xcodeproj */ = {isa = PBXFileReference; lastKnownFileType = "wrapper.pb-project"; name = HighlyComplete.xcodeproj; path = Plugins/HighlyComplete/HighlyComplete.xcodeproj; sourceTree = "<group>"; };
836D28A618086386005B7299 /* MiniModeMenuTitleTransformer.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = MiniModeMenuTitleTransformer.h; path = Window/MiniModeMenuTitleTransformer.h; sourceTree = "<group>"; };
836D28A718086386005B7299 /* MiniModeMenuTitleTransformer.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = MiniModeMenuTitleTransformer.m; path = Window/MiniModeMenuTitleTransformer.m; sourceTree = "<group>"; };
@ -934,7 +935,6 @@
83E5E54A18087CA5001F3284 /* miniModeOffTemplate.pdf */ = {isa = PBXFileReference; lastKnownFileType = image.pdf; name = miniModeOffTemplate.pdf; path = Images/miniModeOffTemplate.pdf; sourceTree = "<group>"; };
83E5E54B18087CA5001F3284 /* miniModeOnTemplate.pdf */ = {isa = PBXFileReference; lastKnownFileType = image.pdf; name = miniModeOnTemplate.pdf; path = Images/miniModeOnTemplate.pdf; sourceTree = "<group>"; };
83E6B750181612FD00D4576D /* Sparkle.xcodeproj */ = {isa = PBXFileReference; lastKnownFileType = "wrapper.pb-project"; name = Sparkle.xcodeproj; path = Frameworks/Sparkle/Sparkle.xcodeproj; sourceTree = "<group>"; };
83F4D52A18D8206A009B2DE6 /* st3play.xcodeproj */ = {isa = PBXFileReference; lastKnownFileType = "wrapper.pb-project"; name = st3play.xcodeproj; path = Plugins/st3play/st3play.xcodeproj; sourceTree = "<group>"; };
8D1107310486CEB800E47090 /* Info.plist */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.plist; path = Info.plist; sourceTree = "<group>"; };
8E07AB760AAC930B00A4B32F /* PreferencesController.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; name = PreferencesController.h; path = Preferences/PreferencesController.h; sourceTree = "<group>"; };
8E07AB770AAC930B00A4B32F /* PreferencesController.m */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.objc; name = PreferencesController.m; path = Preferences/PreferencesController.m; sourceTree = "<group>"; };
@ -1219,6 +1219,7 @@
17B619FF0B909ED400BC003F /* PlugIns */ = {
isa = PBXGroup;
children = (
835CBC7118DA79F80087A03E /* modplay.xcodeproj */,
8360EF0017F92B23005208A4 /* HighlyComplete.xcodeproj */,
B09E94300D747F7B0064F138 /* FFMPEG.xcodeproj */,
566D32160D538550004466A5 /* APL.xcodeproj */,
@ -1242,7 +1243,6 @@
83A0F4841816CE5E00119DB4 /* playptmod.xcodeproj */,
836FB5421820538700B3AD2D /* Hively.xcodeproj */,
836F6B2518BDB80D0095E648 /* vgmstream.xcodeproj */,
83F4D52A18D8206A009B2DE6 /* st3play.xcodeproj */,
);
name = PlugIns;
sourceTree = "<group>";
@ -1565,6 +1565,14 @@
name = Products;
sourceTree = "<group>";
};
835CBC7218DA79F80087A03E /* Products */ = {
isa = PBXGroup;
children = (
835CBC7618DA79F80087A03E /* modplay.bundle */,
);
name = Products;
sourceTree = "<group>";
};
8360EF0117F92B23005208A4 /* Products */ = {
isa = PBXGroup;
children = (
@ -1652,14 +1660,6 @@
name = Products;
sourceTree = "<group>";
};
83F4D52B18D8206A009B2DE6 /* Products */ = {
isa = PBXGroup;
children = (
83F4D52F18D8206A009B2DE6 /* st3play.bundle */,
);
name = Products;
sourceTree = "<group>";
};
8E07AAEA0AAC90DC00A4B32F /* Preferences */ = {
isa = PBXGroup;
children = (
@ -1914,6 +1914,10 @@
ProductGroup = 83B0669D180D5668008E3612 /* Products */;
ProjectRef = 83B0669C180D5668008E3612 /* MIDI.xcodeproj */;
},
{
ProductGroup = 835CBC7218DA79F80087A03E /* Products */;
ProjectRef = 835CBC7118DA79F80087A03E /* modplay.xcodeproj */;
},
{
ProductGroup = 17C8089F0C3BD1AB005707C4 /* Products */;
ProjectRef = 17C8089E0C3BD1AB005707C4 /* Musepack.xcodeproj */;
@ -1942,10 +1946,6 @@
ProductGroup = 83E6B751181612FD00D4576D /* Products */;
ProjectRef = 83E6B750181612FD00D4576D /* Sparkle.xcodeproj */;
},
{
ProductGroup = 83F4D52B18D8206A009B2DE6 /* Products */;
ProjectRef = 83F4D52A18D8206A009B2DE6 /* st3play.xcodeproj */;
},
{
ProductGroup = 17C808B10C3BD1C5005707C4 /* Products */;
ProjectRef = 17C808B00C3BD1C5005707C4 /* TagLib.xcodeproj */;
@ -2083,6 +2083,13 @@
remoteRef = 8359FF3017FEF35D0060F3ED /* PBXContainerItemProxy */;
sourceTree = BUILT_PRODUCTS_DIR;
};
835CBC7618DA79F80087A03E /* modplay.bundle */ = {
isa = PBXReferenceProxy;
fileType = wrapper.cfbundle;
path = modplay.bundle;
remoteRef = 835CBC7518DA79F80087A03E /* PBXContainerItemProxy */;
sourceTree = BUILT_PRODUCTS_DIR;
};
8360EF0517F92B24005208A4 /* HighlyComplete.bundle */ = {
isa = PBXReferenceProxy;
fileType = wrapper.cfbundle;
@ -2167,13 +2174,6 @@
remoteRef = 83E6B760181612FD00D4576D /* PBXContainerItemProxy */;
sourceTree = BUILT_PRODUCTS_DIR;
};
83F4D52F18D8206A009B2DE6 /* st3play.bundle */ = {
isa = PBXReferenceProxy;
fileType = wrapper.cfbundle;
path = st3play.bundle;
remoteRef = 83F4D52E18D8206A009B2DE6 /* PBXContainerItemProxy */;
sourceTree = BUILT_PRODUCTS_DIR;
};
8E8D40870CBB036600135C1B /* M3u.bundle */ = {
isa = PBXReferenceProxy;
fileType = wrapper.cfbundle;

View File

@ -7,6 +7,8 @@
objects = {
/* Begin PBXBuildFile section */
835CBC8218DA95AC0087A03E /* ft2play.h in Headers */ = {isa = PBXBuildFile; fileRef = 839CAC3E18DA744700D67EA9 /* ft2play.h */; settings = {ATTRIBUTES = (Public, ); }; };
839CAC4018DA746000D67EA9 /* ft2play.c in Sources */ = {isa = PBXBuildFile; fileRef = 839CAC3F18DA746000D67EA9 /* ft2play.c */; };
83F4D54818D82105009B2DE6 /* InfoPlist.strings in Resources */ = {isa = PBXBuildFile; fileRef = 83F4D54618D82105009B2DE6 /* InfoPlist.strings */; };
83F4D57518D821D2009B2DE6 /* lanczos_resampler.c in Sources */ = {isa = PBXBuildFile; fileRef = 83F4D57118D821D2009B2DE6 /* lanczos_resampler.c */; };
83F4D57618D821D2009B2DE6 /* lanczos_resampler.h in Headers */ = {isa = PBXBuildFile; fileRef = 83F4D57218D821D2009B2DE6 /* lanczos_resampler.h */; };
@ -15,8 +17,10 @@
/* End PBXBuildFile section */
/* Begin PBXFileReference section */
83F4D53A18D82105009B2DE6 /* st3play.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; path = st3play.framework; sourceTree = BUILT_PRODUCTS_DIR; };
83F4D54518D82105009B2DE6 /* st3play-Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = "st3play-Info.plist"; sourceTree = "<group>"; };
839CAC3E18DA744700D67EA9 /* ft2play.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = ft2play.h; sourceTree = "<group>"; };
839CAC3F18DA746000D67EA9 /* ft2play.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = ft2play.c; sourceTree = "<group>"; };
83F4D53A18D82105009B2DE6 /* modplay.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; path = modplay.framework; sourceTree = BUILT_PRODUCTS_DIR; };
83F4D54518D82105009B2DE6 /* modplay-Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = "modplay-Info.plist"; sourceTree = "<group>"; };
83F4D54718D82105009B2DE6 /* en */ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; name = en; path = en.lproj/InfoPlist.strings; sourceTree = "<group>"; };
83F4D57118D821D2009B2DE6 /* lanczos_resampler.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = lanczos_resampler.c; sourceTree = "<group>"; };
83F4D57218D821D2009B2DE6 /* lanczos_resampler.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = lanczos_resampler.h; sourceTree = "<group>"; };
@ -38,7 +42,7 @@
83F4D53018D82105009B2DE6 = {
isa = PBXGroup;
children = (
83F4D54318D82105009B2DE6 /* st3play */,
83F4D54318D82105009B2DE6 /* modplay */,
83F4D53C18D82105009B2DE6 /* Frameworks */,
83F4D53B18D82105009B2DE6 /* Products */,
);
@ -47,7 +51,7 @@
83F4D53B18D82105009B2DE6 /* Products */ = {
isa = PBXGroup;
children = (
83F4D53A18D82105009B2DE6 /* st3play.framework */,
83F4D53A18D82105009B2DE6 /* modplay.framework */,
);
name = Products;
sourceTree = "<group>";
@ -67,22 +71,24 @@
name = "Other Frameworks";
sourceTree = "<group>";
};
83F4D54318D82105009B2DE6 /* st3play */ = {
83F4D54318D82105009B2DE6 /* modplay */ = {
isa = PBXGroup;
children = (
83F4D57118D821D2009B2DE6 /* lanczos_resampler.c */,
83F4D57218D821D2009B2DE6 /* lanczos_resampler.h */,
83F4D57318D821D2009B2DE6 /* st3play.c */,
83F4D57418D821D2009B2DE6 /* st3play.h */,
839CAC3F18DA746000D67EA9 /* ft2play.c */,
839CAC3E18DA744700D67EA9 /* ft2play.h */,
83F4D54418D82105009B2DE6 /* Supporting Files */,
);
path = st3play;
path = modplay;
sourceTree = "<group>";
};
83F4D54418D82105009B2DE6 /* Supporting Files */ = {
isa = PBXGroup;
children = (
83F4D54518D82105009B2DE6 /* st3play-Info.plist */,
83F4D54518D82105009B2DE6 /* modplay-Info.plist */,
83F4D54618D82105009B2DE6 /* InfoPlist.strings */,
);
name = "Supporting Files";
@ -95,6 +101,7 @@
isa = PBXHeadersBuildPhase;
buildActionMask = 2147483647;
files = (
835CBC8218DA95AC0087A03E /* ft2play.h in Headers */,
83F4D57818D821D2009B2DE6 /* st3play.h in Headers */,
83F4D57618D821D2009B2DE6 /* lanczos_resampler.h in Headers */,
);
@ -103,9 +110,9 @@
/* End PBXHeadersBuildPhase section */
/* Begin PBXNativeTarget section */
83F4D53918D82105009B2DE6 /* st3play */ = {
83F4D53918D82105009B2DE6 /* modplay */ = {
isa = PBXNativeTarget;
buildConfigurationList = 83F4D56218D82105009B2DE6 /* Build configuration list for PBXNativeTarget "st3play" */;
buildConfigurationList = 83F4D56218D82105009B2DE6 /* Build configuration list for PBXNativeTarget "modplay" */;
buildPhases = (
83F4D53518D82105009B2DE6 /* Sources */,
83F4D53618D82105009B2DE6 /* Frameworks */,
@ -116,9 +123,9 @@
);
dependencies = (
);
name = st3play;
productName = st3play;
productReference = 83F4D53A18D82105009B2DE6 /* st3play.framework */;
name = modplay;
productName = modplay;
productReference = 83F4D53A18D82105009B2DE6 /* modplay.framework */;
productType = "com.apple.product-type.framework";
};
/* End PBXNativeTarget section */
@ -130,7 +137,7 @@
LastUpgradeCheck = 0510;
ORGANIZATIONNAME = "Christopher Snowhill";
};
buildConfigurationList = 83F4D53418D82105009B2DE6 /* Build configuration list for PBXProject "st3play" */;
buildConfigurationList = 83F4D53418D82105009B2DE6 /* Build configuration list for PBXProject "modplay" */;
compatibilityVersion = "Xcode 3.2";
developmentRegion = English;
hasScannedForEncodings = 0;
@ -142,7 +149,7 @@
projectDirPath = "";
projectRoot = "";
targets = (
83F4D53918D82105009B2DE6 /* st3play */,
83F4D53918D82105009B2DE6 /* modplay */,
);
};
/* End PBXProject section */
@ -165,6 +172,7 @@
files = (
83F4D57718D821D2009B2DE6 /* st3play.c in Sources */,
83F4D57518D821D2009B2DE6 /* lanczos_resampler.c in Sources */,
839CAC4018DA746000D67EA9 /* ft2play.c in Sources */,
);
runOnlyForDeploymentPostprocessing = 0;
};
@ -261,8 +269,8 @@
DYLIB_COMPATIBILITY_VERSION = 1;
DYLIB_CURRENT_VERSION = 1;
FRAMEWORK_VERSION = A;
INFOPLIST_FILE = "st3play/st3play-Info.plist";
PRODUCT_NAME = "$(TARGET_NAME)";
INFOPLIST_FILE = "modplay/modplay-Info.plist";
PRODUCT_NAME = modplay;
WRAPPER_EXTENSION = framework;
};
name = Debug;
@ -274,8 +282,8 @@
DYLIB_COMPATIBILITY_VERSION = 1;
DYLIB_CURRENT_VERSION = 1;
FRAMEWORK_VERSION = A;
INFOPLIST_FILE = "st3play/st3play-Info.plist";
PRODUCT_NAME = "$(TARGET_NAME)";
INFOPLIST_FILE = "modplay/modplay-Info.plist";
PRODUCT_NAME = modplay;
WRAPPER_EXTENSION = framework;
};
name = Release;
@ -283,7 +291,7 @@
/* End XCBuildConfiguration section */
/* Begin XCConfigurationList section */
83F4D53418D82105009B2DE6 /* Build configuration list for PBXProject "st3play" */ = {
83F4D53418D82105009B2DE6 /* Build configuration list for PBXProject "modplay" */ = {
isa = XCConfigurationList;
buildConfigurations = (
83F4D56018D82105009B2DE6 /* Debug */,
@ -292,13 +300,14 @@
defaultConfigurationIsVisible = 0;
defaultConfigurationName = Release;
};
83F4D56218D82105009B2DE6 /* Build configuration list for PBXNativeTarget "st3play" */ = {
83F4D56218D82105009B2DE6 /* Build configuration list for PBXNativeTarget "modplay" */ = {
isa = XCConfigurationList;
buildConfigurations = (
83F4D56318D82105009B2DE6 /* Debug */,
83F4D56418D82105009B2DE6 /* Release */,
);
defaultConfigurationIsVisible = 0;
defaultConfigurationName = Release;
};
/* End XCConfigurationList section */
};

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,42 @@
#ifndef _FT2PLAY_H_
#define _FT2PLAY_H_
#include <stdint.h>
#ifdef __cplusplus
extern "C" {
#endif
void * ft2play_Alloc(uint32_t _samplingFrequency, int8_t interpolation);
void ft2play_Free(void *);
int8_t ft2play_LoadModule(void *, const int8_t *buffer, size_t size);
void ft2play_PlaySong(void *, int32_t startOrder);
/* Calling this function with a NULL buffer skips mixing altogether */
void ft2play_RenderFloat(void *, float *buffer, int32_t count);
/* These two absolutely require a real buffer */
void ft2play_RenderFixed32(void *, int32_t *buffer, int32_t count, int8_t depth);
void ft2play_RenderFixed16(void *, int16_t *buffer, int32_t count, int8_t depth);
uint32_t ft2play_GetLoopCount(void *);
typedef struct
{
uint16_t order;
uint16_t pattern;
uint16_t row;
uint16_t speed;
uint16_t tempo;
uint8_t channels_playing;
} ft2_info;
void ft2play_GetInfo(void *, ft2_info *);
#ifdef __cplusplus
}
#endif
#endif

View File

@ -67,9 +67,9 @@ void lanczos_resampler_delete(void * _r)
free( _r );
}
void * lanczos_resampler_dup(void * _r)
void * lanczos_resampler_dup(const void * _r)
{
lanczos_resampler * r_in = ( lanczos_resampler * ) _r;
const lanczos_resampler * r_in = ( const lanczos_resampler * ) _r;
lanczos_resampler * r_out = ( lanczos_resampler * ) malloc( sizeof(lanczos_resampler) );
if ( !r_out ) return 0;
@ -85,6 +85,21 @@ void * lanczos_resampler_dup(void * _r)
return r_out;
}
void lanczos_resampler_dup_inplace(void *_d, const void *_s)
{
const lanczos_resampler * r_in = ( const lanczos_resampler * ) _s;
lanczos_resampler * r_out = ( lanczos_resampler * ) _d;
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) );
}
int lanczos_resampler_get_free_count(void *_r)
{
lanczos_resampler * r = ( lanczos_resampler * ) _r;
@ -164,7 +179,7 @@ static int lanczos_resampler_run(lanczos_resampler * r, float ** out_, float * o
}
for (sample = 0, i = 0; i < LANCZOS_WIDTH * 2; ++i)
sample += in[i] * kernel[i];
*out++ = (float)(sample / kernel_sum * 256.0);
*out++ = (float)(sample / kernel_sum * (1.0 / 32768.0));
phase += phase_inc;

View File

@ -9,6 +9,7 @@
#define lanczos_resampler_create EVALUATE(LANCZOS_DECORATE,_lanczos_resampler_create)
#define lanczos_resampler_delete EVALUATE(LANCZOS_DECORATE,_lanczos_resampler_delete)
#define lanczos_resampler_dup EVALUATE(LANCZOS_DECORATE,_lanczos_resampler_dup)
#define lanczos_resampler_dup_inplace EVALUATE(LANCZOS_DECORATE,_lanczos_resampler_dup_inplace)
#define lanczos_resampler_get_free_count EVALUATE(LANCZOS_DECORATE,_lanczos_resampler_get_free_count)
#define lanczos_resampler_write_sample EVALUATE(LANCZOS_DECORATE,_lanczos_resampler_write_sample)
#define lanczos_resampler_set_rate EVALUATE(LANCZOS_DECORATE,_lanczos_resampler_set_rate)
@ -23,7 +24,8 @@ void lanczos_init(void);
void * lanczos_resampler_create(void);
void lanczos_resampler_delete(void *);
void * lanczos_resampler_dup(void *);
void * lanczos_resampler_dup(const void *);
void lanczos_resampler_dup_inplace(void *, const void *);
int lanczos_resampler_get_free_count(void *);
void lanczos_resampler_write_sample(void *, short sample);

View File

@ -56,6 +56,7 @@
#include <stdint.h>
#include <limits.h>
#include <math.h>
#include <assert.h>
#if defined(_MSC_VER) && !defined(inline)
#define inline __forceinline
@ -1342,7 +1343,7 @@ void st3play_PlaySong(void *_p, int16_t startOrder)
pan = (dat & 0x0F) << 4;
}
if (stereomode)
if (p->stereomode)
p->chn[i].apanpos = pan;
else
p->chn[i].apanpos = 7;
@ -1483,7 +1484,7 @@ static void s_setpanwave(PLAYER *p, chn_t *ch) // NON-ST3
static void s_setpanpos(PLAYER *p, chn_t *ch)
{
if (stereomode)
if (p->stereomode)
{
ch->apanpos = (ch->info & 0x0F) << 4;
@ -3082,9 +3083,9 @@ static inline void mixadpcm(PLAYER *p, uint8_t ch, uint32_t samples)
}
}
void mixSampleBlock(PLAYER *p, int32_t *outputStream, uint32_t sampleBlockLength)
void mixSampleBlock(PLAYER *p, float *outputStream, uint32_t sampleBlockLength)
{
int32_t *streamPointer;
float *streamPointer;
uint8_t i;
uint32_t j;
@ -3124,21 +3125,16 @@ void mixSampleBlock(PLAYER *p, int32_t *outputStream, uint32_t sampleBlockLength
outL = p->masterBufferL[j] * p->f_masterVolume;
outR = p->masterBufferR[j] * p->f_masterVolume;
if (outL > INT_MAX) outL = INT_MAX;
else if (outL < INT_MIN) outL = INT_MIN;
if (outR > INT_MAX) outR = INT_MAX;
else if (outR < INT_MIN) outR = INT_MIN;
*streamPointer++ = (int32_t)(outL);
*streamPointer++ = (int32_t)(outR);
*streamPointer++ = outL;
*streamPointer++ = outR;
}
}
void st3play_RenderFixed(void *_p, int32_t *buffer, int32_t count)
void st3play_RenderFloat(void *_p, float *buffer, int32_t count)
{
PLAYER * p = (PLAYER *)_p;
int32_t samplesTodo;
int32_t *outputStream;
float *outputStream;
if (p->isMixing)
{
@ -3172,29 +3168,42 @@ void st3play_RenderFixed(void *_p, int32_t *buffer, int32_t count)
}
}
void st3play_Render16(void *_p, int16_t *buffer, int32_t count)
void st3play_RenderFixed32(void *_p, int32_t *buffer, int32_t count, int8_t depth)
{
int32_t bufferFixed[1024];
int32_t samplesTodo;
int32_t i, sample;
int16_t *outputStream;
outputStream = buffer;
int32_t i;
float * fbuffer = (float *)buffer;
float scale = (float)(1 << (depth - 1));
float sample;
assert(sizeof(int32_t) == sizeof(float));
st3play_RenderFloat(_p, fbuffer, count);
for (i = 0; i < count * 2; ++i)
{
sample = fbuffer[i] * scale;
if (sample > INT_MAX) sample = INT_MAX;
else if (sample < INT_MIN) sample = INT_MIN;
buffer[i] = (int32_t)sample;
}
}
void st3play_RenderFixed16(void *_p, int16_t *buffer, int32_t count, int8_t depth)
{
int32_t i, SamplesTodo;
float scale = (float)(1 << (depth - 1));
float sample;
float fbuffer[1024];
while (count)
{
samplesTodo = (count > 512) ? 512 : count;
st3play_RenderFixed(_p, bufferFixed, samplesTodo);
count -= samplesTodo;
samplesTodo <<= 1;
for (i = 0; i < samplesTodo; ++i)
SamplesTodo = (count < 512) ? count : 512;
st3play_RenderFloat(_p, fbuffer, SamplesTodo);
for (i = 0; i < SamplesTodo * 2; ++i)
{
sample = bufferFixed[i] >> 8;
sample = fbuffer[i] * scale;
if (sample > 32767) sample = 32767;
else if (sample < -32768) sample = -32768;
outputStream[i] = (int16_t)sample;
buffer[i] = (int16_t)sample;
}
outputStream += samplesTodo;
buffer += SamplesTodo * 2;
count -= SamplesTodo;
}
}

View File

@ -15,8 +15,12 @@ void st3play_PlaySong(void *, int16_t startOrder);
int32_t st3play_GetLoopCount(void *);
void st3play_RenderFixed(void *, int32_t *buffer, int32_t count);
void st3play_Render16(void *, int16_t *buffer, int32_t count);
/* Calling this function with a NULL buffer skips mixing altogether */
void st3play_RenderFloat(void *, float *buffer, int32_t count);
/* These two absolutely require a real buffer */
void st3play_RenderFixed32(void *, int32_t *buffer, int32_t count, int8_t depth);
void st3play_RenderFixed16(void *, int16_t *buffer, int32_t count, int8_t depth);
typedef struct
{

View File

@ -9,9 +9,7 @@
/* Begin PBXBuildFile section */
17C8F6950CBEE846008D969D /* DumbDecoder.m in Sources */ = {isa = PBXBuildFile; fileRef = 17C8F68F0CBEE846008D969D /* DumbDecoder.m */; };
17C8F69F0CBEE85F008D969D /* Dumb.framework in CopyFiles */ = {isa = PBXBuildFile; fileRef = 17C8F69E0CBEE857008D969D /* Dumb.framework */; };
17C8F70D0CBEEC87008D969D /* Plugin.h in CopyFiles */ = {isa = PBXBuildFile; fileRef = 17C8F70C0CBEEC87008D969D /* Plugin.h */; };
17C8F7B90CBEF380008D969D /* Dumb.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 17C8F69E0CBEE857008D969D /* Dumb.framework */; };
17DA363D0CC0600E0003F6B2 /* DumbMetadataReader.h in CopyFiles */ = {isa = PBXBuildFile; fileRef = 17DA363B0CC0600E0003F6B2 /* DumbMetadataReader.h */; };
17DA363E0CC0600E0003F6B2 /* DumbMetadataReader.m in Sources */ = {isa = PBXBuildFile; fileRef = 17DA363C0CC0600E0003F6B2 /* DumbMetadataReader.m */; };
8335FF6717FF6FD9002D8DD2 /* DumbContainer.m in Sources */ = {isa = PBXBuildFile; fileRef = 8335FF6617FF6FD9002D8DD2 /* DumbContainer.m */; };
8337AAEC17FFA0000081AFF8 /* umx.mm in Sources */ = {isa = PBXBuildFile; fileRef = 8337AAE817FFA0000081AFF8 /* umx.mm */; };
@ -51,8 +49,6 @@
dstSubfolderSpec = 10;
files = (
17C8F69F0CBEE85F008D969D /* Dumb.framework in CopyFiles */,
17C8F70D0CBEEC87008D969D /* Plugin.h in CopyFiles */,
17DA363D0CC0600E0003F6B2 /* DumbMetadataReader.h in CopyFiles */,
);
runOnlyForDeploymentPostprocessing = 0;
};

View File

@ -7,55 +7,69 @@
objects = {
/* Begin PBXBuildFile section */
835CBC7D18DA7A260087A03E /* modplay.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 835CBC7C18DA7A090087A03E /* modplay.framework */; };
835CBC8018DA7A3E0087A03E /* modplay.framework in CopyFiles */ = {isa = PBXBuildFile; fileRef = 835CBC7C18DA7A090087A03E /* modplay.framework */; };
835CBC8518DACAE90087A03E /* libunmo3.dylib in Frameworks */ = {isa = PBXBuildFile; fileRef = 835CBC8318DACAE90087A03E /* libunmo3.dylib */; };
835CBC8818DACC2D0087A03E /* libunmo3.dylib in CopyFiles */ = {isa = PBXBuildFile; fileRef = 835CBC8318DACAE90087A03E /* libunmo3.dylib */; };
83F4D51918D8206A009B2DE6 /* Cocoa.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 83F4D51818D8206A009B2DE6 /* Cocoa.framework */; };
83F4D52318D8206A009B2DE6 /* InfoPlist.strings in Resources */ = {isa = PBXBuildFile; fileRef = 83F4D52118D8206A009B2DE6 /* InfoPlist.strings */; };
83F4D57B18D8231F009B2DE6 /* st3play.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 83F4D56E18D82106009B2DE6 /* st3play.framework */; };
83F4D57D18D8234D009B2DE6 /* st3play.framework in CopyFiles */ = {isa = PBXBuildFile; fileRef = 83F4D56E18D82106009B2DE6 /* st3play.framework */; };
83F4D58018D8238A009B2DE6 /* st3Decoder.m in Sources */ = {isa = PBXBuildFile; fileRef = 83F4D57F18D8238A009B2DE6 /* st3Decoder.m */; };
83F4D58018D8238A009B2DE6 /* modDecoder.m in Sources */ = {isa = PBXBuildFile; fileRef = 83F4D57F18D8238A009B2DE6 /* modDecoder.m */; };
/* End PBXBuildFile section */
/* Begin PBXContainerItemProxy section */
83F4D56D18D82106009B2DE6 /* PBXContainerItemProxy */ = {
835CBC7B18DA7A090087A03E /* PBXContainerItemProxy */ = {
isa = PBXContainerItemProxy;
containerPortal = 83F4D56818D82105009B2DE6 /* st3play.xcodeproj */;
containerPortal = 835CBC7718DA7A090087A03E /* modplay.xcodeproj */;
proxyType = 2;
remoteGlobalIDString = 83F4D53A18D82105009B2DE6;
remoteInfo = st3play;
remoteInfo = modplay;
};
83F4D57918D82315009B2DE6 /* PBXContainerItemProxy */ = {
835CBC7E18DA7A2E0087A03E /* PBXContainerItemProxy */ = {
isa = PBXContainerItemProxy;
containerPortal = 83F4D56818D82105009B2DE6 /* st3play.xcodeproj */;
containerPortal = 835CBC7718DA7A090087A03E /* modplay.xcodeproj */;
proxyType = 1;
remoteGlobalIDString = 83F4D53918D82105009B2DE6;
remoteInfo = st3play;
remoteInfo = modplay;
};
/* End PBXContainerItemProxy section */
/* Begin PBXCopyFilesBuildPhase section */
835CBC8718DACC250087A03E /* CopyFiles */ = {
isa = PBXCopyFilesBuildPhase;
buildActionMask = 2147483647;
dstPath = "";
dstSubfolderSpec = 6;
files = (
835CBC8818DACC2D0087A03E /* libunmo3.dylib in CopyFiles */,
);
runOnlyForDeploymentPostprocessing = 0;
};
83F4D57C18D82342009B2DE6 /* CopyFiles */ = {
isa = PBXCopyFilesBuildPhase;
buildActionMask = 2147483647;
dstPath = "";
dstSubfolderSpec = 10;
files = (
83F4D57D18D8234D009B2DE6 /* st3play.framework in CopyFiles */,
835CBC8018DA7A3E0087A03E /* modplay.framework in CopyFiles */,
);
runOnlyForDeploymentPostprocessing = 0;
};
/* End PBXCopyFilesBuildPhase section */
/* Begin PBXFileReference section */
83F4D51518D8206A009B2DE6 /* st3play.bundle */ = {isa = PBXFileReference; explicitFileType = wrapper.cfbundle; includeInIndex = 0; path = st3play.bundle; sourceTree = BUILT_PRODUCTS_DIR; };
835CBC7718DA7A090087A03E /* modplay.xcodeproj */ = {isa = PBXFileReference; lastKnownFileType = "wrapper.pb-project"; name = modplay.xcodeproj; path = ../../Frameworks/modplay/modplay.xcodeproj; sourceTree = "<group>"; };
835CBC8318DACAE90087A03E /* libunmo3.dylib */ = {isa = PBXFileReference; lastKnownFileType = "compiled.mach-o.dylib"; name = libunmo3.dylib; path = ../../../ThirdParty/BASS/libunmo3.dylib; sourceTree = "<group>"; };
835CBC8418DACAE90087A03E /* unmo3.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = unmo3.h; path = ../../../ThirdParty/BASS/unmo3.h; sourceTree = "<group>"; };
83F4D51518D8206A009B2DE6 /* modplay.bundle */ = {isa = PBXFileReference; explicitFileType = wrapper.cfbundle; includeInIndex = 0; path = modplay.bundle; sourceTree = BUILT_PRODUCTS_DIR; };
83F4D51818D8206A009B2DE6 /* Cocoa.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = Cocoa.framework; path = System/Library/Frameworks/Cocoa.framework; sourceTree = SDKROOT; };
83F4D51B18D8206A009B2DE6 /* Foundation.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = Foundation.framework; path = System/Library/Frameworks/Foundation.framework; sourceTree = SDKROOT; };
83F4D51C18D8206A009B2DE6 /* CoreData.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = CoreData.framework; path = System/Library/Frameworks/CoreData.framework; sourceTree = SDKROOT; };
83F4D51D18D8206A009B2DE6 /* AppKit.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = AppKit.framework; path = System/Library/Frameworks/AppKit.framework; sourceTree = SDKROOT; };
83F4D52018D8206A009B2DE6 /* st3play-Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = "st3play-Info.plist"; sourceTree = "<group>"; };
83F4D52018D8206A009B2DE6 /* modplay-Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = "modplay-Info.plist"; sourceTree = "<group>"; };
83F4D52218D8206A009B2DE6 /* en */ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; name = en; path = en.lproj/InfoPlist.strings; sourceTree = "<group>"; };
83F4D52418D8206A009B2DE6 /* st3play-Prefix.pch */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = "st3play-Prefix.pch"; sourceTree = "<group>"; };
83F4D56818D82105009B2DE6 /* st3play.xcodeproj */ = {isa = PBXFileReference; lastKnownFileType = "wrapper.pb-project"; name = st3play.xcodeproj; path = ../../Frameworks/st3play/st3play.xcodeproj; sourceTree = "<group>"; };
83F4D57E18D8238A009B2DE6 /* st3Decoder.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = st3Decoder.h; sourceTree = "<group>"; };
83F4D57F18D8238A009B2DE6 /* st3Decoder.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = st3Decoder.m; sourceTree = "<group>"; };
83F4D52418D8206A009B2DE6 /* modplay-Prefix.pch */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = "modplay-Prefix.pch"; sourceTree = "<group>"; };
83F4D57E18D8238A009B2DE6 /* modDecoder.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = modDecoder.h; sourceTree = "<group>"; };
83F4D57F18D8238A009B2DE6 /* modDecoder.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = modDecoder.m; sourceTree = "<group>"; };
83F4D58118D8239D009B2DE6 /* Plugin.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = Plugin.h; path = ../../../Audio/Plugin.h; sourceTree = "<group>"; };
83F4D58218D823D1009B2DE6 /* PlaylistController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = PlaylistController.h; path = ../../../Playlist/PlaylistController.h; sourceTree = "<group>"; };
/* End PBXFileReference section */
@ -65,18 +79,27 @@
isa = PBXFrameworksBuildPhase;
buildActionMask = 2147483647;
files = (
83F4D57B18D8231F009B2DE6 /* st3play.framework in Frameworks */,
835CBC7D18DA7A260087A03E /* modplay.framework in Frameworks */,
83F4D51918D8206A009B2DE6 /* Cocoa.framework in Frameworks */,
835CBC8518DACAE90087A03E /* libunmo3.dylib in Frameworks */,
);
runOnlyForDeploymentPostprocessing = 0;
};
/* End PBXFrameworksBuildPhase section */
/* Begin PBXGroup section */
835CBC7818DA7A090087A03E /* Products */ = {
isa = PBXGroup;
children = (
835CBC7C18DA7A090087A03E /* modplay.framework */,
);
name = Products;
sourceTree = "<group>";
};
83F4D50C18D8206A009B2DE6 = {
isa = PBXGroup;
children = (
83F4D51E18D8206A009B2DE6 /* st3play */,
83F4D51E18D8206A009B2DE6 /* modplay */,
83F4D51718D8206A009B2DE6 /* Frameworks */,
83F4D51618D8206A009B2DE6 /* Products */,
);
@ -85,7 +108,7 @@
83F4D51618D8206A009B2DE6 /* Products */ = {
isa = PBXGroup;
children = (
83F4D51518D8206A009B2DE6 /* st3play.bundle */,
83F4D51518D8206A009B2DE6 /* modplay.bundle */,
);
name = Products;
sourceTree = "<group>";
@ -93,9 +116,9 @@
83F4D51718D8206A009B2DE6 /* Frameworks */ = {
isa = PBXGroup;
children = (
835CBC7718DA7A090087A03E /* modplay.xcodeproj */,
83F4D51818D8206A009B2DE6 /* Cocoa.framework */,
83F4D51A18D8206A009B2DE6 /* Other Frameworks */,
83F4D56818D82105009B2DE6 /* st3play.xcodeproj */,
);
name = Frameworks;
sourceTree = "<group>";
@ -110,56 +133,51 @@
name = "Other Frameworks";
sourceTree = "<group>";
};
83F4D51E18D8206A009B2DE6 /* st3play */ = {
83F4D51E18D8206A009B2DE6 /* modplay */ = {
isa = PBXGroup;
children = (
835CBC8318DACAE90087A03E /* libunmo3.dylib */,
835CBC8418DACAE90087A03E /* unmo3.h */,
83F4D58218D823D1009B2DE6 /* PlaylistController.h */,
83F4D58118D8239D009B2DE6 /* Plugin.h */,
83F4D57E18D8238A009B2DE6 /* st3Decoder.h */,
83F4D57F18D8238A009B2DE6 /* st3Decoder.m */,
83F4D57E18D8238A009B2DE6 /* modDecoder.h */,
83F4D57F18D8238A009B2DE6 /* modDecoder.m */,
83F4D51F18D8206A009B2DE6 /* Supporting Files */,
);
path = st3play;
path = modplay;
sourceTree = "<group>";
};
83F4D51F18D8206A009B2DE6 /* Supporting Files */ = {
isa = PBXGroup;
children = (
83F4D52018D8206A009B2DE6 /* st3play-Info.plist */,
83F4D52018D8206A009B2DE6 /* modplay-Info.plist */,
83F4D52118D8206A009B2DE6 /* InfoPlist.strings */,
83F4D52418D8206A009B2DE6 /* st3play-Prefix.pch */,
83F4D52418D8206A009B2DE6 /* modplay-Prefix.pch */,
);
name = "Supporting Files";
sourceTree = "<group>";
};
83F4D56918D82105009B2DE6 /* Products */ = {
isa = PBXGroup;
children = (
83F4D56E18D82106009B2DE6 /* st3play.framework */,
);
name = Products;
sourceTree = "<group>";
};
/* End PBXGroup section */
/* Begin PBXNativeTarget section */
83F4D51418D8206A009B2DE6 /* st3play */ = {
83F4D51418D8206A009B2DE6 /* modplay */ = {
isa = PBXNativeTarget;
buildConfigurationList = 83F4D52718D8206A009B2DE6 /* Build configuration list for PBXNativeTarget "st3play" */;
buildConfigurationList = 83F4D52718D8206A009B2DE6 /* Build configuration list for PBXNativeTarget "modplay" */;
buildPhases = (
83F4D51118D8206A009B2DE6 /* Sources */,
83F4D51218D8206A009B2DE6 /* Frameworks */,
83F4D51318D8206A009B2DE6 /* Resources */,
83F4D57C18D82342009B2DE6 /* CopyFiles */,
835CBC8718DACC250087A03E /* CopyFiles */,
);
buildRules = (
);
dependencies = (
83F4D57A18D82315009B2DE6 /* PBXTargetDependency */,
835CBC7F18DA7A2E0087A03E /* PBXTargetDependency */,
);
name = st3play;
productName = st3play;
productReference = 83F4D51518D8206A009B2DE6 /* st3play.bundle */;
name = modplay;
productName = modplay;
productReference = 83F4D51518D8206A009B2DE6 /* modplay.bundle */;
productType = "com.apple.product-type.bundle";
};
/* End PBXNativeTarget section */
@ -171,7 +189,7 @@
LastUpgradeCheck = 0510;
ORGANIZATIONNAME = "Christopher Snowhill";
};
buildConfigurationList = 83F4D51018D8206A009B2DE6 /* Build configuration list for PBXProject "st3play" */;
buildConfigurationList = 83F4D51018D8206A009B2DE6 /* Build configuration list for PBXProject "modplay" */;
compatibilityVersion = "Xcode 3.2";
developmentRegion = English;
hasScannedForEncodings = 0;
@ -183,23 +201,23 @@
projectDirPath = "";
projectReferences = (
{
ProductGroup = 83F4D56918D82105009B2DE6 /* Products */;
ProjectRef = 83F4D56818D82105009B2DE6 /* st3play.xcodeproj */;
ProductGroup = 835CBC7818DA7A090087A03E /* Products */;
ProjectRef = 835CBC7718DA7A090087A03E /* modplay.xcodeproj */;
},
);
projectRoot = "";
targets = (
83F4D51418D8206A009B2DE6 /* st3play */,
83F4D51418D8206A009B2DE6 /* modplay */,
);
};
/* End PBXProject section */
/* Begin PBXReferenceProxy section */
83F4D56E18D82106009B2DE6 /* st3play.framework */ = {
835CBC7C18DA7A090087A03E /* modplay.framework */ = {
isa = PBXReferenceProxy;
fileType = wrapper.framework;
path = st3play.framework;
remoteRef = 83F4D56D18D82106009B2DE6 /* PBXContainerItemProxy */;
path = modplay.framework;
remoteRef = 835CBC7B18DA7A090087A03E /* PBXContainerItemProxy */;
sourceTree = BUILT_PRODUCTS_DIR;
};
/* End PBXReferenceProxy section */
@ -220,17 +238,17 @@
isa = PBXSourcesBuildPhase;
buildActionMask = 2147483647;
files = (
83F4D58018D8238A009B2DE6 /* st3Decoder.m in Sources */,
83F4D58018D8238A009B2DE6 /* modDecoder.m in Sources */,
);
runOnlyForDeploymentPostprocessing = 0;
};
/* End PBXSourcesBuildPhase section */
/* Begin PBXTargetDependency section */
83F4D57A18D82315009B2DE6 /* PBXTargetDependency */ = {
835CBC7F18DA7A2E0087A03E /* PBXTargetDependency */ = {
isa = PBXTargetDependency;
name = st3play;
targetProxy = 83F4D57918D82315009B2DE6 /* PBXContainerItemProxy */;
name = modplay;
targetProxy = 835CBC7E18DA7A2E0087A03E /* PBXContainerItemProxy */;
};
/* End PBXTargetDependency section */
@ -321,10 +339,14 @@
buildSettings = {
COMBINE_HIDPI_IMAGES = YES;
GCC_PRECOMPILE_PREFIX_HEADER = YES;
GCC_PREFIX_HEADER = "st3play/st3play-Prefix.pch";
INFOPLIST_FILE = "st3play/st3play-Info.plist";
GCC_PREFIX_HEADER = "modplay/modplay-Prefix.pch";
INFOPLIST_FILE = "modplay/modplay-Info.plist";
INSTALL_PATH = "$(LOCAL_LIBRARY_DIR)/Bundles";
PRODUCT_NAME = "$(TARGET_NAME)";
LIBRARY_SEARCH_PATHS = (
"$(inherited)",
/Volumes/UserData/Users/Chris/Source/Repos/cog/ThirdParty/BASS,
);
PRODUCT_NAME = modplay;
WRAPPER_EXTENSION = bundle;
};
name = Debug;
@ -334,10 +356,14 @@
buildSettings = {
COMBINE_HIDPI_IMAGES = YES;
GCC_PRECOMPILE_PREFIX_HEADER = YES;
GCC_PREFIX_HEADER = "st3play/st3play-Prefix.pch";
INFOPLIST_FILE = "st3play/st3play-Info.plist";
GCC_PREFIX_HEADER = "modplay/modplay-Prefix.pch";
INFOPLIST_FILE = "modplay/modplay-Info.plist";
INSTALL_PATH = "$(LOCAL_LIBRARY_DIR)/Bundles";
PRODUCT_NAME = "$(TARGET_NAME)";
LIBRARY_SEARCH_PATHS = (
"$(inherited)",
/Volumes/UserData/Users/Chris/Source/Repos/cog/ThirdParty/BASS,
);
PRODUCT_NAME = modplay;
WRAPPER_EXTENSION = bundle;
};
name = Release;
@ -345,7 +371,7 @@
/* End XCBuildConfiguration section */
/* Begin XCConfigurationList section */
83F4D51018D8206A009B2DE6 /* Build configuration list for PBXProject "st3play" */ = {
83F4D51018D8206A009B2DE6 /* Build configuration list for PBXProject "modplay" */ = {
isa = XCConfigurationList;
buildConfigurations = (
83F4D52518D8206A009B2DE6 /* Debug */,
@ -354,13 +380,14 @@
defaultConfigurationIsVisible = 0;
defaultConfigurationName = Release;
};
83F4D52718D8206A009B2DE6 /* Build configuration list for PBXNativeTarget "st3play" */ = {
83F4D52718D8206A009B2DE6 /* Build configuration list for PBXNativeTarget "modplay" */ = {
isa = XCConfigurationList;
buildConfigurations = (
83F4D52818D8206A009B2DE6 /* Debug */,
83F4D52918D8206A009B2DE6 /* Release */,
);
defaultConfigurationIsVisible = 0;
defaultConfigurationName = Release;
};
/* End XCConfigurationList section */
};

View File

@ -1,6 +1,6 @@
//
// st3Decoder.h
// st3play
// modDecoder.h
// modplay
//
// Created by Christopher Snowhill on 03/17/14.
// Copyright 2014 __NoWork, Inc__. All rights reserved.
@ -8,14 +8,27 @@
#import <Cocoa/Cocoa.h>
#import <st3play/st3play.h>
#import <modplay/st3play.h>
#import <modplay/ft2play.h>
#import "unmo3.h"
#import "Plugin.h"
@interface st3Decoder : NSObject <CogDecoder> {
void *st3play;
enum
{
TYPE_UNKNOWN = 0,
TYPE_S3M = 1,
TYPE_XM = 2
};
@interface modDecoder : NSObject <CogDecoder> {
uint32_t type;
void *player;
void *data;
long size;
int dataWasMo3;
int track_num;
long framesLength;

View File

@ -0,0 +1,335 @@
//
// modDecoder.m
// modplay
//
// Created by Christopher Snowhill on 03/17/14.
// Copyright 2014 __NoWork, Inc__. All rights reserved.
//
#import "modDecoder.h"
#import "PlaylistController.h"
@implementation modDecoder
BOOL s3m_probe_length( unsigned long * intro_length, unsigned long * loop_length, const void * src, unsigned long size, unsigned int subsong )
{
void * st3play = st3play_Alloc( 44100, 1 );
if ( !st3play ) return NO;
if ( !st3play_LoadModule( st3play, src, size ) )
{
st3play_Free( st3play );
return NO;
}
st3play_PlaySong( st3play, subsong );
unsigned long length_total = 0;
unsigned long length_saved;
const long length_safety = 44100 * 60 * 30;
while ( st3play_GetLoopCount( st3play ) < 1 && length_total < length_safety )
{
st3play_RenderFloat( st3play, NULL, 512 );
length_total += 512;
}
if ( st3play_GetLoopCount( st3play ) < 1 )
{
*loop_length = 0;
*intro_length = 44100 * 60 * 3;
st3play_Free( st3play );
return YES;
}
length_saved = length_total;
while ( st3play_GetLoopCount( st3play ) < 2 )
{
st3play_RenderFloat( st3play, NULL, 512 );
length_total += 512;
}
st3play_Free( st3play );
*loop_length = length_total - length_saved;
if (length_saved > *loop_length)
*intro_length = length_saved - *loop_length;
else
*intro_length = 0;
return YES;
}
BOOL xm_probe_length( unsigned long * intro_length, unsigned long * loop_length, const void * src, unsigned long size, unsigned int subsong )
{
void * ft2play = ft2play_Alloc( 44100, 1 );
if ( !ft2play ) return NO;
if ( !ft2play_LoadModule( ft2play, src, size ) )
{
ft2play_Free( ft2play );
return NO;
}
ft2play_PlaySong( ft2play, subsong );
unsigned long length_total = 0;
unsigned long length_saved;
const long length_safety = 44100 * 60 * 30;
while ( ft2play_GetLoopCount( ft2play ) < 1 && length_total < length_safety )
{
ft2play_RenderFloat( ft2play, NULL, 512 );
length_total += 512;
}
if ( ft2play_GetLoopCount( ft2play ) < 1 )
{
*loop_length = 0;
*intro_length = 44100 * 60 * 3;
ft2play_Free( ft2play );
return YES;
}
length_saved = length_total;
while ( ft2play_GetLoopCount( ft2play ) < 2 )
{
ft2play_RenderFloat( ft2play, NULL, 512 );
length_total += 512;
}
ft2play_Free( ft2play );
*loop_length = length_total - length_saved;
if (length_saved > *loop_length)
*intro_length = length_saved - *loop_length;
else
*intro_length = 0;
return YES;
}
- (BOOL)open:(id<CogSource>)s
{
[s seek:0 whence:SEEK_END];
size = [s tell];
[s seek:0 whence:SEEK_SET];
data = malloc(size);
[s read:data amount:size];
type = TYPE_UNKNOWN;
dataWasMo3 = 0;
if ( memcmp( data, "MO3", 3 ) == 0 )
{
void * in_data = data;
unsigned usize = (unsigned) size;
if (UNMO3_Decode(&in_data, &usize, 0) == 0)
{
free( data );
data = in_data;
size = usize;
dataWasMo3 = 1;
}
}
if ( memcmp( data + 0x2C, "SCRM", 4 ) == 0 )
type = TYPE_S3M;
else if ( memcmp( data, "Extended Module: ", 17 ) == 0 )
type = TYPE_XM;
else
return NO;
if ([[[s url] fragment] length] == 0)
track_num = 0;
else
track_num = [[[s url] fragment] intValue];
unsigned long intro_length = 0, loop_length = 0;
if ( type == TYPE_S3M && !s3m_probe_length(&intro_length, &loop_length, data, size, track_num) )
return NO;
else if ( type == TYPE_XM && !xm_probe_length(&intro_length, &loop_length, data, size, track_num) )
return NO;
framesLength = intro_length + loop_length * 2;
totalFrames = framesLength + 44100 * 8;
[self willChangeValueForKey:@"properties"];
[self didChangeValueForKey:@"properties"];
return YES;
}
- (BOOL)decoderInitialize
{
if ( type == TYPE_S3M )
{
player = st3play_Alloc( 44100, 1 );
if ( !player )
return NO;
if ( !st3play_LoadModule( player, data, size ) )
return NO;
st3play_PlaySong( player, track_num );
}
else if ( type == TYPE_XM )
{
player = ft2play_Alloc( 44100, 1 );
if ( !player )
return NO;
if ( !ft2play_LoadModule( player, data, size ) )
return NO;
ft2play_PlaySong( player, track_num );
}
framesRead = 0;
return YES;
}
- (void)decoderShutdown
{
if ( player )
{
if ( type == TYPE_S3M )
st3play_Free( player );
else if ( type == TYPE_XM )
ft2play_Free( player );
player = NULL;
}
}
- (NSDictionary *)properties
{
return [NSDictionary dictionaryWithObjectsAndKeys:
[NSNumber numberWithInt:0], @"bitrate",
[NSNumber numberWithFloat:44100], @"sampleRate",
[NSNumber numberWithDouble:totalFrames], @"totalFrames",
[NSNumber numberWithInt:32], @"bitsPerSample",
[NSNumber numberWithBool:YES], @"floatingPoint",
[NSNumber numberWithInt:2], @"channels",
[NSNumber numberWithBool:YES], @"seekable",
@"host", @"endian",
nil];
}
- (int)readAudio:(void *)buf frames:(UInt32)frames
{
BOOL repeat_one = IsRepeatOneSet();
if ( !repeat_one && framesRead >= totalFrames )
return 0;
if ( !player )
{
if ( ![self decoderInitialize] )
return 0;
}
int total = 0;
while ( total < frames ) {
int framesToRender = 512;
if ( !repeat_one && framesToRender > totalFrames - framesRead )
framesToRender = (int)(totalFrames - framesRead);
if ( framesToRender > frames - total )
framesToRender = frames - total;
float * sampleBuf = ( float * ) buf + total * 2;
if ( type == TYPE_S3M )
st3play_RenderFloat( player, sampleBuf, framesToRender );
else if ( type == TYPE_XM )
ft2play_RenderFloat( player, sampleBuf, framesToRender );
if ( !repeat_one && framesRead + framesToRender > framesLength ) {
long fadeStart = ( framesLength > framesRead ) ? framesLength : framesRead;
long fadeEnd = ( framesRead + framesToRender < totalFrames ) ? framesRead + framesToRender : totalFrames;
const long fadeTotal = totalFrames - framesLength;
for ( long fadePos = fadeStart; fadePos < fadeEnd; ++fadePos ) {
const double scale = (double)( fadeTotal - ( fadePos - framesLength ) ) / (double)fadeTotal;
const long offset = fadePos - framesRead;
float * samples = sampleBuf + offset * 2;
samples[ 0 ] = samples[ 0 ] * scale;
samples[ 1 ] = samples[ 1 ] * scale;
}
framesToRender = (int)(fadeEnd - framesRead);
}
if ( !framesToRender )
break;
total += framesToRender;
framesRead += framesToRender;
}
return total;
}
- (long)seek:(long)frame
{
if ( frame < framesRead || !player )
{
[self decoderShutdown];
if ( ![self decoderInitialize] )
return 0;
}
while ( framesRead < frame )
{
int frames_todo = INT_MAX;
if ( frames_todo > frame - framesRead )
frames_todo = (int)( frame - framesRead );
if ( type == TYPE_S3M )
st3play_RenderFloat( player, NULL, frames_todo );
else if ( type == TYPE_XM )
ft2play_RenderFloat( player, NULL, frames_todo );
framesRead += frames_todo;
}
framesRead = frame;
return frame;
}
- (void)close
{
[self decoderShutdown];
if (data) {
if ( dataWasMo3 )
UNMO3_Free( data );
else
free( data );
data = NULL;
}
}
+ (NSArray *)fileTypes
{
return [NSArray arrayWithObjects:@"s3m", @"s3z", @"xm", @"xmz", @"mo3", nil];
}
+ (NSArray *)mimeTypes
{
return [NSArray arrayWithObjects:@"audio/x-s3m", @"audio/x-xm", nil];
}
+ (float)priority
{
return 1.5;
}
@end

View File

@ -1,236 +0,0 @@
//
// st3Decoder.m
// st3play
//
// Created by Christopher Snowhill on 03/17/14.
// Copyright 2014 __NoWork, Inc__. All rights reserved.
//
#import "st3Decoder.h"
#import "PlaylistController.h"
@implementation st3Decoder
BOOL probe_length( unsigned long * intro_length, unsigned long * loop_length, const void * src, unsigned long size, unsigned int subsong )
{
void * st3play = st3play_Alloc( 44100, 1 );
if ( !st3play ) return NO;
if ( !st3play_LoadModule( st3play, src, size ) )
{
st3play_Free( st3play );
return NO;
}
st3play_PlaySong( st3play, subsong );
unsigned long length_total = 0;
unsigned long length_saved;
const long length_safety = 44100 * 60 * 30;
while ( st3play_GetLoopCount( st3play ) < 1 && length_total < length_safety )
{
st3play_RenderFixed( st3play, NULL, 512 );
length_total += 512;
}
if ( st3play_GetLoopCount( st3play ) < 1 )
{
*loop_length = 0;
*intro_length = 44100 * 60 * 3;
st3play_Free( st3play );
return YES;
}
length_saved = length_total;
while ( st3play_GetLoopCount( st3play ) < 2 )
{
st3play_RenderFixed( st3play, NULL, 512 );
length_total += 512;
}
st3play_Free( st3play );
*loop_length = length_total - length_saved;
*intro_length = length_saved - *loop_length;
return YES;
}
- (BOOL)open:(id<CogSource>)s
{
[s seek:0 whence:SEEK_END];
size = [s tell];
[s seek:0 whence:SEEK_SET];
data = malloc(size);
[s read:data amount:size];
if ([[[s url] fragment] length] == 0)
track_num = 0;
else
track_num = [[[s url] fragment] intValue];
unsigned long intro_length, loop_length;
if ( !probe_length(&intro_length, &loop_length, data, size, track_num) )
return NO;
framesLength = intro_length + loop_length * 2;
totalFrames = framesLength + 44100 * 8;
[self willChangeValueForKey:@"properties"];
[self didChangeValueForKey:@"properties"];
return YES;
}
- (BOOL)decoderInitialize
{
st3play = st3play_Alloc( 44100, 1 );
if ( !st3play )
return NO;
if ( !st3play_LoadModule( st3play, data, size ) )
return NO;
st3play_PlaySong( st3play, track_num );
framesRead = 0;
return YES;
}
- (void)decoderShutdown
{
if ( st3play )
{
st3play_Free( st3play );
st3play = NULL;
}
}
- (NSDictionary *)properties
{
return [NSDictionary dictionaryWithObjectsAndKeys:
[NSNumber numberWithInt:0], @"bitrate",
[NSNumber numberWithFloat:44100], @"sampleRate",
[NSNumber numberWithDouble:totalFrames], @"totalFrames",
[NSNumber numberWithInt:32], @"bitsPerSample",
[NSNumber numberWithBool:YES], @"floatingPoint",
[NSNumber numberWithInt:2], @"channels",
[NSNumber numberWithBool:YES], @"seekable",
@"host", @"endian",
nil];
}
- (int)readAudio:(void *)buf frames:(UInt32)frames
{
BOOL repeat_one = IsRepeatOneSet();
if ( !repeat_one && framesRead >= totalFrames )
return 0;
if ( !st3play )
{
if ( ![self decoderInitialize] )
return 0;
}
int total = 0;
while ( total < frames ) {
int framesToRender = 512;
if ( !repeat_one && framesToRender > totalFrames - framesRead )
framesToRender = (int)(totalFrames - framesRead);
if ( framesToRender > frames - total )
framesToRender = frames - total;
int32_t * sampleBuf = ( int32_t * ) buf + total * 2;
st3play_RenderFixed( st3play, sampleBuf, framesToRender );
if ( !repeat_one && framesRead + framesToRender > framesLength ) {
long fadeStart = ( framesLength > framesRead ) ? framesLength : framesRead;
long fadeEnd = ( framesRead + framesToRender < totalFrames ) ? framesRead + framesToRender : totalFrames;
const long fadeTotal = totalFrames - framesLength;
for ( long fadePos = fadeStart; fadePos < fadeEnd; ++fadePos ) {
const long scale = ( fadeTotal - ( fadePos - framesLength ) );
const long offset = fadePos - framesRead;
int32_t * samples = sampleBuf + offset * 2;
samples[ 0 ] = (int32_t)(samples[ 0 ] * scale / fadeTotal);
samples[ 1 ] = (int32_t)(samples[ 1 ] * scale / fadeTotal);
}
framesToRender = (int)(fadeEnd - framesRead);
}
if ( !framesToRender )
break;
total += framesToRender;
framesRead += framesToRender;
}
for ( int i = 0; i < total; ++i )
{
int32_t * sampleIn = ( int32_t * ) buf + i * 2;
float * sampleOut = ( float * ) buf + i * 2;
sampleOut[ 0 ] = sampleIn[ 0 ] * (1.0f / 16777216.0f);
sampleOut[ 1 ] = sampleIn[ 1 ] * (1.0f / 16777216.0f);
}
return total;
}
- (long)seek:(long)frame
{
if ( frame < framesRead || !st3play )
{
[self decoderShutdown];
if ( ![self decoderInitialize] )
return 0;
}
while ( framesRead < frame )
{
int frames_todo = INT_MAX;
if ( frames_todo > frame - framesRead )
frames_todo = (int)( frame - framesRead );
st3play_RenderFixed( st3play, NULL, frames_todo );
framesRead += frames_todo;
}
framesRead = frame;
return frame;
}
- (void)close
{
[self decoderShutdown];
if (data) {
free( data );
data = NULL;
}
}
+ (NSArray *)fileTypes
{
return [NSArray arrayWithObjects:@"s3m", @"s3z", nil];
}
+ (NSArray *)mimeTypes
{
return [NSArray arrayWithObjects:@"audio/x-s3m", nil];
}
+ (float)priority
{
return 1.5;
}
@end