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;
|
||||
bytesInBuffer = 0;
|
||||
} else {
|
||||
if(initialBufferFilled == NO) {
|
||||
[controller initialBufferFilled:self];
|
||||
}
|
||||
|
||||
DLog(@"End of stream? %@", [self properties]);
|
||||
|
||||
endOfStream = YES;
|
||||
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);
|
||||
|
||||
// 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
|
||||
DLog("InputNode: Before wait")
|
||||
[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.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]) {
|
||||
[writeSemaphore signal];
|
||||
[readSemaphore signal];
|
||||
|
|
Loading…
Reference in New Issue