/** * Configures the volume setter for software mixing * and apply the default volume. * @note Audio output plugins that cannot apply the volume * should call this function during activation. */ void aout_VolumeSoftInit (audio_output_t *aout) { audio_volume_t volume = var_InheritInteger (aout, "volume"); bool mute = var_InheritBool (aout, "mute"); aout_assert_locked (aout); aout->pf_volume_set = aout_VolumeSoftSet; aout_VolumeSoftSet (aout, volume / (float)AOUT_VOLUME_DEFAULT, mute); }
/* Meant to be called by the output plug-in's Open(). */ void aout_VolumeSoftInit( aout_instance_t * p_aout ) { int i_volume; p_aout->output.pf_volume_get = aout_VolumeSoftGet; p_aout->output.pf_volume_set = aout_VolumeSoftSet; i_volume = config_GetInt( p_aout, "volume" ); if ( i_volume < AOUT_VOLUME_MIN ) { i_volume = AOUT_VOLUME_DEFAULT; } else if ( i_volume > AOUT_VOLUME_MAX ) { i_volume = AOUT_VOLUME_MAX; } aout_VolumeSoftSet( p_aout, (audio_volume_t)i_volume ); }