mirror of
https://github.com/mackron/miniaudio.git
synced 2026-04-22 00:06:59 +02:00
Add support for fading in to sound groups.
This commit is contained in:
@@ -37,6 +37,7 @@ int main(int argc, char** argv)
|
||||
|
||||
//ma_engine_sound_group_set_pan(&engine, NULL, -1);
|
||||
ma_engine_sound_group_set_pitch(&engine, NULL, 1.0f);
|
||||
ma_engine_sound_group_set_fade_in(&engine, NULL, 4000);
|
||||
|
||||
/*ma_engine_sound_set_volume(&engine, &sound, 0.25f);*/
|
||||
//ma_engine_sound_set_pitch(&engine, &sound, 2.0f);
|
||||
@@ -58,7 +59,7 @@ int main(int argc, char** argv)
|
||||
ma_engine_play_sound(&engine, argv[3], NULL);*/
|
||||
#endif
|
||||
|
||||
#if 1
|
||||
#if 0
|
||||
float pitch = 1;
|
||||
float pitchStep = 0.01f;
|
||||
float pitchMin = 0.125f;
|
||||
|
||||
@@ -997,6 +997,7 @@ MA_API ma_result ma_engine_sound_group_set_gain_db(ma_engine* pEngine, ma_sound_
|
||||
MA_API ma_result ma_engine_sound_group_set_effect(ma_engine* pEngine, ma_sound_group* pGroup, ma_effect* pEffect);
|
||||
MA_API ma_result ma_engine_sound_group_set_pan(ma_engine* pEngine, ma_sound_group* pGroup, float pan);
|
||||
MA_API ma_result ma_engine_sound_group_set_pitch(ma_engine* pEngine, ma_sound_group* pGroup, float pitch);
|
||||
MA_API ma_result ma_engine_sound_group_set_fade_in(ma_engine* pEngine, ma_sound_group* pGroup, ma_uint64 fadeTimeInMilliseconds);
|
||||
|
||||
MA_API ma_result ma_engine_listener_set_position(ma_engine* pEngine, ma_vec3 position);
|
||||
MA_API ma_result ma_engine_listener_set_rotation(ma_engine* pEngine, ma_quat rotation);
|
||||
@@ -6554,6 +6555,19 @@ MA_API ma_result ma_engine_sound_group_set_pitch(ma_engine* pEngine, ma_sound_gr
|
||||
return MA_SUCCESS;
|
||||
}
|
||||
|
||||
MA_API ma_result ma_engine_sound_group_set_fade_in(ma_engine* pEngine, ma_sound_group* pGroup, ma_uint64 fadeTimeInMilliseconds)
|
||||
{
|
||||
if (pEngine == NULL) {
|
||||
return MA_INVALID_ARGS;
|
||||
}
|
||||
|
||||
if (pGroup == NULL) {
|
||||
pGroup = &pEngine->masterSoundGroup;
|
||||
}
|
||||
|
||||
return ma_dual_fader_set_fade(&pGroup->effect.fader, 0, 0, 1, pGroup->effect.fader.timeInFramesCur, pGroup->effect.fader.timeInFramesCur + (fadeTimeInMilliseconds * pGroup->effect.fader.config.sampleRate) / 1000);
|
||||
}
|
||||
|
||||
|
||||
MA_API ma_result ma_engine_listener_set_position(ma_engine* pEngine, ma_vec3 position)
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user