Showing the changes to libraries/script-engine/src/AudioScriptingInterface.cpp (1 of 7 files). Show all
Unified · Split
| @@ -9,6 +9,8 @@ · 8 unmodified lines | ||
| 9 | 9 | // See the accompanying file LICENSE or http://www.apache.org/licenses/LICENSE-2.0.html |
| 10 | 10 | // |
| 11 | 11 | |
| 12 | +#include "ScriptAudioInjector.h" | |
| 13 | + | |
| 12 | 14 | #include "AudioScriptingInterface.h" |
| 13 | 15 | |
| 14 | 16 | void registerAudioMetaTypes(QScriptEngine* engine) { |
| @@ -28,12 +30,16 @@ AudioScriptingInterface::AudioScriptingInterface() : · 13 unmodified lines | ||
| 28 | 30 | |
| 29 | 31 | } |
| 30 | 32 | |
| 31 | −AudioInjector* AudioScriptingInterface::playSound(Sound* sound, const AudioInjectorOptions& injectorOptions) { | |
| 33 | +ScriptAudioInjector* AudioScriptingInterface::playSound(Sound* sound, const AudioInjectorOptions& injectorOptions) { | |
| 32 | 34 | AudioInjector* injector = NULL; |
| 33 | 35 | QMetaObject::invokeMethod(this, "invokedPlaySound", Qt::BlockingQueuedConnection, |
| 34 | 36 | Q_RETURN_ARG(AudioInjector*, injector), |
| 35 | 37 | Q_ARG(Sound*, sound), Q_ARG(const AudioInjectorOptions&, injectorOptions)); |
| 36 | − return injector; | |
| 38 | + if (injector) { | |
| 39 | + return new ScriptAudioInjector(injector); | |
| 40 | + } else { | |
| 41 | + return NULL; | |
| 42 | + } | |
| 37 | 43 | } |
| 38 | 44 | |
| 39 | 45 | AudioInjector* AudioScriptingInterface::invokedPlaySound(Sound* sound, const AudioInjectorOptions& injectorOptions) { |
| @@ -43,6 +49,7 @@ AudioInjector* AudioScriptingInterface::invokedPlaySound(Sound* sound, const Aud · 3 unmodified lines | ||
| 43 | 49 | optionsCopy.stereo = sound->isStereo(); |
| 44 | 50 | |
| 45 | 51 | QThread* injectorThread = new QThread(); |
| 52 | + qDebug() << "the injector thread is" << injectorThread; | |
| 46 | 53 | injectorThread->setObjectName("Audio Injector Thread"); |
| 47 | 54 | |
| 48 | 55 | AudioInjector* injector = new AudioInjector(sound, optionsCopy); |
| @@ -50,6 +57,8 @@ AudioInjector* AudioScriptingInterface::invokedPlaySound(Sound* sound, const Aud · 1 unmodified line | ||
| 50 | 57 | |
| 51 | 58 | injector->moveToThread(injectorThread); |
| 52 | 59 | |
| 60 | + qDebug() << "the injector is" << injector; | |
| 61 | + | |
| 53 | 62 | // start injecting when the injector thread starts |
| 54 | 63 | connect(injectorThread, &QThread::started, injector, &AudioInjector::injectAudio); |
| 55 | 64 | |