Merge pull request #1983 from cg2121/infinity-symbol

UI: Display infinity symbol when volume is at 0 percent
This commit is contained in:
Jim 2019-07-21 19:44:29 -07:00 committed by GitHub
commit 6d6330ff03
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 11 additions and 5 deletions

View File

@ -82,7 +82,7 @@ OBSAdvAudioCtrl::OBSAdvAudioCtrl(QGridLayout *, obs_source_t *source_)
volume->setValue(obs_mul_to_db(vol));
if (volume->value() < MIN_DB)
volume->setSpecialValueText("-inf dB");
volume->setSpecialValueText("-" + QT_UTF8("\u221E") + " dB");
forceMono->setChecked((flags & OBS_SOURCE_FLAG_FORCE_MONO) != 0);
@ -293,7 +293,7 @@ void OBSAdvAudioCtrl::SourceMixersChanged(uint32_t mixers)
void OBSAdvAudioCtrl::volumeChanged(double db)
{
if (db < MIN_DB) {
volume->setSpecialValueText("-inf dB");
volume->setSpecialValueText("-" + QT_UTF8("\u221E") + " dB");
db = -INFINITY;
}

View File

@ -74,9 +74,15 @@ void VolControl::SliderChanged(int vol)
void VolControl::updateText()
{
QString db = QString::number(obs_fader_get_db(obs_fader), 'f', 1)
.append(" dB");
volLabel->setText(db);
QString text;
float db = obs_fader_get_db(obs_fader);
if (db < -96.0f)
text = "-" + QT_UTF8("\u221E") + " dB";
else
text = QString::number(db, 'f', 1).append(" dB");
volLabel->setText(text);
bool muted = obs_source_muted(source);
const char *accTextLookup = muted ? "VolControl.SliderMuted"