Removed SourceNode, since its dumb.
parent
eb5ee1586d
commit
116e78c3ed
|
@ -10,12 +10,10 @@
|
|||
|
||||
#import "InputNode.h"
|
||||
#import "ConverterNode.h"
|
||||
#import "sourceNode.h"
|
||||
|
||||
#import "AudioPlayer.h"
|
||||
|
||||
@interface BufferChain : NSObject {
|
||||
SourceNode *sourceNode;
|
||||
InputNode *inputNode;
|
||||
ConverterNode *converterNode;
|
||||
|
||||
|
|
|
@ -8,7 +8,6 @@
|
|||
|
||||
#import "BufferChain.h"
|
||||
#import "OutputNode.h"
|
||||
#import "SourceNode.h"
|
||||
#import "AudioSource.h"
|
||||
#import "CoreAudioUtils.h"
|
||||
|
||||
|
@ -23,7 +22,6 @@
|
|||
streamURL = nil;
|
||||
userInfo = nil;
|
||||
|
||||
sourceNode = nil;
|
||||
inputNode = nil;
|
||||
converterNode = nil;
|
||||
}
|
||||
|
@ -33,7 +31,6 @@
|
|||
|
||||
- (void)buildChain
|
||||
{
|
||||
[sourceNode release]; //Source node is allocated on open..
|
||||
[inputNode release];
|
||||
[converterNode release];
|
||||
|
||||
|
@ -50,13 +47,6 @@
|
|||
[self buildChain];
|
||||
|
||||
id<CogSource> source = [AudioSource audioSourceForURL:url];
|
||||
if ([source buffered]) {
|
||||
sourceNode = [[SourceNode alloc] initWithSource:source];
|
||||
source = sourceNode;
|
||||
}
|
||||
else {
|
||||
sourceNode = nil;
|
||||
}
|
||||
|
||||
if (![source open:url])
|
||||
{
|
||||
|
@ -64,11 +54,6 @@
|
|||
return NO;
|
||||
}
|
||||
|
||||
if (sourceNode) { //If the source is buffered..
|
||||
DBLog(@"LAUNCHING THREAD FOR SOURCE");
|
||||
[sourceNode launchThread];
|
||||
}
|
||||
|
||||
|
||||
if (![inputNode openURL:url withSource:source])
|
||||
return NO;
|
||||
|
|
|
@ -1,40 +0,0 @@
|
|||
//
|
||||
// InputNode.h
|
||||
// Cog
|
||||
//
|
||||
// Created by Vincent Spader on 8/2/05.
|
||||
// Copyright 2005 Vincent Spader. All rights reserved.
|
||||
//
|
||||
|
||||
#import <Cocoa/Cocoa.h>
|
||||
|
||||
#import "Node.h"
|
||||
#import "Plugin.h"
|
||||
|
||||
@interface SourceNode : Node <CogSource>
|
||||
{
|
||||
id<CogSource> source;
|
||||
|
||||
long byteCount;
|
||||
}
|
||||
|
||||
- (id)initWithSource:(id<CogSource>)source;
|
||||
|
||||
- (void)process;
|
||||
|
||||
|
||||
//Same interface as the CogSource protocol
|
||||
- (BOOL)open:(NSURL *)url;
|
||||
|
||||
- (int)read:(void *)buf amount:(int)amount;
|
||||
|
||||
- (BOOL)seekable;
|
||||
- (BOOL)seek:(long)offset whence:(int)whence;
|
||||
|
||||
- (long)tell;
|
||||
|
||||
- (void)close;
|
||||
|
||||
- (NSDictionary *) properties;
|
||||
//End of protocol interface
|
||||
@end
|
|
@ -1,122 +0,0 @@
|
|||
//
|
||||
// InputNode.m
|
||||
// Cog
|
||||
//
|
||||
// Created by Vincent Spader on 8/2/05.
|
||||
// Copyright 2005 Vincent Spader. All rights reserved.
|
||||
//
|
||||
|
||||
#import "SourceNode.h"
|
||||
|
||||
@implementation SourceNode
|
||||
|
||||
- (id)initWithSource:(id<CogSource>)s
|
||||
{
|
||||
self = [super initWithController:nil previous:self];
|
||||
if (self)
|
||||
{
|
||||
source = [s retain];
|
||||
}
|
||||
return self;
|
||||
}
|
||||
|
||||
- (void)process
|
||||
{
|
||||
const int chunk_size = CHUNK_SIZE;
|
||||
char *buf;
|
||||
int amountRead;
|
||||
|
||||
buf = malloc(chunk_size);
|
||||
|
||||
while ([self shouldContinue] == YES)
|
||||
{
|
||||
NSLog(@"PROCESSING!!!");
|
||||
amountRead = [source read:buf amount: chunk_size];
|
||||
if (amountRead <= 0)
|
||||
{
|
||||
endOfStream = YES;
|
||||
NSLog(@"END OF SOURCE WAS REACHED");
|
||||
break; //eof
|
||||
}
|
||||
[self writeData:buf amount:amountRead];
|
||||
}
|
||||
|
||||
free(buf);
|
||||
[source close];
|
||||
|
||||
NSLog(@"CLOSED: %i", self);
|
||||
}
|
||||
|
||||
- (BOOL)open:(NSURL *)url
|
||||
{
|
||||
shouldContinue = YES;
|
||||
endOfStream = NO;
|
||||
|
||||
byteCount = 0;
|
||||
|
||||
return [source open:url];
|
||||
}
|
||||
|
||||
|
||||
- (int)read:(void *)buf amount:(int)amount
|
||||
{
|
||||
int l;
|
||||
do {
|
||||
l = [self readData:buf amount:amount];
|
||||
if (l > 0)
|
||||
byteCount += l;
|
||||
} while (l == 0 && endOfStream == NO);
|
||||
|
||||
NSLog(@"READ: %i", l);
|
||||
return l;
|
||||
}
|
||||
|
||||
//Buffered streams are never seekable.
|
||||
- (BOOL)seekable
|
||||
{
|
||||
return NO;
|
||||
}
|
||||
|
||||
- (BOOL)seek:(long)offset whence:(int)whence
|
||||
{
|
||||
return NO;
|
||||
}
|
||||
|
||||
- (long)tell
|
||||
{
|
||||
return byteCount;
|
||||
}
|
||||
|
||||
- (void)close
|
||||
{
|
||||
NSLog(@"CLOSING");
|
||||
shouldContinue = NO;
|
||||
|
||||
[source close];
|
||||
}
|
||||
|
||||
- (void)dealloc
|
||||
{
|
||||
[source release];
|
||||
|
||||
[super dealloc];
|
||||
}
|
||||
|
||||
- (NSDictionary *) properties
|
||||
{
|
||||
return [source properties];
|
||||
}
|
||||
|
||||
//Shouldnt be used. Required for protocol
|
||||
- (BOOL)buffered
|
||||
{
|
||||
return YES;
|
||||
}
|
||||
|
||||
+ (NSArray *) schemes
|
||||
{
|
||||
return nil;
|
||||
}
|
||||
//end of shouldnt be used
|
||||
|
||||
@end
|
|
@ -11,8 +11,6 @@
|
|||
17A2D3C60B8D1D37000778C4 /* AudioDecoder.m in Sources */ = {isa = PBXBuildFile; fileRef = 17A2D3C40B8D1D37000778C4 /* AudioDecoder.m */; };
|
||||
17ADB13C0B97926D00257CA2 /* AudioSource.h in Headers */ = {isa = PBXBuildFile; fileRef = 17ADB13A0B97926D00257CA2 /* AudioSource.h */; };
|
||||
17ADB13D0B97926D00257CA2 /* AudioSource.m in Sources */ = {isa = PBXBuildFile; fileRef = 17ADB13B0B97926D00257CA2 /* AudioSource.m */; };
|
||||
17ADB1410B97927C00257CA2 /* SourceNode.h in Headers */ = {isa = PBXBuildFile; fileRef = 17ADB13F0B97927C00257CA2 /* SourceNode.h */; };
|
||||
17ADB1420B97927C00257CA2 /* SourceNode.m in Sources */ = {isa = PBXBuildFile; fileRef = 17ADB1400B97927C00257CA2 /* SourceNode.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, ); }; };
|
||||
|
@ -70,8 +68,6 @@
|
|||
17A2D3C40B8D1D37000778C4 /* AudioDecoder.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = AudioDecoder.m; sourceTree = "<group>"; };
|
||||
17ADB13A0B97926D00257CA2 /* AudioSource.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; path = AudioSource.h; sourceTree = "<group>"; };
|
||||
17ADB13B0B97926D00257CA2 /* AudioSource.m */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.objc; path = AudioSource.m; sourceTree = "<group>"; };
|
||||
17ADB13F0B97927C00257CA2 /* SourceNode.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; path = SourceNode.h; sourceTree = "<group>"; };
|
||||
17ADB1400B97927C00257CA2 /* SourceNode.m */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.objc; path = SourceNode.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>"; };
|
||||
|
@ -215,8 +211,6 @@
|
|||
17D21C750B8BE4BA00D1EBDE /* Chain */ = {
|
||||
isa = PBXGroup;
|
||||
children = (
|
||||
17ADB13F0B97927C00257CA2 /* SourceNode.h */,
|
||||
17ADB1400B97927C00257CA2 /* SourceNode.m */,
|
||||
17D21C760B8BE4BA00D1EBDE /* BufferChain.h */,
|
||||
17D21C770B8BE4BA00D1EBDE /* BufferChain.m */,
|
||||
17D21C780B8BE4BA00D1EBDE /* ConverterNode.h */,
|
||||
|
@ -311,7 +305,6 @@
|
|||
17C940230B900909008627D6 /* AudioMetadataReader.h in Headers */,
|
||||
17B619300B909BC300BC003F /* AudioPropertiesReader.h in Headers */,
|
||||
17ADB13C0B97926D00257CA2 /* AudioSource.h in Headers */,
|
||||
17ADB1410B97927C00257CA2 /* SourceNode.h in Headers */,
|
||||
);
|
||||
runOnlyForDeploymentPostprocessing = 0;
|
||||
};
|
||||
|
@ -385,7 +378,6 @@
|
|||
17C940240B900909008627D6 /* AudioMetadataReader.m in Sources */,
|
||||
17B619310B909BC300BC003F /* AudioPropertiesReader.m in Sources */,
|
||||
17ADB13D0B97926D00257CA2 /* AudioSource.m in Sources */,
|
||||
17ADB1420B97927C00257CA2 /* SourceNode.m in Sources */,
|
||||
);
|
||||
runOnlyForDeploymentPostprocessing = 0;
|
||||
};
|
||||
|
|
Loading…
Reference in New Issue