Permalink
Browse files

Rewrite SPPlaybackManager to be both more awesome and to remove the d…

…ependency on CoCA.
  • Loading branch information...
1 parent 7275ef5 commit d2195c4a87e404fc04266f71f0ef811dcf778828 Daniel Kennett committed Oct 2, 2011
View
@@ -1,6 +1 @@
-[submodule "Mac Framework/Sample Projects/Guess The Intro/Guess The Intro/CoCA"]
- path = Mac Framework/Sample Projects/Guess The Intro/Guess The Intro/CoCA
- url = git://github.com/iKenndac/CoCA.git
-[submodule "Mac Framework/Sample Projects/SimplePlayer/SimplePlayer/CoCA"]
- path = Mac Framework/Sample Projects/SimplePlayer/SimplePlayer/CoCA
- url = git://github.com/iKenndac/CoCA.git
+
@@ -7,9 +7,6 @@
objects = {
/* Begin PBXBuildFile section */
- 501EDF60138E763500450D47 /* CoCAAudioDevice.m in Sources */ = {isa = PBXBuildFile; fileRef = 501EDF5A138E763500450D47 /* CoCAAudioDevice.m */; };
- 501EDF61138E763500450D47 /* CoCAAudioHardwareSystem.m in Sources */ = {isa = PBXBuildFile; fileRef = 501EDF5C138E763500450D47 /* CoCAAudioHardwareSystem.m */; };
- 501EDF62138E763500450D47 /* CoCAAudioUnit.m in Sources */ = {isa = PBXBuildFile; fileRef = 501EDF5E138E763500450D47 /* CoCAAudioUnit.m */; };
508464971372A93C00A9493B /* Cocoa.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 508464961372A93C00A9493B /* Cocoa.framework */; };
508464A11372A93C00A9493B /* InfoPlist.strings in Resources */ = {isa = PBXBuildFile; fileRef = 5084649F1372A93C00A9493B /* InfoPlist.strings */; };
508464A41372A93C00A9493B /* main.m in Sources */ = {isa = PBXBuildFile; fileRef = 508464A31372A93C00A9493B /* main.m */; };
@@ -18,12 +15,11 @@
508464AD1372A93D00A9493B /* MainMenu.xib in Resources */ = {isa = PBXBuildFile; fileRef = 508464AB1372A93D00A9493B /* MainMenu.xib */; };
5094F3801407E57600BA3106 /* CocoaLibSpotify.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 5094F37F1407E56D00BA3106 /* CocoaLibSpotify.framework */; };
5094F3831407E58700BA3106 /* CocoaLibSpotify.framework in CopyFiles */ = {isa = PBXBuildFile; fileRef = 5094F37F1407E56D00BA3106 /* CocoaLibSpotify.framework */; };
- 5099E8D913744E44009D5D3E /* SPPlaybackManager.m in Sources */ = {isa = PBXBuildFile; fileRef = 5099E8D813744E44009D5D3E /* SPPlaybackManager.m */; };
50EA72F91372F1C90047BD78 /* SPArrayExtensions.m in Sources */ = {isa = PBXBuildFile; fileRef = 50EA72F81372F1C90047BD78 /* SPArrayExtensions.m */; };
50EA73001373092C0047BD78 /* CoreAudio.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 50EA72FF1373092C0047BD78 /* CoreAudio.framework */; };
50EA7302137309320047BD78 /* AudioUnit.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 50EA7301137309320047BD78 /* AudioUnit.framework */; };
- 50EA7311137309640047BD78 /* NCCommon.m in Sources */ = {isa = PBXBuildFile; fileRef = 50EA730C137309640047BD78 /* NCCommon.m */; };
- 50EA7314137309CF0047BD78 /* SPCircularBuffer.m in Sources */ = {isa = PBXBuildFile; fileRef = 50EA7313137309CF0047BD78 /* SPCircularBuffer.m */; };
+ 50F90990143903F400833EEF /* SPCircularBuffer.m in Sources */ = {isa = PBXBuildFile; fileRef = 50F9098D143903F400833EEF /* SPCircularBuffer.m */; };
+ 50F90991143903F400833EEF /* SPPlaybackManager.m in Sources */ = {isa = PBXBuildFile; fileRef = 50F9098F143903F400833EEF /* SPPlaybackManager.m */; };
/* End PBXBuildFile section */
/* Begin PBXContainerItemProxy section */
@@ -57,14 +53,6 @@
/* End PBXCopyFilesBuildPhase section */
/* Begin PBXFileReference section */
- 501EDF58138E763500450D47 /* CoCA.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = CoCA.h; sourceTree = "<group>"; };
- 501EDF59138E763500450D47 /* CoCAAudioDevice.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = CoCAAudioDevice.h; sourceTree = "<group>"; };
- 501EDF5A138E763500450D47 /* CoCAAudioDevice.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = CoCAAudioDevice.m; sourceTree = "<group>"; };
- 501EDF5B138E763500450D47 /* CoCAAudioHardwareSystem.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = CoCAAudioHardwareSystem.h; sourceTree = "<group>"; };
- 501EDF5C138E763500450D47 /* CoCAAudioHardwareSystem.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = CoCAAudioHardwareSystem.m; sourceTree = "<group>"; };
- 501EDF5D138E763500450D47 /* CoCAAudioUnit.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = CoCAAudioUnit.h; sourceTree = "<group>"; };
- 501EDF5E138E763500450D47 /* CoCAAudioUnit.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = CoCAAudioUnit.m; sourceTree = "<group>"; };
- 501EDF5F138E763500450D47 /* PrivateUtil.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = PrivateUtil.h; sourceTree = "<group>"; };
508464921372A93C00A9493B /* Guess The Intro.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = "Guess The Intro.app"; sourceTree = BUILT_PRODUCTS_DIR; };
508464961372A93C00A9493B /* Cocoa.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = Cocoa.framework; path = System/Library/Frameworks/Cocoa.framework; sourceTree = SDKROOT; };
508464991372A93C00A9493B /* AppKit.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = AppKit.framework; path = System/Library/Frameworks/AppKit.framework; sourceTree = SDKROOT; };
@@ -79,17 +67,15 @@
508464A91372A93C00A9493B /* Guess_The_IntroAppDelegate.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = Guess_The_IntroAppDelegate.m; sourceTree = "<group>"; };
508464AC1372A93D00A9493B /* en */ = {isa = PBXFileReference; lastKnownFileType = file.xib; name = en; path = en.lproj/MainMenu.xib; sourceTree = "<group>"; };
5094F3771407E56D00BA3106 /* CocoaLibSpotify Mac Framework.xcodeproj */ = {isa = PBXFileReference; lastKnownFileType = "wrapper.pb-project"; name = "CocoaLibSpotify Mac Framework.xcodeproj"; path = "../../CocoaLibSpotify Mac Framework.xcodeproj"; sourceTree = "<group>"; };
- 5099E8D713744E44009D5D3E /* SPPlaybackManager.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SPPlaybackManager.h; sourceTree = "<group>"; };
- 5099E8D813744E44009D5D3E /* SPPlaybackManager.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = SPPlaybackManager.m; sourceTree = "<group>"; };
50EA72F71372F1C90047BD78 /* SPArrayExtensions.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SPArrayExtensions.h; sourceTree = "<group>"; };
50EA72F81372F1C90047BD78 /* SPArrayExtensions.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = SPArrayExtensions.m; sourceTree = "<group>"; };
50EA72FA1372F60E0047BD78 /* appkey.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = appkey.c; sourceTree = "<group>"; };
50EA72FF1373092C0047BD78 /* CoreAudio.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = CoreAudio.framework; path = System/Library/Frameworks/CoreAudio.framework; sourceTree = SDKROOT; };
50EA7301137309320047BD78 /* AudioUnit.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = AudioUnit.framework; path = System/Library/Frameworks/AudioUnit.framework; sourceTree = SDKROOT; };
- 50EA730B137309640047BD78 /* NCCommon.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = NCCommon.h; sourceTree = "<group>"; };
- 50EA730C137309640047BD78 /* NCCommon.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = NCCommon.m; sourceTree = "<group>"; };
- 50EA7312137309CF0047BD78 /* SPCircularBuffer.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SPCircularBuffer.h; sourceTree = "<group>"; };
- 50EA7313137309CF0047BD78 /* SPCircularBuffer.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = SPCircularBuffer.m; sourceTree = "<group>"; };
+ 50F9098C143903F400833EEF /* SPCircularBuffer.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = SPCircularBuffer.h; path = "../../Playback Helpers/SPCircularBuffer.h"; sourceTree = "<group>"; };
+ 50F9098D143903F400833EEF /* SPCircularBuffer.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = SPCircularBuffer.m; path = "../../Playback Helpers/SPCircularBuffer.m"; sourceTree = "<group>"; };
+ 50F9098E143903F400833EEF /* SPPlaybackManager.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = SPPlaybackManager.h; path = "../../Playback Helpers/SPPlaybackManager.h"; sourceTree = "<group>"; };
+ 50F9098F143903F400833EEF /* SPPlaybackManager.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = SPPlaybackManager.m; path = "../../Playback Helpers/SPPlaybackManager.m"; sourceTree = "<group>"; };
/* End PBXFileReference section */
/* Begin PBXFrameworksBuildPhase section */
@@ -107,21 +93,6 @@
/* End PBXFrameworksBuildPhase section */
/* Begin PBXGroup section */
- 501EDF57138E763500450D47 /* Source */ = {
- isa = PBXGroup;
- children = (
- 501EDF58138E763500450D47 /* CoCA.h */,
- 501EDF59138E763500450D47 /* CoCAAudioDevice.h */,
- 501EDF5A138E763500450D47 /* CoCAAudioDevice.m */,
- 501EDF5B138E763500450D47 /* CoCAAudioHardwareSystem.h */,
- 501EDF5C138E763500450D47 /* CoCAAudioHardwareSystem.m */,
- 501EDF5D138E763500450D47 /* CoCAAudioUnit.h */,
- 501EDF5E138E763500450D47 /* CoCAAudioUnit.m */,
- 501EDF5F138E763500450D47 /* PrivateUtil.h */,
- );
- path = Source;
- sourceTree = "<group>";
- };
508464871372A93C00A9493B = {
isa = PBXGroup;
children = (
@@ -168,12 +139,8 @@
508464A91372A93C00A9493B /* Guess_The_IntroAppDelegate.m */,
50EA72FA1372F60E0047BD78 /* appkey.c */,
508464AB1372A93D00A9493B /* MainMenu.xib */,
+ 50F9098B143903E400833EEF /* Playback Helpers */,
50EA72F61372F1B00047BD78 /* Extensions */,
- 5099E8D713744E44009D5D3E /* SPPlaybackManager.h */,
- 5099E8D813744E44009D5D3E /* SPPlaybackManager.m */,
- 50EA7312137309CF0047BD78 /* SPCircularBuffer.h */,
- 50EA7313137309CF0047BD78 /* SPCircularBuffer.m */,
- 50EA7303137309640047BD78 /* CoCA */,
5084649D1372A93C00A9493B /* Supporting Files */,
);
path = "Guess The Intro";
@@ -208,14 +175,15 @@
name = Extensions;
sourceTree = "<group>";
};
- 50EA7303137309640047BD78 /* CoCA */ = {
+ 50F9098B143903E400833EEF /* Playback Helpers */ = {
isa = PBXGroup;
children = (
- 501EDF57138E763500450D47 /* Source */,
- 50EA730B137309640047BD78 /* NCCommon.h */,
- 50EA730C137309640047BD78 /* NCCommon.m */,
+ 50F9098C143903F400833EEF /* SPCircularBuffer.h */,
+ 50F9098D143903F400833EEF /* SPCircularBuffer.m */,
+ 50F9098E143903F400833EEF /* SPPlaybackManager.h */,
+ 50F9098F143903F400833EEF /* SPPlaybackManager.m */,
);
- path = CoCA;
+ name = "Playback Helpers";
sourceTree = "<group>";
};
/* End PBXGroup section */
@@ -246,6 +214,7 @@
508464891372A93C00A9493B /* Project object */ = {
isa = PBXProject;
attributes = {
+ LastUpgradeCheck = 0420;
ORGANIZATIONNAME = Spotify;
};
buildConfigurationList = 5084648C1372A93C00A9493B /* Build configuration list for PBXProject "Guess The Intro" */;
@@ -302,12 +271,8 @@
508464A41372A93C00A9493B /* main.m in Sources */,
508464AA1372A93C00A9493B /* Guess_The_IntroAppDelegate.m in Sources */,
50EA72F91372F1C90047BD78 /* SPArrayExtensions.m in Sources */,
- 50EA7311137309640047BD78 /* NCCommon.m in Sources */,
- 50EA7314137309CF0047BD78 /* SPCircularBuffer.m in Sources */,
- 5099E8D913744E44009D5D3E /* SPPlaybackManager.m in Sources */,
- 501EDF60138E763500450D47 /* CoCAAudioDevice.m in Sources */,
- 501EDF61138E763500450D47 /* CoCAAudioHardwareSystem.m in Sources */,
- 501EDF62138E763500450D47 /* CoCAAudioUnit.m in Sources */,
+ 50F90990143903F400833EEF /* SPCircularBuffer.m in Sources */,
+ 50F90991143903F400833EEF /* SPPlaybackManager.m in Sources */,
);
runOnlyForDeploymentPostprocessing = 0;
};
Submodule CoCA deleted from 583ae2
@@ -1,94 +0,0 @@
-//
-// SPCircularBuffer.h
-// Viva
-//
-// Created by Daniel Kennett on 4/9/11.
-/*
- Copyright (c) 2011, Spotify AB
- All rights reserved.
-
- Redistribution and use in source and binary forms, with or without
- modification, are permitted provided that the following conditions are met:
- * Redistributions of source code must retain the above copyright
- notice, this list of conditions and the following disclaimer.
- * Redistributions in binary form must reproduce the above copyright
- notice, this list of conditions and the following disclaimer in the
- documentation and/or other materials provided with the distribution.
- * Neither the name of Spotify AB nor the names of its contributors may
- be used to endorse or promote products derived from this software
- without specific prior written permission.
-
- THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
- ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
- WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
- DISCLAIMED. IN NO EVENT SHALL SPOTIFY AB BE LIABLE FOR ANY DIRECT, INDIRECT,
- INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
- LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA,
- OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
- LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE
- OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
- ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** This class is a simple implementation of a circular buffer, designed to match the behaviour of (Cocoa)LibSpotify.
-
- This class gets around the problem of filling the buffer too far ahead by having a maximum size. Once that
- size is reached, you cannot add more data without reading some out or clearing it and starting again. When
- used with (Cocoa)LibSpotify, this isn't a problem as we can ask the library to re-deliver audio data at a later time.
- */
-
-#import <Foundation/Foundation.h>
-
-@interface SPCircularBuffer : NSObject {
-@private
- void *buffer;
- NSUInteger maximumLength;
- NSUInteger dataStartOffset;
- NSUInteger dataEndOffset;
- BOOL empty;
-}
-
-/** Initialize a new buffer.
-
- Initial size will be zero, with a maximum size as provided.
-
- @param size The maximum size of the buffer, in bytes.
- @return Returns the newly created SPCircularBuffer.
- */
--(id)initWithMaximumLength:(NSUInteger)size;
-
-/** Clears all data from the buffer. */
--(void)clear;
-
-/** Attempt to copy new data into the buffer.
-
- Data is copied using the following heuristic:
-
- - If dataLength <= (maximumLength - length), copy all data.
- - Otherwise, copy (maximumLength - length) bytes.
-
- @param data A buffer containing the data to be copied in.
- @param dataLength The length of the data, in bytes.
- @return Returns the amount of data copied into the buffer, in bytes. If this number is
- smaller than dataLength, only this number of bytes was copied in from the start of the given buffer.
- */
--(NSUInteger)attemptAppendData:(const void *)data ofLength:(NSUInteger)dataLength;
-
-/** Read data out of the buffer.
-
- @warning *Important:* If this method returns non-zero, you _must_ free() the given buffer to
- not leak memory.
-
- @param desiredLength The desired number of bytes to copy out.
- @param outBuffer A pointer to a buffer, which will be malloc()ed and filled with the read data.
- @return Returns the amount of data copied into the given buffer, in bytes.
- */
--(NSUInteger)readDataOfLength:(NSUInteger)desiredLength intoBuffer:(void **)outBuffer;
-
-/** Returns the amount of data currently in the buffer, in bytes. */
-@property (readonly) NSUInteger length;
-
-/** Returns the maximum amount of data that the buffer can hold, in bytes. */
-@property (readonly) NSUInteger maximumLength;
-
-@end
Oops, something went wrong.

0 comments on commit d2195c4

Please sign in to comment.