GstEngine/GstEnginePipeline: support gap-less playback w/ loudness-normalizing gain
Ok, it does appear that it is that simple. In principle this (even the non-update case) results in volume jumps, so maybe we'll want gradual gain change... Notably, i thought we'd always seek if the pipeline was already operating on the same URL as the new one, but apparently only for adjacent songs?
This commit is contained in:
committed by
Jonas Kvinge
parent
f81816b0cd
commit
4bd993b1e3
@@ -602,9 +602,7 @@ bool GstEnginePipeline::InitAudioBin(QString &error) {
|
||||
return false;
|
||||
}
|
||||
|
||||
auto dB_to_mult = [](const double gain_dB) { return std::pow(10., gain_dB / 20.); };
|
||||
|
||||
g_object_set(G_OBJECT(ebur128_volume_), "volume", dB_to_mult(ebur128_loudness_normalizing_gain_db_), nullptr);
|
||||
UpdateEBUR128LoudnessNormalizingGaindB();
|
||||
|
||||
eventprobe_ = ebur128_volume_;
|
||||
}
|
||||
@@ -1535,6 +1533,23 @@ bool GstEnginePipeline::Seek(const qint64 nanosec) {
|
||||
|
||||
}
|
||||
|
||||
void GstEnginePipeline::SetEBUR128LoudnessNormalizingGain_dB(const double ebur128_loudness_normalizing_gain_db) {
|
||||
|
||||
ebur128_loudness_normalizing_gain_db_ = ebur128_loudness_normalizing_gain_db;
|
||||
UpdateEBUR128LoudnessNormalizingGaindB();
|
||||
|
||||
}
|
||||
|
||||
void GstEnginePipeline::UpdateEBUR128LoudnessNormalizingGaindB() {
|
||||
|
||||
if (ebur128_volume_) {
|
||||
auto dB_to_mult = [](const double gain_dB) { return std::pow(10., gain_dB / 20.); };
|
||||
|
||||
g_object_set(G_OBJECT(ebur128_volume_), "volume", dB_to_mult(ebur128_loudness_normalizing_gain_db_), nullptr);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
void GstEnginePipeline::SetVolume(const uint volume_percent) {
|
||||
|
||||
if (volume_) {
|
||||
|
||||
Reference in New Issue
Block a user