Merged with cog-audio-framework branch. Cog now uses plugins.
parent
a7f6b2775c
commit
927b65a4a5
|
@ -1,8 +1,8 @@
|
|||
/* SoundController */
|
||||
/* PlaybackController */
|
||||
|
||||
#import <Cocoa/Cocoa.h>
|
||||
|
||||
#import "SoundController.h"
|
||||
#import "CogAudio/AudioPlayer.h"
|
||||
#import "PlaylistController.h"
|
||||
#import "TrackingSlider.h"
|
||||
|
||||
|
@ -26,7 +26,7 @@
|
|||
NSTimer *positionTimer;
|
||||
|
||||
BOOL waitingForPlay; //No sneaky changing on us
|
||||
SoundController *soundController;
|
||||
AudioPlayer *audioPlayer;
|
||||
|
||||
int playbackStatus;
|
||||
|
||||
|
@ -59,11 +59,4 @@
|
|||
- (void)playEntryAtIndex:(int)i;
|
||||
- (void)playEntry:(PlaylistEntry *)pe;
|
||||
|
||||
|
||||
//Methods since this is SoundController's delegate
|
||||
- (void)delegateNotifyStatusUpdate:(NSNumber *)status;
|
||||
- (void)delegateNotifyBitrateUpdate:(float)bitrate;
|
||||
- (void)delegateNotifySongChanged;
|
||||
- (void)delegateRequestNextSong:(PlaylistEntry *)pe;
|
||||
|
||||
@end
|
|
@ -2,7 +2,7 @@
|
|||
#import "PlaylistView.h"
|
||||
|
||||
#import "DBLog.h"
|
||||
#import "Status.h"
|
||||
#import "CogAudio/Status.h"
|
||||
|
||||
@implementation PlaybackController
|
||||
|
||||
|
@ -11,7 +11,8 @@
|
|||
self = [super init];
|
||||
if (self)
|
||||
{
|
||||
soundController = [[SoundController alloc] initWithDelegate:self];
|
||||
audioPlayer = [[AudioPlayer alloc] init];
|
||||
[audioPlayer setDelegate:self];
|
||||
playbackStatus = kCogStatusStopped;
|
||||
|
||||
showTimeRemaining = NO;
|
||||
|
@ -48,20 +49,20 @@
|
|||
- (IBAction)pause:(id)sender
|
||||
{
|
||||
// DBLog(@"Pause Sent!");
|
||||
[soundController pause];
|
||||
[audioPlayer pause];
|
||||
}
|
||||
|
||||
- (IBAction)resume:(id)sender
|
||||
{
|
||||
// DBLog(@"Resume Sent!");
|
||||
[soundController resume];
|
||||
[audioPlayer resume];
|
||||
}
|
||||
|
||||
- (IBAction)stop:(id)sender
|
||||
{
|
||||
// DBLog(@"Stop Sent!");
|
||||
|
||||
[soundController stop];
|
||||
[audioPlayer stop];
|
||||
}
|
||||
|
||||
//called by double-clicking on table
|
||||
|
@ -92,8 +93,8 @@
|
|||
|
||||
[self updateTimeField:0.0f];
|
||||
|
||||
[soundController play:pe];
|
||||
[soundController setVolume:currentVolume];
|
||||
[audioPlayer play:[NSURL fileURLWithPath:[pe filename]] withUserInfo:pe];
|
||||
[audioPlayer setVolume:currentVolume];
|
||||
}
|
||||
|
||||
- (IBAction)next:(id)sender
|
||||
|
@ -130,7 +131,7 @@
|
|||
time = [positionSlider doubleValue];
|
||||
|
||||
if ([sender tracking] == NO) // check if user stopped sliding before playing audio
|
||||
[soundController seekToTime:time];
|
||||
[audioPlayer seekToTime:time];
|
||||
|
||||
[self updateTimeField:time];
|
||||
}
|
||||
|
@ -173,7 +174,7 @@
|
|||
|
||||
currentVolume = percent * [sender maxValue];
|
||||
|
||||
[soundController setVolume:currentVolume];
|
||||
[audioPlayer setVolume:currentVolume];
|
||||
}
|
||||
|
||||
- (IBAction)volumeDown:(id)sender
|
||||
|
@ -187,7 +188,7 @@
|
|||
|
||||
currentVolume = percent * [volumeSlider maxValue];
|
||||
|
||||
[soundController setVolume:currentVolume];
|
||||
[audioPlayer setVolume:currentVolume];
|
||||
}
|
||||
|
||||
- (IBAction)volumeUp:(id)sender
|
||||
|
@ -201,7 +202,7 @@
|
|||
|
||||
currentVolume = percent * [volumeSlider maxValue];
|
||||
|
||||
[soundController setVolume:currentVolume];
|
||||
[audioPlayer setVolume:currentVolume];
|
||||
}
|
||||
|
||||
|
||||
|
@ -230,8 +231,9 @@
|
|||
[self updateTimeField:[positionSlider doubleValue]];
|
||||
}
|
||||
|
||||
- (void)delegateRequestNextEntry:(PlaylistEntry *)curEntry
|
||||
- (void)audioPlayer:(AudioPlayer *)player requestNextStream:(id)userInfo
|
||||
{
|
||||
PlaylistEntry *curEntry = (PlaylistEntry *)userInfo;
|
||||
PlaylistEntry *pe;
|
||||
|
||||
if ([playlistController shuffle] == YES)
|
||||
|
@ -244,16 +246,18 @@
|
|||
}
|
||||
|
||||
if (pe == nil)
|
||||
[soundController setNextEntry:nil];
|
||||
[player setNextStream:nil];
|
||||
else
|
||||
{
|
||||
DBLog(@"NEXT SONG: %@", [pe filename]);
|
||||
[soundController setNextEntry:pe];
|
||||
[player setNextStream:[NSURL fileURLWithPath:[pe filename]] withUserInfo:pe];
|
||||
}
|
||||
}
|
||||
|
||||
- (void)delegateNotifySongChanged:(PlaylistEntry *)pe
|
||||
- (void)audioPlayer:(AudioPlayer *)player streamChanged:(id)userInfo
|
||||
{
|
||||
PlaylistEntry *pe = (PlaylistEntry *)userInfo;
|
||||
|
||||
[playlistController setCurrentEntry:pe];
|
||||
|
||||
[positionSlider setDoubleValue:0.0f];
|
||||
|
@ -262,14 +266,9 @@
|
|||
|
||||
}
|
||||
|
||||
- (void)delegateNotifyBitrateUpdate:(float)bitrate
|
||||
{
|
||||
// [bitrateField setIntValue:bitrate];
|
||||
}
|
||||
|
||||
- (void)updatePosition:(id)sender
|
||||
{
|
||||
double pos = [soundController amountPlayed];
|
||||
double pos = [audioPlayer amountPlayed];
|
||||
|
||||
if ([positionSlider tracking] == NO)
|
||||
{
|
||||
|
@ -280,7 +279,8 @@
|
|||
|
||||
}
|
||||
|
||||
- (void)delegateNotifyStatusUpdate:(NSNumber *)s
|
||||
|
||||
- (void)audioPlayer:(AudioPlayer *)player statusChanged:(id)s
|
||||
{
|
||||
int status = [s intValue];
|
||||
if (status == kCogStatusStopped || status == kCogStatusPaused)
|
|
@ -0,0 +1,18 @@
|
|||
//
|
||||
// AudioDecoder.h
|
||||
// CogAudio
|
||||
//
|
||||
// Created by Vincent Spader on 2/21/07.
|
||||
// Copyright 2007 __MyCompanyName__. All rights reserved.
|
||||
//
|
||||
|
||||
#import <Cocoa/Cocoa.h>
|
||||
|
||||
#import "PluginController.h"
|
||||
|
||||
@interface AudioDecoder : NSObject {
|
||||
}
|
||||
|
||||
+ audioDecoderForURL:(NSURL *)url;
|
||||
|
||||
@end
|
|
@ -0,0 +1,25 @@
|
|||
//
|
||||
// AudioDecoder.m
|
||||
// CogAudio
|
||||
//
|
||||
// Created by Vincent Spader on 2/21/07.
|
||||
// Copyright 2007 __MyCompanyName__. All rights reserved.
|
||||
//
|
||||
|
||||
#import "AudioDecoder.h"
|
||||
|
||||
|
||||
@implementation AudioDecoder
|
||||
|
||||
+ audioDecoderForURL:(NSURL *)url
|
||||
{
|
||||
NSString *ext = [[url path] pathExtension];
|
||||
|
||||
NSDictionary *decoders = [[PluginController sharedPluginController] decoders];
|
||||
|
||||
Class decoder = NSClassFromString([decoders objectForKey:ext]);
|
||||
|
||||
return [[[decoder alloc] init] autorelease];
|
||||
}
|
||||
|
||||
@end
|
|
@ -0,0 +1,18 @@
|
|||
//
|
||||
// AudioMetadataReader.h
|
||||
// CogAudio
|
||||
//
|
||||
// Created by Vincent Spader on 2/24/07.
|
||||
// Copyright 2007 __MyCompanyName__. All rights reserved.
|
||||
//
|
||||
|
||||
#import <Cocoa/Cocoa.h>
|
||||
|
||||
|
||||
@interface AudioMetadataReader : NSObject {
|
||||
|
||||
}
|
||||
|
||||
+ (NSDictionary *)metadataForURL:(NSURL *)url;
|
||||
|
||||
@end
|
|
@ -0,0 +1,26 @@
|
|||
//
|
||||
// AudioMetadataReader.m
|
||||
// CogAudio
|
||||
//
|
||||
// Created by Vincent Spader on 2/24/07.
|
||||
// Copyright 2007 __MyCompanyName__. All rights reserved.
|
||||
//
|
||||
|
||||
#import "AudioMetadataReader.h"
|
||||
#import "PluginController.h"
|
||||
|
||||
@implementation AudioMetadataReader
|
||||
|
||||
+ (NSDictionary *)metadataForURL:(NSURL *)url
|
||||
{
|
||||
NSString *ext = [[url path] pathExtension];
|
||||
|
||||
NSDictionary *metadataReaders = [[PluginController sharedPluginController] metadataReaders];
|
||||
|
||||
Class metadataReader = NSClassFromString([metadataReaders objectForKey:ext]);
|
||||
|
||||
return [[[[metadataReader alloc] init] autorelease] metadataForURL:url];
|
||||
|
||||
}
|
||||
|
||||
@end
|
|
@ -0,0 +1,76 @@
|
|||
//
|
||||
// AudioController.h
|
||||
// Cog
|
||||
//
|
||||
// Created by Vincent Spader on 8/7/05.
|
||||
// Copyright 2005 Vincent Spader. All rights reserved.
|
||||
//
|
||||
|
||||
#import <Cocoa/Cocoa.h>
|
||||
|
||||
@class BufferChain;
|
||||
@class OutputNode;
|
||||
|
||||
@interface AudioPlayer : NSObject
|
||||
{
|
||||
BufferChain *bufferChain;
|
||||
OutputNode *output;
|
||||
|
||||
NSMutableArray *chainQueue;
|
||||
|
||||
NSURL *nextStream;
|
||||
id nextStreamUserInfo;
|
||||
|
||||
id delegate;
|
||||
}
|
||||
|
||||
- (id)init;
|
||||
|
||||
- (void)setDelegate:(id)d;
|
||||
- (id)delegate;
|
||||
|
||||
- (void)play:(NSURL *)url;
|
||||
- (void)play:(NSURL *)url withUserInfo:(id)userInfo;
|
||||
|
||||
- (void)stop;
|
||||
- (void)pause;
|
||||
- (void)resume;
|
||||
|
||||
- (void)seekToTime:(double)time;
|
||||
- (void)setVolume:(double)v;
|
||||
|
||||
- (double)amountPlayed;
|
||||
|
||||
- (void)setNextStream:(NSURL *)url;
|
||||
- (void)setNextStream:(NSURL *)url withUserInfo:(id)userInfo;
|
||||
|
||||
+ (NSArray *)fileTypes;
|
||||
|
||||
@end
|
||||
|
||||
@interface AudioPlayer (Private) //Dont use this stuff!
|
||||
|
||||
- (OutputNode *) output;
|
||||
- (BufferChain *) bufferChain;
|
||||
- (id)initWithDelegate:(id)d;
|
||||
|
||||
- (void)setPlaybackStatus:(int)s;
|
||||
|
||||
- (void)requestNextStream:(id)userInfo;
|
||||
- (void)requestNextStreamMainThread:(id)userInfo;
|
||||
- (void)notifyStreamChanged:(id)userInfo;
|
||||
- (void)notifyStreamChangedMainThread:(id)userInfo;
|
||||
|
||||
- (void)endOfInputReached:(BufferChain *)sender;
|
||||
- (void)setShouldContinue:(BOOL)s;
|
||||
- (BufferChain *)bufferChain;
|
||||
- (void)endOfInputPlayed;
|
||||
- (void)sendDelegateMethod:(SEL)selector withObject:(id)obj waitUntilDone:(BOOL)wait;
|
||||
@end
|
||||
|
||||
@protocol AudioPlayerDelegate
|
||||
- (void)audioPlayer:(AudioPlayer *)player requestNextStream:(id)userInfo; //You must use setNextStream in this method
|
||||
- (void)audioPlayer:(AudioPlayer *)player streamChanged:(id)userInfo;
|
||||
- (void)audioPlayer:(AudioPlayer *)player changedStatus:(id)status;
|
||||
@end
|
||||
|
|
@ -0,0 +1,284 @@
|
|||
//
|
||||
// AudioController.m
|
||||
// Cog
|
||||
//
|
||||
// Created by Vincent Spader on 8/7/05.
|
||||
// Copyright 2005 Vincent Spader. All rights reserved.
|
||||
//
|
||||
|
||||
#import "AudioPlayer.h"
|
||||
#import "BufferChain.h"
|
||||
#import "OutputNode.h"
|
||||
#import "Status.h"
|
||||
|
||||
|
||||
|
||||
@implementation AudioPlayer
|
||||
|
||||
- (id)init
|
||||
{
|
||||
self = [super init];
|
||||
if (self)
|
||||
{
|
||||
output = NULL;
|
||||
bufferChain = NULL;
|
||||
|
||||
chainQueue = [[NSMutableArray alloc] init];
|
||||
}
|
||||
|
||||
return self;
|
||||
}
|
||||
|
||||
- (void)setDelegate:(id)d
|
||||
{
|
||||
delegate = d;
|
||||
}
|
||||
|
||||
- (id)delegate {
|
||||
return delegate;
|
||||
}
|
||||
|
||||
- (void)play:(NSURL *)url
|
||||
{
|
||||
[self play:url withUserInfo:nil];
|
||||
}
|
||||
|
||||
|
||||
- (void)play:(NSURL *)url withUserInfo:(id)userInfo
|
||||
{
|
||||
if (output)
|
||||
{
|
||||
[output release];
|
||||
}
|
||||
output = [[OutputNode alloc] initWithController:self previous:nil];
|
||||
[output setup];
|
||||
|
||||
NSEnumerator *enumerator = [chainQueue objectEnumerator];
|
||||
id anObject;
|
||||
while (anObject = [enumerator nextObject])
|
||||
{
|
||||
[anObject setShouldContinue:NO];
|
||||
}
|
||||
[chainQueue removeAllObjects];
|
||||
|
||||
if (bufferChain)
|
||||
{
|
||||
[bufferChain setShouldContinue:NO];
|
||||
|
||||
[bufferChain release];
|
||||
}
|
||||
bufferChain = [[BufferChain alloc] initWithController:self];
|
||||
|
||||
while (![bufferChain open:url withOutputFormat:[output format]])
|
||||
{
|
||||
[bufferChain release];
|
||||
|
||||
[self requestNextStream: userInfo];
|
||||
|
||||
url = nextStream;
|
||||
if (url == nil)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
userInfo = nextStreamUserInfo;
|
||||
|
||||
[self notifyStreamChanged:userInfo];
|
||||
|
||||
bufferChain = [[BufferChain alloc] initWithController:self];
|
||||
}
|
||||
|
||||
[bufferChain setUserInfo:userInfo];
|
||||
|
||||
[self setShouldContinue:YES];
|
||||
DBLog(@"DETACHING THREADS");
|
||||
|
||||
[output launchThread];
|
||||
[bufferChain launchThreads];
|
||||
|
||||
[self setPlaybackStatus:kCogStatusPlaying];
|
||||
}
|
||||
|
||||
- (void)stop
|
||||
{
|
||||
//Set shouldoContinue to NO on allll things
|
||||
[self setShouldContinue:NO];
|
||||
[self setPlaybackStatus:kCogStatusStopped];
|
||||
}
|
||||
|
||||
- (void)pause
|
||||
{
|
||||
[output pause];
|
||||
|
||||
[self setPlaybackStatus:kCogStatusPaused];
|
||||
}
|
||||
|
||||
- (void)resume
|
||||
{
|
||||
[output resume];
|
||||
|
||||
[self setPlaybackStatus:kCogStatusPlaying];
|
||||
}
|
||||
|
||||
- (void)seekToTime:(double)time
|
||||
{
|
||||
//Need to reset everything's buffers, and then seek?
|
||||
/*HACK TO TEST HOW WELL THIS WOULD WORK*/
|
||||
[bufferChain seek:time];
|
||||
[output seek:time];
|
||||
|
||||
|
||||
/*END HACK*/
|
||||
}
|
||||
|
||||
- (void)setVolume:(double)v
|
||||
{
|
||||
[output setVolume:v];
|
||||
}
|
||||
|
||||
- (void)setNextStream:(NSURL *)url
|
||||
{
|
||||
[self setNextStream:url withUserInfo:nil];
|
||||
}
|
||||
|
||||
- (void)setNextStream:(NSURL *)url withUserInfo:(id)userInfo
|
||||
{
|
||||
[url retain];
|
||||
[nextStream release];
|
||||
nextStream = url;
|
||||
|
||||
[userInfo retain];
|
||||
[nextStreamUserInfo release];
|
||||
nextStreamUserInfo = userInfo;
|
||||
|
||||
}
|
||||
|
||||
|
||||
- (void)setShouldContinue:(BOOL)s
|
||||
{
|
||||
[bufferChain setShouldContinue:s];
|
||||
[output setShouldContinue:s];
|
||||
}
|
||||
|
||||
- (double)amountPlayed
|
||||
{
|
||||
return [output amountPlayed];
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
- (void)requestNextStream:(id)userInfo
|
||||
{
|
||||
[self sendDelegateMethod:@selector(audioPlayer:requestNextStream:) withObject:userInfo waitUntilDone:YES];
|
||||
}
|
||||
|
||||
- (void)notifyStreamChanged:(id)userInfo
|
||||
{
|
||||
[self sendDelegateMethod:@selector(audioPlayer:streamChanged:) withObject:userInfo waitUntilDone:NO];
|
||||
}
|
||||
|
||||
|
||||
|
||||
- (void)endOfInputReached:(BufferChain *)sender //Sender is a BufferChain
|
||||
{
|
||||
BufferChain *newChain = nil;
|
||||
|
||||
nextStreamUserInfo = [sender userInfo];
|
||||
[nextStreamUserInfo retain]; //Retained because when setNextStream is called, it will be released!!!
|
||||
|
||||
do {
|
||||
[newChain release];
|
||||
[self requestNextStream: nextStreamUserInfo];
|
||||
|
||||
if (nextStream == nil)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
newChain = [[BufferChain alloc] initWithController:self];
|
||||
} while (![newChain open:nextStream withOutputFormat:[output format]]);
|
||||
|
||||
[newChain setUserInfo: nextStreamUserInfo];
|
||||
|
||||
[newChain setShouldContinue:YES];
|
||||
[newChain launchThreads];
|
||||
|
||||
[chainQueue insertObject:newChain atIndex:[chainQueue count]];
|
||||
|
||||
[newChain release];
|
||||
}
|
||||
|
||||
- (void)endOfInputPlayed
|
||||
{
|
||||
if ([chainQueue count] <= 0)
|
||||
{
|
||||
//End of playlist
|
||||
DBLog(@"STOPPED");
|
||||
[self stop];
|
||||
|
||||
return;
|
||||
}
|
||||
// NSLog(@"SWAPPING BUFFERS");
|
||||
[bufferChain release];
|
||||
|
||||
DBLog(@"END OF INPUT PLAYED");
|
||||
bufferChain = [chainQueue objectAtIndex:0];
|
||||
[bufferChain retain];
|
||||
|
||||
[chainQueue removeObjectAtIndex:0];
|
||||
|
||||
[self notifyStreamChanged:[bufferChain userInfo]];
|
||||
[output setEndOfStream:NO];
|
||||
}
|
||||
|
||||
- (void)sendDelegateMethod:(SEL)selector withObject:(id)obj waitUntilDone:(BOOL)wait
|
||||
{
|
||||
NSInvocation *invocation = [NSInvocation invocationWithMethodSignature:[delegate methodSignatureForSelector:selector]];
|
||||
[invocation setSelector:selector];
|
||||
[invocation setArgument:&self atIndex:2]; //Indexes start at 2, the first being self, the second being command.
|
||||
[invocation setArgument:&obj atIndex:3];
|
||||
|
||||
[self performSelectorOnMainThread:@selector(sendDelegateMethodMainThread:) withObject:invocation waitUntilDone:wait];
|
||||
}
|
||||
|
||||
|
||||
- (void)sendDelegateMethodMainThread:(id)invocation
|
||||
{
|
||||
[invocation invokeWithTarget:delegate];
|
||||
}
|
||||
|
||||
- (void)setPlaybackStatus:(int)status
|
||||
{
|
||||
[self sendDelegateMethod:@selector(audioPlayer:statusChanged:) withObject:[NSNumber numberWithInt:status] waitUntilDone:NO];
|
||||
}
|
||||
|
||||
- (BufferChain *)bufferChain
|
||||
{
|
||||
return bufferChain;
|
||||
}
|
||||
|
||||
- (OutputNode *) output
|
||||
{
|
||||
return output;
|
||||
}
|
||||
|
||||
+ (NSArray *)fileTypes
|
||||
{
|
||||
PluginController *pluginController = [PluginController sharedPluginController];
|
||||
|
||||
NSArray *decoderTypes = [[pluginController decoders] allKeys];
|
||||
NSArray *metdataReaderTypes = [[pluginController metadataReaders] allKeys];
|
||||
NSArray *propertiesReaderTypes = [[pluginController propertiesReaders] allKeys];
|
||||
|
||||
NSMutableSet *types = [NSMutableSet set];
|
||||
|
||||
[types addObjectsFromArray:decoderTypes];
|
||||
[types addObjectsFromArray:metdataReaderTypes];
|
||||
[types addObjectsFromArray:propertiesReaderTypes];
|
||||
|
||||
return [types allObjects];
|
||||
}
|
||||
|
||||
|
||||
@end
|
|
@ -0,0 +1,18 @@
|
|||
//
|
||||
// AudioMetadataReader.h
|
||||
// CogAudio
|
||||
//
|
||||
// Created by Vincent Spader on 2/24/07.
|
||||
// Copyright 2007 __MyCompanyName__. All rights reserved.
|
||||
//
|
||||
|
||||
#import <Cocoa/Cocoa.h>
|
||||
|
||||
|
||||
@interface AudioPropertiesReader : NSObject {
|
||||
|
||||
}
|
||||
|
||||
+ (NSDictionary *)propertiesForURL:(NSURL *)url;
|
||||
|
||||
@end
|
|
@ -0,0 +1,26 @@
|
|||
//
|
||||
// AudioMetadataReader.m
|
||||
// CogAudio
|
||||
//
|
||||
// Created by Vincent Spader on 2/24/07.
|
||||
// Copyright 2007 __MyCompanyName__. All rights reserved.
|
||||
//
|
||||
|
||||
#import "AudioPropertiesReader.h"
|
||||
#import "PluginController.h"
|
||||
|
||||
@implementation AudioPropertiesReader
|
||||
|
||||
+ (NSDictionary *)propertiesForURL:(NSURL *)url
|
||||
{
|
||||
NSString *ext = [[url path] pathExtension];
|
||||
|
||||
NSDictionary *propertiesReaders = [[PluginController sharedPluginController] propertiesReaders];
|
||||
|
||||
Class propertiesReader = NSClassFromString([propertiesReaders objectForKey:ext]);
|
||||
|
||||
return [[[[propertiesReader alloc] init] autorelease] propertiesForURL:url];
|
||||
|
||||
}
|
||||
|
||||
@end
|
|
@ -10,28 +10,37 @@
|
|||
|
||||
#import "InputNode.h"
|
||||
#import "ConverterNode.h"
|
||||
#import "SoundController.h"
|
||||
#import "PlaylistEntry.h"
|
||||
#import "AudioPlayer.h"
|
||||
|
||||
@interface BufferChain : NSObject {
|
||||
InputNode *inputNode;
|
||||
ConverterNode *converterNode;
|
||||
PlaylistEntry *playlistEntry;
|
||||
|
||||
NSArray *effects; //Not needed as of now, but for EFFECTS PLUGINS OF THE FUTURE!
|
||||
NSURL *streamURL;
|
||||
id userInfo;
|
||||
|
||||
id finalNode; //Final buffer in the chain.
|
||||
|
||||
id soundController;
|
||||
id controller;
|
||||
}
|
||||
|
||||
- (id)initWithController:(id)c;
|
||||
- (void)buildChain;
|
||||
- (BOOL)open:(PlaylistEntry *)pe;
|
||||
- (BOOL)open:(NSURL *)url withOutputFormat:(AudioStreamBasicDescription)outputFormat;
|
||||
- (void)seek:(double)time;
|
||||
|
||||
- (void)launchThreads;
|
||||
|
||||
- (id)finalNode;
|
||||
|
||||
- (id)userInfo;
|
||||
- (void)setUserInfo:(id)i;
|
||||
|
||||
- (NSURL *)streamURL;
|
||||
|
||||
- (void)setShouldContinue:(BOOL)s;
|
||||
|
||||
- (void)endOfInputReached;
|
||||
|
||||
|
||||
@end
|
|
@ -8,6 +8,7 @@
|
|||
|
||||
#import "BufferChain.h"
|
||||
#import "OutputNode.h"
|
||||
#import "CoreAudioUtils.h"
|
||||
|
||||
@implementation BufferChain
|
||||
|
||||
|
@ -16,8 +17,9 @@
|
|||
self = [super init];
|
||||
if (self)
|
||||
{
|
||||
soundController = c;
|
||||
playlistEntry = nil;
|
||||
controller = c;
|
||||
streamURL = nil;
|
||||
userInfo = nil;
|
||||
inputNode = nil;
|
||||
converterNode = nil;
|
||||
}
|
||||
|
@ -36,19 +38,20 @@
|
|||
finalNode = converterNode;
|
||||
}
|
||||
|
||||
- (BOOL)open:(PlaylistEntry *)pe
|
||||
{
|
||||
[pe retain];
|
||||
[playlistEntry release];
|
||||
NSLog(@"THEY ARE THE SAME?!");
|
||||
playlistEntry = pe;
|
||||
- (BOOL)open:(NSURL *)url withOutputFormat:(AudioStreamBasicDescription)outputFormat
|
||||
{
|
||||
[url retain];
|
||||
[streamURL release];
|
||||
streamURL = url;
|
||||
|
||||
[self buildChain];
|
||||
NSLog(@"Filename in bufferchain: %@, %i %i", [pe filename], playlistEntry, pe);
|
||||
if (![inputNode open:[playlistEntry filename]])
|
||||
if (![inputNode open:url])
|
||||
return NO;
|
||||
|
||||
AudioStreamBasicDescription inputFormat;
|
||||
inputFormat = propertiesToASBD([inputNode properties]);
|
||||
|
||||
[converterNode setupWithInputFormat:(AudioStreamBasicDescription)[inputNode format] outputFormat:[[soundController output] format] ];
|
||||
[converterNode setupWithInputFormat:inputFormat outputFormat:outputFormat ];
|
||||
|
||||
return YES;
|
||||
}
|
||||
|
@ -61,10 +64,21 @@
|
|||
[converterNode launchThread];
|
||||
}
|
||||
|
||||
- (void)setUserInfo:(id)i
|
||||
{
|
||||
[i retain];
|
||||
[userInfo release];
|
||||
userInfo = i;
|
||||
}
|
||||
|
||||
- (id)userInfo
|
||||
{
|
||||
return userInfo;
|
||||
}
|
||||
|
||||
- (void)dealloc
|
||||
{
|
||||
NSLog(@"Releasing playlistEntry: %i", [playlistEntry retainCount]);
|
||||
[playlistEntry release];
|
||||
[userInfo release];
|
||||
|
||||
[inputNode release];
|
||||
|
||||
|
@ -100,7 +114,7 @@
|
|||
|
||||
- (void)endOfInputReached
|
||||
{
|
||||
[soundController endOfInputReached:self];
|
||||
[controller endOfInputReached:self];
|
||||
}
|
||||
|
||||
|
||||
|
@ -109,9 +123,9 @@
|
|||
return finalNode;
|
||||
}
|
||||
|
||||
- (PlaylistEntry *)playlistEntry
|
||||
- (NSURL *)streamURL
|
||||
{
|
||||
return playlistEntry;
|
||||
return streamURL;
|
||||
}
|
||||
|
||||
- (void)setShouldContinue:(BOOL)s
|
|
@ -36,11 +36,8 @@ void PrintStreamDesc (AudioStreamBasicDescription *inDesc)
|
|||
static OSStatus ACInputProc(AudioConverterRef inAudioConverter, UInt32* ioNumberDataPackets, AudioBufferList* ioData, AudioStreamPacketDescription** outDataPacketDescription, void* inUserData)
|
||||
{
|
||||
ConverterNode *converter = (ConverterNode *)inUserData;
|
||||
id previousNode = [converter previousNode];
|
||||
OSStatus err = noErr;
|
||||
void *readPtr;
|
||||
int amountToWrite;
|
||||
int availInput;
|
||||
int amountRead;
|
||||
|
||||
if ([converter shouldContinue] == NO || [converter endOfStream] == YES)
|
||||
|
@ -59,14 +56,7 @@ static OSStatus ACInputProc(AudioConverterRef inAudioConverter, UInt32* ioNumber
|
|||
converter->callbackBuffer = malloc(amountToWrite);
|
||||
|
||||
amountRead = [converter readData:converter->callbackBuffer amount:amountToWrite];
|
||||
/* if ([converter endOfStream] == YES)
|
||||
{
|
||||
ioData->mBuffers[0].mDataByteSize = 0;
|
||||
*ioNumberDataPackets = 0;
|
||||
|
||||
return noErr;
|
||||
}
|
||||
*/ if (amountRead == 0)
|
||||
if (amountRead == 0)
|
||||
{
|
||||
ioData->mBuffers[0].mDataByteSize = 0;
|
||||
*ioNumberDataPackets = 0;
|
||||
|
@ -74,42 +64,6 @@ static OSStatus ACInputProc(AudioConverterRef inAudioConverter, UInt32* ioNumber
|
|||
return 100; //Keep asking for data
|
||||
}
|
||||
|
||||
/*
|
||||
availInput = [[previousNode buffer] lengthAvailableToReadReturningPointer:&readPtr];
|
||||
if (availInput == 0 )
|
||||
{
|
||||
// NSLog(@"0 INPUT");
|
||||
ioData->mBuffers[0].mDataByteSize = 0;
|
||||
*ioNumberDataPackets = 0;
|
||||
|
||||
if ([previousNode endOfStream] == YES)
|
||||
{
|
||||
NSLog(@"END OF CONVERTER INPUT");
|
||||
[converter setEndOfStream:YES];
|
||||
[converter setShouldContinue:NO];
|
||||
|
||||
return noErr;
|
||||
}
|
||||
|
||||
return 100; //Keep asking for data
|
||||
}
|
||||
|
||||
if (amountToWrite > availInput)
|
||||
amountToWrite = availInput;
|
||||
|
||||
*ioNumberDataPackets = amountToWrite/(converter->inputFormat.mBytesPerPacket);
|
||||
|
||||
if (converter->callbackBuffer != NULL)
|
||||
free(converter->callbackBuffer);
|
||||
converter->callbackBuffer = malloc(amountToWrite);
|
||||
memcpy(converter->callbackBuffer, readPtr, amountToWrite);
|
||||
|
||||
if (amountToWrite > 0)
|
||||
{
|
||||
[[previousNode buffer] didReadLength:amountToWrite];
|
||||
[[previousNode semaphore] signal];
|
||||
}
|
||||
*/
|
||||
// NSLog(@"Amount read: %@ %i", converter, amountRead);
|
||||
ioData->mBuffers[0].mData = converter->callbackBuffer;
|
||||
ioData->mBuffers[0].mDataByteSize = amountRead;
|
|
@ -12,20 +12,20 @@
|
|||
#import <AudioToolbox/AudioToolbox.h>
|
||||
#import <AudioUnit/AudioUnit.h>
|
||||
|
||||
#import "SoundFile.h"
|
||||
#import "AudioDecoder.h"
|
||||
#import "Node.h"
|
||||
#import "Plugin.h"
|
||||
|
||||
@interface InputNode : Node {
|
||||
AudioStreamBasicDescription format;
|
||||
|
||||
SoundFile *soundFile;
|
||||
id<CogDecoder> decoder;
|
||||
|
||||
BOOL shouldSeek;
|
||||
double seekTime;
|
||||
}
|
||||
|
||||
- (BOOL)open:(NSURL *)url;
|
||||
- (void)process;
|
||||
- (AudioStreamBasicDescription) format;
|
||||
- (NSDictionary *) properties;
|
||||
- (void)seek:(double)time;
|
||||
|
||||
|
|
@ -7,27 +7,33 @@
|
|||
//
|
||||
|
||||
#import "InputNode.h"
|
||||
|
||||
#import "BufferChain.h"
|
||||
|
||||
@implementation InputNode
|
||||
|
||||
- (BOOL)open:(NSString *)filename
|
||||
- (BOOL)open:(NSURL *)url
|
||||
{
|
||||
NSLog(@"Opening: %@", filename);
|
||||
soundFile = [SoundFile open:filename];
|
||||
if (soundFile == nil)
|
||||
NSLog(@"Opening: %@", url);
|
||||
decoder = [AudioDecoder audioDecoderForURL:url];
|
||||
[decoder retain];
|
||||
|
||||
NSLog(@"Got decoder...%@", decoder);
|
||||
if (decoder == nil)
|
||||
return NO;
|
||||
/* while (soundFile == nil)
|
||||
|
||||
if (![decoder open:url])
|
||||
return NO;
|
||||
|
||||
/* while (decoder == nil)
|
||||
{
|
||||
NSString *nextSong = [controller invalidSoundFile];
|
||||
if (nextSong == nil)
|
||||
NSURL *nextStream = [controller invalidDecoder];
|
||||
if (nextStream == nil)
|
||||
return NO;
|
||||
|
||||
soundFile = [SoundFile open:nextSong];
|
||||
decoder = [AudioDecoder audioDecoderForURL:nextStream];
|
||||
[decoder open:nextStream];
|
||||
}
|
||||
*/
|
||||
[soundFile getFormat:&format];
|
||||
|
||||
shouldContinue = YES;
|
||||
shouldSeek = NO;
|
||||
|
||||
|
@ -48,11 +54,11 @@
|
|||
if (shouldSeek == YES)
|
||||
{
|
||||
NSLog(@"Actually seeking");
|
||||
[soundFile seekToTime:seekTime];
|
||||
[decoder seekToTime:seekTime];
|
||||
shouldSeek = NO;
|
||||
}
|
||||
|
||||
amountRead = [soundFile fillBuffer:buf ofSize: chunk_size];
|
||||
amountRead = [decoder fillBuffer:buf ofSize: chunk_size];
|
||||
if (amountRead <= 0)
|
||||
{
|
||||
endOfStream = YES;
|
||||
|
@ -64,7 +70,7 @@
|
|||
}
|
||||
|
||||
free(buf);
|
||||
[soundFile close];
|
||||
[decoder close];
|
||||
|
||||
NSLog(@"CLOSED: %i", self);
|
||||
}
|
||||
|
@ -76,9 +82,16 @@
|
|||
shouldSeek = YES;
|
||||
}
|
||||
|
||||
- (AudioStreamBasicDescription) format
|
||||
- (void)dealloc
|
||||
{
|
||||
return format;
|
||||
[decoder release];
|
||||
|
||||
[super dealloc];
|
||||
}
|
||||
|
||||
- (NSDictionary *) properties
|
||||
{
|
||||
return [decoder properties];
|
||||
}
|
||||
|
||||
@end
|
|
@ -25,7 +25,7 @@
|
|||
BOOL shouldContinue;
|
||||
BOOL endOfStream; //All data is now in buffer
|
||||
}
|
||||
- (id)initWithPrevious:(id)p;
|
||||
- (id)initWithController:(id)c previous:(id)p;
|
||||
|
||||
- (int)writeData:(void *)ptr amount:(int)a;
|
||||
- (int)readData:(void *)ptr amount:(int)a;
|
|
@ -22,8 +22,6 @@
|
|||
OutputCoreAudio *output;
|
||||
}
|
||||
|
||||
- (id)initWithController:(id)c previousLink:p;
|
||||
|
||||
- (double)amountPlayed;
|
||||
|
||||
- (void)setup;
|
||||
|
@ -38,4 +36,9 @@
|
|||
|
||||
- (void)setVolume:(double) v;
|
||||
|
||||
- (void)setShouldContinue:(BOOL)s;
|
||||
|
||||
- (void)pause;
|
||||
- (void)resume;
|
||||
|
||||
@end
|
|
@ -8,6 +8,8 @@
|
|||
|
||||
#import "OutputNode.h"
|
||||
#import "OutputCoreAudio.h"
|
||||
#import "AudioPlayer.h"
|
||||
#import "BufferChain.h"
|
||||
|
||||
@implementation OutputNode
|
||||
|
||||
|
@ -92,6 +94,8 @@
|
|||
- (void)dealloc
|
||||
{
|
||||
[output release];
|
||||
|
||||
[super dealloc];
|
||||
}
|
||||
|
||||
- (void)setVolume:(double) v
|
|
@ -0,0 +1,519 @@
|
|||
// !$*UTF8*$!
|
||||
{
|
||||
archiveVersion = 1;
|
||||
classes = {
|
||||
};
|
||||
objectVersion = 42;
|
||||
objects = {
|
||||
|
||||
/* Begin PBXBuildFile section */
|
||||
17A2D3C50B8D1D37000778C4 /* AudioDecoder.h in Headers */ = {isa = PBXBuildFile; fileRef = 17A2D3C30B8D1D37000778C4 /* AudioDecoder.h */; settings = {ATTRIBUTES = (Public, ); }; };
|
||||
17A2D3C60B8D1D37000778C4 /* AudioDecoder.m in Sources */ = {isa = PBXBuildFile; fileRef = 17A2D3C40B8D1D37000778C4 /* AudioDecoder.m */; };
|
||||
17B619300B909BC300BC003F /* AudioPropertiesReader.h in Headers */ = {isa = PBXBuildFile; fileRef = 17B6192E0B909BC300BC003F /* AudioPropertiesReader.h */; settings = {ATTRIBUTES = (Public, ); }; };
|
||||
17B619310B909BC300BC003F /* AudioPropertiesReader.m in Sources */ = {isa = PBXBuildFile; fileRef = 17B6192F0B909BC300BC003F /* AudioPropertiesReader.m */; };
|
||||
17C940230B900909008627D6 /* AudioMetadataReader.h in Headers */ = {isa = PBXBuildFile; fileRef = 17C940210B900909008627D6 /* AudioMetadataReader.h */; settings = {ATTRIBUTES = (Public, ); }; };
|
||||
17C940240B900909008627D6 /* AudioMetadataReader.m in Sources */ = {isa = PBXBuildFile; fileRef = 17C940220B900909008627D6 /* AudioMetadataReader.m */; };
|
||||
17D21CA10B8BE4BA00D1EBDE /* BufferChain.h in Headers */ = {isa = PBXBuildFile; fileRef = 17D21C760B8BE4BA00D1EBDE /* BufferChain.h */; settings = {ATTRIBUTES = (Public, ); }; };
|
||||
17D21CA20B8BE4BA00D1EBDE /* BufferChain.m in Sources */ = {isa = PBXBuildFile; fileRef = 17D21C770B8BE4BA00D1EBDE /* BufferChain.m */; };
|
||||
17D21CA30B8BE4BA00D1EBDE /* ConverterNode.h in Headers */ = {isa = PBXBuildFile; fileRef = 17D21C780B8BE4BA00D1EBDE /* ConverterNode.h */; settings = {ATTRIBUTES = (Public, ); }; };
|
||||
17D21CA40B8BE4BA00D1EBDE /* ConverterNode.m in Sources */ = {isa = PBXBuildFile; fileRef = 17D21C790B8BE4BA00D1EBDE /* ConverterNode.m */; };
|
||||
17D21CA50B8BE4BA00D1EBDE /* InputNode.h in Headers */ = {isa = PBXBuildFile; fileRef = 17D21C7A0B8BE4BA00D1EBDE /* InputNode.h */; settings = {ATTRIBUTES = (Public, ); }; };
|
||||
17D21CA60B8BE4BA00D1EBDE /* InputNode.m in Sources */ = {isa = PBXBuildFile; fileRef = 17D21C7B0B8BE4BA00D1EBDE /* InputNode.m */; };
|
||||
17D21CA70B8BE4BA00D1EBDE /* Node.h in Headers */ = {isa = PBXBuildFile; fileRef = 17D21C7C0B8BE4BA00D1EBDE /* Node.h */; settings = {ATTRIBUTES = (Public, ); }; };
|
||||
17D21CA80B8BE4BA00D1EBDE /* Node.m in Sources */ = {isa = PBXBuildFile; fileRef = 17D21C7D0B8BE4BA00D1EBDE /* Node.m */; };
|
||||
17D21CA90B8BE4BA00D1EBDE /* OutputNode.h in Headers */ = {isa = PBXBuildFile; fileRef = 17D21C7E0B8BE4BA00D1EBDE /* OutputNode.h */; settings = {ATTRIBUTES = (Public, ); }; };
|
||||
17D21CAA0B8BE4BA00D1EBDE /* OutputNode.m in Sources */ = {isa = PBXBuildFile; fileRef = 17D21C7F0B8BE4BA00D1EBDE /* OutputNode.m */; };
|
||||
17D21CC50B8BE4BA00D1EBDE /* OutputCoreAudio.h in Headers */ = {isa = PBXBuildFile; fileRef = 17D21C9C0B8BE4BA00D1EBDE /* OutputCoreAudio.h */; settings = {ATTRIBUTES = (Public, ); }; };
|
||||
17D21CC60B8BE4BA00D1EBDE /* OutputCoreAudio.m in Sources */ = {isa = PBXBuildFile; fileRef = 17D21C9D0B8BE4BA00D1EBDE /* OutputCoreAudio.m */; };
|
||||
17D21CC70B8BE4BA00D1EBDE /* Status.h in Headers */ = {isa = PBXBuildFile; fileRef = 17D21C9E0B8BE4BA00D1EBDE /* Status.h */; settings = {ATTRIBUTES = (Public, ); }; };
|
||||
17D21CDF0B8BE5B400D1EBDE /* VirtualRingBuffer.h in Headers */ = {isa = PBXBuildFile; fileRef = 17D21CDA0B8BE5B400D1EBDE /* VirtualRingBuffer.h */; settings = {ATTRIBUTES = (Public, ); }; };
|
||||
17D21CE00B8BE5B400D1EBDE /* VirtualRingBuffer.m in Sources */ = {isa = PBXBuildFile; fileRef = 17D21CDB0B8BE5B400D1EBDE /* VirtualRingBuffer.m */; };
|
||||
17D21CE10B8BE5B400D1EBDE /* DBLog.h in Headers */ = {isa = PBXBuildFile; fileRef = 17D21CDD0B8BE5B400D1EBDE /* DBLog.h */; settings = {ATTRIBUTES = (Public, ); }; };
|
||||
17D21CE20B8BE5B400D1EBDE /* DBLog.m in Sources */ = {isa = PBXBuildFile; fileRef = 17D21CDE0B8BE5B400D1EBDE /* DBLog.m */; };
|
||||
17D21CF30B8BE5EF00D1EBDE /* Semaphore.h in Headers */ = {isa = PBXBuildFile; fileRef = 17D21CF10B8BE5EF00D1EBDE /* Semaphore.h */; settings = {ATTRIBUTES = (Public, ); }; };
|
||||
17D21CF40B8BE5EF00D1EBDE /* Semaphore.m in Sources */ = {isa = PBXBuildFile; fileRef = 17D21CF20B8BE5EF00D1EBDE /* Semaphore.m */; };
|
||||
17D21DAD0B8BE76800D1EBDE /* AudioToolbox.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 17D21DA90B8BE76800D1EBDE /* AudioToolbox.framework */; };
|
||||
17D21DAE0B8BE76800D1EBDE /* AudioUnit.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 17D21DAA0B8BE76800D1EBDE /* AudioUnit.framework */; };
|
||||
17D21DAF0B8BE76800D1EBDE /* CoreAudio.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 17D21DAB0B8BE76800D1EBDE /* CoreAudio.framework */; };
|
||||
17D21DB00B8BE76800D1EBDE /* CoreAudioKit.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 17D21DAC0B8BE76800D1EBDE /* CoreAudioKit.framework */; };
|
||||
17D21DC70B8BE79700D1EBDE /* CoreAudioUtils.h in Headers */ = {isa = PBXBuildFile; fileRef = 17D21DC50B8BE79700D1EBDE /* CoreAudioUtils.h */; settings = {ATTRIBUTES = (Public, ); }; };
|
||||
17D21DC80B8BE79700D1EBDE /* CoreAudioUtils.m in Sources */ = {isa = PBXBuildFile; fileRef = 17D21DC60B8BE79700D1EBDE /* CoreAudioUtils.m */; };
|
||||
17D21EBD0B8BF44000D1EBDE /* AudioPlayer.h in Headers */ = {isa = PBXBuildFile; fileRef = 17D21EBB0B8BF44000D1EBDE /* AudioPlayer.h */; settings = {ATTRIBUTES = (Public, ); }; };
|
||||
17D21EBE0B8BF44000D1EBDE /* AudioPlayer.m in Sources */ = {isa = PBXBuildFile; fileRef = 17D21EBC0B8BF44000D1EBDE /* AudioPlayer.m */; };
|
||||
17F94DD50B8D0F7000A34E87 /* PluginController.h in Headers */ = {isa = PBXBuildFile; fileRef = 17F94DD30B8D0F7000A34E87 /* PluginController.h */; settings = {ATTRIBUTES = (Public, ); }; };
|
||||
17F94DD60B8D0F7000A34E87 /* PluginController.m in Sources */ = {isa = PBXBuildFile; fileRef = 17F94DD40B8D0F7000A34E87 /* PluginController.m */; };
|
||||
17F94DDD0B8D101100A34E87 /* Plugin.h in Headers */ = {isa = PBXBuildFile; fileRef = 17F94DDC0B8D101100A34E87 /* Plugin.h */; settings = {ATTRIBUTES = (Public, ); }; };
|
||||
8DC2EF570486A6940098B216 /* Cocoa.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 1058C7B1FEA5585E11CA2CBB /* Cocoa.framework */; };
|
||||
/* End PBXBuildFile section */
|
||||
|
||||
/* Begin PBXCopyFilesBuildPhase section */
|
||||
17D21D2B0B8BE6A200D1EBDE /* CopyFiles */ = {
|
||||
isa = PBXCopyFilesBuildPhase;
|
||||
buildActionMask = 2147483647;
|
||||
dstPath = "";
|
||||
dstSubfolderSpec = 10;
|
||||
files = (
|
||||
);
|
||||
runOnlyForDeploymentPostprocessing = 0;
|
||||
};
|
||||
/* End PBXCopyFilesBuildPhase section */
|
||||
|
||||
/* Begin PBXFileReference section */
|
||||
0867D69BFE84028FC02AAC07 /* Foundation.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = Foundation.framework; path = /System/Library/Frameworks/Foundation.framework; sourceTree = "<absolute>"; };
|
||||
0867D6A5FE840307C02AAC07 /* AppKit.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = AppKit.framework; path = /System/Library/Frameworks/AppKit.framework; sourceTree = "<absolute>"; };
|
||||
1058C7B1FEA5585E11CA2CBB /* Cocoa.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = Cocoa.framework; path = /System/Library/Frameworks/Cocoa.framework; sourceTree = "<absolute>"; };
|
||||
17A2D3C30B8D1D37000778C4 /* AudioDecoder.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = AudioDecoder.h; sourceTree = "<group>"; };
|
||||
17A2D3C40B8D1D37000778C4 /* AudioDecoder.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = AudioDecoder.m; sourceTree = "<group>"; };
|
||||
17B6192E0B909BC300BC003F /* AudioPropertiesReader.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; path = AudioPropertiesReader.h; sourceTree = "<group>"; };
|
||||
17B6192F0B909BC300BC003F /* AudioPropertiesReader.m */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.objc; path = AudioPropertiesReader.m; sourceTree = "<group>"; };
|
||||
17C940210B900909008627D6 /* AudioMetadataReader.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = AudioMetadataReader.h; sourceTree = "<group>"; };
|
||||
17C940220B900909008627D6 /* AudioMetadataReader.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = AudioMetadataReader.m; sourceTree = "<group>"; };
|
||||
17D21C760B8BE4BA00D1EBDE /* BufferChain.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; path = BufferChain.h; sourceTree = "<group>"; };
|
||||
17D21C770B8BE4BA00D1EBDE /* BufferChain.m */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.objc; path = BufferChain.m; sourceTree = "<group>"; };
|
||||
17D21C780B8BE4BA00D1EBDE /* ConverterNode.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; path = ConverterNode.h; sourceTree = "<group>"; };
|
||||
17D21C790B8BE4BA00D1EBDE /* ConverterNode.m */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.objc; path = ConverterNode.m; sourceTree = "<group>"; };
|
||||
17D21C7A0B8BE4BA00D1EBDE /* InputNode.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; path = InputNode.h; sourceTree = "<group>"; };
|
||||
17D21C7B0B8BE4BA00D1EBDE /* InputNode.m */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.objc; path = InputNode.m; sourceTree = "<group>"; };
|
||||
17D21C7C0B8BE4BA00D1EBDE /* Node.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; path = Node.h; sourceTree = "<group>"; };
|
||||
17D21C7D0B8BE4BA00D1EBDE /* Node.m */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.objc; path = Node.m; sourceTree = "<group>"; };
|
||||
17D21C7E0B8BE4BA00D1EBDE /* OutputNode.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; path = OutputNode.h; sourceTree = "<group>"; };
|
||||
17D21C7F0B8BE4BA00D1EBDE /* OutputNode.m */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.objc; path = OutputNode.m; sourceTree = "<group>"; };
|
||||
17D21C9C0B8BE4BA00D1EBDE /* OutputCoreAudio.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; path = OutputCoreAudio.h; sourceTree = "<group>"; };
|
||||
17D21C9D0B8BE4BA00D1EBDE /* OutputCoreAudio.m */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.objc; path = OutputCoreAudio.m; sourceTree = "<group>"; };
|
||||
17D21C9E0B8BE4BA00D1EBDE /* Status.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; path = Status.h; sourceTree = "<group>"; };
|
||||
17D21CDA0B8BE5B400D1EBDE /* VirtualRingBuffer.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; path = VirtualRingBuffer.h; sourceTree = "<group>"; };
|
||||
17D21CDB0B8BE5B400D1EBDE /* VirtualRingBuffer.m */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.objc; path = VirtualRingBuffer.m; sourceTree = "<group>"; };
|
||||
17D21CDD0B8BE5B400D1EBDE /* DBLog.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; path = DBLog.h; sourceTree = "<group>"; };
|
||||
17D21CDE0B8BE5B400D1EBDE /* DBLog.m */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.objc; path = DBLog.m; sourceTree = "<group>"; };
|
||||
17D21CF10B8BE5EF00D1EBDE /* Semaphore.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; path = Semaphore.h; sourceTree = "<group>"; };
|
||||
17D21CF20B8BE5EF00D1EBDE /* Semaphore.m */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.objc; path = Semaphore.m; sourceTree = "<group>"; };
|
||||
17D21DA90B8BE76800D1EBDE /* AudioToolbox.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = AudioToolbox.framework; path = /System/Library/Frameworks/AudioToolbox.framework; sourceTree = "<absolute>"; };
|
||||
17D21DAA0B8BE76800D1EBDE /* AudioUnit.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = AudioUnit.framework; path = /System/Library/Frameworks/AudioUnit.framework; sourceTree = "<absolute>"; };
|
||||
17D21DAB0B8BE76800D1EBDE /* CoreAudio.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = CoreAudio.framework; path = /System/Library/Frameworks/CoreAudio.framework; sourceTree = "<absolute>"; };
|
||||
17D21DAC0B8BE76800D1EBDE /* CoreAudioKit.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = CoreAudioKit.framework; path = /System/Library/Frameworks/CoreAudioKit.framework; sourceTree = "<absolute>"; };
|
||||
17D21DC50B8BE79700D1EBDE /* CoreAudioUtils.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; path = CoreAudioUtils.h; sourceTree = "<group>"; };
|
||||
17D21DC60B8BE79700D1EBDE /* CoreAudioUtils.m */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.objc; path = CoreAudioUtils.m; sourceTree = "<group>"; };
|
||||
17D21EBB0B8BF44000D1EBDE /* AudioPlayer.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; path = AudioPlayer.h; sourceTree = "<group>"; };
|
||||
17D21EBC0B8BF44000D1EBDE /* AudioPlayer.m */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.objc; path = AudioPlayer.m; sourceTree = "<group>"; };
|
||||
17F94DD30B8D0F7000A34E87 /* PluginController.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; path = PluginController.h; sourceTree = "<group>"; };
|
||||
17F94DD40B8D0F7000A34E87 /* PluginController.m */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.objc; path = PluginController.m; sourceTree = "<group>"; };
|
||||
17F94DDC0B8D101100A34E87 /* Plugin.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; path = Plugin.h; sourceTree = "<group>"; };
|
||||
32DBCF5E0370ADEE00C91783 /* CogAudio_Prefix.pch */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = CogAudio_Prefix.pch; sourceTree = "<group>"; };
|
||||
8DC2EF5A0486A6940098B216 /* Info.plist */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.plist; path = Info.plist; sourceTree = "<group>"; };
|
||||
8DC2EF5B0486A6940098B216 /* CogAudio.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; path = CogAudio.framework; sourceTree = BUILT_PRODUCTS_DIR; };
|
||||
D2F7E79907B2D74100F64583 /* CoreData.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = CoreData.framework; path = /System/Library/Frameworks/CoreData.framework; sourceTree = "<absolute>"; };
|
||||
/* End PBXFileReference section */
|
||||
|
||||
/* Begin PBXFrameworksBuildPhase section */
|
||||
8DC2EF560486A6940098B216 /* Frameworks */ = {
|
||||
isa = PBXFrameworksBuildPhase;
|
||||
buildActionMask = 2147483647;
|
||||
files = (
|
||||
8DC2EF570486A6940098B216 /* Cocoa.framework in Frameworks */,
|
||||
17D21DAD0B8BE76800D1EBDE /* AudioToolbox.framework in Frameworks */,
|
||||
17D21DAE0B8BE76800D1EBDE /* AudioUnit.framework in Frameworks */,
|
||||
17D21DAF0B8BE76800D1EBDE /* CoreAudio.framework in Frameworks */,
|
||||
17D21DB00B8BE76800D1EBDE /* CoreAudioKit.framework in Frameworks */,
|
||||
);
|
||||
runOnlyForDeploymentPostprocessing = 0;
|
||||
};
|
||||
/* End PBXFrameworksBuildPhase section */
|
||||
|
||||
/* Begin PBXGroup section */
|
||||
034768DFFF38A50411DB9C8B /* Products */ = {
|
||||
isa = PBXGroup;
|
||||
children = (
|
||||
8DC2EF5B0486A6940098B216 /* CogAudio.framework */,
|
||||
);
|
||||
name = Products;
|
||||
sourceTree = "<group>";
|
||||
};
|
||||
0867D691FE84028FC02AAC07 /* CogAudio */ = {
|
||||
isa = PBXGroup;
|
||||
children = (
|
||||
08FB77AEFE84172EC02AAC07 /* Classes */,
|
||||
32C88DFF0371C24200C91783 /* Other Sources */,
|
||||
089C1665FE841158C02AAC07 /* Resources */,
|
||||
0867D69AFE84028FC02AAC07 /* External Frameworks and Libraries */,
|
||||
034768DFFF38A50411DB9C8B /* Products */,
|
||||
);
|
||||
name = CogAudio;
|
||||
sourceTree = "<group>";
|
||||
};
|
||||
0867D69AFE84028FC02AAC07 /* External Frameworks and Libraries */ = {
|
||||
isa = PBXGroup;
|
||||
children = (
|
||||
1058C7B0FEA5585E11CA2CBB /* Linked Frameworks */,
|
||||
1058C7B2FEA5585E11CA2CBB /* Other Frameworks */,
|
||||
);
|
||||
name = "External Frameworks and Libraries";
|
||||
sourceTree = "<group>";
|
||||
};
|
||||
089C1665FE841158C02AAC07 /* Resources */ = {
|
||||
isa = PBXGroup;
|
||||
children = (
|
||||
8DC2EF5A0486A6940098B216 /* Info.plist */,
|
||||
);
|
||||
name = Resources;
|
||||
sourceTree = "<group>";
|
||||
};
|
||||
08FB77AEFE84172EC02AAC07 /* Classes */ = {
|
||||
isa = PBXGroup;
|
||||
children = (
|
||||
17F94DDC0B8D101100A34E87 /* Plugin.h */,
|
||||
17D21EBB0B8BF44000D1EBDE /* AudioPlayer.h */,
|
||||
17D21EBC0B8BF44000D1EBDE /* AudioPlayer.m */,
|
||||
17A2D3C30B8D1D37000778C4 /* AudioDecoder.h */,
|
||||
17A2D3C40B8D1D37000778C4 /* AudioDecoder.m */,
|
||||
17C940210B900909008627D6 /* AudioMetadataReader.h */,
|
||||
17C940220B900909008627D6 /* AudioMetadataReader.m */,
|
||||
17B6192E0B909BC300BC003F /* AudioPropertiesReader.h */,
|
||||
17B6192F0B909BC300BC003F /* AudioPropertiesReader.m */,
|
||||
17F94DD30B8D0F7000A34E87 /* PluginController.h */,
|
||||
17F94DD40B8D0F7000A34E87 /* PluginController.m */,
|
||||
17D21C750B8BE4BA00D1EBDE /* Chain */,
|
||||
17D21C9B0B8BE4BA00D1EBDE /* Output */,
|
||||
17D21C9E0B8BE4BA00D1EBDE /* Status.h */,
|
||||
17D21CD80B8BE5B400D1EBDE /* ThirdParty */,
|
||||
17D21CDC0B8BE5B400D1EBDE /* Utils */,
|
||||
);
|
||||
name = Classes;
|
||||
sourceTree = "<group>";
|
||||
};
|
||||
1058C7B0FEA5585E11CA2CBB /* Linked Frameworks */ = {
|
||||
isa = PBXGroup;
|
||||
children = (
|
||||
1058C7B1FEA5585E11CA2CBB /* Cocoa.framework */,
|
||||
);
|
||||
name = "Linked Frameworks";
|
||||
sourceTree = "<group>";
|
||||
};
|
||||
1058C7B2FEA5585E11CA2CBB /* Other Frameworks */ = {
|
||||
isa = PBXGroup;
|
||||
children = (
|
||||
17D21DA90B8BE76800D1EBDE /* AudioToolbox.framework */,
|
||||
17D21DAA0B8BE76800D1EBDE /* AudioUnit.framework */,
|
||||
17D21DAB0B8BE76800D1EBDE /* CoreAudio.framework */,
|
||||
17D21DAC0B8BE76800D1EBDE /* CoreAudioKit.framework */,
|
||||
0867D6A5FE840307C02AAC07 /* AppKit.framework */,
|
||||
D2F7E79907B2D74100F64583 /* CoreData.framework */,
|
||||
0867D69BFE84028FC02AAC07 /* Foundation.framework */,
|
||||
);
|
||||
name = "Other Frameworks";
|
||||
sourceTree = "<group>";
|
||||
};
|
||||
17D21C750B8BE4BA00D1EBDE /* Chain */ = {
|
||||
isa = PBXGroup;
|
||||
children = (
|
||||
17D21C760B8BE4BA00D1EBDE /* BufferChain.h */,
|
||||
17D21C770B8BE4BA00D1EBDE /* BufferChain.m */,
|
||||
17D21C780B8BE4BA00D1EBDE /* ConverterNode.h */,
|
||||
17D21C790B8BE4BA00D1EBDE /* ConverterNode.m */,
|
||||
17D21C7A0B8BE4BA00D1EBDE /* InputNode.h */,
|
||||
17D21C7B0B8BE4BA00D1EBDE /* InputNode.m */,
|
||||
17D21C7C0B8BE4BA00D1EBDE /* Node.h */,
|
||||
17D21C7D0B8BE4BA00D1EBDE /* Node.m */,
|
||||
17D21C7E0B8BE4BA00D1EBDE /* OutputNode.h */,
|
||||
17D21C7F0B8BE4BA00D1EBDE /* OutputNode.m */,
|
||||
);
|
||||
path = Chain;
|
||||
sourceTree = "<group>";
|
||||
};
|
||||
17D21C9B0B8BE4BA00D1EBDE /* Output */ = {
|
||||
isa = PBXGroup;
|
||||
children = (
|
||||
17D21C9C0B8BE4BA00D1EBDE /* OutputCoreAudio.h */,
|
||||
17D21C9D0B8BE4BA00D1EBDE /* OutputCoreAudio.m */,
|
||||
);
|
||||
path = Output;
|
||||
sourceTree = "<group>";
|
||||
};
|
||||
17D21CD80B8BE5B400D1EBDE /* ThirdParty */ = {
|
||||
isa = PBXGroup;
|
||||
children = (
|
||||
17D21DC40B8BE79700D1EBDE /* CoreAudioUtils */,
|
||||
17D21CD90B8BE5B400D1EBDE /* VirtualRingBuffer */,
|
||||
);
|
||||
path = ThirdParty;
|
||||
sourceTree = "<group>";
|
||||
};
|
||||
17D21CD90B8BE5B400D1EBDE /* VirtualRingBuffer */ = {
|
||||
isa = PBXGroup;
|
||||
children = (
|
||||
17D21CDA0B8BE5B400D1EBDE /* VirtualRingBuffer.h */,
|
||||
17D21CDB0B8BE5B400D1EBDE /* VirtualRingBuffer.m */,
|
||||
);
|
||||
path = VirtualRingBuffer;
|
||||
sourceTree = "<group>";
|
||||
};
|
||||
17D21CDC0B8BE5B400D1EBDE /* Utils */ = {
|
||||
isa = PBXGroup;
|
||||
children = (
|
||||
17D21CDD0B8BE5B400D1EBDE /* DBLog.h */,
|
||||
17D21CDE0B8BE5B400D1EBDE /* DBLog.m */,
|
||||
17D21CF10B8BE5EF00D1EBDE /* Semaphore.h */,
|
||||
17D21CF20B8BE5EF00D1EBDE /* Semaphore.m */,
|
||||
);
|
||||
path = Utils;
|
||||
sourceTree = "<group>";
|
||||
};
|
||||
17D21DC40B8BE79700D1EBDE /* CoreAudioUtils */ = {
|
||||
isa = PBXGroup;
|
||||
children = (
|
||||
17D21DC50B8BE79700D1EBDE /* CoreAudioUtils.h */,
|
||||
17D21DC60B8BE79700D1EBDE /* CoreAudioUtils.m */,
|
||||
);
|
||||
path = CoreAudioUtils;
|
||||
sourceTree = "<group>";
|
||||
};
|
||||
32C88DFF0371C24200C91783 /* Other Sources */ = {
|
||||
isa = PBXGroup;
|
||||
children = (
|
||||
32DBCF5E0370ADEE00C91783 /* CogAudio_Prefix.pch */,
|
||||
);
|
||||
name = "Other Sources";
|
||||
sourceTree = "<group>";
|
||||
};
|
||||
/* End PBXGroup section */
|
||||
|
||||
/* Begin PBXHeadersBuildPhase section */
|
||||
8DC2EF500486A6940098B216 /* Headers */ = {
|
||||
isa = PBXHeadersBuildPhase;
|
||||
buildActionMask = 2147483647;
|
||||
files = (
|
||||
17D21CA10B8BE4BA00D1EBDE /* BufferChain.h in Headers */,
|
||||
17D21CA30B8BE4BA00D1EBDE /* ConverterNode.h in Headers */,
|
||||
17D21CA50B8BE4BA00D1EBDE /* InputNode.h in Headers */,
|
||||
17D21CA70B8BE4BA00D1EBDE /* Node.h in Headers */,
|
||||
17D21CA90B8BE4BA00D1EBDE /* OutputNode.h in Headers */,
|
||||
17D21CC50B8BE4BA00D1EBDE /* OutputCoreAudio.h in Headers */,
|
||||
17D21CC70B8BE4BA00D1EBDE /* Status.h in Headers */,
|
||||
17D21CDF0B8BE5B400D1EBDE /* VirtualRingBuffer.h in Headers */,
|
||||
17D21CE10B8BE5B400D1EBDE /* DBLog.h in Headers */,
|
||||
17D21CF30B8BE5EF00D1EBDE /* Semaphore.h in Headers */,
|
||||
17D21DC70B8BE79700D1EBDE /* CoreAudioUtils.h in Headers */,
|
||||
17D21EBD0B8BF44000D1EBDE /* AudioPlayer.h in Headers */,
|
||||
17F94DD50B8D0F7000A34E87 /* PluginController.h in Headers */,
|
||||
17F94DDD0B8D101100A34E87 /* Plugin.h in Headers */,
|
||||
17A2D3C50B8D1D37000778C4 /* AudioDecoder.h in Headers */,
|
||||
17C940230B900909008627D6 /* AudioMetadataReader.h in Headers */,
|
||||
17B619300B909BC300BC003F /* AudioPropertiesReader.h in Headers */,
|
||||
);
|
||||
runOnlyForDeploymentPostprocessing = 0;
|
||||
};
|
||||
/* End PBXHeadersBuildPhase section */
|
||||
|
||||
/* Begin PBXNativeTarget section */
|
||||
8DC2EF4F0486A6940098B216 /* CogAudio */ = {
|
||||
isa = PBXNativeTarget;
|
||||
buildConfigurationList = 1DEB91AD08733DA50010E9CD /* Build configuration list for PBXNativeTarget "CogAudio" */;
|
||||
buildPhases = (
|
||||
17D21D2B0B8BE6A200D1EBDE /* CopyFiles */,
|
||||
8DC2EF500486A6940098B216 /* Headers */,
|
||||
8DC2EF540486A6940098B216 /* Sources */,
|
||||
8DC2EF560486A6940098B216 /* Frameworks */,
|
||||
8DC2EF520486A6940098B216 /* Resources */,
|
||||
);
|
||||
buildRules = (
|
||||
);
|
||||
dependencies = (
|
||||
);
|
||||
name = CogAudio;
|
||||
productInstallPath = "$(HOME)/Library/Frameworks";
|
||||
productName = CogAudio;
|
||||
productReference = 8DC2EF5B0486A6940098B216 /* CogAudio.framework */;
|
||||
productType = "com.apple.product-type.framework";
|
||||
};
|
||||
/* End PBXNativeTarget section */
|
||||
|
||||
/* Begin PBXProject section */
|
||||
0867D690FE84028FC02AAC07 /* Project object */ = {
|
||||
isa = PBXProject;
|
||||
buildConfigurationList = 1DEB91B108733DA50010E9CD /* Build configuration list for PBXProject "CogAudio" */;
|
||||
hasScannedForEncodings = 1;
|
||||
mainGroup = 0867D691FE84028FC02AAC07 /* CogAudio */;
|
||||
productRefGroup = 034768DFFF38A50411DB9C8B /* Products */;
|
||||
projectDirPath = "";
|
||||
targets = (
|
||||
8DC2EF4F0486A6940098B216 /* CogAudio */,
|
||||
);
|
||||
};
|
||||
/* End PBXProject section */
|
||||
|
||||
/* Begin PBXResourcesBuildPhase section */
|
||||
8DC2EF520486A6940098B216 /* Resources */ = {
|
||||
isa = PBXResourcesBuildPhase;
|
||||
buildActionMask = 2147483647;
|
||||
files = (
|
||||
);
|
||||
runOnlyForDeploymentPostprocessing = 0;
|
||||
};
|
||||
/* End PBXResourcesBuildPhase section */
|
||||
|
||||
/* Begin PBXSourcesBuildPhase section */
|
||||
8DC2EF540486A6940098B216 /* Sources */ = {
|
||||
isa = PBXSourcesBuildPhase;
|
||||
buildActionMask = 2147483647;
|
||||
files = (
|
||||
17D21CA20B8BE4BA00D1EBDE /* BufferChain.m in Sources */,
|
||||
17D21CA40B8BE4BA00D1EBDE /* ConverterNode.m in Sources */,
|
||||
17D21CA60B8BE4BA00D1EBDE /* InputNode.m in Sources */,
|
||||
17D21CA80B8BE4BA00D1EBDE /* Node.m in Sources */,
|
||||
17D21CAA0B8BE4BA00D1EBDE /* OutputNode.m in Sources */,
|
||||
17D21CC60B8BE4BA00D1EBDE /* OutputCoreAudio.m in Sources */,
|
||||
17D21CE00B8BE5B400D1EBDE /* VirtualRingBuffer.m in Sources */,
|
||||
17D21CE20B8BE5B400D1EBDE /* DBLog.m in Sources */,
|
||||
17D21CF40B8BE5EF00D1EBDE /* Semaphore.m in Sources */,
|
||||
17D21DC80B8BE79700D1EBDE /* CoreAudioUtils.m in Sources */,
|
||||
17D21EBE0B8BF44000D1EBDE /* AudioPlayer.m in Sources */,
|
||||
17F94DD60B8D0F7000A34E87 /* PluginController.m in Sources */,
|
||||
17A2D3C60B8D1D37000778C4 /* AudioDecoder.m in Sources */,
|
||||
17C940240B900909008627D6 /* AudioMetadataReader.m in Sources */,
|
||||
17B619310B909BC300BC003F /* AudioPropertiesReader.m in Sources */,
|
||||
);
|
||||
runOnlyForDeploymentPostprocessing = 0;
|
||||
};
|
||||
/* End PBXSourcesBuildPhase section */
|
||||
|
||||
/* Begin XCBuildConfiguration section */
|
||||
1DEB91AE08733DA50010E9CD /* Debug */ = {
|
||||
isa = XCBuildConfiguration;
|
||||
buildSettings = {
|
||||
COPY_PHASE_STRIP = NO;
|
||||
DYLIB_COMPATIBILITY_VERSION = 1;
|
||||
DYLIB_CURRENT_VERSION = 1;
|
||||
FRAMEWORK_SEARCH_PATHS = (
|
||||
"$(inherited)",
|
||||
"$(FRAMEWORK_SEARCH_PATHS_QUOTED_1)",
|
||||
"$(FRAMEWORK_SEARCH_PATHS_QUOTED_2)",
|
||||
"$(FRAMEWORK_SEARCH_PATHS_QUOTED_3)",
|
||||
"$(FRAMEWORK_SEARCH_PATHS_QUOTED_4)",
|
||||
"$(FRAMEWORK_SEARCH_PATHS_QUOTED_5)",
|
||||
"$(FRAMEWORK_SEARCH_PATHS_QUOTED_6)",
|
||||
"$(FRAMEWORK_SEARCH_PATHS_QUOTED_7)",
|
||||
"$(FRAMEWORK_SEARCH_PATHS_QUOTED_8)",
|
||||
"$(FRAMEWORK_SEARCH_PATHS_QUOTED_9)",
|
||||
"$(FRAMEWORK_SEARCH_PATHS_QUOTED_10)",
|
||||
);
|
||||
FRAMEWORK_SEARCH_PATHS_QUOTED_1 = "\"$(SRCROOT)/../FLAC/build/Release\"";
|
||||
FRAMEWORK_SEARCH_PATHS_QUOTED_10 = "\"$(SRCROOT)/../WavPack/build/Release\"";
|
||||
FRAMEWORK_SEARCH_PATHS_QUOTED_2 = "\"$(SRCROOT)/../ID3Tag/build/Release\"";
|
||||
FRAMEWORK_SEARCH_PATHS_QUOTED_3 = "\"$(SRCROOT)/../MAC/build/Release\"";
|
||||
FRAMEWORK_SEARCH_PATHS_QUOTED_4 = "\"$(SRCROOT)/../MAD/build/Release\"";
|
||||
FRAMEWORK_SEARCH_PATHS_QUOTED_5 = "\"$(SRCROOT)/../MPCDec/build/Release\"";
|
||||
FRAMEWORK_SEARCH_PATHS_QUOTED_6 = "\"$(SRCROOT)/../Ogg/build/Release\"";
|
||||
FRAMEWORK_SEARCH_PATHS_QUOTED_7 = "\"$(SRCROOT)/../Shorten/build/Release\"";
|
||||
FRAMEWORK_SEARCH_PATHS_QUOTED_8 = "\"$(SRCROOT)/../TagLib/build/Release\"";
|
||||
FRAMEWORK_SEARCH_PATHS_QUOTED_9 = "\"$(SRCROOT)/../Vorbis/build/Release\"";
|
||||
FRAMEWORK_VERSION = A;
|
||||
GCC_DYNAMIC_NO_PIC = NO;
|
||||
GCC_ENABLE_FIX_AND_CONTINUE = YES;
|
||||
GCC_MODEL_TUNING = G5;
|
||||
GCC_OPTIMIZATION_LEVEL = 0;
|
||||
GCC_PRECOMPILE_PREFIX_HEADER = YES;
|
||||
GCC_PREFIX_HEADER = CogAudio_Prefix.pch;
|
||||
INFOPLIST_FILE = Info.plist;
|
||||
INSTALL_PATH = "@executable_path/../Frameworks";
|
||||
OTHER_LDFLAGS = "";
|
||||
PRODUCT_NAME = CogAudio;
|
||||
WARNING_LDFLAGS = "";
|
||||
WRAPPER_EXTENSION = framework;
|
||||
ZERO_LINK = YES;
|
||||
};
|
||||
name = Debug;
|
||||
};
|
||||
1DEB91AF08733DA50010E9CD /* Release */ = {
|
||||
isa = XCBuildConfiguration;
|
||||
buildSettings = {
|
||||
ARCHS = (
|
||||
ppc,
|
||||
i386,
|
||||
);
|
||||
DYLIB_COMPATIBILITY_VERSION = 1;
|
||||
DYLIB_CURRENT_VERSION = 1;
|
||||
FRAMEWORK_SEARCH_PATHS = (
|
||||
"$(inherited)",
|
||||
"$(FRAMEWORK_SEARCH_PATHS_QUOTED_1)",
|
||||
"$(FRAMEWORK_SEARCH_PATHS_QUOTED_2)",
|
||||
"$(FRAMEWORK_SEARCH_PATHS_QUOTED_3)",
|
||||
"$(FRAMEWORK_SEARCH_PATHS_QUOTED_4)",
|
||||
"$(FRAMEWORK_SEARCH_PATHS_QUOTED_5)",
|
||||
"$(FRAMEWORK_SEARCH_PATHS_QUOTED_6)",
|
||||
"$(FRAMEWORK_SEARCH_PATHS_QUOTED_7)",
|
||||
"$(FRAMEWORK_SEARCH_PATHS_QUOTED_8)",
|
||||
"$(FRAMEWORK_SEARCH_PATHS_QUOTED_9)",
|
||||
"$(FRAMEWORK_SEARCH_PATHS_QUOTED_10)",
|
||||
);
|
||||
FRAMEWORK_SEARCH_PATHS_QUOTED_1 = "\"$(SRCROOT)/../FLAC/build/Release\"";
|
||||
FRAMEWORK_SEARCH_PATHS_QUOTED_10 = "\"$(SRCROOT)/../WavPack/build/Release\"";
|
||||
FRAMEWORK_SEARCH_PATHS_QUOTED_2 = "\"$(SRCROOT)/../ID3Tag/build/Release\"";
|
||||
FRAMEWORK_SEARCH_PATHS_QUOTED_3 = "\"$(SRCROOT)/../MAC/build/Release\"";
|
||||
FRAMEWORK_SEARCH_PATHS_QUOTED_4 = "\"$(SRCROOT)/../MAD/build/Release\"";
|
||||
FRAMEWORK_SEARCH_PATHS_QUOTED_5 = "\"$(SRCROOT)/../MPCDec/build/Release\"";
|
||||
FRAMEWORK_SEARCH_PATHS_QUOTED_6 = "\"$(SRCROOT)/../Ogg/build/Release\"";
|
||||
FRAMEWORK_SEARCH_PATHS_QUOTED_7 = "\"$(SRCROOT)/../Shorten/build/Release\"";
|
||||
FRAMEWORK_SEARCH_PATHS_QUOTED_8 = "\"$(SRCROOT)/../TagLib/build/Release\"";
|
||||
FRAMEWORK_SEARCH_PATHS_QUOTED_9 = "\"$(SRCROOT)/../Vorbis/build/Release\"";
|
||||
FRAMEWORK_VERSION = A;
|
||||
GCC_GENERATE_DEBUGGING_SYMBOLS = NO;
|
||||
GCC_MODEL_TUNING = G5;
|
||||
GCC_PRECOMPILE_PREFIX_HEADER = YES;
|
||||
GCC_PREFIX_HEADER = CogAudio_Prefix.pch;
|
||||
INFOPLIST_FILE = Info.plist;
|
||||
INSTALL_PATH = "@executable_path/../Frameworks";
|
||||
OTHER_LDFLAGS = "";
|
||||
PRODUCT_NAME = CogAudio;
|
||||
WARNING_LDFLAGS = "";
|
||||
WRAPPER_EXTENSION = framework;
|
||||
};
|
||||
name = Release;
|
||||
};
|
||||
1DEB91B208733DA50010E9CD /* Debug */ = {
|
||||
isa = XCBuildConfiguration;
|
||||
buildSettings = {
|
||||
GCC_WARN_ABOUT_RETURN_TYPE = YES;
|
||||
GCC_WARN_UNUSED_VARIABLE = YES;
|
||||
PREBINDING = NO;
|
||||
SDKROOT = /Developer/SDKs/MacOSX10.4u.sdk;
|
||||
};
|
||||
name = Debug;
|
||||
};
|
||||
1DEB91B308733DA50010E9CD /* Release */ = {
|
||||
isa = XCBuildConfiguration;
|
||||
buildSettings = {
|
||||
ARCHS = (
|
||||
ppc,
|
||||
i386,
|
||||
);
|
||||
GCC_WARN_ABOUT_RETURN_TYPE = YES;
|
||||
GCC_WARN_UNUSED_VARIABLE = YES;
|
||||
PREBINDING = NO;
|
||||
SDKROOT = /Developer/SDKs/MacOSX10.4u.sdk;
|
||||
};
|
||||
name = Release;
|
||||
};
|
||||
/* End XCBuildConfiguration section */
|
||||
|
||||
/* Begin XCConfigurationList section */
|
||||
1DEB91AD08733DA50010E9CD /* Build configuration list for PBXNativeTarget "CogAudio" */ = {
|
||||
isa = XCConfigurationList;
|
||||
buildConfigurations = (
|
||||
1DEB91AE08733DA50010E9CD /* Debug */,
|
||||
1DEB91AF08733DA50010E9CD /* Release */,
|
||||
);
|
||||
defaultConfigurationIsVisible = 0;
|
||||
defaultConfigurationName = Release;
|
||||
};
|
||||
1DEB91B108733DA50010E9CD /* Build configuration list for PBXProject "CogAudio" */ = {
|
||||
isa = XCConfigurationList;
|
||||
buildConfigurations = (
|
||||
1DEB91B208733DA50010E9CD /* Debug */,
|
||||
1DEB91B308733DA50010E9CD /* Release */,
|
||||
);
|
||||
defaultConfigurationIsVisible = 0;
|
||||
defaultConfigurationName = Release;
|
||||
};
|
||||
/* End XCConfigurationList section */
|
||||
};
|
||||
rootObject = 0867D690FE84028FC02AAC07 /* Project object */;
|
||||
}
|
|
@ -0,0 +1,7 @@
|
|||
//
|
||||
// Prefix header for all source files of the 'CogAudio' target in the 'CogAudio' project.
|
||||
//
|
||||
|
||||
#ifdef __OBJC__
|
||||
#import <Cocoa/Cocoa.h>
|
||||
#endif
|
|
@ -8,9 +8,17 @@
|
|||
|
||||
#import <Cocoa/Cocoa.h>
|
||||
#import "SoundFile.h"
|
||||
|
||||
//config.h things
|
||||
#define __MACOSX__
|
||||
#define HAVE_CONFIG_H
|
||||
|
||||
#import <Vorbis/vorbisfile.h>
|
||||
#import <Vorbis/codec.h>
|
||||
|
||||
#undef __MACOSX__
|
||||
#undef HAVE_CONFIG_H
|
||||
|
||||
@interface VorbisFile : SoundFile {
|
||||
FILE *inFd;
|
||||
OggVorbis_File vorbisRef;
|
|
@ -12,15 +12,17 @@
|
|||
#import <AudioToolbox/AudioToolbox.h>
|
||||
#import <AudioUnit/AudioUnit.h>
|
||||
|
||||
@class OutputNode;
|
||||
|
||||
@interface OutputCoreAudio : NSObject {
|
||||
id outputController;
|
||||
OutputNode * outputController;
|
||||
|
||||
AudioUnit outputUnit;
|
||||
AURenderCallbackStruct renderCallback;
|
||||
AURenderCallbackStruct renderCallback;
|
||||
AudioStreamBasicDescription deviceFormat; // info about the default device
|
||||
}
|
||||
|
||||
- (id)initWithController:(id)c;
|
||||
- (id)initWithController:(OutputNode *)c;
|
||||
|
||||
- (BOOL)setup;
|
||||
- (BOOL)setOutputDevice:(AudioDeviceID)outputDevice;
|
|
@ -7,11 +7,11 @@
|
|||
//
|
||||
|
||||
#import "OutputCoreAudio.h"
|
||||
|
||||
#import "OutputNode.h"
|
||||
|
||||
@implementation OutputCoreAudio
|
||||
|
||||
- (id)initWithController:(id)c
|
||||
- (id)initWithController:(OutputNode *)c
|
||||
{
|
||||
self = [super init];
|
||||
if (self)
|
||||
|
@ -247,6 +247,8 @@ static OSStatus Sound_Renderer(void *inRefCon, AudioUnitRenderActionFlags *ioAc
|
|||
- (void)dealloc
|
||||
{
|
||||
[self stop];
|
||||
|
||||
[super dealloc];
|
||||
}
|
||||
|
||||
- (void)pause
|
|
@ -0,0 +1,34 @@
|
|||
typedef enum
|
||||
{
|
||||
kCogPluginCodec = 1,
|
||||
} PluginType;
|
||||
|
||||
@protocol CogPlugin
|
||||
- (PluginType)pluginType;
|
||||
@end
|
||||
|
||||
@protocol CogCodecPlugin
|
||||
- (Class)decoder;
|
||||
- (Class)metadataReader;
|
||||
- (Class)propertiesReader;
|
||||
@end
|
||||
|
||||
@protocol CogDecoder
|
||||
+ (NSArray *)fileTypes;
|
||||
|
||||
- (BOOL)open:(NSURL *)url;
|
||||
- (NSDictionary *)properties;
|
||||
- (double)seekToTime:(double)time;
|
||||
- (int)fillBuffer:(void *)buf ofSize:(UInt32)size;
|
||||
- (void)close;
|
||||
@end
|
||||
|
||||
@protocol CogMetadataReader
|
||||
+ (NSArray *)fileTypes;
|
||||
@end
|
||||
|
||||
@protocol CogPropertiesReader
|
||||
+ (NSArray *)fileTypes;
|
||||
@end
|
||||
|
||||
|
|
@ -0,0 +1,28 @@
|
|||
/* PluginController */
|
||||
|
||||
#import <Cocoa/Cocoa.h>
|
||||
|
||||
//Singleton
|
||||
@interface PluginController : NSObject
|
||||
{
|
||||
NSMutableArray *codecPlugins;
|
||||
|
||||
NSMutableDictionary *decoders;
|
||||
NSMutableDictionary *metadataReaders;
|
||||
NSMutableDictionary *propertiesReaders;
|
||||
}
|
||||
|
||||
+ (PluginController *)sharedPluginController; //Use this to get the instance.
|
||||
|
||||
- (void)setup;
|
||||
|
||||
- (void)loadPlugins;
|
||||
- (void)setupPlugins;
|
||||
|
||||
- (void)printPluginInfo;
|
||||
|
||||
- (NSDictionary *)decoders;
|
||||
- (NSDictionary *)metadataReaders;
|
||||
- (NSDictionary *)propertiesReaders;
|
||||
|
||||
@end
|
|
@ -0,0 +1,206 @@
|
|||
#import "PluginController.h"
|
||||
#import "Plugin.h"
|
||||
|
||||
@implementation PluginController
|
||||
|
||||
//Start of singleton-related stuff.
|
||||
static PluginController *sharedPluginController = nil;
|
||||
|
||||
+ (PluginController*)sharedPluginController
|
||||
{
|
||||
@synchronized(self) {
|
||||
if (sharedPluginController == nil) {
|
||||
[[self alloc] init]; // assignment not done here
|
||||
}
|
||||
}
|
||||
return sharedPluginController;
|
||||
}
|
||||
|
||||
+ (id)allocWithZone:(NSZone *)zone
|
||||
{
|
||||
@synchronized(self) {
|
||||
if (sharedPluginController == nil) {
|
||||
sharedPluginController = [super allocWithZone:zone];
|
||||
return sharedPluginController; // assignment and return on first allocation
|
||||
}
|
||||
}
|
||||
|
||||
return nil; //on subsequent allocation attempts return nil
|
||||
}
|
||||
|
||||
- (id)copyWithZone:(NSZone *)zone
|
||||
{
|
||||
return self;
|
||||
}
|
||||
|
||||
- (id)retain
|
||||
{
|
||||
return self;
|
||||
}
|
||||
|
||||
- (unsigned)retainCount
|
||||
{
|
||||
return UINT_MAX; //denotes an object that cannot be released
|
||||
}
|
||||
|
||||
- (void)release
|
||||
{
|
||||
//do nothing
|
||||
}
|
||||
|
||||
- (id)autorelease
|
||||
{
|
||||
return self;
|
||||
}
|
||||
|
||||
//End of singleton-related stuff
|
||||
|
||||
- (id)init {
|
||||
self = [super init];
|
||||
if (self) {
|
||||
codecPlugins = [[NSMutableArray alloc] init];
|
||||
|
||||
decoders = [[NSMutableDictionary alloc] init];
|
||||
metadataReaders = [[NSMutableDictionary alloc] init];
|
||||
propertiesReaders = [[NSMutableDictionary alloc] init];
|
||||
}
|
||||
|
||||
return self;
|
||||
}
|
||||
|
||||
- (void)setup
|
||||
{
|
||||
NSAutoreleasePool *pool = [[NSAutoreleasePool alloc] init];
|
||||
|
||||
[self loadPlugins];
|
||||
[self setupPlugins];
|
||||
[self printPluginInfo];
|
||||
|
||||
[pool release];
|
||||
}
|
||||
|
||||
- (void)loadPluginsAtPath:(NSString *)path
|
||||
{
|
||||
|
||||
NSArray *dirContents = [[NSFileManager defaultManager] directoryContentsAtPath:path];
|
||||
NSEnumerator *dirEnum = [dirContents objectEnumerator];
|
||||
|
||||
NSString *pname;
|
||||
|
||||
NSLog(@"Loading plugins at %@, candidates: %@", path, dirContents);
|
||||
while (pname = [dirEnum nextObject])
|
||||
{
|
||||
NSString *ppath;
|
||||
ppath = [NSString pathWithComponents:[NSArray arrayWithObjects:path,pname,nil]];
|
||||
|
||||
if ([[pname pathExtension] isEqualToString:@"bundle"])
|
||||
{
|
||||
NSBundle *b = [NSBundle bundleWithPath:ppath];
|
||||
if (b)
|
||||
{
|
||||
NSLog(@"Loaded bundle: %@", b);
|
||||
id plugin = [[[b principalClass] alloc] init];
|
||||
NSLog(@"Candidate: %@", plugin);
|
||||
if ([plugin respondsToSelector:@selector(pluginType)])
|
||||
{
|
||||
NSLog(@"Responds to selector");
|
||||
switch([plugin pluginType])
|
||||
{
|
||||
case kCogPluginCodec: //Only type currently
|
||||
NSLog(@"Its a codec");
|
||||
[codecPlugins addObject:plugin];
|
||||
break;
|
||||
default:
|
||||
NSLog(@"Unknown plugin type");
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
- (void)loadPlugins
|
||||
{
|
||||
[self loadPluginsAtPath:[[NSBundle mainBundle] builtInPlugInsPath]];
|
||||
[self loadPluginsAtPath:[@"~/Library/Application Support/Cog/Plugins" stringByExpandingTildeInPath]];
|
||||
}
|
||||
|
||||
- (void)setupInputPlugins
|
||||
{
|
||||
NSEnumerator *pluginsEnum = [codecPlugins objectEnumerator];
|
||||
id plugin;
|
||||
while (plugin = [pluginsEnum nextObject])
|
||||
{
|
||||
Class decoder = [plugin decoder];
|
||||
Class metadataReader = [plugin metadataReader];
|
||||
Class propertiesReader = [plugin propertiesReader];
|
||||
|
||||
if (decoder) {
|
||||
NSEnumerator *fileTypesEnum = [[decoder fileTypes] objectEnumerator];
|
||||
id fileType;
|
||||
NSString *classString = NSStringFromClass(decoder);
|
||||
while (fileType = [fileTypesEnum nextObject])
|
||||
{
|
||||
[decoders setObject:classString forKey:fileType];
|
||||
}
|
||||
}
|
||||
|
||||
if (metadataReader) {
|
||||
NSEnumerator *fileTypesEnum = [[metadataReader fileTypes] objectEnumerator];
|
||||
id fileType;
|
||||
NSString *classString = NSStringFromClass(metadataReader);
|
||||
while (fileType = [fileTypesEnum nextObject])
|
||||
{
|
||||
[metadataReaders setObject:classString forKey:fileType];
|
||||
}
|
||||
}
|
||||
|
||||
if (propertiesReader) {
|
||||
NSEnumerator *fileTypesEnum = [[propertiesReader fileTypes] objectEnumerator];
|
||||
id fileType;
|
||||
NSString *classString = NSStringFromClass(propertiesReader);
|
||||
while (fileType = [fileTypesEnum nextObject])
|
||||
{
|
||||
[propertiesReaders setObject:classString forKey:fileType];
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
- (void)setupPlugins {
|
||||
[self setupInputPlugins];
|
||||
}
|
||||
|
||||
- (void)printPluginInfo
|
||||
{
|
||||
NSLog(@"Codecs: %@\n\n", codecPlugins);
|
||||
}
|
||||
|
||||
- (NSDictionary *)decoders
|
||||
{
|
||||
return decoders;
|
||||
}
|
||||
|
||||
- (NSDictionary *)metadataReaders
|
||||
{
|
||||
return metadataReaders;
|
||||
}
|
||||
|
||||
- (NSDictionary *)propertiesReaders
|
||||
{
|
||||
return propertiesReaders;
|
||||
}
|
||||
|
||||
@end
|
||||
|
||||
//This is called when the framework is loaded.
|
||||
void __attribute__ ((constructor)) InitializePlugins(void) {
|
||||
static BOOL wasInitialized = NO;
|
||||
if (!wasInitialized) {
|
||||
// safety in case we get called twice.
|
||||
[[PluginController sharedPluginController] setup];
|
||||
|
||||
wasInitialized = YES;
|
||||
}
|
||||
}
|
|
@ -0,0 +1,30 @@
|
|||
/*
|
||||
* $Id$
|
||||
*
|
||||
* Copyright (C) 2006 Stephen F. Booth <me@sbooth.org>
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation; either version 2 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
*/
|
||||
|
||||
#import <Cocoa/Cocoa.h>
|
||||
#import <AudioToolbox/AudioToolbox.h>
|
||||
|
||||
// Return an array of valid audio file extensions recognized by Core Audio
|
||||
NSArray * getCoreAudioExtensions();
|
||||
|
||||
AudioStreamBasicDescription propertiesToASBD(NSDictionary *properties);
|
||||
NSDictionary *ASBDToProperties(AudioStreamBasicDescription asbd);
|
||||
|
||||
BOOL hostIsBigEndian();
|
|
@ -0,0 +1,90 @@
|
|||
/*
|
||||
* $Id$
|
||||
*
|
||||
* Copyright (C) 2006 Stephen F. Booth <me@sbooth.org>
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation; either version 2 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
*/
|
||||
|
||||
#include "CoreAudioUtils.h"
|
||||
|
||||
#include <AudioToolbox/AudioFile.h>
|
||||
|
||||
// CoreAudio utility function
|
||||
static NSArray *sAudioExtensions = nil;
|
||||
|
||||
// Return an array of valid audio file extensions recognized by Core Audio
|
||||
NSArray *
|
||||
getCoreAudioExtensions()
|
||||
{
|
||||
OSStatus err;
|
||||
UInt32 size;
|
||||
|
||||
@synchronized(sAudioExtensions) {
|
||||
if(nil == sAudioExtensions) {
|
||||
size = sizeof(sAudioExtensions);
|
||||
err = AudioFileGetGlobalInfo(kAudioFileGlobalInfo_AllExtensions, 0, NULL, &size, &sAudioExtensions);
|
||||
if(noErr != err) {
|
||||
return nil;
|
||||
}
|
||||
|
||||
[sAudioExtensions retain];
|
||||
}
|
||||
}
|
||||
|
||||
return sAudioExtensions;
|
||||
}
|
||||
|
||||
|
||||
BOOL hostIsBigEndian()
|
||||
{
|
||||
#ifdef __BIG_ENDIAN__
|
||||
return YES;
|
||||
#else
|
||||
return NO;
|
||||
#endif
|
||||
}
|
||||
|
||||
AudioStreamBasicDescription propertiesToASBD(NSDictionary *properties)
|
||||
{
|
||||
AudioStreamBasicDescription asbd;
|
||||
asbd.mFormatID = kAudioFormatLinearPCM;
|
||||
asbd.mFormatFlags = 0;
|
||||
|
||||
asbd.mSampleRate = [[properties objectForKey:@"sampleRate"] doubleValue];
|
||||
|
||||
asbd.mBitsPerChannel = [[properties objectForKey:@"bitsPerSample"] intValue];
|
||||
|
||||
asbd.mChannelsPerFrame = [[properties objectForKey:@"channels"] intValue];;
|
||||
asbd.mBytesPerFrame = (asbd.mBitsPerChannel/8)*asbd.mChannelsPerFrame;
|
||||
|
||||
asbd.mFramesPerPacket = 1;
|
||||
asbd.mBytesPerPacket = asbd.mBytesPerFrame;
|
||||
asbd.mReserved = 0;
|
||||
|
||||
if ([[properties objectForKey:@"endian"] isEqualToString:@"big"] || ([[properties objectForKey:@"endian"] isEqualToString:@"host"] && hostIsBigEndian() ))
|
||||
{
|
||||
asbd.mFormatFlags |= kLinearPCMFormatFlagIsBigEndian;
|
||||
asbd.mFormatFlags |= kLinearPCMFormatFlagIsAlignedHigh;
|
||||
}
|
||||
|
||||
if ([[properties objectForKey:@"unsigned"] boolValue] == NO) {
|
||||
asbd.mFormatFlags |= kLinearPCMFormatFlagIsSignedInteger;
|
||||
}
|
||||
|
||||
return asbd;
|
||||
}
|
||||
|
||||
|
|
@ -0,0 +1,88 @@
|
|||
//
|
||||
// VirtualRingBuffer.h
|
||||
// PlayBufferedSoundFile
|
||||
//
|
||||
/*
|
||||
Copyright (c) 2002, Kurt Revis. 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 Snoize nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission.
|
||||
|
||||
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
|
||||
//
|
||||
// VirtualRingBuffer implements a classic ring buffer (or circular buffer), with a couple of twists.
|
||||
//
|
||||
// * It allows reads and writes to happen in different threads, with no explicit locking,
|
||||
// so readers and writers will never block. This is useful if either thread uses the
|
||||
// time-constraint scheduling policy, since it is bad for such threads to block for
|
||||
// indefinite amounts of time.
|
||||
//
|
||||
// * It uses a virtual memory trick to allow the client to read or write using just one
|
||||
// operation, even if the data involved wraps around the end of the buffer. We allocate
|
||||
// our buffer normally, and then place a VM region immediately after it in the address
|
||||
// space which maps back to the "real" buffer. So reads and writes into both sections
|
||||
// are transparently translated into the same physical memory.
|
||||
// This makes the API much simpler to use, and saves us from doing some math to
|
||||
// calculate the wraparound points.
|
||||
// The tradeoff is that we use twice as much address space for the buffer than we would
|
||||
// otherwise. Address space is not typically constrained for most applications, though,
|
||||
// so this isn't a big problem.
|
||||
// The idea for this trick came from <http://phil.ipal.org/freeware/vrb/> (via sweetcode.org),
|
||||
// although none of that code is used here. (We use the Mach VM API directly.)
|
||||
//
|
||||
|
||||
// Threading note:
|
||||
// It is expected that this object will be shared between exactly two threads; one will
|
||||
// always read and the other will always write. In that situation, the implementation is
|
||||
// thread-safe, and this object will never block or yield.
|
||||
// It will also work in one thread, of course (although I don't know why you'd bother).
|
||||
// However, if you have multiple reader or writer threads, all bets are off!
|
||||
|
||||
#import <Foundation/Foundation.h>
|
||||
|
||||
|
||||
@interface VirtualRingBuffer : NSObject
|
||||
{
|
||||
void *buffer;
|
||||
void *bufferEnd;
|
||||
UInt32 bufferLength;
|
||||
// buffer is the start of the ring buffer's address space.
|
||||
// bufferEnd is the end of the "real" buffer (always buffer + bufferLength).
|
||||
// Note that the "virtual" portion of the buffer extends from bufferEnd to bufferEnd+bufferLength.
|
||||
|
||||
void *readPointer;
|
||||
void *writePointer;
|
||||
}
|
||||
|
||||
- (id)initWithLength:(UInt32)length;
|
||||
// Note: The specified length will be rounded up to an integral number of VM pages.
|
||||
|
||||
// Empties the buffer. It is NOT safe to do this while anyone is reading from or writing to the buffer.
|
||||
- (void)empty;
|
||||
// Checks if the buffer is empty or not. This is safe in any thread.
|
||||
- (BOOL)isEmpty;
|
||||
|
||||
- (UInt32)bufferLength;
|
||||
|
||||
// Read operations:
|
||||
|
||||
// The reading thread must call this method first.
|
||||
- (UInt32)lengthAvailableToReadReturningPointer:(void **)returnedReadPointer;
|
||||
// Iff a value > 0 is returned, the reading thread may go on to read that much data from the returned pointer.
|
||||
// Afterwards, the reading thread must call didReadLength:.
|
||||
- (void)didReadLength:(UInt32)length;
|
||||
|
||||
// Write operations:
|
||||
|
||||
// The writing thread must call this method first.
|
||||
- (UInt32)lengthAvailableToWriteReturningPointer:(void **)returnedWritePointer;
|
||||
// Iff a value > 0 is returned, the writing thread may then write that much data into the returned pointer.
|
||||
// Afterwards, the writing thread must call didWriteLength:.
|
||||
- (void)didWriteLength:(UInt32)length;
|
||||
|
||||
@end
|
|
@ -0,0 +1,309 @@
|
|||
//
|
||||
// VirtualRingBuffer.m
|
||||
// PlayBufferedSoundFile
|
||||
//
|
||||
/*
|
||||
Copyright (c) 2002, Kurt Revis. 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 Snoize nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission.
|
||||
|
||||
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
|
||||
|
||||
#import "VirtualRingBuffer.h"
|
||||
|
||||
#include <mach/mach.h>
|
||||
#include <mach/mach_error.h>
|
||||
|
||||
|
||||
@implementation VirtualRingBuffer
|
||||
|
||||
static void *allocateVirtualBuffer(UInt32 bufferLength);
|
||||
static void deallocateVirtualBuffer(void *buffer, UInt32 bufferLength);
|
||||
|
||||
|
||||
- (id)initWithLength:(UInt32)length
|
||||
{
|
||||
if (![super init])
|
||||
return nil;
|
||||
|
||||
// We need to allocate entire VM pages, so round the specified length up to the next page if necessary.
|
||||
bufferLength = round_page(length);
|
||||
|
||||
buffer = allocateVirtualBuffer(bufferLength);
|
||||
if (buffer) {
|
||||
bufferEnd = buffer + bufferLength;
|
||||
} else {
|
||||
[self release];
|
||||
return nil;
|
||||
}
|
||||
|
||||
readPointer = NULL;
|
||||
writePointer = NULL;
|
||||
|
||||
return self;
|
||||
}
|
||||
|
||||
- (void)dealloc
|
||||
{
|
||||
if (buffer)
|
||||
deallocateVirtualBuffer(buffer, bufferLength);
|
||||
|
||||
[super dealloc];
|
||||
}
|
||||
|
||||
- (void)empty
|
||||
{
|
||||
// Assumption:
|
||||
// No one is reading or writing from the buffer, in any thread, when this method is called.
|
||||
|
||||
readPointer = NULL;
|
||||
writePointer = NULL;
|
||||
}
|
||||
|
||||
- (BOOL)isEmpty
|
||||
{
|
||||
return (readPointer != NULL && writePointer != NULL);
|
||||
}
|
||||
|
||||
|
||||
- (UInt32)bufferLength
|
||||
{
|
||||
return bufferLength;
|
||||
}
|
||||
|
||||
//
|
||||
// Theory of operation:
|
||||
//
|
||||
// This class keeps a pointer to the next byte to be read (readPointer) and a pointer to the next byte to be written (writePointer).
|
||||
// readPointer is only advanced in the reading thread (except for one case: when the buffer first has data written to it).
|
||||
// writePointer is only advanced in the writing thread.
|
||||
//
|
||||
// Since loading and storing word length data is atomic, each pointer can safely be modified in one thread while the other thread
|
||||
// uses it, IF each thread is careful to make a local copy of the "opposite" pointer when necessary.
|
||||
//
|
||||
|
||||
//
|
||||
// Read operations
|
||||
//
|
||||
|
||||
- (UInt32)lengthAvailableToReadReturningPointer:(void **)returnedReadPointer
|
||||
{
|
||||
// Assumptions:
|
||||
// returnedReadPointer != NULL
|
||||
|
||||
UInt32 length;
|
||||
// Read this pointer exactly once, so we're safe in case it is changed in another thread
|
||||
void *localWritePointer = writePointer;
|
||||
|
||||
// Depending on out-of-order execution and memory storage, either one of these may be NULL when the buffer is empty. So we must check both.
|
||||
if (!readPointer || !localWritePointer) {
|
||||
// The buffer is empty
|
||||
length = 0;
|
||||
} else if (localWritePointer > readPointer) {
|
||||
// Write is ahead of read in the buffer
|
||||
length = localWritePointer - readPointer;
|
||||
} else {
|
||||
// Write has wrapped around past read, OR write == read (the buffer is full)
|
||||
length = bufferLength - (readPointer - localWritePointer);
|
||||
}
|
||||
|
||||
*returnedReadPointer = readPointer;
|
||||
return length;
|
||||
}
|
||||
|
||||
- (void)didReadLength:(UInt32)length
|
||||
{
|
||||
// Assumptions:
|
||||
// [self lengthAvailableToReadReturningPointer:] currently returns a value >= length
|
||||
// length > 0
|
||||
|
||||
void *newReadPointer;
|
||||
|
||||
newReadPointer = readPointer + length;
|
||||
if (newReadPointer >= bufferEnd)
|
||||
newReadPointer -= bufferLength;
|
||||
|
||||
if (newReadPointer == writePointer) {
|
||||
// We just read the last data out of the buffer, so it is now empty.
|
||||
newReadPointer = NULL;
|
||||
}
|
||||
|
||||
// Store the new read pointer. This is the only place this happens in the read thread.
|
||||
readPointer = newReadPointer;
|
||||
}
|
||||
|
||||
|
||||
//
|
||||
// Write operations
|
||||
//
|
||||
|
||||
- (UInt32)lengthAvailableToWriteReturningPointer:(void **)returnedWritePointer
|
||||
{
|
||||
// Assumptions:
|
||||
// returnedWritePointer != NULL
|
||||
|
||||
UInt32 length;
|
||||
// Read this pointer exactly once, so we're safe in case it is changed in another thread
|
||||
void *localReadPointer = readPointer;
|
||||
|
||||
// Either one of these may be NULL when the buffer is empty. So we must check both.
|
||||
if (!localReadPointer || !writePointer) {
|
||||
// The buffer is empty. Set it up to be written into.
|
||||
// This is one of the two places the write pointer can change; both are in the write thread.
|
||||
writePointer = buffer;
|
||||
length = bufferLength;
|
||||
} else if (writePointer <= localReadPointer) {
|
||||
// Write is before read in the buffer, OR write == read (meaning that the buffer is full).
|
||||
length = localReadPointer - writePointer;
|
||||
} else {
|
||||
// Write is behind read in the buffer. The available space wraps around.
|
||||
length = (bufferEnd - writePointer) + (localReadPointer - buffer);
|
||||
}
|
||||
|
||||
*returnedWritePointer = writePointer;
|
||||
return length;
|
||||
}
|
||||
|
||||
- (void)didWriteLength:(UInt32)length
|
||||
{
|
||||
// Assumptions:
|
||||
// [self lengthAvailableToWriteReturningPointer:] currently returns a value >= length
|
||||
// length > 0
|
||||
|
||||
void *oldWritePointer = writePointer;
|
||||
void *newWritePointer;
|
||||
|
||||
// Advance the write pointer, wrapping around if necessary.
|
||||
newWritePointer = writePointer + length;
|
||||
if (newWritePointer >= bufferEnd)
|
||||
newWritePointer -= bufferLength;
|
||||
|
||||
// This is one of the two places the write pointer can change; both are in the write thread.
|
||||
writePointer = newWritePointer;
|
||||
|
||||
// Also, if the read pointer is NULL, then we just wrote into a previously empty buffer, so set the read pointer.
|
||||
// This is the only place the read pointer is changed in the write thread.
|
||||
// The read thread should never change the read pointer when it is NULL, so this is safe.
|
||||
if (!readPointer)
|
||||
readPointer = oldWritePointer;
|
||||
}
|
||||
|
||||
@end
|
||||
|
||||
|
||||
void *allocateVirtualBuffer(UInt32 bufferLength)
|
||||
{
|
||||
kern_return_t error;
|
||||
vm_address_t originalAddress = (vm_address_t)NULL;
|
||||
vm_address_t realAddress = (vm_address_t)NULL;
|
||||
mach_port_t memoryEntry;
|
||||
vm_size_t memoryEntryLength;
|
||||
vm_address_t virtualAddress = (vm_address_t)NULL;
|
||||
|
||||
// We want to find where we can get 2 * bufferLength bytes of contiguous address space.
|
||||
// So let's just allocate that space, remember its address, and deallocate it.
|
||||
// (This doesn't actually have to touch all of that memory so it's not terribly expensive.)
|
||||
error = vm_allocate(mach_task_self(), &originalAddress, 2 * bufferLength, TRUE);
|
||||
if (error) {
|
||||
#if DEBUG
|
||||
mach_error("vm_allocate initial chunk", error);
|
||||
#endif
|
||||
return NULL;
|
||||
}
|
||||
|
||||
error = vm_deallocate(mach_task_self(), originalAddress, 2 * bufferLength);
|
||||
if (error) {
|
||||
#if DEBUG
|
||||
mach_error("vm_deallocate initial chunk", error);
|
||||
#endif
|
||||
return NULL;
|
||||
}
|
||||
|
||||
// Then allocate a "real" block of memory at the same address, but with the normal bufferLength.
|
||||
realAddress = originalAddress;
|
||||
error = vm_allocate(mach_task_self(), &realAddress, bufferLength, FALSE);
|
||||
if (error) {
|
||||
#if DEBUG
|
||||
mach_error("vm_allocate real chunk", error);
|
||||
#endif
|
||||
return NULL;
|
||||
}
|
||||
if (realAddress != originalAddress) {
|
||||
#if DEBUG
|
||||
DBLog(@"allocateVirtualBuffer: vm_allocate 2nd time didn't return same address (%p vs %p)", originalAddress, realAddress);
|
||||
#endif
|
||||
goto errorReturn;
|
||||
}
|
||||
|
||||
// Then make a memory entry for the area we just allocated.
|
||||
memoryEntryLength = bufferLength;
|
||||
error = mach_make_memory_entry(mach_task_self(), &memoryEntryLength, realAddress, VM_PROT_READ | VM_PROT_WRITE, &memoryEntry, (vm_address_t)NULL);
|
||||
if (error) {
|
||||
#if DEBUG
|
||||
mach_error("mach_make_memory_entry", error);
|
||||
#endif
|
||||
goto errorReturn;
|
||||
}
|
||||
if (!memoryEntry) {
|
||||
#if DEBUG
|
||||
DBLog(@"mach_make_memory_entry: returned memoryEntry of NULL");
|
||||
#endif
|
||||
goto errorReturn;
|
||||
}
|
||||
if (memoryEntryLength != bufferLength) {
|
||||
#if DEBUG
|
||||
DBLog(@"mach_make_memory_entry: size changed (from %0x to %0x)", bufferLength, memoryEntryLength);
|
||||
#endif
|
||||
goto errorReturn;
|
||||
}
|
||||
|
||||
// And map the area immediately after the first block, with length bufferLength, to that memory entry.
|
||||
virtualAddress = realAddress + bufferLength;
|
||||
error = vm_map(mach_task_self(), &virtualAddress, bufferLength, 0, FALSE, memoryEntry, 0, FALSE, VM_PROT_READ | VM_PROT_WRITE, VM_PROT_READ | VM_PROT_WRITE, VM_INHERIT_DEFAULT);
|
||||
if (error) {
|
||||
#if DEBUG
|
||||
mach_error("vm_map", error);
|
||||
#endif
|
||||
// TODO Retry from the beginning, instead of failing completely. There is a tiny (but > 0) probability that someone
|
||||
// will allocate this space out from under us.
|
||||
virtualAddress = (vm_address_t)NULL;
|
||||
goto errorReturn;
|
||||
}
|
||||
if (virtualAddress != realAddress + bufferLength) {
|
||||
#if DEBUG
|
||||
DBLog(@"vm_map: didn't return correct address (%p vs %p)", realAddress + bufferLength, virtualAddress);
|
||||
#endif
|
||||
goto errorReturn;
|
||||
}
|
||||
|
||||
// Success!
|
||||
return (void *)realAddress;
|
||||
|
||||
errorReturn:
|
||||
if (realAddress)
|
||||
vm_deallocate(mach_task_self(), realAddress, bufferLength);
|
||||
if (virtualAddress)
|
||||
vm_deallocate(mach_task_self(), virtualAddress, bufferLength);
|
||||
|
||||
return NULL;
|
||||
}
|
||||
|
||||
void deallocateVirtualBuffer(void *buffer, UInt32 bufferLength)
|
||||
{
|
||||
kern_return_t error;
|
||||
|
||||
// We can conveniently deallocate both the vm_allocated memory and
|
||||
// the vm_mapped region at the same time.
|
||||
error = vm_deallocate(mach_task_self(), (vm_address_t)buffer, bufferLength * 2);
|
||||
if (error) {
|
||||
#if DEBUG
|
||||
mach_error("vm_deallocate in dealloc", error);
|
||||
#endif
|
||||
}
|
||||
}
|
|
@ -0,0 +1,21 @@
|
|||
/*
|
||||
* NSDebug.h
|
||||
* Cog
|
||||
*
|
||||
* Created by Vincent Spader on 5/30/05.
|
||||
* Copyright 2005 Vincent Spader All rights reserved.
|
||||
*
|
||||
*/
|
||||
|
||||
#include <Cocoa/Cocoa.h>
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C"
|
||||
{
|
||||
#endif
|
||||
|
||||
void DBLog(NSString *format, ...);
|
||||
|
||||
#ifdef __cplusplus
|
||||
};
|
||||
#endif
|
|
@ -0,0 +1,25 @@
|
|||
/*
|
||||
* NSDebug.c
|
||||
* Cog
|
||||
*
|
||||
* Created by Vincent Spader on 5/30/05.
|
||||
* Copyright 2005 Vincent Spader All rights reserved.
|
||||
*
|
||||
*/
|
||||
|
||||
#include "DBLog.h"
|
||||
|
||||
|
||||
void DBLog(NSString *format, ...)
|
||||
{
|
||||
#ifdef DEBUG
|
||||
|
||||
va_list ap;
|
||||
|
||||
va_start(ap, format);
|
||||
|
||||
NSLogv(format, ap);
|
||||
|
||||
va_end(ap);
|
||||
#endif
|
||||
}
|
|
@ -0,0 +1,21 @@
|
|||
//
|
||||
// Semaphore.h
|
||||
// Cog
|
||||
//
|
||||
// Created by Vincent Spader on 8/2/05.
|
||||
// Copyright 2005 Vincent Spader. All rights reserved.
|
||||
//
|
||||
|
||||
#import <Cocoa/Cocoa.h>
|
||||
#import <mach/mach.h>
|
||||
|
||||
@interface Semaphore : NSObject {
|
||||
semaphore_t semaphore;
|
||||
}
|
||||
|
||||
-(id)init;
|
||||
-(void)signal;
|
||||
-(void)timedWait:(int)seconds;
|
||||
-(void)wait;
|
||||
|
||||
@end
|
|
@ -0,0 +1,43 @@
|
|||
//
|
||||
// Semaphore.m
|
||||
// Cog
|
||||
//
|
||||
// Created by Vincent Spader on 8/2/05.
|
||||
// Copyright 2005 Vincent Spader. All rights reserved.
|
||||
//
|
||||
|
||||
#import "Semaphore.h"
|
||||
|
||||
|
||||
@implementation Semaphore
|
||||
|
||||
-(id)init
|
||||
{
|
||||
self = [super init];
|
||||
if (self)
|
||||
{
|
||||
semaphore_create(mach_task_self(), &semaphore, SYNC_POLICY_FIFO, 0);
|
||||
}
|
||||
|
||||
return self;
|
||||
}
|
||||
|
||||
-(void)signal
|
||||
{
|
||||
semaphore_signal_all(semaphore);
|
||||
}
|
||||
|
||||
-(void)timedWait:(int)seconds
|
||||
{
|
||||
mach_timespec_t timeout = {seconds, 0};
|
||||
|
||||
semaphore_timedwait(semaphore, timeout);
|
||||
}
|
||||
|
||||
-(void)wait
|
||||
{
|
||||
mach_timespec_t t = {2.0, 0.0}; //2 second timeout
|
||||
semaphore_timedwait(semaphore, t);
|
||||
}
|
||||
|
||||
@end
|
4
COMPILE
4
COMPILE
|
@ -1,5 +1,5 @@
|
|||
To compile Cog, you must first compile all of the projects in the Libraries and Preferences folders with the Release build configuration.
|
||||
To compile Cog, you must first compile all of the projects in the Frameworks and Preferences folders with the Release build configuration.
|
||||
|
||||
To make this easier, I have created a bash script named build_dependencies.sh in the main folder. Just run that in a terminal, and when it is finished, all the dependencies should be built.
|
||||
To make this easier, I have created a bash script named build_dependencies.sh in the Scripts folder. Just run that in a terminal from the project root, and when it is finished, all the dependencies should be built.
|
||||
|
||||
If you have any problems, email me at vspader@users.sourceforge.net
|
||||
|
|
File diff suppressed because it is too large
Load Diff
|
@ -1,8 +0,0 @@
|
|||
/* InfoView */
|
||||
|
||||
#import <Cocoa/Cocoa.h>
|
||||
|
||||
@interface InfoView : NSView
|
||||
{
|
||||
}
|
||||
@end
|
|
@ -1,21 +0,0 @@
|
|||
#import "InfoView.h"
|
||||
|
||||
@implementation InfoView
|
||||
/*
|
||||
- (id)initWithFrame:(NSRect)frameRect
|
||||
{
|
||||
if ((self = [super initWithFrame:frameRect]) != nil) {
|
||||
// Add initialization code here
|
||||
}
|
||||
return self;
|
||||
}
|
||||
|
||||
- (void)drawRect:(NSRect)rect
|
||||
{
|
||||
}
|
||||
*/
|
||||
- (BOOL)isFlipped
|
||||
{
|
||||
return NO;
|
||||
}
|
||||
@end
|
|
@ -3,19 +3,19 @@
|
|||
<plist version="1.0">
|
||||
<dict>
|
||||
<key>IBDocumentLocation</key>
|
||||
<string>41 92 639 388 0 0 1440 878 </string>
|
||||
<string>295 362 639 388 0 0 1680 1028 </string>
|
||||
<key>IBEditorPositions</key>
|
||||
<dict>
|
||||
<key>1063</key>
|
||||
<string>0 228 136 49 0 0 1024 746 </string>
|
||||
<key>1156</key>
|
||||
<string>599 414 241 366 0 0 1440 878 </string>
|
||||
<string>719 527 241 366 0 0 1680 1028 </string>
|
||||
<key>29</key>
|
||||
<string>-3 826 383 44 0 0 1440 878 </string>
|
||||
<string>-3 974 383 44 0 0 1680 1028 </string>
|
||||
<key>463</key>
|
||||
<string>549 524 341 145 0 0 1440 878 </string>
|
||||
<string>669 637 341 145 0 0 1680 1028 </string>
|
||||
<key>513</key>
|
||||
<string>935 231 125 137 0 0 1440 878 </string>
|
||||
<string>1026 274 125 137 0 0 1680 1028 </string>
|
||||
</dict>
|
||||
<key>IBFramework Version</key>
|
||||
<string>446.1</string>
|
||||
|
@ -32,10 +32,11 @@
|
|||
<integer>4</integer>
|
||||
<key>IBOpenObjects</key>
|
||||
<array>
|
||||
<integer>29</integer>
|
||||
<integer>463</integer>
|
||||
<integer>21</integer>
|
||||
<integer>1156</integer>
|
||||
<integer>513</integer>
|
||||
<integer>21</integer>
|
||||
<integer>29</integer>
|
||||
</array>
|
||||
<key>IBSystem Version</key>
|
||||
<string>8L2127</string>
|
||||
|
|
Binary file not shown.
|
@ -7,7 +7,7 @@
|
|||
//
|
||||
|
||||
#import <Cocoa/Cocoa.h>
|
||||
#import "UKKQueue/UKKQueue.h"
|
||||
#import "UKKQueue.h"
|
||||
|
||||
@interface FileTreeWatcher : NSObject {
|
||||
UKKQueue *kqueue;
|
||||
|
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue