Commit 1387f38f authored by Rémi Denis-Courmont's avatar Rémi Denis-Courmont

aout: add option to initialize hardware volume

parent 9df888d6
......@@ -221,7 +221,7 @@ VLC_API const char * aout_FormatPrintChannels( const audio_sample_format_t * ) V
VLC_API void aout_VolumeNoneInit( audio_output_t * );
VLC_API void aout_VolumeSoftInit( audio_output_t * );
VLC_API void aout_VolumeHardInit( audio_output_t *, aout_volume_cb );
VLC_API void aout_VolumeHardInit( audio_output_t *, aout_volume_cb, bool );
VLC_API void aout_VolumeHardSet( audio_output_t *, float, bool );
VLC_API void aout_TimeReport(audio_output_t *, mtime_t);
......
......@@ -560,12 +560,7 @@ static int OpenAnalog( audio_output_t *p_aout )
/* Do the last VLC aout setups */
aout_FormatPrepare( &p_aout->format );
aout_PacketInit( p_aout, &p_sys->packet, FRAMESIZE );
aout_VolumeHardInit( p_aout, VolumeSet );
/* Initialize starting volume */
audio_volume_t volume = var_InheritInteger (p_aout, "volume");
bool mute = var_InheritBool (p_aout, "mute");
VolumeSet(p_aout, volume / (float)AOUT_VOLUME_DEFAULT, mute);
aout_VolumeHardInit( p_aout, VolumeSet, true );
/* set the IOproc callback */
input.inputProc = (AURenderCallback) RenderCallbackAnalog;
......
......@@ -947,7 +947,7 @@ static int Open(vlc_object_t *obj)
aout->pf_play = Play;
aout->pf_pause = Pause;
aout->pf_flush = Flush;
aout_VolumeHardInit (aout, VolumeSet);
aout_VolumeHardInit (aout, VolumeSet, false);
return VLC_SUCCESS;
fail:
......
......@@ -296,7 +296,7 @@ static int Open( vlc_object_t *p_this )
if( waveOutGetDevCaps( (UINT_PTR)p_aout->sys->h_waveout,
&wocaps, sizeof(wocaps) ) == MMSYSERR_NOERROR
&& (wocaps.dwSupport & WAVECAPS_VOLUME) )
aout_VolumeHardInit( p_aout, VolumeSet );
aout_VolumeHardInit( p_aout, VolumeSet, false /* ?? */ );
else
aout_VolumeSoftInit( p_aout );
}
......
......@@ -334,13 +334,22 @@ void aout_VolumeSoftInit (audio_output_t *aout)
* Configures a custom volume setter. This is used by audio outputs that can
* control the hardware volume directly and/or emulate it internally.
* @param setter volume setter callback
* @param restore apply volume from VLC configuration immediately
*/
void aout_VolumeHardInit (audio_output_t *aout, aout_volume_cb setter)
void aout_VolumeHardInit (audio_output_t *aout, aout_volume_cb setter,
bool restore)
{
aout_assert_locked (aout);
aout->pf_volume_set = setter;
var_Create (aout, "volume", VLC_VAR_INTEGER|VLC_VAR_DOINHERIT);
var_Create (aout, "mute", VLC_VAR_BOOL|VLC_VAR_DOINHERIT);
if (restore)
{
float vol = var_InheritInteger (aout, "volume")
/ (float)AOUT_VOLUME_DEFAULT;
setter (aout, vol, var_InheritBool (aout, "mute"));
}
}
/**
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment