mirror of
https://github.com/WinampDesktop/winamp.git
synced 2025-06-19 08:25:47 -04:00
HostInterface: Add separate volume control for fast forwarding
This commit is contained in:
@ -25,11 +25,13 @@ AudioSettingsWidget::AudioSettingsWidget(QtHostInterface* host_interface, QWidge
|
||||
SettingWidgetBinder::BindWidgetToBoolSetting(m_host_interface, m_ui.startDumpingOnBoot, "Audio", "DumpOnBoot");
|
||||
SettingWidgetBinder::BindWidgetToBoolSetting(m_host_interface, m_ui.muteCDAudio, "CDROM", "MuteCDAudio");
|
||||
|
||||
m_ui.volume->setValue(m_host_interface->GetIntSettingValue("Audio", "OutputVolume"));
|
||||
m_ui.muted->setChecked(m_host_interface->GetBoolSettingValue("Audio", "OutputMuted"));
|
||||
m_ui.volume->setValue(m_host_interface->GetIntSettingValue("Audio", "OutputVolume", 100));
|
||||
m_ui.fastForwardVolume->setValue(m_host_interface->GetIntSettingValue("Audio", "FastForwardVolume", 100));
|
||||
m_ui.muted->setChecked(m_host_interface->GetBoolSettingValue("Audio", "OutputMuted", false));
|
||||
|
||||
connect(m_ui.bufferSize, &QSlider::valueChanged, this, &AudioSettingsWidget::updateBufferingLabel);
|
||||
connect(m_ui.volume, &QSlider::valueChanged, this, &AudioSettingsWidget::onOutputVolumeChanged);
|
||||
connect(m_ui.fastForwardVolume, &QSlider::valueChanged, this, &AudioSettingsWidget::onFastForwardVolumeChanged);
|
||||
connect(m_ui.muted, &QCheckBox::stateChanged, this, &AudioSettingsWidget::onOutputMutedChanged);
|
||||
|
||||
updateBufferingLabel();
|
||||
@ -53,8 +55,11 @@ AudioSettingsWidget::AudioSettingsWidget(QtHostInterface* host_interface, QWidge
|
||||
dialog->registerWidgetHelp(
|
||||
m_ui.startDumpingOnBoot, tr("Start Dumping On Boot"), tr("Unchecked"),
|
||||
tr("Start dumping audio to file as soon as the emulator is started. Mainly useful as a debug option."));
|
||||
dialog->registerWidgetHelp(m_ui.volume, tr("Volume"), "100",
|
||||
dialog->registerWidgetHelp(m_ui.volume, tr("Output Volume"), "100",
|
||||
tr("Controls the volume of the audio played on the host. Values are in percentage."));
|
||||
dialog->registerWidgetHelp(
|
||||
m_ui.fastForwardVolume, tr("Fast Forward Volume"), "100",
|
||||
tr("Controls the volume of the audio played on the host when fast forwarding. Values are in percentage."));
|
||||
dialog->registerWidgetHelp(m_ui.muted, tr("Mute All Sound"), tr("Unchecked"),
|
||||
tr("Prevents the emulator from producing any audible sound."));
|
||||
dialog->registerWidgetHelp(m_ui.muteCDAudio, tr("Mute CD Audio"), tr("Unchecked"),
|
||||
@ -83,13 +88,23 @@ void AudioSettingsWidget::updateBufferingLabel()
|
||||
void AudioSettingsWidget::updateVolumeLabel()
|
||||
{
|
||||
m_ui.volumeLabel->setText(tr("%1%").arg(m_ui.volume->value()));
|
||||
m_ui.fastForwardVolumeLabel->setText(tr("%1%").arg(m_ui.fastForwardVolume->value()));
|
||||
}
|
||||
|
||||
void AudioSettingsWidget::onOutputVolumeChanged(int new_value)
|
||||
{
|
||||
m_host_interface->SetIntSettingValue("Audio", "OutputVolume", new_value);
|
||||
if (!m_ui.muted->isChecked())
|
||||
m_host_interface->setAudioOutputVolume(new_value);
|
||||
m_host_interface->setAudioOutputVolume(new_value, m_ui.fastForwardVolume->value());
|
||||
|
||||
updateVolumeLabel();
|
||||
}
|
||||
|
||||
void AudioSettingsWidget::onFastForwardVolumeChanged(int new_value)
|
||||
{
|
||||
m_host_interface->SetIntSettingValue("Audio", "FastForwardVolume", new_value);
|
||||
if (!m_ui.muted->isChecked())
|
||||
m_host_interface->setAudioOutputVolume(m_ui.volume->value(), new_value);
|
||||
|
||||
updateVolumeLabel();
|
||||
}
|
||||
|
@ -19,6 +19,7 @@ private Q_SLOTS:
|
||||
void updateBufferingLabel();
|
||||
void updateVolumeLabel();
|
||||
void onOutputVolumeChanged(int new_value);
|
||||
void onFastForwardVolumeChanged(int new_value);
|
||||
void onOutputMutedChanged(int new_state);
|
||||
|
||||
private:
|
||||
|
@ -7,7 +7,7 @@
|
||||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>502</width>
|
||||
<height>308</height>
|
||||
<height>312</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="windowTitle">
|
||||
@ -123,66 +123,109 @@
|
||||
<item row="0" column="0">
|
||||
<widget class="QLabel" name="label_3">
|
||||
<property name="text">
|
||||
<string>Volume:</string>
|
||||
<string>Output Volume:</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="0" column="1">
|
||||
<widget class="QSlider" name="volume">
|
||||
<property name="maximum">
|
||||
<number>100</number>
|
||||
</property>
|
||||
<property name="value">
|
||||
<number>100</number>
|
||||
</property>
|
||||
<property name="orientation">
|
||||
<enum>Qt::Horizontal</enum>
|
||||
</property>
|
||||
<property name="tickPosition">
|
||||
<enum>QSlider::TicksBothSides</enum>
|
||||
</property>
|
||||
<property name="tickInterval">
|
||||
<number>10</number>
|
||||
<layout class="QHBoxLayout" name="horizontalLayout">
|
||||
<item>
|
||||
<widget class="QSlider" name="volume">
|
||||
<property name="maximum">
|
||||
<number>100</number>
|
||||
</property>
|
||||
<property name="value">
|
||||
<number>100</number>
|
||||
</property>
|
||||
<property name="orientation">
|
||||
<enum>Qt::Horizontal</enum>
|
||||
</property>
|
||||
<property name="tickPosition">
|
||||
<enum>QSlider::TicksBothSides</enum>
|
||||
</property>
|
||||
<property name="tickInterval">
|
||||
<number>10</number>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QLabel" name="volumeLabel">
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="Fixed" vsizetype="Preferred">
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>100%</string>
|
||||
</property>
|
||||
<property name="alignment">
|
||||
<set>Qt::AlignCenter</set>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
<item row="1" column="1">
|
||||
<layout class="QHBoxLayout" name="horizontalLayout_2">
|
||||
<item>
|
||||
<widget class="QSlider" name="fastForwardVolume">
|
||||
<property name="maximum">
|
||||
<number>100</number>
|
||||
</property>
|
||||
<property name="value">
|
||||
<number>100</number>
|
||||
</property>
|
||||
<property name="orientation">
|
||||
<enum>Qt::Horizontal</enum>
|
||||
</property>
|
||||
<property name="tickPosition">
|
||||
<enum>QSlider::TicksBothSides</enum>
|
||||
</property>
|
||||
<property name="tickInterval">
|
||||
<number>10</number>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QLabel" name="fastForwardVolumeLabel">
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="Fixed" vsizetype="Preferred">
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>100%</string>
|
||||
</property>
|
||||
<property name="alignment">
|
||||
<set>Qt::AlignCenter</set>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
<item row="1" column="0">
|
||||
<widget class="QLabel" name="label_4">
|
||||
<property name="text">
|
||||
<string>Fast Forward Volume:</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="2" column="0" colspan="2">
|
||||
<item row="2" column="0">
|
||||
<widget class="QCheckBox" name="muted">
|
||||
<property name="text">
|
||||
<string>Mute All Sound</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="3" column="0" colspan="2">
|
||||
<item row="3" column="0">
|
||||
<widget class="QCheckBox" name="muteCDAudio">
|
||||
<property name="text">
|
||||
<string>Mute CD Audio</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="1" column="1">
|
||||
<widget class="QLabel" name="volumeLabel">
|
||||
<property name="text">
|
||||
<string>100%</string>
|
||||
</property>
|
||||
<property name="alignment">
|
||||
<set>Qt::AlignCenter</set>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="1" column="0">
|
||||
<spacer name="horizontalSpacer_2">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Horizontal</enum>
|
||||
</property>
|
||||
<property name="sizeHint" stdset="0">
|
||||
<size>
|
||||
<width>40</width>
|
||||
<height>20</height>
|
||||
</size>
|
||||
</property>
|
||||
</spacer>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
</item>
|
||||
@ -202,7 +245,7 @@
|
||||
</layout>
|
||||
</widget>
|
||||
<resources>
|
||||
<include location="resources/icons.qrc"/>
|
||||
<include location="resources/resources.qrc"/>
|
||||
</resources>
|
||||
<connections/>
|
||||
</ui>
|
||||
|
@ -1162,18 +1162,19 @@ void QtHostInterface::saveState(bool global, qint32 slot, bool block_until_done
|
||||
SaveState(global, slot);
|
||||
}
|
||||
|
||||
void QtHostInterface::setAudioOutputVolume(int value)
|
||||
void QtHostInterface::setAudioOutputVolume(int volume, int fast_forward_volume)
|
||||
{
|
||||
if (!isOnWorkerThread())
|
||||
{
|
||||
QMetaObject::invokeMethod(this, "setAudioOutputVolume", Q_ARG(int, value));
|
||||
QMetaObject::invokeMethod(this, "setAudioOutputVolume", Q_ARG(int, volume), Q_ARG(int, fast_forward_volume));
|
||||
return;
|
||||
}
|
||||
|
||||
if (m_audio_stream)
|
||||
m_audio_stream->SetOutputVolume(value);
|
||||
m_audio_stream->SetOutputVolume(m_speed_limiter_enabled ? volume : fast_forward_volume);
|
||||
|
||||
g_settings.audio_output_volume = value;
|
||||
g_settings.audio_output_volume = volume;
|
||||
g_settings.audio_fast_forward_volume = fast_forward_volume;
|
||||
}
|
||||
|
||||
void QtHostInterface::setAudioOutputMuted(bool muted)
|
||||
@ -1185,7 +1186,7 @@ void QtHostInterface::setAudioOutputMuted(bool muted)
|
||||
}
|
||||
|
||||
if (m_audio_stream)
|
||||
m_audio_stream->SetOutputVolume(muted ? 0 : g_settings.audio_output_volume);
|
||||
m_audio_stream->SetOutputVolume(GetAudioOutputVolume());
|
||||
|
||||
g_settings.audio_output_muted = muted;
|
||||
}
|
||||
|
@ -159,7 +159,7 @@ public Q_SLOTS:
|
||||
void loadState(const QString& filename);
|
||||
void loadState(bool global, qint32 slot);
|
||||
void saveState(bool global, qint32 slot, bool block_until_done = false);
|
||||
void setAudioOutputVolume(int value);
|
||||
void setAudioOutputVolume(int volume, int fast_forward_volume);
|
||||
void setAudioOutputMuted(bool muted);
|
||||
void startDumpingAudio();
|
||||
void stopDumpingAudio();
|
||||
|
Reference in New Issue
Block a user