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

CQTexperiment
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) {
NSLog(@"Launching output thread!");
[output launchThread];
outputLaunched = YES;
}
else {
NSLog(@"Resuming not launching");
[output resume];
}
}

View File

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

View File

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

View File

@ -24,6 +24,8 @@
- (void)seek:(double)time
{
[output pause];
[semaphore signal];
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
AudioDeviceID deviceID = outputDevice; //XXX use default if null
NSLog(@"WEEE");
NSLog(@"Using output device %d", deviceID);
OSStatus err;
@ -253,11 +252,13 @@ static OSStatus Sound_Renderer(void *inRefCon, AudioUnitRenderActionFlags *ioAc
- (void)pause
{
NSLog(@"PAUSE");
AudioOutputUnitStop(outputUnit);
}
- (void)resume
{
NSLog(@"RESUME");
AudioOutputUnitStart(outputUnit);
}

View File

@ -1,4 +1,5 @@
<?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">
<plist version='1.0'>
<dict>
@ -95,7 +96,7 @@
<key>CFBundleSignature</key>
<string>????</string>
<key>CFBundleVersion</key>
<string>0.06</string>
<string>r428</string>
<key>CFBundleHelpBookFolder</key>
<string>Help</string>
<key>CFBundleHelpBookName</key>
@ -111,3 +112,4 @@
<string>http://cogosx.sourceforge.net/appcast.xml</string>
</dict>
</plist>