Showing the changes to interface/src/scripting/AudioDeviceScriptingInterface.cpp (1 of 11 files). Show all
Unified · Split
| @@ -18,9 +18,15 @@ AudioDeviceScriptingInterface* AudioDeviceScriptingInterface::getInstance() { · 17 unmodified lines | |||
| 18 | return &sharedInstance; | 18 | return &sharedInstance; |
| 19 | } | 19 | } |
| 20 | 20 | ||
| 21 | AudioDeviceScriptingInterface::AudioDeviceScriptingInterface() { | ||
| 22 | connect(DependencyManager::get<Audio>(), &Audio::muteToggled, | ||
| 23 | AudioDeviceScriptingInterface::getInstance(), | ||
| 24 | &AudioDeviceScriptingInterface::muteToggled, Qt::DirectConnection); | ||
| 25 | } | ||
| 26 | |||
| 21 | bool AudioDeviceScriptingInterface::setInputDevice(const QString& deviceName) { | 27 | bool AudioDeviceScriptingInterface::setInputDevice(const QString& deviceName) { |
| 22 | bool result; | 28 | bool result; |
| 23 | QMetaObject::invokeMethod(Application::getInstance()->getAudio(), "switchInputToAudioDevice", | 29 | QMetaObject::invokeMethod(DependencyManager::get<Audio>(), "switchInputToAudioDevice", |
| 24 | Qt::BlockingQueuedConnection, | 30 | Qt::BlockingQueuedConnection, |
| 25 | Q_RETURN_ARG(bool, result), | 31 | Q_RETURN_ARG(bool, result), |
| 26 | Q_ARG(const QString&, deviceName)); | 32 | Q_ARG(const QString&, deviceName)); |
| @@ -30,7 +36,7 @@ bool AudioDeviceScriptingInterface::setInputDevice(const QString& deviceName) { · 3 unmodified lines | |||
| 30 | 36 | ||
| 31 | bool AudioDeviceScriptingInterface::setOutputDevice(const QString& deviceName) { | 37 | bool AudioDeviceScriptingInterface::setOutputDevice(const QString& deviceName) { |
| 32 | bool result; | 38 | bool result; |
| 33 | QMetaObject::invokeMethod(Application::getInstance()->getAudio(), "switchOutputToAudioDevice", | 39 | QMetaObject::invokeMethod(DependencyManager::get<Audio>(), "switchOutputToAudioDevice", |
| 34 | Qt::BlockingQueuedConnection, | 40 | Qt::BlockingQueuedConnection, |
| 35 | Q_RETURN_ARG(bool, result), | 41 | Q_RETURN_ARG(bool, result), |
| 36 | Q_ARG(const QString&, deviceName)); | 42 | Q_ARG(const QString&, deviceName)); |
| @@ -39,50 +45,50 @@ bool AudioDeviceScriptingInterface::setOutputDevice(const QString& deviceName) { · 2 unmodified lines | |||
| 39 | } | 45 | } |
| 40 | 46 | ||
| 41 | QString AudioDeviceScriptingInterface::getInputDevice() { | 47 | QString AudioDeviceScriptingInterface::getInputDevice() { |
| 42 | return Application::getInstance()->getAudio()->getDeviceName(QAudio::AudioInput); | 48 | return DependencyManager::get<Audio>()->getDeviceName(QAudio::AudioInput); |
| 43 | } | 49 | } |
| 44 | 50 | ||
| 45 | QString AudioDeviceScriptingInterface::getOutputDevice() { | 51 | QString AudioDeviceScriptingInterface::getOutputDevice() { |
| 46 | return Application::getInstance()->getAudio()->getDeviceName(QAudio::AudioOutput); | 52 | return DependencyManager::get<Audio>()->getDeviceName(QAudio::AudioOutput); |
| 47 | } | 53 | } |
| 48 | 54 | ||
| 49 | QString AudioDeviceScriptingInterface::getDefaultInputDevice() { | 55 | QString AudioDeviceScriptingInterface::getDefaultInputDevice() { |
| 50 | return Application::getInstance()->getAudio()->getDefaultDeviceName(QAudio::AudioInput); | 56 | return DependencyManager::get<Audio>()->getDefaultDeviceName(QAudio::AudioInput); |
| 51 | } | 57 | } |
| 52 | 58 | ||
| 53 | QString AudioDeviceScriptingInterface::getDefaultOutputDevice() { | 59 | QString AudioDeviceScriptingInterface::getDefaultOutputDevice() { |
| 54 | return Application::getInstance()->getAudio()->getDefaultDeviceName(QAudio::AudioOutput); | 60 | return DependencyManager::get<Audio>()->getDefaultDeviceName(QAudio::AudioOutput); |
| 55 | } | 61 | } |
| 56 | 62 | ||
| 57 | QVector<QString> AudioDeviceScriptingInterface::getInputDevices() { | 63 | QVector<QString> AudioDeviceScriptingInterface::getInputDevices() { |
| 58 | return Application::getInstance()->getAudio()->getDeviceNames(QAudio::AudioInput); | 64 | return DependencyManager::get<Audio>()->getDeviceNames(QAudio::AudioInput); |
| 59 | } | 65 | } |
| 60 | 66 | ||
| 61 | QVector<QString> AudioDeviceScriptingInterface::getOutputDevices() { | 67 | QVector<QString> AudioDeviceScriptingInterface::getOutputDevices() { |
| 62 | return Application::getInstance()->getAudio()->getDeviceNames(QAudio::AudioOutput); | 68 | return DependencyManager::get<Audio>()->getDeviceNames(QAudio::AudioOutput); |
| 63 | } | 69 | } |
| 64 | 70 | ||
| 65 | 71 | ||
| 66 | float AudioDeviceScriptingInterface::getInputVolume() { | 72 | float AudioDeviceScriptingInterface::getInputVolume() { |
| 67 | return Application::getInstance()->getAudio()->getInputVolume(); | 73 | return DependencyManager::get<Audio>()->getInputVolume(); |
| 68 | } | 74 | } |
| 69 | 75 | ||
| 70 | void AudioDeviceScriptingInterface::setInputVolume(float volume) { | 76 | void AudioDeviceScriptingInterface::setInputVolume(float volume) { |
| 71 | Application::getInstance()->getAudio()->setInputVolume(volume); | 77 | DependencyManager::get<Audio>()->setInputVolume(volume); |
| 72 | } | 78 | } |
| 73 | 79 | ||
| 74 | void AudioDeviceScriptingInterface::setReverb(bool reverb) { | 80 | void AudioDeviceScriptingInterface::setReverb(bool reverb) { |
| 75 | Application::getInstance()->getAudio()->setReverb(reverb); | 81 | DependencyManager::get<Audio>()->setReverb(reverb); |
| 76 | } | 82 | } |
| 77 | 83 | ||
| 78 | void AudioDeviceScriptingInterface::setReverbOptions(const AudioEffectOptions* options) { | 84 | void AudioDeviceScriptingInterface::setReverbOptions(const AudioEffectOptions* options) { |
| 79 | Application::getInstance()->getAudio()->setReverbOptions(options); | 85 | DependencyManager::get<Audio>()->setReverbOptions(options); |
| 80 | } | 86 | } |
| 81 | 87 | ||
| 82 | void AudioDeviceScriptingInterface::toggleMute() { | 88 | void AudioDeviceScriptingInterface::toggleMute() { |
| 83 | Application::getInstance()->getAudio()->toggleMute(); | 89 | DependencyManager::get<Audio>()->toggleMute(); |
| 84 | } | 90 | } |
| 85 | 91 | ||
| 86 | bool AudioDeviceScriptingInterface::getMuted() { | 92 | bool AudioDeviceScriptingInterface::getMuted() { |
| 87 | return Application::getInstance()->getAudio()->getMuted(); | 93 | return DependencyManager::get<Audio>()->getMuted(); |
| 88 | } | 94 | } |