mirror of
https://github.com/mackron/miniaudio.git
synced 2026-04-23 08:44:04 +02:00
Rename some APIs.
* ma_engine_sound_*() renamed to ma_sound_*(). * ma_engine_sound_group_*() renamed to ma_sound_group_*().
This commit is contained in:
+20
-20
@@ -22,8 +22,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_engine_sound_get_length_in_pcm_frames(pLoadedNotification->pEngine, pLoadedNotification->pSound, &lengthInPCMFrames);
|
||||
ma_engine_sound_set_fade_point_in_frames(pLoadedNotification->pEngine, pLoadedNotification->pSound, 1, 1, 0, lengthInPCMFrames - 192000, lengthInPCMFrames);
|
||||
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);
|
||||
}
|
||||
|
||||
int main(int argc, char** argv)
|
||||
@@ -50,7 +50,7 @@ int main(int argc, char** argv)
|
||||
loadNotification.pEngine = &engine;
|
||||
loadNotification.pSound = &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, &loadNotification, NULL, &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);
|
||||
@@ -59,24 +59,24 @@ int main(int argc, char** argv)
|
||||
|
||||
/*ma_data_source_seek_to_pcm_frame(sound.pDataSource, 5000000);*/
|
||||
|
||||
//ma_engine_sound_group_set_pan(&engine, NULL, -1);
|
||||
//ma_engine_sound_group_set_pitch(&engine, NULL, 1.0f);
|
||||
//ma_engine_sound_group_set_start_delay(&engine, NULL, 2000);
|
||||
//ma_sound_group_set_pan(&engine, NULL, -1);
|
||||
//ma_sound_group_set_pitch(&engine, NULL, 1.0f);
|
||||
//ma_sound_group_set_start_delay(&engine, NULL, 2000);
|
||||
|
||||
/*ma_engine_sound_set_volume(&engine, &sound, 0.25f);*/
|
||||
//ma_engine_sound_set_pitch(&engine, &sound, 2.0f);
|
||||
ma_engine_sound_set_pan(&engine, &sound, 0.0f);
|
||||
ma_engine_sound_set_looping(&engine, &sound, MA_TRUE);
|
||||
//ma_engine_sound_seek_to_pcm_frame(&engine, &sound, 6000000);
|
||||
//ma_engine_sound_set_start_delay(&engine, &sound, 1110);
|
||||
ma_engine_sound_set_fade_point_in_milliseconds(&engine, &sound, 0, 0, 1, 0, 2000);
|
||||
ma_engine_sound_set_stop_delay(&engine, &sound, 1000);
|
||||
ma_engine_sound_start(&engine, &sound);
|
||||
/*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_sleep(2000);
|
||||
printf("Stopping...\n");
|
||||
ma_engine_sound_stop(&engine, &sound);
|
||||
//ma_engine_sound_group_stop(&engine, NULL);
|
||||
ma_sound_stop(&engine, &sound);
|
||||
//ma_sound_group_stop(&engine, NULL);
|
||||
#endif
|
||||
|
||||
#if 1
|
||||
@@ -101,8 +101,8 @@ int main(int argc, char** argv)
|
||||
pitchStep = -pitchStep;
|
||||
}
|
||||
|
||||
//ma_engine_sound_group_set_pitch(&engine, NULL, pitch);
|
||||
ma_engine_sound_set_pitch(&engine, &sound, pitch);
|
||||
//ma_sound_group_set_pitch(&engine, NULL, pitch);
|
||||
ma_sound_set_pitch(&engine, &sound, pitch);
|
||||
printf("Pitch: %f\n", pitch);
|
||||
|
||||
ma_sleep(1);
|
||||
@@ -112,7 +112,7 @@ int main(int argc, char** argv)
|
||||
printf("Press Enter to quit...");
|
||||
getchar();
|
||||
|
||||
ma_engine_sound_uninit(&engine, &sound);
|
||||
ma_sound_uninit(&engine, &sound);
|
||||
ma_engine_uninit(&engine);
|
||||
|
||||
return 0;
|
||||
|
||||
Reference in New Issue
Block a user