简体   繁体   中英

how do you allocate memory for a buffer in iOS

I have an AudioQueueBufferRef datatype and I want to allocate memory for the buffers but I don't want to associate it with the queue. Hence, I can't use AudioQueueAllocateBufferWithPacketDescription. What is the general way of allocating memory to any buffer?

I tried malloc but it didn't work

        for(i=0;i<numBuffers;i++){
          AudBuf[i] = (AudioQueueBufferRef)malloc(sizeof(AudioQueueBuffer));

}

AudioQueueBuffer dummyAQB;
audioQueueBuffer = malloc(sizeof(dummyAQB)*kNumAQBufs);

看一下Apple的AudioFileStreamExample

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM