1
0
mirror of https://github.com/TomHarte/CLK.git synced 2024-12-23 20:29:42 +00:00

Eliminated waiting here — either the buffer can be enqueued now or it is dropped.

This commit is contained in:
Thomas Harte 2016-08-14 16:20:24 -04:00
parent 48a00d9e05
commit 6079d30e58
2 changed files with 2 additions and 4 deletions

View File

@ -174,9 +174,8 @@ static void audioOutputCallback(
- (void)enqueueAudioBuffer:(const int16_t *)buffer numberOfSamples:(size_t)lengthInSamples
{
while(1)
if([_writeLock tryLockWhenCondition:AudioQueueCanProceed])
{
[_writeLock lockWhenCondition:AudioQueueCanProceed];
if((_audioStreamReadPosition + _streamLength) - _audioStreamWritePosition >= lengthInSamples)
{
size_t samplesBeforeOverflow = _streamLength - (_audioStreamWritePosition % _streamLength);
@ -193,7 +192,6 @@ static void audioOutputCallback(
_audioStreamWritePosition += lengthInSamples;
[_writeLock unlockWithCondition:[self writeLockCondition]];
break;
}
else
{

View File

@ -157,7 +157,7 @@ class Vic20Document: MachineDocument {
standardUserDefaults.registerDefaults([
self.autoloadingUserDefaultsKey: true,
self.memorySizeUserDefaultsKey: 5,
self.countryUserDefaultsKey: 4
self.countryUserDefaultsKey: 1
])
let loadAutomatically = standardUserDefaults.boolForKey(self.autoloadingUserDefaultsKey)