A fix to try to stop the buffer from running dry when seeking.

This commit is contained in:
vspader 2007-05-26 12:42:00 +00:00
parent 258d7aa077
commit 0f7f8f2750
6 changed files with 17 additions and 7 deletions

View file

@ -173,6 +173,11 @@
if (outputLaunched == NO) { if (outputLaunched == NO) {
NSLog(@"Launching output thread!"); NSLog(@"Launching output thread!");
[output launchThread]; [output launchThread];
outputLaunched = YES;
}
else {
NSLog(@"Resuming not launching");
[output resume];
} }
} }

View file

@ -87,16 +87,16 @@
- (void)seek:(double)time - (void)seek:(double)time
{ {
NSLog(@"SEEKING IN BUFFERCHIAN");
[inputNode seek:time];
[[inputNode readLock] lock]; [[inputNode readLock] lock];
[[inputNode writeLock] lock]; [[inputNode writeLock] lock];
//Signal so its waiting when we unlock //Signal so its waiting when we unlock
[[inputNode semaphore] signal]; [[inputNode semaphore] signal];
NSLog(@"Reset input buffer!");
[inputNode resetBuffer]; [inputNode resetBuffer];
NSLog(@"Seeking in bufferchain!");
[inputNode seek:time];
[[inputNode writeLock] unlock]; [[inputNode writeLock] unlock];
[[inputNode readLock] unlock]; [[inputNode readLock] unlock];
@ -112,7 +112,6 @@
[controller launchOutputThread]; [controller launchOutputThread];
} }
- (id)finalNode - (id)finalNode
{ {
return finalNode; return finalNode;

View file

@ -130,9 +130,10 @@
- (void)seek:(double)time - (void)seek:(double)time
{ {
NSLog(@"SEEKING WEEE"); NSLog(@"SEEKING IN INPUTNODE");
seekTime = time; seekTime = time;
shouldSeek = YES; shouldSeek = YES;
initialBufferFilled = NO;
} }
- (void)dealloc - (void)dealloc

View file

@ -24,6 +24,8 @@
- (void)seek:(double)time - (void)seek:(double)time
{ {
[output pause];
[semaphore signal];
amountPlayed = time*format.mBytesPerFrame*(format.mSampleRate/1000.0); amountPlayed = time*format.mBytesPerFrame*(format.mSampleRate/1000.0);
} }

View file

@ -77,7 +77,6 @@ static OSStatus Sound_Renderer(void *inRefCon, AudioUnitRenderActionFlags *ioAc
{ {
// Set the output device // Set the output device
AudioDeviceID deviceID = outputDevice; //XXX use default if null AudioDeviceID deviceID = outputDevice; //XXX use default if null
NSLog(@"WEEE");
NSLog(@"Using output device %d", deviceID); NSLog(@"Using output device %d", deviceID);
OSStatus err; OSStatus err;
@ -253,11 +252,13 @@ static OSStatus Sound_Renderer(void *inRefCon, AudioUnitRenderActionFlags *ioAc
- (void)pause - (void)pause
{ {
NSLog(@"PAUSE");
AudioOutputUnitStop(outputUnit); AudioOutputUnitStop(outputUnit);
} }
- (void)resume - (void)resume
{ {
NSLog(@"RESUME");
AudioOutputUnitStart(outputUnit); AudioOutputUnitStart(outputUnit);
} }

View file

@ -1,4 +1,5 @@
<?xml version='1.0' encoding='UTF-8'?> <?xml version='1.0' encoding='UTF-8'?>
<!DOCTYPE plist PUBLIC "-//Apple Computer//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd"> <!DOCTYPE plist PUBLIC "-//Apple Computer//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version='1.0'> <plist version='1.0'>
<dict> <dict>
@ -95,7 +96,7 @@
<key>CFBundleSignature</key> <key>CFBundleSignature</key>
<string>????</string> <string>????</string>
<key>CFBundleVersion</key> <key>CFBundleVersion</key>
<string>0.06</string> <string>r428</string>
<key>CFBundleHelpBookFolder</key> <key>CFBundleHelpBookFolder</key>
<string>Help</string> <string>Help</string>
<key>CFBundleHelpBookName</key> <key>CFBundleHelpBookName</key>
@ -111,3 +112,4 @@
<string>http://cogosx.sourceforge.net/appcast.xml</string> <string>http://cogosx.sourceforge.net/appcast.xml</string>
</dict> </dict>
</plist> </plist>