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

Merge branch 'pr1082'

This commit is contained in:
Tux3 / Mlkj / !Lev.uXFMLA 2015-02-01 17:33:16 +01:00
commit aa3134c09f
No known key found for this signature in database
GPG Key ID: 7E086DD661263264
6 changed files with 15 additions and 2 deletions

View File

@ -41,6 +41,7 @@ ALCdevice* Audio::alInDev{nullptr};
ALCdevice* Audio::alOutDev{nullptr};
ALCcontext* Audio::alContext{nullptr};
ALuint Audio::alMainSource{0};
float Audio::outputVolume{1.0};
void audioDebugLog(QString msg)
{
@ -261,7 +262,10 @@ void Audio::playGroupAudio(int group, int peer, const int16_t* data,
return;
if (!call.alSources.contains(peer))
{
alGenSources(1, &call.alSources[peer]);
alSourcef(call.alSources[peer], AL_GAIN, outputVolume);
}
playAudioBuffer(call.alSources[peer], data, samples, channels, sample_rate);
}
@ -301,6 +305,7 @@ void Audio::playAudioBuffer(ALuint alSource, const int16_t *data, int samples, u
ALint state;
alGetSourcei(alSource, AL_SOURCE_STATE, &state);
alSourcef(alSource, AL_GAIN, outputVolume);
if (state != AL_PLAYING)
alSourcePlay(alSource);
}

View File

@ -73,6 +73,7 @@ public:
static QThread* audioThread;
static ALCcontext* alContext;
static ALuint alMainSource;
static float outputVolume;
private:
explicit Audio()=default;

View File

@ -559,6 +559,7 @@ void Core::playAudioBuffer(ALuint alSource, const int16_t *data, int samples, un
ALint state;
alGetSourcei(alSource, AL_SOURCE_STATE, &state);
alSourcef(alSource, AL_GAIN, Audio::outputVolume);
if (state != AL_PLAYING)
{
alSourcePlay(alSource);

View File

@ -47,6 +47,7 @@ AVForm::AVForm() :
connect(bodyUI->outDevCombobox, qcomboboxIndexChanged, this, &AVForm::onOutDevChanged);
connect(bodyUI->filterAudio, SIGNAL(toggled(bool)), this, SLOT(onFilterAudioToggled(bool)));
connect(bodyUI->rescanButton, &QPushButton::clicked, this, [=](){getAudioInDevices(); getAudioOutDevices();});
bodyUI->playbackSlider->setValue(100);
}
AVForm::~AVForm()
@ -258,3 +259,8 @@ void AVForm::on_ContrastSlider_valueChanged(int value)
{
Camera::getInstance()->setProp(Camera::CONTRAST, value / 100.0);
}
void AVForm::on_playbackSlider_valueChanged(int value)
{
Audio::getInstance().outputVolume = value / 100.0;
}

View File

@ -53,6 +53,7 @@ private slots:
void onInDevChanged(const QString& deviceDescriptor);
void onOutDevChanged(const QString& deviceDescriptor);
void onFilterAudioToggled(bool filterAudio);
void on_playbackSlider_valueChanged(int value);
// camera
void onPropProbingFinished(Camera::Prop prop, double val);

View File

@ -61,8 +61,7 @@
<enum>Qt::Horizontal</enum>
</property>
<property name="toolTip">
<string>Use slider to set volume of your speakers.
WARNING: slider is not supposed to work yet.</string>
<string>Use slider to set volume of your speakers.</string>
</property>
</widget>
</item>