mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2025-04-26 06:54:49 +00:00
tools: play: use cubic volume factor when adjusting volume
This is more natural and better-suited for a playback application.
This commit is contained in:
parent
cf4c70265b
commit
64b4b2a20a
1 changed files with 2 additions and 2 deletions
|
@ -169,13 +169,13 @@ play_set_relative_volume (GstPlay * play, gdouble volume_step)
|
||||||
gdouble volume;
|
gdouble volume;
|
||||||
|
|
||||||
volume = gst_stream_volume_get_volume (GST_STREAM_VOLUME (play->playbin),
|
volume = gst_stream_volume_get_volume (GST_STREAM_VOLUME (play->playbin),
|
||||||
GST_STREAM_VOLUME_FORMAT_LINEAR);
|
GST_STREAM_VOLUME_FORMAT_CUBIC);
|
||||||
|
|
||||||
volume = round ((volume + volume_step) * VOLUME_STEPS) / VOLUME_STEPS;
|
volume = round ((volume + volume_step) * VOLUME_STEPS) / VOLUME_STEPS;
|
||||||
volume = CLAMP (volume, 0.0, 10.0);
|
volume = CLAMP (volume, 0.0, 10.0);
|
||||||
|
|
||||||
gst_stream_volume_set_volume (GST_STREAM_VOLUME (play->playbin),
|
gst_stream_volume_set_volume (GST_STREAM_VOLUME (play->playbin),
|
||||||
GST_STREAM_VOLUME_FORMAT_LINEAR, volume);
|
GST_STREAM_VOLUME_FORMAT_CUBIC, volume);
|
||||||
|
|
||||||
g_print ("Volume: %.0f%% \n", volume * 100);
|
g_print ("Volume: %.0f%% \n", volume * 100);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue