|
|
@ -28,12 +28,12 @@ |
|
|
|
#include <QShowEvent> |
|
|
|
#include <QShowEvent> |
|
|
|
|
|
|
|
|
|
|
|
#include "src/audio/audio.h" |
|
|
|
#include "src/audio/audio.h" |
|
|
|
#include "src/core/core.h" |
|
|
|
#include "src/audio/iaudiosettings.h" |
|
|
|
#include "src/core/coreav.h" |
|
|
|
#include "src/core/coreav.h" |
|
|
|
#include "src/core/recursivesignalblocker.h" |
|
|
|
#include "src/core/recursivesignalblocker.h" |
|
|
|
#include "src/persistence/settings.h" |
|
|
|
|
|
|
|
#include "src/video/cameradevice.h" |
|
|
|
#include "src/video/cameradevice.h" |
|
|
|
#include "src/video/camerasource.h" |
|
|
|
#include "src/video/camerasource.h" |
|
|
|
|
|
|
|
#include "src/video/ivideosettings.h" |
|
|
|
#include "src/video/videosurface.h" |
|
|
|
#include "src/video/videosurface.h" |
|
|
|
#include "src/widget/tool/screenshotgrabber.h" |
|
|
|
#include "src/widget/tool/screenshotgrabber.h" |
|
|
|
#include "src/widget/translator.h" |
|
|
|
#include "src/widget/translator.h" |
|
|
@ -42,41 +42,42 @@ |
|
|
|
#define ALC_ALL_DEVICES_SPECIFIER ALC_DEVICE_SPECIFIER |
|
|
|
#define ALC_ALL_DEVICES_SPECIFIER ALC_DEVICE_SPECIFIER |
|
|
|
#endif |
|
|
|
#endif |
|
|
|
|
|
|
|
|
|
|
|
AVForm::AVForm() |
|
|
|
AVForm::AVForm(Audio* audio, CoreAV* coreAV, CameraSource& camera, |
|
|
|
|
|
|
|
IAudioSettings* audioSettings, IVideoSettings* videoSettings) |
|
|
|
: GenericForm(QPixmap(":/img/settings/av.png")) |
|
|
|
: GenericForm(QPixmap(":/img/settings/av.png")) |
|
|
|
|
|
|
|
, audio{audio} |
|
|
|
|
|
|
|
, coreAV{coreAV} |
|
|
|
|
|
|
|
, audioSettings{audioSettings} |
|
|
|
|
|
|
|
, videoSettings{videoSettings} |
|
|
|
, subscribedToAudioIn(false) |
|
|
|
, subscribedToAudioIn(false) |
|
|
|
, camVideoSurface(nullptr) |
|
|
|
, camVideoSurface(nullptr) |
|
|
|
, camera(CameraSource::getInstance()) |
|
|
|
, camera(camera) |
|
|
|
{ |
|
|
|
{ |
|
|
|
setupUi(this); |
|
|
|
setupUi(this); |
|
|
|
|
|
|
|
|
|
|
|
// block all child signals during initialization
|
|
|
|
// block all child signals during initialization
|
|
|
|
const RecursiveSignalBlocker signalBlocker(this); |
|
|
|
const RecursiveSignalBlocker signalBlocker(this); |
|
|
|
|
|
|
|
|
|
|
|
const Audio& audio = Audio::getInstance(); |
|
|
|
cbEnableTestSound->setChecked(audioSettings->getEnableTestSound()); |
|
|
|
const Settings& s = Settings::getInstance(); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
cbEnableTestSound->setChecked(s.getEnableTestSound()); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
cbEnableTestSound->setToolTip(tr("Play a test sound while changing the output volume.")); |
|
|
|
cbEnableTestSound->setToolTip(tr("Play a test sound while changing the output volume.")); |
|
|
|
|
|
|
|
|
|
|
|
#ifndef USE_FILTERAUDIO |
|
|
|
#ifndef USE_FILTERAUDIO |
|
|
|
cbEnableBackend2->setVisible(false); |
|
|
|
cbEnableBackend2->setVisible(false); |
|
|
|
#endif |
|
|
|
#endif |
|
|
|
cbEnableBackend2->setChecked(s.getEnableBackend2()); |
|
|
|
cbEnableBackend2->setChecked(audioSettings->getEnableBackend2()); |
|
|
|
|
|
|
|
|
|
|
|
connect(rescanButton, &QPushButton::clicked, this, &AVForm::rescanDevices); |
|
|
|
connect(rescanButton, &QPushButton::clicked, this, &AVForm::rescanDevices); |
|
|
|
|
|
|
|
|
|
|
|
playbackSlider->setTracking(false); |
|
|
|
playbackSlider->setTracking(false); |
|
|
|
playbackSlider->setValue(s.getOutVolume()); |
|
|
|
playbackSlider->setValue(audioSettings->getOutVolume()); |
|
|
|
playbackSlider->installEventFilter(this); |
|
|
|
playbackSlider->installEventFilter(this); |
|
|
|
|
|
|
|
|
|
|
|
microphoneSlider->setToolTip(tr("Use slider to set the gain of your input device ranging" |
|
|
|
microphoneSlider->setToolTip(tr("Use slider to set the gain of your input device ranging" |
|
|
|
" from %1dB to %2dB.") |
|
|
|
" from %1dB to %2dB.") |
|
|
|
.arg(audio.minInputGain()) |
|
|
|
.arg(audio->minInputGain()) |
|
|
|
.arg(audio.maxInputGain())); |
|
|
|
.arg(audio->maxInputGain())); |
|
|
|
microphoneSlider->setMinimum(qRound(audio.minInputGain()) * 10); |
|
|
|
microphoneSlider->setMinimum(qRound(audio->minInputGain()) * 10); |
|
|
|
microphoneSlider->setMaximum(qRound(audio.maxInputGain()) * 10); |
|
|
|
microphoneSlider->setMaximum(qRound(audio->maxInputGain()) * 10); |
|
|
|
microphoneSlider->setTickPosition(QSlider::TicksBothSides); |
|
|
|
microphoneSlider->setTickPosition(QSlider::TicksBothSides); |
|
|
|
microphoneSlider->setTickInterval( |
|
|
|
microphoneSlider->setTickInterval( |
|
|
|
(qAbs(microphoneSlider->minimum()) + microphoneSlider->maximum()) / 4); |
|
|
|
(qAbs(microphoneSlider->minimum()) + microphoneSlider->maximum()) / 4); |
|
|
@ -104,7 +105,7 @@ void AVForm::hideEvent(QHideEvent* event) |
|
|
|
{ |
|
|
|
{ |
|
|
|
if (subscribedToAudioIn) { |
|
|
|
if (subscribedToAudioIn) { |
|
|
|
// TODO: This should not be done in show/hide events
|
|
|
|
// TODO: This should not be done in show/hide events
|
|
|
|
Audio::getInstance().unsubscribeInput(); |
|
|
|
audio->unsubscribeInput(); |
|
|
|
subscribedToAudioIn = false; |
|
|
|
subscribedToAudioIn = false; |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
@ -126,7 +127,7 @@ void AVForm::showEvent(QShowEvent* event) |
|
|
|
|
|
|
|
|
|
|
|
if (!subscribedToAudioIn) { |
|
|
|
if (!subscribedToAudioIn) { |
|
|
|
// TODO: This should not be done in show/hide events
|
|
|
|
// TODO: This should not be done in show/hide events
|
|
|
|
Audio::getInstance().subscribeInput(); |
|
|
|
audio->subscribeInput(); |
|
|
|
subscribedToAudioIn = true; |
|
|
|
subscribedToAudioIn = true; |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
@ -136,8 +137,8 @@ void AVForm::showEvent(QShowEvent* event) |
|
|
|
void AVForm::open(const QString& devName, const VideoMode& mode) |
|
|
|
void AVForm::open(const QString& devName, const VideoMode& mode) |
|
|
|
{ |
|
|
|
{ |
|
|
|
QRect rect = mode.toRect(); |
|
|
|
QRect rect = mode.toRect(); |
|
|
|
Settings::getInstance().setCamVideoRes(rect); |
|
|
|
videoSettings->setCamVideoRes(rect); |
|
|
|
Settings::getInstance().setCamVideoFPS(static_cast<quint16>(mode.FPS)); |
|
|
|
videoSettings->setCamVideoFPS(static_cast<quint16>(mode.FPS)); |
|
|
|
camera.setupDevice(devName, mode); |
|
|
|
camera.setupDevice(devName, mode); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
@ -150,7 +151,7 @@ void AVForm::rescanDevices() |
|
|
|
|
|
|
|
|
|
|
|
void AVForm::on_cbEnableBackend2_stateChanged() |
|
|
|
void AVForm::on_cbEnableBackend2_stateChanged() |
|
|
|
{ |
|
|
|
{ |
|
|
|
Settings::getInstance().setEnableBackend2(cbEnableBackend2->isChecked()); |
|
|
|
audioSettings->setEnableBackend2(cbEnableBackend2->isChecked()); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
void AVForm::on_videoModescomboBox_currentIndexChanged(int index) |
|
|
|
void AVForm::on_videoModescomboBox_currentIndexChanged(int index) |
|
|
@ -163,8 +164,8 @@ void AVForm::on_videoModescomboBox_currentIndexChanged(int index) |
|
|
|
VideoMode mode = videoModes[index]; |
|
|
|
VideoMode mode = videoModes[index]; |
|
|
|
|
|
|
|
|
|
|
|
if (CameraDevice::isScreen(devName) && mode == VideoMode()) { |
|
|
|
if (CameraDevice::isScreen(devName) && mode == VideoMode()) { |
|
|
|
if (Settings::getInstance().getScreenGrabbed()) { |
|
|
|
if (videoSettings->getScreenGrabbed()) { |
|
|
|
VideoMode mode(Settings::getInstance().getScreenRegion()); |
|
|
|
VideoMode mode(videoSettings->getScreenRegion()); |
|
|
|
open(devName, mode); |
|
|
|
open(devName, mode); |
|
|
|
return; |
|
|
|
return; |
|
|
|
} |
|
|
|
} |
|
|
@ -182,8 +183,8 @@ void AVForm::on_videoModescomboBox_currentIndexChanged(int index) |
|
|
|
mode.x += screen.x(); |
|
|
|
mode.x += screen.x(); |
|
|
|
mode.y += screen.y(); |
|
|
|
mode.y += screen.y(); |
|
|
|
|
|
|
|
|
|
|
|
Settings::getInstance().setScreenRegion(mode.toRect()); |
|
|
|
videoSettings->setScreenRegion(mode.toRect()); |
|
|
|
Settings::getInstance().setScreenGrabbed(true); |
|
|
|
videoSettings->setScreenGrabbed(true); |
|
|
|
|
|
|
|
|
|
|
|
open(devName, mode); |
|
|
|
open(devName, mode); |
|
|
|
}; |
|
|
|
}; |
|
|
@ -194,7 +195,7 @@ void AVForm::on_videoModescomboBox_currentIndexChanged(int index) |
|
|
|
return; |
|
|
|
return; |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
Settings::getInstance().setScreenGrabbed(false); |
|
|
|
videoSettings->setScreenGrabbed(false); |
|
|
|
open(devName, mode); |
|
|
|
open(devName, mode); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
@ -299,8 +300,8 @@ void AVForm::fillCameraModesComboBox() |
|
|
|
|
|
|
|
|
|
|
|
int AVForm::searchPreferredIndex() |
|
|
|
int AVForm::searchPreferredIndex() |
|
|
|
{ |
|
|
|
{ |
|
|
|
QRect prefRes = Settings::getInstance().getCamVideoRes(); |
|
|
|
QRect prefRes = videoSettings->getCamVideoRes(); |
|
|
|
quint16 prefFPS = Settings::getInstance().getCamVideoFPS(); |
|
|
|
quint16 prefFPS = videoSettings->getCamVideoFPS(); |
|
|
|
|
|
|
|
|
|
|
|
for (int i = 0; i < videoModes.size(); ++i) { |
|
|
|
for (int i = 0; i < videoModes.size(); ++i) { |
|
|
|
VideoMode mode = videoModes[i]; |
|
|
|
VideoMode mode = videoModes[i]; |
|
|
@ -344,7 +345,7 @@ void AVForm::fillAudioQualityComboBox() |
|
|
|
audioQualityComboBox->addItem(tr("Low (16 kbps)"), 16); |
|
|
|
audioQualityComboBox->addItem(tr("Low (16 kbps)"), 16); |
|
|
|
audioQualityComboBox->addItem(tr("Very low (8 kbps)"), 8); |
|
|
|
audioQualityComboBox->addItem(tr("Very low (8 kbps)"), 8); |
|
|
|
|
|
|
|
|
|
|
|
const int currentBitrate = Settings::getInstance().getAudioBitrate(); |
|
|
|
const int currentBitrate = audioSettings->getAudioBitrate(); |
|
|
|
const int index = audioQualityComboBox->findData(currentBitrate); |
|
|
|
const int index = audioQualityComboBox->findData(currentBitrate); |
|
|
|
|
|
|
|
|
|
|
|
audioQualityComboBox->setCurrentIndex(index); |
|
|
|
audioQualityComboBox->setCurrentIndex(index); |
|
|
@ -375,7 +376,7 @@ void AVForm::updateVideoModes(int curIndex) |
|
|
|
|
|
|
|
|
|
|
|
int preferedIndex = searchPreferredIndex(); |
|
|
|
int preferedIndex = searchPreferredIndex(); |
|
|
|
if (preferedIndex != -1) { |
|
|
|
if (preferedIndex != -1) { |
|
|
|
Settings::getInstance().setScreenGrabbed(false); |
|
|
|
videoSettings->setScreenGrabbed(false); |
|
|
|
videoModescomboBox->blockSignals(true); |
|
|
|
videoModescomboBox->blockSignals(true); |
|
|
|
videoModescomboBox->setCurrentIndex(preferedIndex); |
|
|
|
videoModescomboBox->setCurrentIndex(preferedIndex); |
|
|
|
videoModescomboBox->blockSignals(false); |
|
|
|
videoModescomboBox->blockSignals(false); |
|
|
@ -384,10 +385,10 @@ void AVForm::updateVideoModes(int curIndex) |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
if (isScreen) { |
|
|
|
if (isScreen) { |
|
|
|
QRect rect = Settings::getInstance().getScreenRegion(); |
|
|
|
QRect rect = videoSettings->getScreenRegion(); |
|
|
|
VideoMode mode(rect); |
|
|
|
VideoMode mode(rect); |
|
|
|
|
|
|
|
|
|
|
|
Settings::getInstance().setScreenGrabbed(true); |
|
|
|
videoSettings->setScreenGrabbed(true); |
|
|
|
videoModescomboBox->setCurrentIndex(videoModes.size() - 1); |
|
|
|
videoModescomboBox->setCurrentIndex(videoModes.size() - 1); |
|
|
|
open(devName, mode); |
|
|
|
open(devName, mode); |
|
|
|
return; |
|
|
|
return; |
|
|
@ -406,14 +407,14 @@ void AVForm::on_videoDevCombobox_currentIndexChanged(int index) |
|
|
|
{ |
|
|
|
{ |
|
|
|
assert(0 <= index && index < videoDeviceList.size()); |
|
|
|
assert(0 <= index && index < videoDeviceList.size()); |
|
|
|
|
|
|
|
|
|
|
|
Settings::getInstance().setScreenGrabbed(false); |
|
|
|
videoSettings->setScreenGrabbed(false); |
|
|
|
QString dev = videoDeviceList[index].first; |
|
|
|
QString dev = videoDeviceList[index].first; |
|
|
|
Settings::getInstance().setVideoDev(dev); |
|
|
|
videoSettings->setVideoDev(dev); |
|
|
|
bool previouslyBlocked = videoModescomboBox->blockSignals(true); |
|
|
|
bool previouslyBlocked = videoModescomboBox->blockSignals(true); |
|
|
|
updateVideoModes(index); |
|
|
|
updateVideoModes(index); |
|
|
|
videoModescomboBox->blockSignals(previouslyBlocked); |
|
|
|
videoModescomboBox->blockSignals(previouslyBlocked); |
|
|
|
|
|
|
|
|
|
|
|
if (Settings::getInstance().getScreenGrabbed()) |
|
|
|
if (videoSettings->getScreenGrabbed()) |
|
|
|
return; |
|
|
|
return; |
|
|
|
|
|
|
|
|
|
|
|
int modeIndex = videoModescomboBox->currentIndex(); |
|
|
|
int modeIndex = videoModescomboBox->currentIndex(); |
|
|
@ -422,18 +423,19 @@ void AVForm::on_videoDevCombobox_currentIndexChanged(int index) |
|
|
|
mode = videoModes[modeIndex]; |
|
|
|
mode = videoModes[modeIndex]; |
|
|
|
|
|
|
|
|
|
|
|
camera.setupDevice(dev, mode); |
|
|
|
camera.setupDevice(dev, mode); |
|
|
|
if (dev == "none") |
|
|
|
if (dev == "none") { |
|
|
|
Core::getInstance()->getAv()->sendNoVideo(); |
|
|
|
coreAV->sendNoVideo(); |
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
void AVForm::on_audioQualityComboBox_currentIndexChanged(int index) |
|
|
|
void AVForm::on_audioQualityComboBox_currentIndexChanged(int index) |
|
|
|
{ |
|
|
|
{ |
|
|
|
Settings::getInstance().setAudioBitrate(audioQualityComboBox->currentData().toInt()); |
|
|
|
audioSettings->setAudioBitrate(audioQualityComboBox->currentData().toInt()); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
void AVForm::getVideoDevices() |
|
|
|
void AVForm::getVideoDevices() |
|
|
|
{ |
|
|
|
{ |
|
|
|
QString settingsInDev = Settings::getInstance().getVideoDev(); |
|
|
|
QString settingsInDev = videoSettings->getVideoDev(); |
|
|
|
int videoDevIndex = 0; |
|
|
|
int videoDevIndex = 0; |
|
|
|
videoDeviceList = CameraDevice::getDeviceList(); |
|
|
|
videoDeviceList = CameraDevice::getDeviceList(); |
|
|
|
// prevent currentIndexChanged to be fired while adding items
|
|
|
|
// prevent currentIndexChanged to be fired while adding items
|
|
|
@ -457,7 +459,7 @@ int AVForm::getModeSize(VideoMode mode) |
|
|
|
void AVForm::getAudioInDevices() |
|
|
|
void AVForm::getAudioInDevices() |
|
|
|
{ |
|
|
|
{ |
|
|
|
QStringList deviceNames; |
|
|
|
QStringList deviceNames; |
|
|
|
deviceNames << tr("Disabled") << Audio::getInstance().inDeviceNames(); |
|
|
|
deviceNames << tr("Disabled") << audio->inDeviceNames(); |
|
|
|
|
|
|
|
|
|
|
|
inDevCombobox->blockSignals(true); |
|
|
|
inDevCombobox->blockSignals(true); |
|
|
|
inDevCombobox->clear(); |
|
|
|
inDevCombobox->clear(); |
|
|
@ -465,9 +467,9 @@ void AVForm::getAudioInDevices() |
|
|
|
inDevCombobox->blockSignals(false); |
|
|
|
inDevCombobox->blockSignals(false); |
|
|
|
|
|
|
|
|
|
|
|
int idx = 0; |
|
|
|
int idx = 0; |
|
|
|
bool enabled = Settings::getInstance().getAudioInDevEnabled(); |
|
|
|
bool enabled = audioSettings->getAudioInDevEnabled(); |
|
|
|
if (enabled && deviceNames.size() > 1) { |
|
|
|
if (enabled && deviceNames.size() > 1) { |
|
|
|
QString dev = Settings::getInstance().getInDev(); |
|
|
|
QString dev = audioSettings->getInDev(); |
|
|
|
idx = qMax(deviceNames.indexOf(dev), 1); |
|
|
|
idx = qMax(deviceNames.indexOf(dev), 1); |
|
|
|
} |
|
|
|
} |
|
|
|
inDevCombobox->setCurrentIndex(idx); |
|
|
|
inDevCombobox->setCurrentIndex(idx); |
|
|
@ -476,7 +478,7 @@ void AVForm::getAudioInDevices() |
|
|
|
void AVForm::getAudioOutDevices() |
|
|
|
void AVForm::getAudioOutDevices() |
|
|
|
{ |
|
|
|
{ |
|
|
|
QStringList deviceNames; |
|
|
|
QStringList deviceNames; |
|
|
|
deviceNames << tr("Disabled") << Audio::getInstance().outDeviceNames(); |
|
|
|
deviceNames << tr("Disabled") << audio->outDeviceNames(); |
|
|
|
|
|
|
|
|
|
|
|
outDevCombobox->blockSignals(true); |
|
|
|
outDevCombobox->blockSignals(true); |
|
|
|
outDevCombobox->clear(); |
|
|
|
outDevCombobox->clear(); |
|
|
@ -484,9 +486,9 @@ void AVForm::getAudioOutDevices() |
|
|
|
outDevCombobox->blockSignals(false); |
|
|
|
outDevCombobox->blockSignals(false); |
|
|
|
|
|
|
|
|
|
|
|
int idx = 0; |
|
|
|
int idx = 0; |
|
|
|
bool enabled = Settings::getInstance().getAudioOutDevEnabled(); |
|
|
|
bool enabled = audioSettings->getAudioOutDevEnabled(); |
|
|
|
if (enabled && deviceNames.size() > 1) { |
|
|
|
if (enabled && deviceNames.size() > 1) { |
|
|
|
QString dev = Settings::getInstance().getOutDev(); |
|
|
|
QString dev = audioSettings->getOutDev(); |
|
|
|
idx = qMax(deviceNames.indexOf(dev), 1); |
|
|
|
idx = qMax(deviceNames.indexOf(dev), 1); |
|
|
|
} |
|
|
|
} |
|
|
|
outDevCombobox->setCurrentIndex(idx); |
|
|
|
outDevCombobox->setCurrentIndex(idx); |
|
|
@ -494,65 +496,61 @@ void AVForm::getAudioOutDevices() |
|
|
|
|
|
|
|
|
|
|
|
void AVForm::on_inDevCombobox_currentIndexChanged(int deviceIndex) |
|
|
|
void AVForm::on_inDevCombobox_currentIndexChanged(int deviceIndex) |
|
|
|
{ |
|
|
|
{ |
|
|
|
Settings::getInstance().setAudioInDevEnabled(deviceIndex != 0); |
|
|
|
audioSettings->setAudioInDevEnabled(deviceIndex != 0); |
|
|
|
|
|
|
|
|
|
|
|
QString deviceName; |
|
|
|
QString deviceName; |
|
|
|
if (deviceIndex > 0) |
|
|
|
if (deviceIndex > 0) |
|
|
|
deviceName = inDevCombobox->itemText(deviceIndex); |
|
|
|
deviceName = inDevCombobox->itemText(deviceIndex); |
|
|
|
|
|
|
|
|
|
|
|
Settings::getInstance().setInDev(deviceName); |
|
|
|
audioSettings->setInDev(deviceName); |
|
|
|
|
|
|
|
|
|
|
|
Audio& audio = Audio::getInstance(); |
|
|
|
audio->reinitInput(deviceName); |
|
|
|
audio.reinitInput(deviceName); |
|
|
|
|
|
|
|
microphoneSlider->setEnabled(deviceIndex > 0); |
|
|
|
microphoneSlider->setEnabled(deviceIndex > 0); |
|
|
|
microphoneSlider->setSliderPosition(qRound(audio.inputGain() * 10.0)); |
|
|
|
microphoneSlider->setSliderPosition(qRound(audio->inputGain() * 10.0)); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
void AVForm::on_outDevCombobox_currentIndexChanged(int deviceIndex) |
|
|
|
void AVForm::on_outDevCombobox_currentIndexChanged(int deviceIndex) |
|
|
|
{ |
|
|
|
{ |
|
|
|
Settings::getInstance().setAudioOutDevEnabled(deviceIndex != 0); |
|
|
|
audioSettings->setAudioOutDevEnabled(deviceIndex != 0); |
|
|
|
|
|
|
|
|
|
|
|
QString deviceName; |
|
|
|
QString deviceName; |
|
|
|
if (deviceIndex > 0) |
|
|
|
if (deviceIndex > 0) |
|
|
|
deviceName = outDevCombobox->itemText(deviceIndex); |
|
|
|
deviceName = outDevCombobox->itemText(deviceIndex); |
|
|
|
|
|
|
|
|
|
|
|
Settings::getInstance().setOutDev(deviceName); |
|
|
|
audioSettings->setOutDev(deviceName); |
|
|
|
|
|
|
|
|
|
|
|
Audio& audio = Audio::getInstance(); |
|
|
|
audio->reinitOutput(deviceName); |
|
|
|
audio.reinitOutput(deviceName); |
|
|
|
|
|
|
|
playbackSlider->setEnabled(deviceIndex > 0); |
|
|
|
playbackSlider->setEnabled(deviceIndex > 0); |
|
|
|
playbackSlider->setSliderPosition(qRound(audio.outputVolume() * 100.0)); |
|
|
|
playbackSlider->setSliderPosition(qRound(audio->outputVolume() * 100.0)); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
void AVForm::on_playbackSlider_valueChanged(int value) |
|
|
|
void AVForm::on_playbackSlider_valueChanged(int value) |
|
|
|
{ |
|
|
|
{ |
|
|
|
Settings::getInstance().setOutVolume(value); |
|
|
|
audioSettings->setOutVolume(value); |
|
|
|
|
|
|
|
|
|
|
|
Audio& audio = Audio::getInstance(); |
|
|
|
if (audio->isOutputReady()) { |
|
|
|
if (audio.isOutputReady()) { |
|
|
|
|
|
|
|
const qreal percentage = value / 100.0; |
|
|
|
const qreal percentage = value / 100.0; |
|
|
|
audio.setOutputVolume(percentage); |
|
|
|
audio->setOutputVolume(percentage); |
|
|
|
|
|
|
|
|
|
|
|
if (cbEnableTestSound->isChecked()) |
|
|
|
if (cbEnableTestSound->isChecked()) |
|
|
|
audio.playMono16Sound(Audio::getSound(Audio::Sound::Test)); |
|
|
|
audio->playMono16Sound(Audio::getSound(Audio::Sound::Test)); |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
void AVForm::on_cbEnableTestSound_stateChanged() |
|
|
|
void AVForm::on_cbEnableTestSound_stateChanged() |
|
|
|
{ |
|
|
|
{ |
|
|
|
Settings::getInstance().setEnableTestSound(cbEnableTestSound->isChecked()); |
|
|
|
audioSettings->setEnableTestSound(cbEnableTestSound->isChecked()); |
|
|
|
|
|
|
|
|
|
|
|
Audio& audio = Audio::getInstance(); |
|
|
|
if (cbEnableTestSound->isChecked() && audio->isOutputReady()) |
|
|
|
if (cbEnableTestSound->isChecked() && audio.isOutputReady()) |
|
|
|
audio->playMono16Sound(Audio::getSound(Audio::Sound::Test)); |
|
|
|
audio.playMono16Sound(Audio::getSound(Audio::Sound::Test)); |
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
void AVForm::on_microphoneSlider_valueChanged(int value) |
|
|
|
void AVForm::on_microphoneSlider_valueChanged(int value) |
|
|
|
{ |
|
|
|
{ |
|
|
|
const qreal dB = value / 10.0; |
|
|
|
const qreal dB = value / 10.0; |
|
|
|
|
|
|
|
|
|
|
|
Settings::getInstance().setAudioInGainDecibel(dB); |
|
|
|
audioSettings->setAudioInGainDecibel(dB); |
|
|
|
Audio::getInstance().setInputGain(dB); |
|
|
|
audio->setInputGain(dB); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
void AVForm::createVideoSurface() |
|
|
|
void AVForm::createVideoSurface() |
|
|
|