Note that there are some explanatory texts on larger screens.

plurals
  1. POAudio buffer size is incorrect on a mac
    text
    copied!<p>After a while,developing with the audio unit, i know there is some bug that is well known to devs who works with audio buffers in low level .</p> <p>The bug is that the buffer size on a mac is wrong and show 512, instead of 1024 , where the same software on a iDevice , shows 1024 .</p> <p>Question is , there is a way to solve that so i can get on a mac also 1024 bits buffer? its a little bit hard to work like that, because simulation is different from device.</p> <p>This is the callback function where i check the buffer from the mic input :</p> <pre><code>static OSStatus recordingCallback(void *inRefCon, AudioUnitRenderActionFlags *ioActionFlags, const AudioTimeStamp *inTimeStamp, UInt32 inBusNumber, UInt32 inNumberFrames, AudioBufferList *ioData) { AudioBuffer buffer; buffer.mNumberChannels = 1; buffer.mDataByteSize = inNumberFrames * 2; buffer.mData = NULL; AudioBufferList bufferList; bufferList.mNumberBuffers = 1; bufferList.mBuffers[0] = buffer; OSStatus status; status = AudioUnitRender(audioUnit, ioActionFlags, inTimeStamp, inBusNumber, inNumberFrames, &amp;bufferList); int16_t *q = (int16_t *)(&amp;bufferList)-&gt;mBuffers[0].mData; // inNumberFrames, is 512 on a mac ,and 1024 on a device </code></pre> <p>(speaker output callback is the same by the way=512 bits).</p> <p>A part of the setting of the audio unit :</p> <pre><code>AudioStreamBasicDescription audioFormat; audioFormat.mSampleRate = 44100.00;//44100.00; audioFormat.mFormatID = kAudioFormatLinearPCM; audioFormat.mFormatFlags = kAudioFormatFlagIsSignedInteger | kAudioFormatFlagIsPacked; audioFormat.mFramesPerPacket = 1; audioFormat.mChannelsPerFrame = 1; audioFormat.mBitsPerChannel = 16; audioFormat.mBytesPerPacket = 2; audioFormat.mBytesPerFrame = 2; </code></pre> <p>Well i found here that someone say you have to set on the mac (retina is mine) the sample rate in the midi tool , i check it out but its 44100 in there . the chanels are 24 bit, i was trying with 16 bits but no good result . still 512 bits buffer size on my mac. I have a mac retina display 2012.</p>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload