This is uninitializing the ring buffer before the device which results
in a situation where a stray data callback may try touching the buffer
after it's be uninitialized.
This updates ma_linear_resampler_get_expected_output_frame_count() to
calculate the expected output frame count in constant time rather than
linear time. This should improve performances of anything using
ma_calculate_frame_count_after_resampling() which includes
ma_decoder_get_length_in_pcm_frames().
When a decoding backend is not present, initialization should abort
immediately with MA_NO_BACKEND, however it is including code for no
reason. This commit excludes that useless code from the build.
The thread priority can be set via ma_thread_create() and can be set in
the context config along side the thread priority for configuring the
size of the stack for the audio thread.
A streaming data source keeps in memory only two pages of audio data
and dynamically loads data from a background thread. It is essentially
a double buffering system - as one page is playing, the other is being
loaded by the async thread.
The size of a single page is defined by the following macro:
MA_RESOURCE_MANAGER_PAGE_SIZE_IN_MILLISECONDS
By default this is currently set to 1 second of audio data. This means
each page has 1 second to load which should be plenty of time. If you
need additional time, the only way to do it is increase the size of the
page by changing the value of the above macro.
* ma_resource_manager_uninit() has been implemented.
* Bug fixes and inserting and removing data buffers from the BST.
* Some old experimental code has been removed.
* Minor whitespace clean up.
This enables early playback of the sound while the remainder of the
sound is loaded in the background. When the first page is loaded, the
sound can start playback. While it's playing, the rest of the sound is
loaded in a background thread. In addition, sounds no longer need to
wait for every sound prior to it in the queue to fully decode before it
is able to start - it only needs to wait for the first page of each of
the queued sounds to decode. This enables much fairer prioritization of
asynchronously loaded sounds.
This paged decoding system is *not* a true streaming solution for long
sounds. Support for true streaming will be added in future commits.
This commit is only concerned with filling in-memory buffers containing
the whole sound in an asynchronous manner.