Added st3play plugin

CQTexperiment
Chris Moeller 2014-03-18 20:17:45 -07:00
parent 1c68ad1c8d
commit e4d76dd1ca
14 changed files with 4544 additions and 0 deletions

View File

@ -188,6 +188,7 @@
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 */; };
@ -575,6 +576,13 @@
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 */;
@ -628,6 +636,7 @@
dstPath = "";
dstSubfolderSpec = 13;
files = (
83F4D58318D827BB009B2DE6 /* st3play.bundle in CopyFiles */,
836F706218BDD1230095E648 /* vgmstream.bundle in CopyFiles */,
836FB5A718206F2500B3AD2D /* Hively.bundle in CopyFiles */,
83A0F4E31816DBF900119DB4 /* playptmod.bundle in CopyFiles */,
@ -925,6 +934,7 @@
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>"; };
@ -1232,6 +1242,7 @@
83A0F4841816CE5E00119DB4 /* playptmod.xcodeproj */,
836FB5421820538700B3AD2D /* Hively.xcodeproj */,
836F6B2518BDB80D0095E648 /* vgmstream.xcodeproj */,
83F4D52A18D8206A009B2DE6 /* st3play.xcodeproj */,
);
name = PlugIns;
sourceTree = "<group>";
@ -1641,6 +1652,14 @@
name = Products;
sourceTree = "<group>";
};
83F4D52B18D8206A009B2DE6 /* Products */ = {
isa = PBXGroup;
children = (
83F4D52F18D8206A009B2DE6 /* st3play.bundle */,
);
name = Products;
sourceTree = "<group>";
};
8E07AAEA0AAC90DC00A4B32F /* Preferences */ = {
isa = PBXGroup;
children = (
@ -1923,6 +1942,10 @@
ProductGroup = 83E6B751181612FD00D4576D /* Products */;
ProjectRef = 83E6B750181612FD00D4576D /* Sparkle.xcodeproj */;
},
{
ProductGroup = 83F4D52B18D8206A009B2DE6 /* Products */;
ProjectRef = 83F4D52A18D8206A009B2DE6 /* st3play.xcodeproj */;
},
{
ProductGroup = 17C808B10C3BD1C5005707C4 /* Products */;
ProjectRef = 17C808B00C3BD1C5005707C4 /* TagLib.xcodeproj */;
@ -2144,6 +2167,13 @@
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

@ -0,0 +1,306 @@
// !$*UTF8*$!
{
archiveVersion = 1;
classes = {
};
objectVersion = 46;
objects = {
/* Begin PBXBuildFile section */
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 */; };
83F4D57718D821D2009B2DE6 /* st3play.c in Sources */ = {isa = PBXBuildFile; fileRef = 83F4D57318D821D2009B2DE6 /* st3play.c */; };
83F4D57818D821D2009B2DE6 /* st3play.h in Headers */ = {isa = PBXBuildFile; fileRef = 83F4D57418D821D2009B2DE6 /* st3play.h */; settings = {ATTRIBUTES = (Public, ); }; };
/* 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>"; };
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>"; };
83F4D57318D821D2009B2DE6 /* st3play.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = st3play.c; sourceTree = "<group>"; };
83F4D57418D821D2009B2DE6 /* st3play.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = st3play.h; sourceTree = "<group>"; };
/* End PBXFileReference section */
/* Begin PBXFrameworksBuildPhase section */
83F4D53618D82105009B2DE6 /* Frameworks */ = {
isa = PBXFrameworksBuildPhase;
buildActionMask = 2147483647;
files = (
);
runOnlyForDeploymentPostprocessing = 0;
};
/* End PBXFrameworksBuildPhase section */
/* Begin PBXGroup section */
83F4D53018D82105009B2DE6 = {
isa = PBXGroup;
children = (
83F4D54318D82105009B2DE6 /* st3play */,
83F4D53C18D82105009B2DE6 /* Frameworks */,
83F4D53B18D82105009B2DE6 /* Products */,
);
sourceTree = "<group>";
};
83F4D53B18D82105009B2DE6 /* Products */ = {
isa = PBXGroup;
children = (
83F4D53A18D82105009B2DE6 /* st3play.framework */,
);
name = Products;
sourceTree = "<group>";
};
83F4D53C18D82105009B2DE6 /* Frameworks */ = {
isa = PBXGroup;
children = (
83F4D53F18D82105009B2DE6 /* Other Frameworks */,
);
name = Frameworks;
sourceTree = "<group>";
};
83F4D53F18D82105009B2DE6 /* Other Frameworks */ = {
isa = PBXGroup;
children = (
);
name = "Other Frameworks";
sourceTree = "<group>";
};
83F4D54318D82105009B2DE6 /* st3play */ = {
isa = PBXGroup;
children = (
83F4D57118D821D2009B2DE6 /* lanczos_resampler.c */,
83F4D57218D821D2009B2DE6 /* lanczos_resampler.h */,
83F4D57318D821D2009B2DE6 /* st3play.c */,
83F4D57418D821D2009B2DE6 /* st3play.h */,
83F4D54418D82105009B2DE6 /* Supporting Files */,
);
path = st3play;
sourceTree = "<group>";
};
83F4D54418D82105009B2DE6 /* Supporting Files */ = {
isa = PBXGroup;
children = (
83F4D54518D82105009B2DE6 /* st3play-Info.plist */,
83F4D54618D82105009B2DE6 /* InfoPlist.strings */,
);
name = "Supporting Files";
sourceTree = "<group>";
};
/* End PBXGroup section */
/* Begin PBXHeadersBuildPhase section */
83F4D53718D82105009B2DE6 /* Headers */ = {
isa = PBXHeadersBuildPhase;
buildActionMask = 2147483647;
files = (
83F4D57818D821D2009B2DE6 /* st3play.h in Headers */,
83F4D57618D821D2009B2DE6 /* lanczos_resampler.h in Headers */,
);
runOnlyForDeploymentPostprocessing = 0;
};
/* End PBXHeadersBuildPhase section */
/* Begin PBXNativeTarget section */
83F4D53918D82105009B2DE6 /* st3play */ = {
isa = PBXNativeTarget;
buildConfigurationList = 83F4D56218D82105009B2DE6 /* Build configuration list for PBXNativeTarget "st3play" */;
buildPhases = (
83F4D53518D82105009B2DE6 /* Sources */,
83F4D53618D82105009B2DE6 /* Frameworks */,
83F4D53718D82105009B2DE6 /* Headers */,
83F4D53818D82105009B2DE6 /* Resources */,
);
buildRules = (
);
dependencies = (
);
name = st3play;
productName = st3play;
productReference = 83F4D53A18D82105009B2DE6 /* st3play.framework */;
productType = "com.apple.product-type.framework";
};
/* End PBXNativeTarget section */
/* Begin PBXProject section */
83F4D53118D82105009B2DE6 /* Project object */ = {
isa = PBXProject;
attributes = {
LastUpgradeCheck = 0510;
ORGANIZATIONNAME = "Christopher Snowhill";
};
buildConfigurationList = 83F4D53418D82105009B2DE6 /* Build configuration list for PBXProject "st3play" */;
compatibilityVersion = "Xcode 3.2";
developmentRegion = English;
hasScannedForEncodings = 0;
knownRegions = (
en,
);
mainGroup = 83F4D53018D82105009B2DE6;
productRefGroup = 83F4D53B18D82105009B2DE6 /* Products */;
projectDirPath = "";
projectRoot = "";
targets = (
83F4D53918D82105009B2DE6 /* st3play */,
);
};
/* End PBXProject section */
/* Begin PBXResourcesBuildPhase section */
83F4D53818D82105009B2DE6 /* Resources */ = {
isa = PBXResourcesBuildPhase;
buildActionMask = 2147483647;
files = (
83F4D54818D82105009B2DE6 /* InfoPlist.strings in Resources */,
);
runOnlyForDeploymentPostprocessing = 0;
};
/* End PBXResourcesBuildPhase section */
/* Begin PBXSourcesBuildPhase section */
83F4D53518D82105009B2DE6 /* Sources */ = {
isa = PBXSourcesBuildPhase;
buildActionMask = 2147483647;
files = (
83F4D57718D821D2009B2DE6 /* st3play.c in Sources */,
83F4D57518D821D2009B2DE6 /* lanczos_resampler.c in Sources */,
);
runOnlyForDeploymentPostprocessing = 0;
};
/* End PBXSourcesBuildPhase section */
/* Begin PBXVariantGroup section */
83F4D54618D82105009B2DE6 /* InfoPlist.strings */ = {
isa = PBXVariantGroup;
children = (
83F4D54718D82105009B2DE6 /* en */,
);
name = InfoPlist.strings;
sourceTree = "<group>";
};
/* End PBXVariantGroup section */
/* Begin XCBuildConfiguration section */
83F4D56018D82105009B2DE6 /* Debug */ = {
isa = XCBuildConfiguration;
buildSettings = {
ALWAYS_SEARCH_USER_PATHS = NO;
CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x";
CLANG_CXX_LIBRARY = "libc++";
CLANG_ENABLE_MODULES = YES;
CLANG_ENABLE_OBJC_ARC = YES;
CLANG_WARN_BOOL_CONVERSION = YES;
CLANG_WARN_CONSTANT_CONVERSION = YES;
CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR;
CLANG_WARN_EMPTY_BODY = YES;
CLANG_WARN_ENUM_CONVERSION = YES;
CLANG_WARN_INT_CONVERSION = YES;
CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR;
CLANG_WARN__DUPLICATE_METHOD_MATCH = YES;
COPY_PHASE_STRIP = NO;
GCC_C_LANGUAGE_STANDARD = gnu99;
GCC_DYNAMIC_NO_PIC = NO;
GCC_ENABLE_OBJC_EXCEPTIONS = YES;
GCC_OPTIMIZATION_LEVEL = 0;
GCC_PREPROCESSOR_DEFINITIONS = (
"DEBUG=1",
"$(inherited)",
);
GCC_SYMBOLS_PRIVATE_EXTERN = NO;
GCC_WARN_64_TO_32_BIT_CONVERSION = YES;
GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR;
GCC_WARN_UNDECLARED_SELECTOR = YES;
GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE;
GCC_WARN_UNUSED_FUNCTION = YES;
GCC_WARN_UNUSED_VARIABLE = YES;
INSTALL_PATH = "@loader_path/../Frameworks";
MACOSX_DEPLOYMENT_TARGET = 10.7;
ONLY_ACTIVE_ARCH = YES;
SDKROOT = macosx;
};
name = Debug;
};
83F4D56118D82105009B2DE6 /* Release */ = {
isa = XCBuildConfiguration;
buildSettings = {
ALWAYS_SEARCH_USER_PATHS = NO;
CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x";
CLANG_CXX_LIBRARY = "libc++";
CLANG_ENABLE_MODULES = YES;
CLANG_ENABLE_OBJC_ARC = YES;
CLANG_WARN_BOOL_CONVERSION = YES;
CLANG_WARN_CONSTANT_CONVERSION = YES;
CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR;
CLANG_WARN_EMPTY_BODY = YES;
CLANG_WARN_ENUM_CONVERSION = YES;
CLANG_WARN_INT_CONVERSION = YES;
CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR;
CLANG_WARN__DUPLICATE_METHOD_MATCH = YES;
COPY_PHASE_STRIP = YES;
DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym";
ENABLE_NS_ASSERTIONS = NO;
GCC_C_LANGUAGE_STANDARD = gnu99;
GCC_ENABLE_OBJC_EXCEPTIONS = YES;
GCC_WARN_64_TO_32_BIT_CONVERSION = YES;
GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR;
GCC_WARN_UNDECLARED_SELECTOR = YES;
GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE;
GCC_WARN_UNUSED_FUNCTION = YES;
GCC_WARN_UNUSED_VARIABLE = YES;
INSTALL_PATH = "@loader_path/../Frameworks";
MACOSX_DEPLOYMENT_TARGET = 10.7;
SDKROOT = macosx;
};
name = Release;
};
83F4D56318D82105009B2DE6 /* Debug */ = {
isa = XCBuildConfiguration;
buildSettings = {
COMBINE_HIDPI_IMAGES = YES;
DYLIB_COMPATIBILITY_VERSION = 1;
DYLIB_CURRENT_VERSION = 1;
FRAMEWORK_VERSION = A;
INFOPLIST_FILE = "st3play/st3play-Info.plist";
PRODUCT_NAME = "$(TARGET_NAME)";
WRAPPER_EXTENSION = framework;
};
name = Debug;
};
83F4D56418D82105009B2DE6 /* Release */ = {
isa = XCBuildConfiguration;
buildSettings = {
COMBINE_HIDPI_IMAGES = YES;
DYLIB_COMPATIBILITY_VERSION = 1;
DYLIB_CURRENT_VERSION = 1;
FRAMEWORK_VERSION = A;
INFOPLIST_FILE = "st3play/st3play-Info.plist";
PRODUCT_NAME = "$(TARGET_NAME)";
WRAPPER_EXTENSION = framework;
};
name = Release;
};
/* End XCBuildConfiguration section */
/* Begin XCConfigurationList section */
83F4D53418D82105009B2DE6 /* Build configuration list for PBXProject "st3play" */ = {
isa = XCConfigurationList;
buildConfigurations = (
83F4D56018D82105009B2DE6 /* Debug */,
83F4D56118D82105009B2DE6 /* Release */,
);
defaultConfigurationIsVisible = 0;
defaultConfigurationName = Release;
};
83F4D56218D82105009B2DE6 /* Build configuration list for PBXNativeTarget "st3play" */ = {
isa = XCConfigurationList;
buildConfigurations = (
83F4D56318D82105009B2DE6 /* Debug */,
83F4D56418D82105009B2DE6 /* Release */,
);
defaultConfigurationIsVisible = 0;
};
/* End XCConfigurationList section */
};
rootObject = 83F4D53118D82105009B2DE6 /* Project object */;
}

View File

@ -0,0 +1,2 @@
/* Localized versions of Info.plist keys */

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 "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];
float 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, float ** out_, float * 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 )
{
float* 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++ = sample / kernel_sum * 256.0;
phase += phase_inc;
in += phase >> 13;
phase &= 8191;
}
while ( in < in_end );
r->phase = phase;
*out_ = out;
used = (int)(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;
float * 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;
}
float 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,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 *);
float lanczos_resampler_get_sample(void *);
void lanczos_resampler_remove_sample(void *);
#endif

