Showing the changes to interface/src/scripting/AudioDeviceScriptingInterface.cpp (1 of 8 files). Show all
Unified · Split
| @@ -18,6 +18,21 @@ AudioDeviceScriptingInterface* AudioDeviceScriptingInterface::getInstance() { · 17 unmodified lines | ||
| 18 | 18 | return &sharedInstance; |
| 19 | 19 | } |
| 20 | 20 | |
| 21 | +QStringList AudioDeviceScriptingInterface::inputAudioDevices() const | |
| 22 | +{ | |
| 23 | + return DependencyManager::get<AudioClient>()->getDeviceNames(QAudio::AudioInput).toList();; | |
| 24 | +} | |
| 25 | + | |
| 26 | +QStringList AudioDeviceScriptingInterface::outputAudioDevices() const | |
| 27 | +{ | |
| 28 | + return DependencyManager::get<AudioClient>()->getDeviceNames(QAudio::AudioOutput).toList();; | |
| 29 | +} | |
| 30 | + | |
| 31 | +bool AudioDeviceScriptingInterface::muted() | |
| 32 | +{ | |
| 33 | + return getMuted(); | |
| 34 | +} | |
| 35 | + | |
| 21 | 36 | AudioDeviceScriptingInterface::AudioDeviceScriptingInterface() { |
| 22 | 37 | connect(DependencyManager::get<AudioClient>().data(), &AudioClient::muteToggled, |
| 23 | 38 | this, &AudioDeviceScriptingInterface::muteToggled); |
| @@ -31,7 +46,6 @@ bool AudioDeviceScriptingInterface::setInputDevice(const QString& deviceName) { · 7 unmodified lines | ||
| 31 | 46 | Qt::BlockingQueuedConnection, |
| 32 | 47 | Q_RETURN_ARG(bool, result), |
| 33 | 48 | Q_ARG(const QString&, deviceName)); |
| 34 | − | |
| 35 | 49 | return result; |
| 36 | 50 | } |
| 37 | 51 | |
| @@ -41,7 +55,6 @@ bool AudioDeviceScriptingInterface::setOutputDevice(const QString& deviceName) { · 3 unmodified lines | ||
| 41 | 55 | Qt::BlockingQueuedConnection, |
| 42 | 56 | Q_RETURN_ARG(bool, result), |
| 43 | 57 | Q_ARG(const QString&, deviceName)); |
| 44 | − | |
| 45 | 58 | return result; |
| 46 | 59 | } |
| 47 | 60 | |
| @@ -69,7 +82,6 @@ QVector<QString> AudioDeviceScriptingInterface::getOutputDevices() { · 21 unmodified lines | ||
| 69 | 82 | return DependencyManager::get<AudioClient>()->getDeviceNames(QAudio::AudioOutput); |
| 70 | 83 | } |
| 71 | 84 | |
| 72 | − | |
| 73 | 85 | float AudioDeviceScriptingInterface::getInputVolume() { |
| 74 | 86 | return DependencyManager::get<AudioClient>()->getInputVolume(); |
| 75 | 87 | } |
| @@ -90,6 +102,17 @@ void AudioDeviceScriptingInterface::toggleMute() { · 14 unmodified lines | ||
| 90 | 102 | DependencyManager::get<AudioClient>()->toggleMute(); |
| 91 | 103 | } |
| 92 | 104 | |
| 105 | +void AudioDeviceScriptingInterface::setMuted(bool muted) | |
| 106 | +{ | |
| 107 | + bool lMuted = getMuted(); | |
| 108 | + if (lMuted == muted) | |
| 109 | + return; | |
| 110 | + | |
| 111 | + toggleMute(); | |
| 112 | + lMuted = getMuted(); | |
| 113 | + emit mutedChanged(lMuted); | |
| 114 | +} | |
| 115 | + | |
| 93 | 116 | bool AudioDeviceScriptingInterface::getMuted() { |
| 94 | 117 | return DependencyManager::get<AudioClient>()->isMuted(); |
| 95 | 118 | } |