Work in progress on the new high level API.

* Early work on asynchronously decoding into a memory buffer. This is
    just an early implementation - there are still issues needing to be
    figured out. In particular, sounds do not automatically start until
    the entire file has been decoded. It would be good if they could
    start as soon as the first second or so of data has been decoded.
This commit is contained in:
David Reid
2020-06-10 22:07:16 +10:00
parent 86181dfac8
commit 8734e8f578
3 changed files with 1364 additions and 658 deletions
+6 -3
View File
@@ -28,20 +28,23 @@ int main(int argc, char** argv)
return -1;
}
result = ma_engine_sound_init_from_file(&engine, argv[1], MA_DATA_SOURCE_FLAG_DECODE, NULL, &sound);
result = ma_engine_sound_init_from_file(&engine, argv[1], MA_DATA_SOURCE_FLAG_DECODE | MA_DATA_SOURCE_FLAG_ASYNC, NULL, &sound);
if (result != MA_SUCCESS) {
ma_engine_uninit(&engine);
return -1;
}
ma_engine_sound_set_volume(&engine, &sound, 0.25f);
ma_engine_sound_set_pitch(&engine, &sound, 1.0f);
ma_engine_sound_set_pan(&engine, &sound, -1.0f);
ma_engine_sound_set_pan(&engine, &sound, 0.0f);
ma_engine_sound_set_looping(&engine, &sound, MA_TRUE);
ma_engine_sound_start(&engine, &sound);
ma_engine_play_sound(&engine, argv[1], NULL);
#if 1
/*ma_engine_play_sound(&engine, argv[1], NULL);*/
ma_engine_play_sound(&engine, argv[2], NULL);
ma_engine_play_sound(&engine, argv[3], NULL);
#endif
#if 0
float pitch = 1;