Make ma_sound_init_copy() more generic.

The copying of the data source is now done generically through the new
data source copying system rather than being restricted to just the
resource manager.
This commit is contained in:
David Reid
2026-04-29 10:51:27 +10:00
parent f223d3e315
commit 50fcc2f41f
2 changed files with 51 additions and 35 deletions
+21
View File
@@ -76,6 +76,7 @@ int main(int argc, char** argv)
ma_engine_start(&engine);
/* Rapidly create and delete sounds. */
#if 1
{
ma_sound* pSound = NULL;
ma_uint32 soundCount = 10;
@@ -124,6 +125,26 @@ int main(int argc, char** argv)
}
sounds.clear();
}
#else
{
ma_sound baseSound;
result = ma_sound_init_from_file(&engine, pFilePaths[0], MA_SOUND_FLAG_DECODE | MA_SOUND_FLAG_ASYNC, NULL, NULL, &baseSound);
if (result == MA_SUCCESS) {
ma_sound copiedSound;
result = ma_sound_init_copy(&engine, &baseSound, 0, NULL, NULL, &copiedSound);
if (result != MA_SUCCESS) {
printf("Failed to copy sound.\n");
}
ma_sound_start(&copiedSound);
ma_sleep(5000);
ma_sound_uninit(&copiedSound);
}
}
#endif
ma_engine_uninit(&engine);