Commit 0c3c36fd authored by Rémi Denis-Courmont's avatar Rémi Denis-Courmont

aout: implement changing of software gain while not playing

This concerns ALSA, AudioQueue, JACK and KAI.
parent b1c459e9
......@@ -531,6 +531,7 @@ static int Start (audio_output_t *aout, audio_sample_format_t *restrict fmt)
var_AddCallback (aout, "audio-device", DeviceChanged, NULL);
free (device);
aout_SoftVolumeStart (aout);
return 0;
error:
......
......@@ -126,6 +126,7 @@ static int Start( audio_output_t *aout, audio_sample_format_t *restrict fmt )
p_aout->play = aout_PacketPlay;
p_aout->pause = aout_PacketPause;
p_aout->flush = aout_PacketFlush;
aout_SoftVolumeStart(p_aout);
msg_Dbg(p_aout, "Starting AudioQueue (status = %i)", status);
status = AudioQueueStart(p_sys->audioQueue, NULL);
......
......@@ -137,7 +137,7 @@ static int Start( audio_output_t *p_aout, audio_sample_format_t *restrict fmt )
p_aout->flush = aout_PacketFlush;
aout_PacketInit( p_aout, &p_sys->packet,
jack_get_buffer_size( p_sys->p_jack_client ), fmt );
aout_SoftVolumeInit( p_aout );
aout_SoftVolumeStart( p_aout );
p_sys->i_channels = aout_FormatNbChannels( fmt );
......
......@@ -204,10 +204,10 @@ static int Start ( audio_output_t *p_aout, audio_sample_format_t *fmt )
p_aout->play = Play;
p_aout->pause = aout_PacketPause;
p_aout->flush = aout_PacketFlush;
aout_SoftVolumeStart( p_aout );
aout_PacketInit( p_aout, &p_sys->packet,
ks_obtained.ulBufferSize / i_bytes_per_frame );
aout_SoftVolumeInit( p_aout );
if ( var_Type( p_aout, "audio-device" ) == 0 )
{
......@@ -343,8 +343,8 @@ static int Open (vlc_object_t *obj)
{
audio_output_t *aout = (audio_output_t *)obj;
/* FIXME: set volume/mute here */
aout->start = Start;
aout->stop = Stop;
aout_SoftVolumeInit( p_aout );
return VLC_SUCCESS;
}
......@@ -71,12 +71,6 @@ static void aout_SoftVolumeInit(audio_output_t *aout)
float gain = var_InheritFloat(aout, MODULE_STRING"-gain");
bool mute = var_InheritBool(aout, "mute");
if (aout_GainRequest(aout, mute ? 0.f : gain))
{
mute = false;
gain = 1.f;
}
aout->volume_set = aout_SoftVolumeSet;
aout->mute_set = aout_SoftMuteSet;
sys->soft_gain = gain;
......@@ -85,3 +79,14 @@ static void aout_SoftVolumeInit(audio_output_t *aout)
aout_MuteReport(aout, mute);
aout_VolumeReport(aout, cbrtf(gain));
}
static void aout_SoftVolumeStart (audio_output_t *aout)
{
aout_sys_t *sys = aout->sys;
if (aout_GainRequest(aout, sys->soft_mute ? 0.f : sys->soft_gain))
{
aout_MuteReport(aout, false);
aout_VolumeReport(aout, 1.f);
}
}
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