mirror of
https://github.com/mackron/miniaudio.git
synced 2026-04-24 01:04:02 +02:00
Initial work on a new job system for the high level API.
This new system is used for asynchronous decoding of sound data. The main improvement with this one over the old one is the ability to do multi-producer, multi-consumer lock-free posting of messages which means multiple threads can be used to process jobs simultaneously rather than a single thread processing all jobs serially. Decoding is inherently serial which means multiple job threads is only useful when decoding multiple sounds. Each individual sound will be decoded serially. Another change with this commit is the ability for applications to control whether or not the resource manager manages it's own job threads. This is useful if an application wants to manage the job queue themselves if, for example, they want to integrate it more closely with their existing job system.
This commit is contained in:
@@ -26,7 +26,7 @@ int main(int argc, char** argv)
|
|||||||
|
|
||||||
|
|
||||||
#if 1
|
#if 1
|
||||||
result = ma_engine_sound_init_from_file(&engine, argv[1], MA_DATA_SOURCE_FLAG_DECODE /*| MA_DATA_SOURCE_FLAG_ASYNC | MA_DATA_SOURCE_FLAG_STREAM*/, NULL, &sound);
|
result = ma_engine_sound_init_from_file(&engine, argv[1], MA_DATA_SOURCE_FLAG_DECODE | MA_DATA_SOURCE_FLAG_ASYNC | MA_DATA_SOURCE_FLAG_STREAM, NULL, &sound);
|
||||||
if (result != MA_SUCCESS) {
|
if (result != MA_SUCCESS) {
|
||||||
printf("Failed to load sound: %s\n", argv[1]);
|
printf("Failed to load sound: %s\n", argv[1]);
|
||||||
ma_engine_uninit(&engine);
|
ma_engine_uninit(&engine);
|
||||||
@@ -35,7 +35,7 @@ int main(int argc, char** argv)
|
|||||||
|
|
||||||
/*ma_data_source_seek_to_pcm_frame(sound.pDataSource, 5000000);*/
|
/*ma_data_source_seek_to_pcm_frame(sound.pDataSource, 5000000);*/
|
||||||
|
|
||||||
ma_engine_sound_set_volume(&engine, &sound, 0.25f);
|
/*ma_engine_sound_set_volume(&engine, &sound, 0.25f);*/
|
||||||
ma_engine_sound_set_pitch(&engine, &sound, 1.0f);
|
ma_engine_sound_set_pitch(&engine, &sound, 1.0f);
|
||||||
ma_engine_sound_set_pan(&engine, &sound, 0.0f);
|
ma_engine_sound_set_pan(&engine, &sound, 0.0f);
|
||||||
ma_engine_sound_set_looping(&engine, &sound, MA_TRUE);
|
ma_engine_sound_set_looping(&engine, &sound, MA_TRUE);
|
||||||
@@ -48,7 +48,7 @@ int main(int argc, char** argv)
|
|||||||
ma_engine_play_sound(&engine, argv[3], NULL);*/
|
ma_engine_play_sound(&engine, argv[3], NULL);*/
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if 1
|
#if 0
|
||||||
float pitch = 1;
|
float pitch = 1;
|
||||||
float pitchStep = 0.01f;
|
float pitchStep = 0.01f;
|
||||||
float pitchMin = 0.125f;
|
float pitchMin = 0.125f;
|
||||||
|
|||||||
+626
-777
File diff suppressed because it is too large
Load Diff
Reference in New Issue
Block a user