View File

@ -0,0 +1,30 @@
<?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>CFBundleDevelopmentRegion</key>
<string>English</string>
<key>CFBundleExecutable</key>
<string>${EXECUTABLE_NAME}</string>
<key>CFBundleIconFile</key>
<string></string>
<key>CFBundleIdentifier</key>
<string>NoWork-Inc.${PRODUCT_NAME:rfc1034identifier}</string>
<key>CFBundleInfoDictionaryVersion</key>
<string>6.0</string>
<key>CFBundleName</key>
<string>${PRODUCT_NAME}</string>
<key>CFBundlePackageType</key>
<string>FMWK</string>
<key>CFBundleShortVersionString</key>
<string>1.0</string>
<key>CFBundleSignature</key>
<string>????</string>
<key>CFBundleVersion</key>
<string>1</string>
<key>NSHumanReadableCopyright</key>
<string>Copyright © 2014 Christopher Snowhill. All rights reserved.</string>
<key>NSPrincipalClass</key>
<string></string>
</dict>
</plist>

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,35 @@
#ifndef _ST3PLAY_H_
#define _ST3PLAY_H_
#include <stdint.h>
#ifdef __cplusplus
extern "C" {
#endif
void * st3play_Alloc(uint32_t outputFreq, int8_t interpolation);
void st3play_Free(void *);
int8_t st3play_LoadModule(void *, const uint8_t *module, size_t size);
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);
typedef struct
{
int16_t order;
int16_t pattern;
int16_t row;
int8_t channels_playing;
} st3_info;
void st3play_GetInfo(void *, st3_info *);
#ifdef __cplusplus
}
#endif
#endif

