diff --git a/Audio/Chain/BufferChain.m b/Audio/Chain/BufferChain.m index 461d2ada7..07e78cdd0 100644 --- a/Audio/Chain/BufferChain.m +++ b/Audio/Chain/BufferChain.m @@ -54,7 +54,10 @@ if (![source open:url]) { DLog(@"Couldn't open source..."); - return NO; + url = [NSURL URLWithString:@"silence://1"]; + source = [AudioSource audioSourceForURL:url]; + if (![source open:url]) + return NO; } if (![inputNode openWithSource:source]) diff --git a/Cog.xcodeproj/project.pbxproj b/Cog.xcodeproj/project.pbxproj index 4e01f080c..a6a941ffa 100644 --- a/Cog.xcodeproj/project.pbxproj +++ b/Cog.xcodeproj/project.pbxproj @@ -191,6 +191,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 */; }; + 83F9D8071A884C54007ABEC2 /* SilenceDecoder.bundle in CopyFiles */ = {isa = PBXBuildFile; fileRef = 83F9D7F61A884B46007ABEC2 /* SilenceDecoder.bundle */; settings = {ATTRIBUTES = (CodeSignOnCopy, RemoveHeadersOnCopy, ); }; }; 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 */; }; @@ -613,6 +614,20 @@ remoteGlobalIDString = 8DC2EF4F0486A6940098B216; remoteInfo = Sparkle; }; + 83F9D7F51A884B46007ABEC2 /* PBXContainerItemProxy */ = { + isa = PBXContainerItemProxy; + containerPortal = 83F9D7F11A884B44007ABEC2 /* SilenceDecoder.xcodeproj */; + proxyType = 2; + remoteGlobalIDString = 83F9D7E71A884B44007ABEC2; + remoteInfo = SilenceDecoder; + }; + 83F9D8051A884C33007ABEC2 /* PBXContainerItemProxy */ = { + isa = PBXContainerItemProxy; + containerPortal = 83F9D7F11A884B44007ABEC2 /* SilenceDecoder.xcodeproj */; + proxyType = 1; + remoteGlobalIDString = 83F9D7E61A884B44007ABEC2; + remoteInfo = SilenceDecoder; + }; 8E8D40860CBB036600135C1B /* PBXContainerItemProxy */ = { isa = PBXContainerItemProxy; containerPortal = 8E8D40820CBB036600135C1B /* M3u.xcodeproj */; @@ -666,6 +681,7 @@ dstPath = ""; dstSubfolderSpec = 13; files = ( + 83F9D8071A884C54007ABEC2 /* SilenceDecoder.bundle in CopyFiles */, 836F5BF91A357A01002730CC /* sidplay.bundle in CopyFiles */, 839BD010196521E600947767 /* BASSMODS.bundle in CopyFiles */, 835CBC8118DA7A520087A03E /* modplay.bundle in CopyFiles */, @@ -969,6 +985,7 @@ 83E5E54A18087CA5001F3284 /* miniModeOffTemplate.pdf */ = {isa = PBXFileReference; lastKnownFileType = image.pdf; name = miniModeOffTemplate.pdf; path = Images/miniModeOffTemplate.pdf; sourceTree = ""; }; 83E5E54B18087CA5001F3284 /* miniModeOnTemplate.pdf */ = {isa = PBXFileReference; lastKnownFileType = image.pdf; name = miniModeOnTemplate.pdf; path = Images/miniModeOnTemplate.pdf; sourceTree = ""; }; 83E6B750181612FD00D4576D /* Sparkle.xcodeproj */ = {isa = PBXFileReference; lastKnownFileType = "wrapper.pb-project"; name = Sparkle.xcodeproj; path = Frameworks/Sparkle/Sparkle.xcodeproj; sourceTree = ""; }; + 83F9D7F11A884B44007ABEC2 /* SilenceDecoder.xcodeproj */ = {isa = PBXFileReference; lastKnownFileType = "wrapper.pb-project"; name = SilenceDecoder.xcodeproj; path = Plugins/SilenceDecoder/SilenceDecoder.xcodeproj; sourceTree = ""; }; 8D1107310486CEB800E47090 /* Info.plist */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.plist; path = Info.plist; sourceTree = ""; }; 8E07AB760AAC930B00A4B32F /* PreferencesController.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; name = PreferencesController.h; path = Preferences/PreferencesController.h; sourceTree = ""; }; 8E07AB770AAC930B00A4B32F /* PreferencesController.m */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.objc; name = PreferencesController.m; path = Preferences/PreferencesController.m; sourceTree = ""; }; @@ -1279,6 +1296,7 @@ 836F6B2518BDB80D0095E648 /* vgmstream.xcodeproj */, 839BCFE71965133E00947767 /* BASSMODS.xcodeproj */, 8314D63B1A354DFE00EEE8E6 /* sidplay.xcodeproj */, + 83F9D7F11A884B44007ABEC2 /* SilenceDecoder.xcodeproj */, ); name = PlugIns; sourceTree = ""; @@ -1712,6 +1730,14 @@ name = Products; sourceTree = ""; }; + 83F9D7F21A884B44007ABEC2 /* Products */ = { + isa = PBXGroup; + children = ( + 83F9D7F61A884B46007ABEC2 /* SilenceDecoder.bundle */, + ); + name = Products; + sourceTree = ""; + }; 8E07AAEA0AAC90DC00A4B32F /* Preferences */ = { isa = PBXGroup; children = ( @@ -1844,6 +1870,7 @@ buildRules = ( ); dependencies = ( + 83F9D8061A884C33007ABEC2 /* PBXTargetDependency */, 836F5BEE1A3579F5002730CC /* PBXTargetDependency */, 839BD012196521FD00947767 /* PBXTargetDependency */, 836FB5A618206F1500B3AD2D /* PBXTargetDependency */, @@ -2004,6 +2031,10 @@ ProductGroup = 8314D63C1A354DFE00EEE8E6 /* Products */; ProjectRef = 8314D63B1A354DFE00EEE8E6 /* sidplay.xcodeproj */; }, + { + ProductGroup = 83F9D7F21A884B44007ABEC2 /* Products */; + ProjectRef = 83F9D7F11A884B44007ABEC2 /* SilenceDecoder.xcodeproj */; + }, { ProductGroup = 83E6B751181612FD00D4576D /* Products */; ProjectRef = 83E6B750181612FD00D4576D /* Sparkle.xcodeproj */; @@ -2250,6 +2281,13 @@ remoteRef = 83E6B760181612FD00D4576D /* PBXContainerItemProxy */; sourceTree = BUILT_PRODUCTS_DIR; }; + 83F9D7F61A884B46007ABEC2 /* SilenceDecoder.bundle */ = { + isa = PBXReferenceProxy; + fileType = wrapper.cfbundle; + path = SilenceDecoder.bundle; + remoteRef = 83F9D7F51A884B46007ABEC2 /* PBXContainerItemProxy */; + sourceTree = BUILT_PRODUCTS_DIR; + }; 8E8D40870CBB036600135C1B /* M3u.bundle */ = { isa = PBXReferenceProxy; fileType = wrapper.cfbundle; @@ -2603,6 +2641,11 @@ name = Sparkle; targetProxy = 83E6B7631816138800D4576D /* PBXContainerItemProxy */; }; + 83F9D8061A884C33007ABEC2 /* PBXTargetDependency */ = { + isa = PBXTargetDependency; + name = SilenceDecoder; + targetProxy = 83F9D8051A884C33007ABEC2 /* PBXContainerItemProxy */; + }; 8E8D40930CBB03AF00135C1B /* PBXTargetDependency */ = { isa = PBXTargetDependency; name = M3u; diff --git a/Plugins/SilenceDecoder/SilenceDecoder.xcodeproj/project.pbxproj b/Plugins/SilenceDecoder/SilenceDecoder.xcodeproj/project.pbxproj new file mode 100644 index 000000000..c3f577d2e --- /dev/null +++ b/Plugins/SilenceDecoder/SilenceDecoder.xcodeproj/project.pbxproj @@ -0,0 +1,273 @@ +// !$*UTF8*$! +{ + archiveVersion = 1; + classes = { + }; + objectVersion = 46; + objects = { + +/* Begin PBXBuildFile section */ + 83F9D8021A884C0B007ABEC2 /* SilenceDecoder.m in Sources */ = {isa = PBXBuildFile; fileRef = 83F9D7FF1A884C0B007ABEC2 /* SilenceDecoder.m */; }; + 83F9D8031A884C0B007ABEC2 /* SilenceSource.m in Sources */ = {isa = PBXBuildFile; fileRef = 83F9D8011A884C0B007ABEC2 /* SilenceSource.m */; }; +/* End PBXBuildFile section */ + +/* Begin PBXFileReference section */ + 83F9D7E71A884B44007ABEC2 /* SilenceDecoder.bundle */ = {isa = PBXFileReference; explicitFileType = wrapper.cfbundle; includeInIndex = 0; path = SilenceDecoder.bundle; sourceTree = BUILT_PRODUCTS_DIR; }; + 83F9D7EB1A884B44007ABEC2 /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = ""; }; + 83F9D7FE1A884C0B007ABEC2 /* SilenceDecoder.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SilenceDecoder.h; sourceTree = ""; }; + 83F9D7FF1A884C0B007ABEC2 /* SilenceDecoder.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = SilenceDecoder.m; sourceTree = ""; }; + 83F9D8001A884C0B007ABEC2 /* SilenceSource.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SilenceSource.h; sourceTree = ""; }; + 83F9D8011A884C0B007ABEC2 /* SilenceSource.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = SilenceSource.m; sourceTree = ""; }; + 83F9D8041A884C23007ABEC2 /* PlaylistController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = PlaylistController.h; path = ../../../Playlist/PlaylistController.h; sourceTree = ""; }; + 83F9D8081A884C93007ABEC2 /* Plugin.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = Plugin.h; path = ../../../Audio/Plugin.h; sourceTree = ""; }; + 83F9D8091A884CB5007ABEC2 /* Logging.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = Logging.h; path = ../../../Utils/Logging.h; sourceTree = ""; }; +/* End PBXFileReference section */ + +/* Begin PBXFrameworksBuildPhase section */ + 83F9D7E41A884B44007ABEC2 /* Frameworks */ = { + isa = PBXFrameworksBuildPhase; + buildActionMask = 2147483647; + files = ( + ); + runOnlyForDeploymentPostprocessing = 0; + }; +/* End PBXFrameworksBuildPhase section */ + +/* Begin PBXGroup section */ + 83F9D7DE1A884B44007ABEC2 = { + isa = PBXGroup; + children = ( + 83F9D7E91A884B44007ABEC2 /* SilenceDecoder */, + 83F9D7E81A884B44007ABEC2 /* Products */, + ); + sourceTree = ""; + }; + 83F9D7E81A884B44007ABEC2 /* Products */ = { + isa = PBXGroup; + children = ( + 83F9D7E71A884B44007ABEC2 /* SilenceDecoder.bundle */, + ); + name = Products; + sourceTree = ""; + }; + 83F9D7E91A884B44007ABEC2 /* SilenceDecoder */ = { + isa = PBXGroup; + children = ( + 83F9D8091A884CB5007ABEC2 /* Logging.h */, + 83F9D8081A884C93007ABEC2 /* Plugin.h */, + 83F9D8041A884C23007ABEC2 /* PlaylistController.h */, + 83F9D7FE1A884C0B007ABEC2 /* SilenceDecoder.h */, + 83F9D7FF1A884C0B007ABEC2 /* SilenceDecoder.m */, + 83F9D8001A884C0B007ABEC2 /* SilenceSource.h */, + 83F9D8011A884C0B007ABEC2 /* SilenceSource.m */, + 83F9D7EA1A884B44007ABEC2 /* Supporting Files */, + ); + path = SilenceDecoder; + sourceTree = ""; + }; + 83F9D7EA1A884B44007ABEC2 /* Supporting Files */ = { + isa = PBXGroup; + children = ( + 83F9D7EB1A884B44007ABEC2 /* Info.plist */, + ); + name = "Supporting Files"; + sourceTree = ""; + }; +/* End PBXGroup section */ + +/* Begin PBXNativeTarget section */ + 83F9D7E61A884B44007ABEC2 /* SilenceDecoder */ = { + isa = PBXNativeTarget; + buildConfigurationList = 83F9D7EE1A884B44007ABEC2 /* Build configuration list for PBXNativeTarget "SilenceDecoder" */; + buildPhases = ( + 83F9D7E31A884B44007ABEC2 /* Sources */, + 83F9D7E41A884B44007ABEC2 /* Frameworks */, + 83F9D7E51A884B44007ABEC2 /* Resources */, + ); + buildRules = ( + ); + dependencies = ( + ); + name = SilenceDecoder; + productName = SilenceDecoder; + productReference = 83F9D7E71A884B44007ABEC2 /* SilenceDecoder.bundle */; + productType = "com.apple.product-type.bundle"; + }; +/* End PBXNativeTarget section */ + +/* Begin PBXProject section */ + 83F9D7DF1A884B44007ABEC2 /* Project object */ = { + isa = PBXProject; + attributes = { + LastUpgradeCheck = 0610; + ORGANIZATIONNAME = "Christopher Snowhill"; + TargetAttributes = { + 83F9D7E61A884B44007ABEC2 = { + CreatedOnToolsVersion = 6.1.1; + }; + }; + }; + buildConfigurationList = 83F9D7E21A884B44007ABEC2 /* Build configuration list for PBXProject "SilenceDecoder" */; + compatibilityVersion = "Xcode 3.2"; + developmentRegion = English; + hasScannedForEncodings = 0; + knownRegions = ( + en, + ); + mainGroup = 83F9D7DE1A884B44007ABEC2; + productRefGroup = 83F9D7E81A884B44007ABEC2 /* Products */; + projectDirPath = ""; + projectRoot = ""; + targets = ( + 83F9D7E61A884B44007ABEC2 /* SilenceDecoder */, + ); + }; +/* End PBXProject section */ + +/* Begin PBXResourcesBuildPhase section */ + 83F9D7E51A884B44007ABEC2 /* Resources */ = { + isa = PBXResourcesBuildPhase; + buildActionMask = 2147483647; + files = ( + ); + runOnlyForDeploymentPostprocessing = 0; + }; +/* End PBXResourcesBuildPhase section */ + +/* Begin PBXSourcesBuildPhase section */ + 83F9D7E31A884B44007ABEC2 /* Sources */ = { + isa = PBXSourcesBuildPhase; + buildActionMask = 2147483647; + files = ( + 83F9D8031A884C0B007ABEC2 /* SilenceSource.m in Sources */, + 83F9D8021A884C0B007ABEC2 /* SilenceDecoder.m in Sources */, + ); + runOnlyForDeploymentPostprocessing = 0; + }; +/* End PBXSourcesBuildPhase section */ + +/* Begin XCBuildConfiguration section */ + 83F9D7EC1A884B44007ABEC2 /* 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_UNREACHABLE_CODE = YES; + CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; + COPY_PHASE_STRIP = NO; + ENABLE_STRICT_OBJC_MSGSEND = YES; + GCC_C_LANGUAGE_STANDARD = gnu99; + GCC_DYNAMIC_NO_PIC = NO; + 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; + MTL_ENABLE_DEBUG_INFO = YES; + ONLY_ACTIVE_ARCH = YES; + SDKROOT = macosx; + }; + name = Debug; + }; + 83F9D7ED1A884B44007ABEC2 /* 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_UNREACHABLE_CODE = YES; + CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; + COPY_PHASE_STRIP = YES; + DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym"; + ENABLE_NS_ASSERTIONS = NO; + ENABLE_STRICT_OBJC_MSGSEND = YES; + GCC_C_LANGUAGE_STANDARD = gnu99; + 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; + MTL_ENABLE_DEBUG_INFO = NO; + SDKROOT = macosx; + }; + name = Release; + }; + 83F9D7EF1A884B44007ABEC2 /* Debug */ = { + isa = XCBuildConfiguration; + buildSettings = { + CLANG_ENABLE_OBJC_ARC = NO; + COMBINE_HIDPI_IMAGES = YES; + INFOPLIST_FILE = SilenceDecoder/Info.plist; + INSTALL_PATH = "$(LOCAL_LIBRARY_DIR)/Bundles"; + PRODUCT_NAME = "$(TARGET_NAME)"; + SKIP_INSTALL = YES; + WRAPPER_EXTENSION = bundle; + }; + name = Debug; + }; + 83F9D7F01A884B44007ABEC2 /* Release */ = { + isa = XCBuildConfiguration; + buildSettings = { + CLANG_ENABLE_OBJC_ARC = NO; + COMBINE_HIDPI_IMAGES = YES; + INFOPLIST_FILE = SilenceDecoder/Info.plist; + INSTALL_PATH = "$(LOCAL_LIBRARY_DIR)/Bundles"; + PRODUCT_NAME = "$(TARGET_NAME)"; + SKIP_INSTALL = YES; + WRAPPER_EXTENSION = bundle; + }; + name = Release; + }; +/* End XCBuildConfiguration section */ + +/* Begin XCConfigurationList section */ + 83F9D7E21A884B44007ABEC2 /* Build configuration list for PBXProject "SilenceDecoder" */ = { + isa = XCConfigurationList; + buildConfigurations = ( + 83F9D7EC1A884B44007ABEC2 /* Debug */, + 83F9D7ED1A884B44007ABEC2 /* Release */, + ); + defaultConfigurationIsVisible = 0; + defaultConfigurationName = Release; + }; + 83F9D7EE1A884B44007ABEC2 /* Build configuration list for PBXNativeTarget "SilenceDecoder" */ = { + isa = XCConfigurationList; + buildConfigurations = ( + 83F9D7EF1A884B44007ABEC2 /* Debug */, + 83F9D7F01A884B44007ABEC2 /* Release */, + ); + defaultConfigurationIsVisible = 0; + }; +/* End XCConfigurationList section */ + }; + rootObject = 83F9D7DF1A884B44007ABEC2 /* Project object */; +} diff --git a/Plugins/SilenceDecoder/SilenceDecoder/Info.plist b/Plugins/SilenceDecoder/SilenceDecoder/Info.plist new file mode 100644 index 000000000..ee77de34f --- /dev/null +++ b/Plugins/SilenceDecoder/SilenceDecoder/Info.plist @@ -0,0 +1,28 @@ + + + + + CFBundleDevelopmentRegion + en + CFBundleExecutable + $(EXECUTABLE_NAME) + CFBundleIdentifier + org.cogx.$(PRODUCT_NAME:rfc1034identifier) + CFBundleInfoDictionaryVersion + 6.0 + CFBundleName + $(PRODUCT_NAME) + CFBundlePackageType + BNDL + CFBundleShortVersionString + 1.0 + CFBundleSignature + ???? + CFBundleVersion + 1 + NSHumanReadableCopyright + Copyright © 2015 Christopher Snowhill. All rights reserved. + NSPrincipalClass + + + diff --git a/Plugins/SilenceDecoder/SilenceDecoder/SilenceDecoder.h b/Plugins/SilenceDecoder/SilenceDecoder/SilenceDecoder.h new file mode 100755 index 000000000..affbefd62 --- /dev/null +++ b/Plugins/SilenceDecoder/SilenceDecoder/SilenceDecoder.h @@ -0,0 +1,22 @@ +// +// SilenceDecoder.h +// Cog +// +// Created by Christopher Snowhill on 2/8/15. +// Copyright 2015 __NoWork, LLC__. All rights reserved. +// + +#import + +#import "Plugin.h" + +@interface SilenceDecoder : NSObject { + id source; + + long length; + long remain; +} + +- (void)setSource:(id)s; +- (id)source; +@end diff --git a/Plugins/SilenceDecoder/SilenceDecoder/SilenceDecoder.m b/Plugins/SilenceDecoder/SilenceDecoder/SilenceDecoder.m new file mode 100755 index 000000000..48485c376 --- /dev/null +++ b/Plugins/SilenceDecoder/SilenceDecoder/SilenceDecoder.m @@ -0,0 +1,107 @@ +// +// SilenceDecoder.m +// Cog +// +// Created by Christopher Snowhill on 2/8/15. +// Copyright 2015 __NoWork, LLC__. All rights reserved. +// + +#import "SilenceDecoder.h" + +#import "Logging.h" + +#import "PlaylistController.h" + +@implementation SilenceDecoder + +enum { sample_rate = 44100 }; +enum { channels = 2 }; + +- (BOOL)open:(id)s +{ + [self setSource:s]; + + NSString * path = [[[s url] relativeString] substringFromIndex:10]; + + length = [path intValue] * sample_rate; + remain = length; + + [self willChangeValueForKey:@"properties"]; + [self didChangeValueForKey:@"properties"]; + + return YES; +} + +- (NSDictionary *)properties +{ + return [NSDictionary dictionaryWithObjectsAndKeys: + [NSNumber numberWithInt:0], @"bitrate", + [NSNumber numberWithFloat:sample_rate], @"sampleRate", + [NSNumber numberWithDouble:length], @"totalFrames", + [NSNumber numberWithInt:32], @"bitsPerSample", + [NSNumber numberWithBool:YES], @"floatingPoint", + [NSNumber numberWithInt:channels], @"channels", + [NSNumber numberWithBool:YES], @"seekable", + @"host", @"endian", + nil]; +} + +- (int)readAudio:(void *)buf frames:(UInt32)frames +{ + int total = frames; + + if (!IsRepeatOneSet()) + { + if (total > remain) + total = (int)remain; + + remain -= total; + } + + memset(buf, 0, sizeof(float) * total * channels); + + return total; +} + +- (long)seek:(long)frame +{ + if (frame > length) + frame = length; + + remain = length - frame; + + return frame; +} + +- (void)close +{ +} + +- (void)setSource:(id)s +{ + [s retain]; + [source release]; + source = s; +} + +- (id)source +{ + return source; +} + ++ (NSArray *)fileTypes +{ + return [NSArray array]; +} + ++ (NSArray *)mimeTypes +{ + return [NSArray arrayWithObject:@"audio/x-silence"]; +} + ++ (float)priority +{ + return 1.0; +} + +@end diff --git a/Plugins/SilenceDecoder/SilenceDecoder/SilenceSource.h b/Plugins/SilenceDecoder/SilenceDecoder/SilenceSource.h new file mode 100644 index 000000000..4e21e606e --- /dev/null +++ b/Plugins/SilenceDecoder/SilenceDecoder/SilenceSource.h @@ -0,0 +1,18 @@ +// +// SilenceSource.h +// SilenceSource +// +// Created by Christopher Snowhill on 2/8/15. +// Copyright 2015 __NoWork, LLC__. All rights reserved. +// + +#import + +#import "Plugin.h" + +@interface SilenceSource : NSObject +{ + NSURL *_url; +} + +@end diff --git a/Plugins/SilenceDecoder/SilenceDecoder/SilenceSource.m b/Plugins/SilenceDecoder/SilenceDecoder/SilenceSource.m new file mode 100644 index 000000000..4cfdc025c --- /dev/null +++ b/Plugins/SilenceDecoder/SilenceDecoder/SilenceSource.m @@ -0,0 +1,76 @@ +// +// SilenceSource.m +// SilenceSource +// +// Created by Christopher Snowhill on 2/8/15. +// Copyright 2015 __NoWork, LLC__. All rights reserved. +// + +#import "SilenceSource.h" + + +@implementation SilenceSource + +- (BOOL)open:(NSURL *)url +{ + [self setURL:url]; + + return YES; +} + +- (BOOL)seekable +{ + return YES; +} + +- (BOOL)seek:(long)position whence:(int)whence +{ + return YES; +} + +- (long)tell +{ + return 0; +} + +- (long)read:(void *)buffer amount:(long)amount +{ + memset(buffer, 0, amount); + return amount; +} + +- (void)close +{ +} + +- (NSURL *)url +{ + return _url; +} + +- (NSString *)mimeType +{ + return @"audio/x-silence"; +} + +- (void)setURL:(NSURL *)url +{ + [url retain]; + [_url release]; + _url = url; +} + + ++ (NSArray *)schemes +{ + return [NSArray arrayWithObject:@"silence"]; +} + +- (void)dealloc { + [self close]; + [self setURL:nil]; + + [super dealloc]; +} + +@end