mirror of
https://github.com/mackron/miniaudio.git
synced 2026-04-24 01:04:02 +02:00
Remove the pEngine parameter from all ma_sound_*() APIs.
This commit is contained in:
+14
-16
@@ -9,7 +9,6 @@
|
|||||||
typedef struct
|
typedef struct
|
||||||
{
|
{
|
||||||
ma_async_notification_callbacks cb;
|
ma_async_notification_callbacks cb;
|
||||||
ma_engine* pEngine;
|
|
||||||
ma_sound* pSound;
|
ma_sound* pSound;
|
||||||
} sound_loaded_notification;
|
} 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
|
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.
|
the fade out time.
|
||||||
*/
|
*/
|
||||||
ma_sound_get_length_in_pcm_frames(pLoadedNotification->pEngine, pLoadedNotification->pSound, &lengthInPCMFrames);
|
ma_sound_get_length_in_pcm_frames(pLoadedNotification->pSound, &lengthInPCMFrames);
|
||||||
ma_sound_set_fade_point_in_frames(pLoadedNotification->pEngine, pLoadedNotification->pSound, 1, 1, 0, lengthInPCMFrames - 192000, lengthInPCMFrames);
|
ma_sound_set_fade_point_in_frames(pLoadedNotification->pSound, 1, 1, 0, lengthInPCMFrames - 192000, lengthInPCMFrames);
|
||||||
}
|
}
|
||||||
|
|
||||||
int main(int argc, char** argv)
|
int main(int argc, char** argv)
|
||||||
@@ -47,7 +46,6 @@ int main(int argc, char** argv)
|
|||||||
|
|
||||||
|
|
||||||
#if 1
|
#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);
|
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);
|
||||||
@@ -63,19 +61,19 @@ int main(int argc, char** argv)
|
|||||||
//ma_sound_group_set_pitch(&engine, NULL, 1.0f);
|
//ma_sound_group_set_pitch(&engine, NULL, 1.0f);
|
||||||
//ma_sound_group_set_start_delay(&engine, NULL, 2000);
|
//ma_sound_group_set_start_delay(&engine, NULL, 2000);
|
||||||
|
|
||||||
/*ma_sound_set_volume(&engine, &sound, 0.25f);*/
|
/*ma_sound_set_volume(&sound, 0.25f);*/
|
||||||
//ma_sound_set_pitch(&engine, &sound, 2.0f);
|
//ma_sound_set_pitch(&sound, 2.0f);
|
||||||
ma_sound_set_pan(&engine, &sound, 0.0f);
|
ma_sound_set_pan(&sound, 0.0f);
|
||||||
ma_sound_set_looping(&engine, &sound, MA_TRUE);
|
ma_sound_set_looping(&sound, MA_TRUE);
|
||||||
//ma_sound_seek_to_pcm_frame(&engine, &sound, 6000000);
|
//ma_sound_seek_to_pcm_frame(&sound, 6000000);
|
||||||
//ma_sound_set_start_delay(&engine, &sound, 1110);
|
//ma_sound_set_start_delay(&sound, 1110);
|
||||||
ma_sound_set_fade_point_in_milliseconds(&engine, &sound, 0, 0, 1, 0, 2000);
|
ma_sound_set_fade_point_in_milliseconds(&sound, 0, 0, 1, 0, 2000);
|
||||||
ma_sound_set_stop_delay(&engine, &sound, 1000);
|
ma_sound_set_stop_delay(&sound, 1000);
|
||||||
ma_sound_start(&engine, &sound);
|
ma_sound_start(&sound);
|
||||||
|
|
||||||
ma_sleep(2000);
|
ma_sleep(2000);
|
||||||
printf("Stopping...\n");
|
printf("Stopping...\n");
|
||||||
ma_sound_stop(&engine, &sound);
|
ma_sound_stop(&sound);
|
||||||
//ma_sound_group_stop(&engine, NULL);
|
//ma_sound_group_stop(&engine, NULL);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
@@ -102,7 +100,7 @@ int main(int argc, char** argv)
|
|||||||
}
|
}
|
||||||
|
|
||||||
//ma_sound_group_set_pitch(&engine, NULL, pitch);
|
//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);
|
printf("Pitch: %f\n", pitch);
|
||||||
|
|
||||||
ma_sleep(1);
|
ma_sleep(1);
|
||||||
@@ -112,7 +110,7 @@ int main(int argc, char** argv)
|
|||||||
printf("Press Enter to quit...");
|
printf("Press Enter to quit...");
|
||||||
getchar();
|
getchar();
|
||||||
|
|
||||||
ma_sound_uninit(&engine, &sound);
|
ma_sound_uninit(&sound);
|
||||||
ma_engine_uninit(&engine);
|
ma_engine_uninit(&engine);
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
|
|||||||
+541
-526
File diff suppressed because it is too large
Load Diff
Reference in New Issue
Block a user