Remove the pEngine parameter from all ma_sound_*() APIs.

This commit is contained in:
David Reid
2020-08-23 10:18:03 +10:00
parent fd1ca85219
commit 0c410b0fdc
2 changed files with 556 additions and 543 deletions
+15 -17
View File
@@ -9,7 +9,6 @@
typedef struct
{
ma_async_notification_callbacks cb;
ma_engine* pEngine;
ma_sound* pSound;
} sound_loaded_notification;
@@ -22,8 +21,8 @@ void on_sound_loaded(ma_async_notification* pNotification)
This will be fired when the sound has finished loading. We should be able to retrieve the length of the sound at this point. Here we'll just set
the fade out time.
*/
ma_sound_get_length_in_pcm_frames(pLoadedNotification->pEngine, pLoadedNotification->pSound, &lengthInPCMFrames);
ma_sound_set_fade_point_in_frames(pLoadedNotification->pEngine, pLoadedNotification->pSound, 1, 1, 0, lengthInPCMFrames - 192000, lengthInPCMFrames);
ma_sound_get_length_in_pcm_frames(pLoadedNotification->pSound, &lengthInPCMFrames);
ma_sound_set_fade_point_in_frames(pLoadedNotification->pSound, 1, 1, 0, lengthInPCMFrames - 192000, lengthInPCMFrames);
}
int main(int argc, char** argv)
@@ -47,8 +46,7 @@ int main(int argc, char** argv)
#if 1
loadNotification.pEngine = &engine;
loadNotification.pSound = &sound;
loadNotification.pSound = &sound;
result = ma_sound_init_from_file(&engine, argv[1], MA_DATA_SOURCE_FLAG_DECODE | MA_DATA_SOURCE_FLAG_ASYNC | MA_DATA_SOURCE_FLAG_STREAM, &loadNotification, NULL, &sound);
if (result != MA_SUCCESS) {
@@ -63,19 +61,19 @@ int main(int argc, char** argv)
//ma_sound_group_set_pitch(&engine, NULL, 1.0f);
//ma_sound_group_set_start_delay(&engine, NULL, 2000);
/*ma_sound_set_volume(&engine, &sound, 0.25f);*/
//ma_sound_set_pitch(&engine, &sound, 2.0f);
ma_sound_set_pan(&engine, &sound, 0.0f);
ma_sound_set_looping(&engine, &sound, MA_TRUE);
//ma_sound_seek_to_pcm_frame(&engine, &sound, 6000000);
//ma_sound_set_start_delay(&engine, &sound, 1110);
ma_sound_set_fade_point_in_milliseconds(&engine, &sound, 0, 0, 1, 0, 2000);
ma_sound_set_stop_delay(&engine, &sound, 1000);
ma_sound_start(&engine, &sound);
/*ma_sound_set_volume(&sound, 0.25f);*/
//ma_sound_set_pitch(&sound, 2.0f);
ma_sound_set_pan(&sound, 0.0f);
ma_sound_set_looping(&sound, MA_TRUE);
//ma_sound_seek_to_pcm_frame(&sound, 6000000);
//ma_sound_set_start_delay(&sound, 1110);
ma_sound_set_fade_point_in_milliseconds(&sound, 0, 0, 1, 0, 2000);
ma_sound_set_stop_delay(&sound, 1000);
ma_sound_start(&sound);
ma_sleep(2000);
printf("Stopping...\n");
ma_sound_stop(&engine, &sound);
ma_sound_stop(&sound);
//ma_sound_group_stop(&engine, NULL);
#endif
@@ -102,7 +100,7 @@ int main(int argc, char** argv)
}
//ma_sound_group_set_pitch(&engine, NULL, pitch);
ma_sound_set_pitch(&engine, &sound, pitch);
ma_sound_set_pitch(&sound, pitch);
printf("Pitch: %f\n", pitch);
ma_sleep(1);
@@ -112,7 +110,7 @@ int main(int argc, char** argv)
printf("Press Enter to quit...");
getchar();
ma_sound_uninit(&engine, &sound);
ma_sound_uninit(&sound);
ma_engine_uninit(&engine);
return 0;
+541 -526
View File
File diff suppressed because it is too large Load Diff