質問

i am using AudioQueues to get Chunks of audio samples.

here is my callback method

void AQRecorder::MyInputBufferHandler(  void *                              inUserData,
                                    AudioQueueRef                       inAQ,
                                    AudioQueueBufferRef                 inBuffer,
                                    const AudioTimeStamp *              inStartTime,
                                    UInt32                              inNumPackets,
                                    const AudioStreamPacketDescription* inPacketDesc)

there is api which expect me to send byte array (that i am not familiar with) which variable should i send in this case?

there is not a lot of docs about this one

役に立ちましたか?

解決

The mDataByteSize element of the C struct pointed to by inPacketDesc will tell you the number of bytes per packet. And the inNumPackets function parameter is the number of packets sent to your Audio Queue callback function. Multiply the two to get the total number of bytes to send.

The app might also have set up the number of bytes per packet when configuring the Audio Queue, so you could just use that number.

ライセンス: CC-BY-SA帰属
所属していません StackOverflow
scroll top