MA_APIma_resultma_paged_audio_buffer_read_pcm_frames(ma_paged_audio_buffer*pPagedAudioBuffer,void*pFramesOut,ma_uint64frameCount,ma_uint64*pFramesRead);/* Returns MA_AT_END if no more pages available. */
ma_bool32isUnknownLength;/* When set to true does not update the running frame count of the data buffer nor the data pointer until the last page has been decoded. */
if(frameIndex<pageRangeEnd||(frameIndex==pageRangeEnd&&pPage==(ma_paged_audio_buffer_page*)c89atomic_load_ptr(ma_paged_audio_buffer_data_get_tail(pPagedAudioBuffer->pData)))){/* A small edge case - allow seeking to the very end of the buffer. */
pageDataBufferJob.pageDataBuffer.pInitNotification=NULL;/* <-- Clear this notification to NULL to ensure it's not signalled a second time at the end of decoding, which will be done for sounds of unknown length. */
pageDataBufferJob.pageDataBuffer.pInitNotification=pJob->loadDataBuffer.pInitNotification;/* <-- Set this to the init notification so that the PAGE_DATA_BUFFER job can signal it at the end of decoding. Only needed for sounds of unknown length. */
/* The length is unknown. Need to use a paged buffer. */
result=MA_AT_END;/* We don't have a destination buffer which means we probably ran out of memory in ma_paged_audio_buffer_allocate_page(). Just terminate decoding by pretending we're at the end. */
}
/* Make sure the page is attached to the buffer if we're running a paged audio buffer. */
/* When the length is unknown we were doubling the size of the buffer each time we needed more data. Let's try reducing this by doing a final realloc(). */
/* If it was an unknown length, we can finally initialize the connector. For sounds of a known length, the connector was initialized when the first page was decoded in MA_JOB_LOAD_DATA_BUFFER. */
/* We need to set the status of the page so other things can know about it. We can only change the status away from MA_BUSY. If it's anything else it cannot be changed. */