mirror of
https://github.com/overte-org/overte.git
synced 2025-08-06 18:50:00 +02:00
Merge pull request #12578 from druiz17/use-correct-audio-api
use correct scripting api for audio in Audio.qml
This commit is contained in:
commit
42a686ad93
5 changed files with 18 additions and 6 deletions
|
@ -128,10 +128,10 @@ Rectangle {
|
||||||
AudioControls.CheckBox {
|
AudioControls.CheckBox {
|
||||||
id: stereoMic
|
id: stereoMic
|
||||||
spacing: muteMic.spacing;
|
spacing: muteMic.spacing;
|
||||||
text: qsTr("use stereo for stereo devices");
|
text: qsTr("Enable stereo input");
|
||||||
checked: false;
|
checked: AudioScriptingInterface.isStereoInput();
|
||||||
onClicked: {
|
onClicked: {
|
||||||
var success = Audio.setIsStereoInput(checked);
|
var success = AudioScriptingInterface.setStereoInput(checked);
|
||||||
if (!success) {
|
if (!success) {
|
||||||
checked = !checked;
|
checked = !checked;
|
||||||
}
|
}
|
||||||
|
@ -219,7 +219,7 @@ Rectangle {
|
||||||
onPressed: {
|
onPressed: {
|
||||||
if (!checked) {
|
if (!checked) {
|
||||||
stereoMic.checked = false;
|
stereoMic.checked = false;
|
||||||
Audio.setIsStereoInput(false); // the next selected audio device might not support stereo
|
AudioScriptingInterface.setStereoInput(false); // the next selected audio device might not support stereo
|
||||||
AudioScriptingInterface.setInputDevice(info, bar.currentIndex === 1);
|
AudioScriptingInterface.setInputDevice(info, bar.currentIndex === 1);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -193,6 +193,7 @@ public slots:
|
||||||
bool isMuted() { return _muted; }
|
bool isMuted() { return _muted; }
|
||||||
|
|
||||||
virtual bool setIsStereoInput(bool stereo) override;
|
virtual bool setIsStereoInput(bool stereo) override;
|
||||||
|
virtual bool isStereoInput() override { return _isStereoInput; }
|
||||||
|
|
||||||
void setNoiseReduction(bool isNoiseGateEnabled);
|
void setNoiseReduction(bool isNoiseGateEnabled);
|
||||||
bool isNoiseReductionEnabled() const { return _isNoiseGateEnabled; }
|
bool isNoiseReductionEnabled() const { return _isNoiseGateEnabled; }
|
||||||
|
|
|
@ -28,7 +28,7 @@ class AbstractAudioInterface : public QObject {
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
public:
|
public:
|
||||||
AbstractAudioInterface(QObject* parent = 0) : QObject(parent) {};
|
AbstractAudioInterface(QObject* parent = 0) : QObject(parent) {};
|
||||||
|
|
||||||
static void emitAudioPacket(const void* audioData, size_t bytes, quint16& sequenceNumber, bool isStereo,
|
static void emitAudioPacket(const void* audioData, size_t bytes, quint16& sequenceNumber, bool isStereo,
|
||||||
const Transform& transform, glm::vec3 avatarBoundingBoxCorner, glm::vec3 avatarBoundingBoxScale,
|
const Transform& transform, glm::vec3 avatarBoundingBoxCorner, glm::vec3 avatarBoundingBoxScale,
|
||||||
PacketType packetType, QString codecName = QString(""));
|
PacketType packetType, QString codecName = QString(""));
|
||||||
|
@ -40,8 +40,10 @@ public:
|
||||||
|
|
||||||
public slots:
|
public slots:
|
||||||
virtual bool shouldLoopbackInjectors() { return false; }
|
virtual bool shouldLoopbackInjectors() { return false; }
|
||||||
|
|
||||||
virtual bool setIsStereoInput(bool stereo) = 0;
|
virtual bool setIsStereoInput(bool stereo) = 0;
|
||||||
|
|
||||||
|
virtual bool isStereoInput() = 0;
|
||||||
};
|
};
|
||||||
|
|
||||||
Q_DECLARE_METATYPE(AbstractAudioInterface*)
|
Q_DECLARE_METATYPE(AbstractAudioInterface*)
|
||||||
|
|
|
@ -67,3 +67,11 @@ bool AudioScriptingInterface::setStereoInput(bool stereo) {
|
||||||
}
|
}
|
||||||
return stereoInputChanged;
|
return stereoInputChanged;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool AudioScriptingInterface::isStereoInput() {
|
||||||
|
bool stereoEnabled = false;
|
||||||
|
if (_localAudioInterface) {
|
||||||
|
stereoEnabled = _localAudioInterface->isStereoInput();
|
||||||
|
}
|
||||||
|
return stereoEnabled;
|
||||||
|
}
|
||||||
|
|
|
@ -36,6 +36,7 @@ protected:
|
||||||
Q_INVOKABLE ScriptAudioInjector* playSystemSound(SharedSoundPointer sound, const QVector3D& position);
|
Q_INVOKABLE ScriptAudioInjector* playSystemSound(SharedSoundPointer sound, const QVector3D& position);
|
||||||
|
|
||||||
Q_INVOKABLE bool setStereoInput(bool stereo);
|
Q_INVOKABLE bool setStereoInput(bool stereo);
|
||||||
|
Q_INVOKABLE bool isStereoInput();
|
||||||
|
|
||||||
signals:
|
signals:
|
||||||
void mutedByMixer(); /// the client has been muted by the mixer
|
void mutedByMixer(); /// the client has been muted by the mixer
|
||||||
|
|
Loading…
Reference in a new issue