Added some error messages that should hopefully fix some initial stuttering issues.

CQTexperiment
vspader 2007-03-19 00:19:47 +00:00
parent 2a0b588f4d
commit 77c7819dd6
6 changed files with 35 additions and 3 deletions

View File

@ -22,6 +22,8 @@
id nextStreamUserInfo;
id delegate;
BOOL outputLaunched;
}
- (id)init;
@ -65,6 +67,7 @@
- (void)endOfInputReached:(BufferChain *)sender;
- (void)setShouldContinue:(BOOL)s;
- (BufferChain *)bufferChain;
- (void)launchOutputThread;
- (void)endOfInputPlayed;
- (void)sendDelegateMethod:(SEL)selector withObject:(id)obj waitUntilDone:(BOOL)wait;
@end

View File

@ -22,6 +22,7 @@
{
output = NULL;
bufferChain = NULL;
outputLaunched = NO;
chainQueue = [[NSMutableArray alloc] init];
}
@ -91,9 +92,9 @@
[bufferChain setUserInfo:userInfo];
[self setShouldContinue:YES];
DBLog(@"DETACHING THREADS");
[output launchThread];
outputLaunched = NO;
NSLog(@"Launching input thread!");
[bufferChain launchThreads];
[self setPlaybackStatus:kCogStatusPlaying];
@ -165,6 +166,13 @@
return [output amountPlayed];
}
- (void)launchOutputThread
{
if (outputLaunched == NO) {
NSLog(@"Launching output thread!");
[output launchThread];
}
}

View File

@ -40,6 +40,8 @@
- (void)setShouldContinue:(BOOL)s;
- (void)initialBufferFilled;
- (void)endOfInputReached;

View File

@ -107,6 +107,11 @@
[controller endOfInputReached:self];
}
- (void)initialBufferFilled
{
[controller launchOutputThread];
}
- (id)finalNode
{

View File

@ -24,6 +24,7 @@
BOOL shouldContinue;
BOOL endOfStream; //All data is now in buffer
BOOL initialBufferFilled;
}
- (id)initWithController:(id)c previous:(id)p;

View File

@ -20,6 +20,8 @@
readLock = [[NSLock alloc] init];
writeLock = [[NSLock alloc] init];
initialBufferFilled = NO;
controller = c;
previousNode = p;
endOfStream = NO;
@ -43,6 +45,11 @@
if (availOutput == 0)
{
[writeLock unlock];
if (initialBufferFilled == NO) {
initialBufferFilled = YES;\
if ([controller respondsToSelector:@selector(initialBufferFilled)])
[controller performSelector:@selector(initialBufferFilled)];
}
[semaphore wait];
[writeLock lock];
}
@ -104,7 +111,13 @@
//If it is the outputNode, [soundController newInputChain];
//else
endOfStream = YES;
}
}
if (availInput <= 0) {
NSLog(@"BUFFER RAN DRY!");
}
else if (availInput < amount) {
NSLog(@"BUFFER IN DANGER");
}
amountToCopy = availInput;
if (amountToCopy > amount)