Begin work on integrating the engine with the routing system.

This commit has known issues which will be fixed in the next commits.
This commit is contained in:
David Reid
2021-01-10 19:48:24 +10:00
parent 67863c48f3
commit d72b6f1dca
2 changed files with 363 additions and 217 deletions
+12 -8
View File
@@ -54,7 +54,8 @@ int main(int argc, char** argv)
}
resourceManagerConfig = ma_resource_manager_config_init();
//resourceManagerConfig.decodedFormat = ma_format_s16;
resourceManagerConfig.decodedFormat = ma_format_f32;
resourceManagerConfig.decodedChannels = 2;
resourceManagerConfig.decodedSampleRate = 48000;
result = ma_resource_manager_init(&resourceManagerConfig, &resourceManager);
if (result != MA_SUCCESS) {
@@ -71,18 +72,20 @@ int main(int argc, char** argv)
return -1;
}
result = ma_sound_group_init(&engine, NULL, &group);
#if 0
result = ma_sound_group_init(&engine, 0, NULL, &group);
if (result != MA_SUCCESS) {
printf("Failed to initialize sound group.");
return -1;
}
#endif
#if 1
loadNotification.cb.onSignal = on_sound_loaded;
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, &group, &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) {
printf("Failed to load sound: %s\n", argv[1]);
ma_engine_uninit(&engine);
@@ -103,13 +106,13 @@ int main(int argc, char** argv)
//ma_sound_group_set_pan(ma_engine_get_master_sound_group(&engine), -1);
//ma_sound_group_set_pitch(ma_engine_get_master_sound_group(&engine), 1.0f);
//ma_sound_group_set_start_delay(ma_engine_get_master_sound_group(&engine), 2000);
ma_sound_group_set_fade_in_milliseconds(&group, 0, 1, 5000);
//ma_sound_group_set_fade_in_milliseconds(&group, 0, 1, 5000);
//ma_sound_set_fade_in_milliseconds(&sound, 0, 1, 5000);
/*ma_sound_set_volume(&sound, 0.25f);*/
//ma_sound_set_pitch(&sound, 2.0f);
ma_sound_set_pan(&sound, 0.0f);
/*ma_sound_set_pitch(&sound, 1.2f);*/
/*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);
@@ -118,6 +121,7 @@ int main(int argc, char** argv)
//ma_sound_set_fade_point_auto_reset(&sound, 0, MA_FALSE); /* Enable fading around loop transitions. */
//ma_sound_set_fade_point_auto_reset(&sound, 1, MA_FALSE);
//ma_sound_set_stop_delay(&sound, 1000);
//ma_sound_set_volume(&sound, 1);
ma_sound_start(&sound);
//ma_sleep(1000);
@@ -137,11 +141,11 @@ int main(int argc, char** argv)
ma_engine_play_sound(&engine, argv[3], NULL);*/
#endif
#if 0
#if 1
float pitch = 1;
float pitchStep = 0.01f;
float pitchMin = 0.125f;
float pitchMax = 8;
float pitchMax = 2;
for (;;) {
pitch += pitchStep;
if (pitch < pitchMin) {