Add a volume (gain) property to QAudioInput.
Only implemented for PulseAudio so far, but the API does explain that it's optional. Change-Id: I4543a1c81d810fe92bb08f1ed13f3a3534a371e4 Reviewed-by: Ling Hu <ling.hu@nokia.com>
This commit is contained in:
committed by
Qt by Nokia
parent
8aef60c1cf
commit
3b00730eca
@@ -326,6 +326,29 @@ int QAudioInput::notifyInterval() const
|
||||
return d->notifyInterval();
|
||||
}
|
||||
|
||||
/*!
|
||||
Sets the input volume to \a volume.
|
||||
|
||||
If the device does not support adjusting the input
|
||||
volume then \a volume will be ignored and the input
|
||||
volume will remain at 1.0.
|
||||
*/
|
||||
void QAudioInput::setVolume(qreal volume)
|
||||
{
|
||||
d->setVolume(volume);
|
||||
}
|
||||
|
||||
/*!
|
||||
Returns the input volume (gain).
|
||||
|
||||
If the device does not support adjusting the input volume
|
||||
the returned value will be 1.0.
|
||||
*/
|
||||
qreal QAudioInput::volume() const
|
||||
{
|
||||
return d->volume();
|
||||
}
|
||||
|
||||
/*!
|
||||
Returns the amount of audio data processed since start()
|
||||
was called in microseconds.
|
||||
|
||||
@@ -91,6 +91,9 @@ public:
|
||||
void setNotifyInterval(int milliSeconds);
|
||||
int notifyInterval() const;
|
||||
|
||||
void setVolume(qreal volume);
|
||||
qreal volume() const;
|
||||
|
||||
qint64 processedUSecs() const;
|
||||
qint64 elapsedUSecs() const;
|
||||
|
||||
|
||||
@@ -127,6 +127,8 @@ public:
|
||||
virtual QAudio::State state() const = 0;
|
||||
virtual void setFormat(const QAudioFormat& fmt) = 0;
|
||||
virtual QAudioFormat format() const = 0;
|
||||
virtual void setVolume(qreal) {}
|
||||
virtual qreal volume() const { return 1.0; }
|
||||
|
||||
Q_SIGNALS:
|
||||
void errorChanged(QAudio::Error);
|
||||
|
||||
Reference in New Issue
Block a user