Through a bit of ugliness and interface exposure, the InputNode will now pause the OutputNode while it is making the decoder seek, which prevents cases of the output continuing to run for seconds at a time during a slow seek operation by decoders such as HighlyComplete

CQTexperiment
Chris Moeller 2013-10-20 22:04:09 -07:00
parent 761ea97e0e
commit 755147b48a
5 changed files with 27 additions and 0 deletions

View File

@ -61,4 +61,6 @@
- (BOOL)isRunning;
- (id)controller;
@end

View File

@ -207,4 +207,9 @@
return NO;
}
- (id)controller
{
return controller;
}
@end

View File

@ -10,6 +10,8 @@
#import "BufferChain.h"
#import "Plugin.h"
#import "CoreAudioUtils.h"
#import "AudioPlayer.h"
#import "OutputNode.h"
#import "Logging.h"
@ -120,8 +122,12 @@
{
if (shouldSeek == YES)
{
OutputNode *output = [[controller controller] output];
BOOL isPaused = [output isPaused];
if ( !isPaused ) [output pause];
DLog(@"SEEKING!");
[decoder seek:seekFrame];
if ( !isPaused ) [output resume];
shouldSeek = NO;
DLog(@"Seeked! Resetting Buffer");

View File

@ -20,6 +20,8 @@
unsigned long long amountPlayed;
OutputCoreAudio *output;
BOOL paused;
}
- (double)amountPlayed;
@ -41,4 +43,6 @@
- (void)pause;
- (void)resume;
- (BOOL)isPaused;
@end

View File

@ -18,6 +18,8 @@
- (void)setup
{
amountPlayed = 0;
paused = YES;
output = [[OutputCoreAudio alloc] initWithController:self];
@ -33,16 +35,19 @@
- (void)process
{
paused = NO;
[output start];
}
- (void)pause
{
paused = YES;
[output pause];
}
- (void)resume
{
paused = NO;
[output resume];
}
@ -111,4 +116,9 @@
// if (s == NO)
// [output stop];
}
- (BOOL)isPaused
{
return paused;
}
@end