mirror of
https://github.com/mackron/miniaudio.git
synced 2026-04-23 16:54:03 +02:00
Rename some functions for consistency.
This commit is contained in:
+21
-2
@@ -28,7 +28,7 @@ int main(int argc, char** argv)
|
|||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
result = ma_engine_create_sound_from_file(&engine, argv[1], NULL, &sound);
|
result = ma_engine_sound_init_from_file(&engine, argv[1], NULL, &sound);
|
||||||
if (result != MA_SUCCESS) {
|
if (result != MA_SUCCESS) {
|
||||||
ma_engine_uninit(&engine);
|
ma_engine_uninit(&engine);
|
||||||
return -1;
|
return -1;
|
||||||
@@ -40,11 +40,30 @@ int main(int argc, char** argv)
|
|||||||
ma_engine_sound_start(&engine, &sound);
|
ma_engine_sound_start(&engine, &sound);
|
||||||
|
|
||||||
|
|
||||||
|
float pitch = 1;
|
||||||
|
float pitchStep = 0.01f;
|
||||||
|
float pitchMin = 0.125f;
|
||||||
|
float pitchMax = 8;
|
||||||
|
for (;;) {
|
||||||
|
pitch += pitchStep;
|
||||||
|
if (pitch < pitchMin) {
|
||||||
|
pitch = pitchMin;
|
||||||
|
pitchStep = -pitchStep;
|
||||||
|
}
|
||||||
|
if (pitch > pitchMax) {
|
||||||
|
pitch = pitchMax;
|
||||||
|
pitchStep = -pitchStep;
|
||||||
|
}
|
||||||
|
|
||||||
|
ma_engine_sound_set_pitch(&engine, &sound, pitch);
|
||||||
|
|
||||||
|
Sleep(1);
|
||||||
|
}
|
||||||
|
|
||||||
printf("Press Enter to quit...");
|
printf("Press Enter to quit...");
|
||||||
getchar();
|
getchar();
|
||||||
|
|
||||||
ma_engine_delete_sound(&engine, &sound);
|
ma_engine_sound_uninit(&engine, &sound);
|
||||||
ma_engine_uninit(&engine);
|
ma_engine_uninit(&engine);
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
|
|||||||
@@ -309,10 +309,10 @@ MA_API ma_result ma_engine_set_volume(ma_engine* pEngine, float volume);
|
|||||||
MA_API ma_result ma_engine_set_gain_db(ma_engine* pEngine, float gainDB);
|
MA_API ma_result ma_engine_set_gain_db(ma_engine* pEngine, float gainDB);
|
||||||
|
|
||||||
#ifndef MA_NO_RESOURCE_MANAGER
|
#ifndef MA_NO_RESOURCE_MANAGER
|
||||||
MA_API ma_result ma_engine_create_sound_from_file(ma_engine* pEngine, const char* pFilePath, ma_sound_group* pGroup, ma_sound* pSound);
|
MA_API ma_result ma_engine_sound_init_from_file(ma_engine* pEngine, const char* pFilePath, ma_sound_group* pGroup, ma_sound* pSound);
|
||||||
#endif
|
#endif
|
||||||
MA_API ma_result ma_engine_create_sound_from_data_source(ma_engine* pEngine, ma_data_source* pDataSource, ma_sound_group* pGroup, ma_sound* pSound);
|
MA_API ma_result ma_engine_sound_init_from_data_source(ma_engine* pEngine, ma_data_source* pDataSource, ma_sound_group* pGroup, ma_sound* pSound);
|
||||||
MA_API void ma_engine_delete_sound(ma_engine* pEngine, ma_sound* pSound);
|
MA_API void ma_engine_sound_uninit(ma_engine* pEngine, ma_sound* pSound);
|
||||||
MA_API ma_result ma_engine_sound_start(ma_engine* pEngine, ma_sound* pSound);
|
MA_API ma_result ma_engine_sound_start(ma_engine* pEngine, ma_sound* pSound);
|
||||||
MA_API ma_result ma_engine_sound_stop(ma_engine* pEngine, ma_sound* pSound);
|
MA_API ma_result ma_engine_sound_stop(ma_engine* pEngine, ma_sound* pSound);
|
||||||
MA_API ma_result ma_engine_sound_set_volume(ma_engine* pEngine, ma_sound* pSound, float volume);
|
MA_API ma_result ma_engine_sound_set_volume(ma_engine* pEngine, ma_sound* pSound, float volume);
|
||||||
@@ -1089,7 +1089,7 @@ MA_API ma_result ma_engine_set_gain_db(ma_engine* pEngine, float gainDB)
|
|||||||
|
|
||||||
|
|
||||||
#ifndef MA_NO_RESOURCE_MANAGER
|
#ifndef MA_NO_RESOURCE_MANAGER
|
||||||
MA_API ma_result ma_engine_create_sound_from_file(ma_engine* pEngine, const char* pFilePath, ma_sound_group* pGroup, ma_sound* pSound)
|
MA_API ma_result ma_engine_sound_init_from_file(ma_engine* pEngine, const char* pFilePath, ma_sound_group* pGroup, ma_sound* pSound)
|
||||||
{
|
{
|
||||||
ma_result result;
|
ma_result result;
|
||||||
ma_data_source* pDataSource;
|
ma_data_source* pDataSource;
|
||||||
@@ -1111,7 +1111,7 @@ MA_API ma_result ma_engine_create_sound_from_file(ma_engine* pEngine, const char
|
|||||||
}
|
}
|
||||||
|
|
||||||
/* Now that we have our data source we can create the sound using our generic function. */
|
/* Now that we have our data source we can create the sound using our generic function. */
|
||||||
result = ma_engine_create_sound_from_data_source(pEngine, pDataSource, pGroup, pSound);
|
result = ma_engine_sound_init_from_data_source(pEngine, pDataSource, pGroup, pSound);
|
||||||
if (result != MA_SUCCESS) {
|
if (result != MA_SUCCESS) {
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
@@ -1526,7 +1526,7 @@ static ma_result ma_engine_effect_reinit(ma_engine* pEngine, ma_engine_effect* p
|
|||||||
return ma_engine_effect_init(pEngine, pEffect);
|
return ma_engine_effect_init(pEngine, pEffect);
|
||||||
}
|
}
|
||||||
|
|
||||||
MA_API ma_result ma_engine_create_sound_from_data_source(ma_engine* pEngine, ma_data_source* pDataSource, ma_sound_group* pGroup, ma_sound* pSound)
|
MA_API ma_result ma_engine_sound_init_from_data_source(ma_engine* pEngine, ma_data_source* pDataSource, ma_sound_group* pGroup, ma_sound* pSound)
|
||||||
{
|
{
|
||||||
ma_result result;
|
ma_result result;
|
||||||
|
|
||||||
@@ -1561,7 +1561,7 @@ MA_API ma_result ma_engine_create_sound_from_data_source(ma_engine* pEngine, ma_
|
|||||||
return MA_SUCCESS;
|
return MA_SUCCESS;
|
||||||
}
|
}
|
||||||
|
|
||||||
MA_API void ma_engine_delete_sound(ma_engine* pEngine, ma_sound* pSound)
|
MA_API void ma_engine_sound_uninit(ma_engine* pEngine, ma_sound* pSound)
|
||||||
{
|
{
|
||||||
ma_result result;
|
ma_result result;
|
||||||
|
|
||||||
@@ -1798,7 +1798,7 @@ MA_API ma_result ma_engine_play_sound(ma_engine* pEngine, const char* pFilePath,
|
|||||||
result = ma_engine_effect_reinit(pEngine, &pSound->effect);
|
result = ma_engine_effect_reinit(pEngine, &pSound->effect);
|
||||||
if (result != MA_SUCCESS) {
|
if (result != MA_SUCCESS) {
|
||||||
/* We failed to reinitialize the effect. The sound is currently in a bad state and we need to delete it and return an error. Should never happen. */
|
/* We failed to reinitialize the effect. The sound is currently in a bad state and we need to delete it and return an error. Should never happen. */
|
||||||
ma_engine_delete_sound(pEngine, pSound);
|
ma_engine_sound_uninit(pEngine, pSound);
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1811,7 +1811,7 @@ MA_API ma_result ma_engine_play_sound(ma_engine* pEngine, const char* pFilePath,
|
|||||||
return MA_OUT_OF_MEMORY;
|
return MA_OUT_OF_MEMORY;
|
||||||
}
|
}
|
||||||
|
|
||||||
result = ma_engine_create_sound_from_file(pEngine, pFilePath, pGroup, pSound);
|
result = ma_engine_sound_init_from_file(pEngine, pFilePath, pGroup, pSound);
|
||||||
if (result != MA_SUCCESS) {
|
if (result != MA_SUCCESS) {
|
||||||
ma__free_from_callbacks(pEngine, &pEngine->allocationCallbacks);
|
ma__free_from_callbacks(pEngine, &pEngine->allocationCallbacks);
|
||||||
return result;
|
return result;
|
||||||
|
|||||||
Reference in New Issue
Block a user