summaryrefslogtreecommitdiffstats
path: root/libao2
diff options
context:
space:
mode:
authornplourde <nplourde@b3059339-0415-0410-9bf9-f77b7e298cf2>2005-07-19 14:36:13 +0000
committernplourde <nplourde@b3059339-0415-0410-9bf9-f77b7e298cf2>2005-07-19 14:36:13 +0000
commitf8f3683a37912bd9dc8a79dab2a88ef57810868a (patch)
tree5a39599b7ec6ba288090eba4dc22e201135fab68 /libao2
parentc0a4d944688eb159517aa0666043236e0ad87311 (diff)
downloadmpv-f8f3683a37912bd9dc8a79dab2a88ef57810868a.tar.bz2
mpv-f8f3683a37912bd9dc8a79dab2a88ef57810868a.tar.xz
remove delay when setting audio volume
git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@16015 b3059339-0415-0410-9bf9-f77b7e298cf2
Diffstat (limited to 'libao2')
-rw-r--r--libao2/ao_macosx.c20
1 files changed, 9 insertions, 11 deletions
diff --git a/libao2/ao_macosx.c b/libao2/ao_macosx.c
index b51040bee2..6017242146 100644
--- a/libao2/ao_macosx.c
+++ b/libao2/ao_macosx.c
@@ -224,7 +224,6 @@ int aoIsCreated = ao != NULL;
if (!aoIsCreated) ao = (ao_macosx_t *)malloc(sizeof(ao_macosx_t));
// Build Description for the input format
- memset(&inDesc, 0, sizeof(AudioStreamBasicDescription));
inDesc.mSampleRate=rate;
inDesc.mFormatID=kAudioFormatLinearPCM;
inDesc.mChannelsPerFrame=channels;
@@ -302,19 +301,19 @@ int aoIsCreated = ao != NULL;
return CONTROL_FALSE;
}
- size=sizeof(UInt32);
- maxFrames=8192; // This was calculated empirically. On MY system almost everything works more or less the same...
- err = AudioUnitSetProperty(ao->theOutputUnit, kAudioUnitProperty_MaximumFramesPerSlice, kAudioUnitScope_Input, 0, &maxFrames, size);
+ size = sizeof(UInt32);
+ err = AudioUnitGetProperty(ao->theOutputUnit, kAudioDevicePropertyBufferSize, kAudioUnitScope_Input, 0, &maxFrames, &size);
- if(err) {
- ao_msg(MSGT_AO, MSGL_WARN, "Unable to set the maximum number of frames per slice!! (err=%d)\n", err);
+ if (err)
+ {
+ ao_msg(MSGT_AO,MSGL_WARN, "AudioUnitGetProperty returned %d when getting kAudioDevicePropertyBufferSize\n", (int)err);
return CONTROL_FALSE;
}
-
- ao_msg(MSGT_AO, MSGL_DBG2, "Maximum number of frames per request %d (that is %d bytes)", err, maxFrames, maxFrames*inDesc.mBytesPerFrame);
- ao->chunk_size = maxFrames*inDesc.mBytesPerFrame;
- ao->num_chunks = NUM_BUFS;
+ ao->chunk_size = maxFrames;//*inDesc.mBytesPerFrame;
+ ao_msg(MSGT_AO,MSGL_V, "%5d chunk size\n", (int)ao->chunk_size);
+
+ ao->num_chunks = NUM_BUFS;
ao->buffer_len = (ao->num_chunks + 1) * ao->chunk_size;
ao->buffer = aoIsCreated ? (unsigned char *)realloc(ao->buffer,(ao->num_chunks + 1)*ao->chunk_size)
: (unsigned char *)calloc(ao->num_chunks + 1, ao->chunk_size);
@@ -324,7 +323,6 @@ int aoIsCreated = ao != NULL;
ao_data.outburst = ao_data.buffersize = ao->chunk_size;
ao_data.bps = ao_data.samplerate * inDesc.mBytesPerFrame;
- memset(&renderCallback, 0, sizeof(AURenderCallbackStruct));
renderCallback.inputProc = theRenderProc;
renderCallback.inputProcRefCon = 0;
err = AudioUnitSetProperty(ao->theOutputUnit, kAudioUnitProperty_SetRenderCallback, kAudioUnitScope_Input, 0, &renderCallback, sizeof(AURenderCallbackStruct));