1
0
mirror of https://github.com/qTox/qTox.git synced 2024-03-22 14:00:36 +08:00

Add audio in/out device list (stubs)

Clicking through the list currently has no effect
This commit is contained in:
Tux3 / Mlkj / !Lev.uXFMLA 2014-10-28 20:47:20 +01:00
parent 7a6b349e17
commit 8501f3e543
No known key found for this signature in database
GPG Key ID: 7E086DD661263264
3 changed files with 72 additions and 6 deletions

View File

@ -17,12 +17,23 @@
#include "avform.h" #include "avform.h"
#include "ui_avsettings.h" #include "ui_avsettings.h"
#if defined(__APPLE__) && defined(__MACH__)
#include <OpenAL/al.h>
#include <OpenAL/alc.h>
#else
#include <AL/alc.h>
#include <AL/al.h>
#endif
AVForm::AVForm() : AVForm::AVForm() :
GenericForm(tr("Audio/Video"), QPixmap(":/img/settings/av.png")) GenericForm(tr("Audio/Video"), QPixmap(":/img/settings/av.png"))
{ {
bodyUI = new Ui::AVSettings; bodyUI = new Ui::AVSettings;
bodyUI->setupUi(this); bodyUI->setupUi(this);
getAudioOutDevices();
getAudioInDevices();
connect(Camera::getInstance(), &Camera::propProbingFinished, this, &AVForm::onPropProbingFinished); connect(Camera::getInstance(), &Camera::propProbingFinished, this, &AVForm::onPropProbingFinished);
connect(Camera::getInstance(), &Camera::resolutionProbingFinished, this, &AVForm::onResProbingFinished); connect(Camera::getInstance(), &Camera::resolutionProbingFinished, this, &AVForm::onResProbingFinished);
} }
@ -103,3 +114,35 @@ void AVForm::hideEvent(QHideEvent *)
{ {
bodyUI->CamVideoSurface->setSource(nullptr); bodyUI->CamVideoSurface->setSource(nullptr);
} }
void AVForm::getAudioInDevices()
{
const ALchar *pDeviceList = alcGetString(NULL, ALC_CAPTURE_DEVICE_SPECIFIER);
if (pDeviceList)
{
while (*pDeviceList)
{
int len = strlen(pDeviceList);
bodyUI->inDevCombobox->addItem(QString::fromLocal8Bit(pDeviceList,len));
pDeviceList += len+1;
}
}
}
void AVForm::getAudioOutDevices()
{
const ALchar *pDeviceList;
if (alcIsExtensionPresent(NULL, "ALC_ENUMERATE_ALL_EXT") != AL_FALSE)
pDeviceList = alcGetString(NULL, ALC_ALL_DEVICES_SPECIFIER);
else
pDeviceList = alcGetString(NULL, ALC_DEVICE_SPECIFIER);
if (pDeviceList)
{
while (*pDeviceList)
{
int len = strlen(pDeviceList);
bodyUI->outDevCombobox->addItem(QString::fromLocal8Bit(pDeviceList,len));
pDeviceList += len+1;
}
}
}

View File

@ -38,8 +38,11 @@ public:
~AVForm(); ~AVForm();
virtual void present(); virtual void present();
private slots: private:
void getAudioInDevices();
void getAudioOutDevices();
private slots:
void on_ContrastSlider_sliderMoved(int position); void on_ContrastSlider_sliderMoved(int position);
void on_SaturationSlider_sliderMoved(int position); void on_SaturationSlider_sliderMoved(int position);
void on_BrightnessSlider_sliderMoved(int position); void on_BrightnessSlider_sliderMoved(int position);

View File

@ -38,37 +38,57 @@
<item> <item>
<widget class="QGroupBox" name="audioGroup"> <widget class="QGroupBox" name="audioGroup">
<property name="title"> <property name="title">
<string>Volume Settings (Stubs)</string> <string>Audio Settings</string>
</property> </property>
<layout class="QFormLayout" name="formLayout_2"> <layout class="QFormLayout" name="formLayout_2">
<item row="4" column="0"> <item row="6" column="0">
<widget class="QLabel" name="microphoneLabel"> <widget class="QLabel" name="microphoneLabel">
<property name="text"> <property name="text">
<string>Microphone</string> <string>Microphone</string>
</property> </property>
</widget> </widget>
</item> </item>
<item row="0" column="0"> <item row="1" column="0">
<widget class="QLabel" name="playbackLabel"> <widget class="QLabel" name="playbackLabel">
<property name="text"> <property name="text">
<string>Playback</string> <string>Playback</string>
</property> </property>
</widget> </widget>
</item> </item>
<item row="0" column="1"> <item row="1" column="1">
<widget class="QSlider" name="playbackSlider"> <widget class="QSlider" name="playbackSlider">
<property name="orientation"> <property name="orientation">
<enum>Qt::Horizontal</enum> <enum>Qt::Horizontal</enum>
</property> </property>
</widget> </widget>
</item> </item>
<item row="4" column="1"> <item row="6" column="1">
<widget class="QSlider" name="microphoneSlider"> <widget class="QSlider" name="microphoneSlider">
<property name="orientation"> <property name="orientation">
<enum>Qt::Horizontal</enum> <enum>Qt::Horizontal</enum>
</property> </property>
</widget> </widget>
</item> </item>
<item row="0" column="0">
<widget class="QLabel" name="outDevLabel">
<property name="text">
<string>Playback device</string>
</property>
</widget>
</item>
<item row="5" column="0">
<widget class="QLabel" name="inDevLabel">
<property name="text">
<string>Capture device</string>
</property>
</widget>
</item>
<item row="5" column="1">
<widget class="QComboBox" name="inDevCombobox"/>
</item>
<item row="0" column="1">
<widget class="QComboBox" name="outDevCombobox"/>
</item>
</layout> </layout>
</widget> </widget>
</item> </item>