View File

@ -0,0 +1,368 @@
// !$*UTF8*$!
{
archiveVersion = 1;
classes = {
};
objectVersion = 46;
objects = {
/* Begin PBXBuildFile section */
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 */; };
/* End PBXBuildFile section */
/* Begin PBXContainerItemProxy section */
83F4D56D18D82106009B2DE6 /* PBXContainerItemProxy */ = {
isa = PBXContainerItemProxy;
containerPortal = 83F4D56818D82105009B2DE6 /* st3play.xcodeproj */;
proxyType = 2;
remoteGlobalIDString = 83F4D53A18D82105009B2DE6;
remoteInfo = st3play;
};
83F4D57918D82315009B2DE6 /* PBXContainerItemProxy */ = {
isa = PBXContainerItemProxy;
containerPortal = 83F4D56818D82105009B2DE6 /* st3play.xcodeproj */;
proxyType = 1;
remoteGlobalIDString = 83F4D53918D82105009B2DE6;
remoteInfo = st3play;
};
/* End PBXContainerItemProxy section */
/* Begin PBXCopyFilesBuildPhase section */
83F4D57C18D82342009B2DE6 /* CopyFiles */ = {
isa = PBXCopyFilesBuildPhase;
buildActionMask = 2147483647;
dstPath = "";
dstSubfolderSpec = 10;
files = (
83F4D57D18D8234D009B2DE6 /* st3play.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; };
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>"; };
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>"; };
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 */
/* Begin PBXFrameworksBuildPhase section */
83F4D51218D8206A009B2DE6 /* Frameworks */ = {
isa = PBXFrameworksBuildPhase;
buildActionMask = 2147483647;
files = (
83F4D57B18D8231F009B2DE6 /* st3play.framework in Frameworks */,
83F4D51918D8206A009B2DE6 /* Cocoa.framework in Frameworks */,
);
runOnlyForDeploymentPostprocessing = 0;
};
/* End PBXFrameworksBuildPhase section */
/* Begin PBXGroup section */
83F4D50C18D8206A009B2DE6 = {
isa = PBXGroup;
children = (
83F4D51E18D8206A009B2DE6 /* st3play */,
83F4D51718D8206A009B2DE6 /* Frameworks */,
83F4D51618D8206A009B2DE6 /* Products */,
);
sourceTree = "<group>";
};
83F4D51618D8206A009B2DE6 /* Products */ = {
isa = PBXGroup;
children = (
83F4D51518D8206A009B2DE6 /* st3play.bundle */,
);
name = Products;
sourceTree = "<group>";
};
83F4D51718D8206A009B2DE6 /* Frameworks */ = {
isa = PBXGroup;
children = (
83F4D51818D8206A009B2DE6 /* Cocoa.framework */,
83F4D51A18D8206A009B2DE6 /* Other Frameworks */,
83F4D56818D82105009B2DE6 /* st3play.xcodeproj */,
);
name = Frameworks;
sourceTree = "<group>";
};
83F4D51A18D8206A009B2DE6 /* Other Frameworks */ = {
isa = PBXGroup;
children = (
83F4D51B18D8206A009B2DE6 /* Foundation.framework */,
83F4D51C18D8206A009B2DE6 /* CoreData.framework */,
83F4D51D18D8206A009B2DE6 /* AppKit.framework */,
);
name = "Other Frameworks";
sourceTree = "<group>";
};
83F4D51E18D8206A009B2DE6 /* st3play */ = {
isa = PBXGroup;
children = (
83F4D58218D823D1009B2DE6 /* PlaylistController.h */,
83F4D58118D8239D009B2DE6 /* Plugin.h */,
83F4D57E18D8238A009B2DE6 /* st3Decoder.h */,
83F4D57F18D8238A009B2DE6 /* st3Decoder.m */,
83F4D51F18D8206A009B2DE6 /* Supporting Files */,
);
path = st3play;
sourceTree = "<group>";
};
83F4D51F18D8206A009B2DE6 /* Supporting Files */ = {
isa = PBXGroup;
children = (
83F4D52018D8206A009B2DE6 /* st3play-Info.plist */,
83F4D52118D8206A009B2DE6 /* InfoPlist.strings */,
83F4D52418D8206A009B2DE6 /* st3play-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 */ = {
isa = PBXNativeTarget;
buildConfigurationList = 83F4D52718D8206A009B2DE6 /* Build configuration list for PBXNativeTarget "st3play" */;
buildPhases = (
83F4D51118D8206A009B2DE6 /* Sources */,
83F4D51218D8206A009B2DE6 /* Frameworks */,
83F4D51318D8206A009B2DE6 /* Resources */,
83F4D57C18D82342009B2DE6 /* CopyFiles */,
);
buildRules = (
);
dependencies = (
83F4D57A18D82315009B2DE6 /* PBXTargetDependency */,
);
name = st3play;
productName = st3play;
productReference = 83F4D51518D8206A009B2DE6 /* st3play.bundle */;
productType = "com.apple.product-type.bundle";
};
/* End PBXNativeTarget section */
/* Begin PBXProject section */
83F4D50D18D8206A009B2DE6 /* Project object */ = {
isa = PBXProject;
attributes = {
LastUpgradeCheck = 0510;
ORGANIZATIONNAME = "Christopher Snowhill";
};
buildConfigurationList = 83F4D51018D8206A009B2DE6 /* Build configuration list for PBXProject "st3play" */;
compatibilityVersion = "Xcode 3.2";
developmentRegion = English;
hasScannedForEncodings = 0;
knownRegions = (
en,
);
mainGroup = 83F4D50C18D8206A009B2DE6;
productRefGroup = 83F4D51618D8206A009B2DE6 /* Products */;
projectDirPath = "";
projectReferences = (
{
ProductGroup = 83F4D56918D82105009B2DE6 /* Products */;
ProjectRef = 83F4D56818D82105009B2DE6 /* st3play.xcodeproj */;
},
);
projectRoot = "";
targets = (
83F4D51418D8206A009B2DE6 /* st3play */,
);
};
/* End PBXProject section */
/* Begin PBXReferenceProxy section */
83F4D56E18D82106009B2DE6 /* st3play.framework */ = {
isa = PBXReferenceProxy;
fileType = wrapper.framework;
path = st3play.framework;
remoteRef = 83F4D56D18D82106009B2DE6 /* PBXContainerItemProxy */;
sourceTree = BUILT_PRODUCTS_DIR;
};
/* End PBXReferenceProxy section */
/* Begin PBXResourcesBuildPhase section */
83F4D51318D8206A009B2DE6 /* Resources */ = {
isa = PBXResourcesBuildPhase;
buildActionMask = 2147483647;
files = (
83F4D52318D8206A009B2DE6 /* InfoPlist.strings in Resources */,
);
runOnlyForDeploymentPostprocessing = 0;
};
/* End PBXResourcesBuildPhase section */
/* Begin PBXSourcesBuildPhase section */
83F4D51118D8206A009B2DE6 /* Sources */ = {
isa = PBXSourcesBuildPhase;
buildActionMask = 2147483647;
files = (
83F4D58018D8238A009B2DE6 /* st3Decoder.m in Sources */,
);
runOnlyForDeploymentPostprocessing = 0;
};
/* End PBXSourcesBuildPhase section */
/* Begin PBXTargetDependency section */
83F4D57A18D82315009B2DE6 /* PBXTargetDependency */ = {
isa = PBXTargetDependency;
name = st3play;
targetProxy = 83F4D57918D82315009B2DE6 /* PBXContainerItemProxy */;
};
/* End PBXTargetDependency section */
/* Begin PBXVariantGroup section */
83F4D52118D8206A009B2DE6 /* InfoPlist.strings */ = {
isa = PBXVariantGroup;
children = (
83F4D52218D8206A009B2DE6 /* en */,
);
name = InfoPlist.strings;
sourceTree = "<group>";
};
/* End PBXVariantGroup section */
/* Begin XCBuildConfiguration section */
83F4D52518D8206A009B2DE6 /* Debug */ = {
isa = XCBuildConfiguration;
buildSettings = {
ALWAYS_SEARCH_USER_PATHS = NO;
CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x";
CLANG_CXX_LIBRARY = "libc++";
CLANG_ENABLE_MODULES = YES;
CLANG_ENABLE_OBJC_ARC = YES;
CLANG_WARN_BOOL_CONVERSION = YES;
CLANG_WARN_CONSTANT_CONVERSION = YES;
CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR;
CLANG_WARN_EMPTY_BODY = YES;
CLANG_WARN_ENUM_CONVERSION = YES;
CLANG_WARN_INT_CONVERSION = YES;
CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR;
CLANG_WARN__DUPLICATE_METHOD_MATCH = YES;
COPY_PHASE_STRIP = NO;
GCC_C_LANGUAGE_STANDARD = gnu99;
GCC_DYNAMIC_NO_PIC = NO;
GCC_ENABLE_OBJC_EXCEPTIONS = YES;
GCC_OPTIMIZATION_LEVEL = 0;
GCC_PREPROCESSOR_DEFINITIONS = (
"DEBUG=1",
"$(inherited)",
);
GCC_SYMBOLS_PRIVATE_EXTERN = NO;
GCC_WARN_64_TO_32_BIT_CONVERSION = YES;
GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR;
GCC_WARN_UNDECLARED_SELECTOR = YES;
GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE;
GCC_WARN_UNUSED_FUNCTION = YES;
GCC_WARN_UNUSED_VARIABLE = YES;
MACOSX_DEPLOYMENT_TARGET = 10.7;
ONLY_ACTIVE_ARCH = YES;
SDKROOT = macosx;
};
name = Debug;
};
83F4D52618D8206A009B2DE6 /* Release */ = {
isa = XCBuildConfiguration;
buildSettings = {
ALWAYS_SEARCH_USER_PATHS = NO;
CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x";
CLANG_CXX_LIBRARY = "libc++";
CLANG_ENABLE_MODULES = YES;
CLANG_ENABLE_OBJC_ARC = YES;
CLANG_WARN_BOOL_CONVERSION = YES;
CLANG_WARN_CONSTANT_CONVERSION = YES;
CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR;
CLANG_WARN_EMPTY_BODY = YES;
CLANG_WARN_ENUM_CONVERSION = YES;
CLANG_WARN_INT_CONVERSION = YES;
CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR;
CLANG_WARN__DUPLICATE_METHOD_MATCH = YES;
COPY_PHASE_STRIP = YES;
DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym";
ENABLE_NS_ASSERTIONS = NO;
GCC_C_LANGUAGE_STANDARD = gnu99;
GCC_ENABLE_OBJC_EXCEPTIONS = YES;
GCC_WARN_64_TO_32_BIT_CONVERSION = YES;
GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR;
GCC_WARN_UNDECLARED_SELECTOR = YES;
GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE;
GCC_WARN_UNUSED_FUNCTION = YES;
GCC_WARN_UNUSED_VARIABLE = YES;
MACOSX_DEPLOYMENT_TARGET = 10.7;
SDKROOT = macosx;
};
name = Release;
};
83F4D52818D8206A009B2DE6 /* Debug */ = {
isa = XCBuildConfiguration;
buildSettings = {
COMBINE_HIDPI_IMAGES = YES;
GCC_PRECOMPILE_PREFIX_HEADER = YES;
GCC_PREFIX_HEADER = "st3play/st3play-Prefix.pch";
INFOPLIST_FILE = "st3play/st3play-Info.plist";
INSTALL_PATH = "$(LOCAL_LIBRARY_DIR)/Bundles";
PRODUCT_NAME = "$(TARGET_NAME)";
WRAPPER_EXTENSION = bundle;
};
name = Debug;
};
83F4D52918D8206A009B2DE6 /* Release */ = {
isa = XCBuildConfiguration;
buildSettings = {
COMBINE_HIDPI_IMAGES = YES;
GCC_PRECOMPILE_PREFIX_HEADER = YES;
GCC_PREFIX_HEADER = "st3play/st3play-Prefix.pch";
INFOPLIST_FILE = "st3play/st3play-Info.plist";
INSTALL_PATH = "$(LOCAL_LIBRARY_DIR)/Bundles";
PRODUCT_NAME = "$(TARGET_NAME)";
WRAPPER_EXTENSION = bundle;
};
name = Release;
};
/* End XCBuildConfiguration section */
/* Begin XCConfigurationList section */
83F4D51018D8206A009B2DE6 /* Build configuration list for PBXProject "st3play" */ = {
isa = XCConfigurationList;
buildConfigurations = (
83F4D52518D8206A009B2DE6 /* Debug */,
83F4D52618D8206A009B2DE6 /* Release */,
);
defaultConfigurationIsVisible = 0;
defaultConfigurationName = Release;
};
83F4D52718D8206A009B2DE6 /* Build configuration list for PBXNativeTarget "st3play" */ = {
isa = XCConfigurationList;
buildConfigurations = (
83F4D52818D8206A009B2DE6 /* Debug */,
83F4D52918D8206A009B2DE6 /* Release */,
);
defaultConfigurationIsVisible = 0;
};
/* End XCConfigurationList section */
};
rootObject = 83F4D50D18D8206A009B2DE6 /* Project object */;
}

View File

@ -0,0 +1,2 @@
/* Localized versions of Info.plist keys */

View File

@ -0,0 +1,25 @@
//
// st3Decoder.h
// st3play
//
// Created by Christopher Snowhill on 03/17/14.
// Copyright 2014 __NoWork, Inc__. All rights reserved.
//
#import <Cocoa/Cocoa.h>
#import <st3play/st3play.h>
#import "Plugin.h"
@interface st3Decoder : NSObject <CogDecoder> {
void *st3play;
void *data;
long size;
int track_num;
long framesLength;
long totalFrames;
long framesRead;
}
@end

View File

@ -0,0 +1,236 @@
//
// 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

View File

@ -0,0 +1,30 @@
<?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>CFBundleDevelopmentRegion</key>
<string>English</string>
<key>CFBundleExecutable</key>
<string>${EXECUTABLE_NAME}</string>
<key>CFBundleIconFile</key>
<string></string>
<key>CFBundleIdentifier</key>
<string>NoWork-Inc.${PRODUCT_NAME:rfc1034identifier}</string>
<key>CFBundleInfoDictionaryVersion</key>
<string>6.0</string>
<key>CFBundleName</key>
<string>${PRODUCT_NAME}</string>
<key>CFBundlePackageType</key>
<string>BNDL</string>
<key>CFBundleShortVersionString</key>
<string>1.0</string>
<key>CFBundleSignature</key>
<string>????</string>
<key>CFBundleVersion</key>
<string>1</string>
<key>NSHumanReadableCopyright</key>
<string>Copyright © 2014 Christopher Snowhill. All rights reserved.</string>
<key>NSPrincipalClass</key>
<string></string>
</dict>
</plist>

View File

@ -0,0 +1,9 @@
//
// Prefix header
//
// The contents of this file are implicitly included at the beginning of every source file.
//
#ifdef __OBJC__
#import <Cocoa/Cocoa.h>
#endif