Skip to content
Snippets Groups Projects
Commit c5a9831e authored by Ralph Giles's avatar Ralph Giles
Browse files

Apply patch from Ben Hines. The macosx device now works!

git-svn-id: http://svn.xiph.org/trunk/ao@5001 0101bb08-14d6-0310-b084-bc0e0c8e3800
parent a0b6ecac
No related branches found
No related tags found
No related merge requests found
......@@ -190,6 +190,11 @@ int ao_plugin_open(ao_device *device, ao_sample_format *format)
}
propertySize = sizeof(internal->outputBufferByteCount);
internal->outputBufferByteCount = 8192;
status = AudioDeviceSetProperty(internal->outputDeviceID, 0, 0, false, kAudioDevicePropertyBufferSize,
propertySize, &internal->outputBufferByteCount);
status = AudioDeviceGetProperty(internal->outputDeviceID, 0, false, kAudioDevicePropertyBufferSize, &propertySize, &internal->outputBufferByteCount);
if (status) {
fprintf(stderr, "ao_macosx_open: AudioDeviceGetProperty returned %d when getting kAudioDevicePropertyBufferSize\n", (int)status);
......@@ -200,7 +205,7 @@ int ao_plugin_open(ao_device *device, ao_sample_format *format)
// It appears that AudioDeviceGetProperty lies about this property in DP4
// Set the actual value
internal->outputBufferByteCount = 32768;
//internal->outputBufferByteCount = 32768;
// Set the IO proc that CoreAudio will call when it needs data, but don't start
// the stream yet.
......@@ -383,10 +388,10 @@ static OSStatus audioDeviceIOProc(AudioDeviceID inDevice, const AudioTimeStamp *
// Find the first valid frame and the number of valid frames
pthread_mutex_lock(&internal->mutex);
bytesToCopy = internal->outputBufferByteCount;
bytesToCopy = internal->outputBufferByteCount/2;
validByteCount = internal->validByteCount;
outBuffer = (float *)outOutputData;
outBuffer = (float *)outOutputData->mBuffers[0].mData;
if (validByteCount < bytesToCopy && !internal->isStopping) {
// Not enough data ... let it build up a bit more before we start copying stuff over.
// If we are stopping, of course, we should just copy whatever we have.
......@@ -424,8 +429,8 @@ static OSStatus audioDeviceIOProc(AudioDeviceID inDevice, const AudioTimeStamp *
sample++;
}
pthread_cond_signal(&internal->condition);
pthread_mutex_unlock(&internal->mutex);
pthread_cond_signal(&internal->condition);
return 0;
}
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment