GstEnginePipeline: Use linear volume
This commit is contained in:
parent
f19dda57f0
commit
41f2710dea
|
@ -876,7 +876,7 @@ void GstEnginePipeline::NotifyVolumeCallback(GstElement *element, GParamSpec *pa
|
|||
|
||||
g_object_get(G_OBJECT(instance->volume_), "volume", &instance->volume_internal_, nullptr);
|
||||
|
||||
const uint volume_percent = static_cast<uint>(qBound(0L, lround(qBound(0.0, gst_stream_volume_convert_volume(GST_STREAM_VOLUME_FORMAT_LINEAR, GST_STREAM_VOLUME_FORMAT_CUBIC, instance->volume_internal_), 1.0) / 0.01), 100L));
|
||||
const uint volume_percent = static_cast<uint>(qBound(0L, lround(instance->volume_internal_ / 0.01), 100L));
|
||||
if (volume_percent != instance->volume_percent_) {
|
||||
instance->volume_percent_ = volume_percent;
|
||||
emit instance->VolumeChanged(volume_percent);
|
||||
|
@ -1515,8 +1515,8 @@ bool GstEnginePipeline::Seek(const qint64 nanosec) {
|
|||
|
||||
void GstEnginePipeline::SetVolume(const uint volume_percent) {
|
||||
|
||||
if (volume_) {
|
||||
const double volume_internal = lround(static_cast<int>(gst_stream_volume_convert_volume(GST_STREAM_VOLUME_FORMAT_CUBIC, GST_STREAM_VOLUME_FORMAT_LINEAR, static_cast<double>(volume_percent) * 0.01) * 100.0)) / 100.0;
|
||||
if (volume_ && volume_percent_ != volume_percent) {
|
||||
const double volume_internal = static_cast<double>(volume_percent) * 0.01;
|
||||
if (volume_internal != volume_internal_) {
|
||||
volume_internal_ = volume_internal;
|
||||
g_object_set(G_OBJECT(volume_), "volume", volume_internal, nullptr);
|
||||
|
|
Loading…
Reference in New Issue