Fixes starting playback on short files
These two changes fix playback issues with either starting in the middle of the playlist on a really short file terminating immediately instead of queueing more files (InputNode.m), and issues with starting playback at all on the end of a playlist on a short file. (OutputCoreAudio.m) Fixes #246 Signed-off-by: Christopher Snowhill <kode54@gmail.com>CQTexperiment
parent
7c5cec1eb7
commit
6dccaa4d7f
|
@ -186,16 +186,18 @@
|
||||||
amountInBuffer = 0;
|
amountInBuffer = 0;
|
||||||
bytesInBuffer = 0;
|
bytesInBuffer = 0;
|
||||||
} else {
|
} else {
|
||||||
if(initialBufferFilled == NO) {
|
|
||||||
[controller initialBufferFilled:self];
|
|
||||||
}
|
|
||||||
|
|
||||||
DLog(@"End of stream? %@", [self properties]);
|
DLog(@"End of stream? %@", [self properties]);
|
||||||
|
|
||||||
endOfStream = YES;
|
endOfStream = YES;
|
||||||
shouldClose = [controller endOfInputReached]; // Lets us know if we should keep going or not (occassionally, for track changes within a file)
|
shouldClose = [controller endOfInputReached]; // Lets us know if we should keep going or not (occassionally, for track changes within a file)
|
||||||
DLog(@"closing? is %i", shouldClose);
|
DLog(@"closing? is %i", shouldClose);
|
||||||
|
|
||||||
|
// Move this here, so that the above endOfInputReached has a chance to queue another track before starting output
|
||||||
|
// Technically, the output should still play out its buffer first before checking if it should stop
|
||||||
|
if(initialBufferFilled == NO) {
|
||||||
|
[controller initialBufferFilled:self];
|
||||||
|
}
|
||||||
|
|
||||||
// wait before exiting, as we might still get seeking request
|
// wait before exiting, as we might still get seeking request
|
||||||
DLog("InputNode: Before wait")
|
DLog("InputNode: Before wait")
|
||||||
[exitAtTheEndOfTheStream waitIndefinitely];
|
[exitAtTheEndOfTheStream waitIndefinitely];
|
||||||
|
|
|
@ -816,7 +816,13 @@ default_device_changed(AudioObjectID inObjectID, UInt32 inNumberAddresses, const
|
||||||
[[NSUserDefaultsController sharedUserDefaultsController] removeObserver:self forKeyPath:@"values.GraphicEQenable"];
|
[[NSUserDefaultsController sharedUserDefaultsController] removeObserver:self forKeyPath:@"values.GraphicEQenable"];
|
||||||
[[NSUserDefaultsController sharedUserDefaultsController] removeObserver:self forKeyPath:@"values.eqPreamp"];
|
[[NSUserDefaultsController sharedUserDefaultsController] removeObserver:self forKeyPath:@"values.eqPreamp"];
|
||||||
}
|
}
|
||||||
if(stopNext && started && !paused) {
|
if(stopNext && !paused) {
|
||||||
|
if(!started) {
|
||||||
|
// This happens if playback is started on a very short file, and the queue is empty or at the end of the playlist
|
||||||
|
started = YES;
|
||||||
|
NSError *err;
|
||||||
|
[_au startHardwareAndReturnError:&err];
|
||||||
|
}
|
||||||
while(![[outputController buffer] isEmpty]) {
|
while(![[outputController buffer] isEmpty]) {
|
||||||
[writeSemaphore signal];
|
[writeSemaphore signal];
|
||||||
[readSemaphore signal];
|
[readSemaphore signal];
|
||||||
|
|
Loading…
Reference in New Issue