Add more volume options

Added a "master" volume for the entire audio subsystem.

Also, added a "presentation" volume for both the master volume and for
each invidiaul source.  The presentation volume is used to control
things like transitioning volumes, preventing sources from outputting
any audio when they're inactive, as well as some other uses in the
future.
This commit is contained in:
jp9000
2014-02-20 15:53:16 -07:00
parent 27b851c06e
commit 579f026c5b
5 changed files with 66 additions and 9 deletions

View File

@@ -314,6 +314,9 @@ static bool obs_init_audio(struct audio_output_info *ai)
/* TODO: sound subsystem */
audio->user_volume = 1.0f;
audio->present_volume = 1.0f;
errorcode = audio_output_open(&audio->audio, ai);
if (errorcode == AUDIO_OUTPUT_SUCCESS)
return true;
@@ -790,3 +793,25 @@ void obs_render_main_view(void)
if (!obs) return;
obs_view_render(&obs->data.main_view);
}
void obs_set_master_volume(float volume)
{
if (!obs) return;
obs->audio.user_volume = volume;
}
void obs_set_present_volume(float volume)
{
if (!obs) return;
obs->audio.present_volume = volume;
}
float obs_get_master_volume(void)
{
return obs ? obs->audio.user_volume : 0.0f;
}
float obs_get_present_volume(void)
{
return obs ? obs->audio.present_volume : 0.0f;
}