mirror of
https://github.com/overte-org/overte.git
synced 2025-04-20 04:44:11 +02:00
handle passing of local audio interface to AudioInjector
This commit is contained in:
parent
1f452c8baa
commit
d0e8c294da
4 changed files with 10 additions and 6 deletions
|
@ -417,7 +417,7 @@ Application::Application(int& argc, char** argv, QElapsedTimer &startup_time) :
|
|||
_trayIcon->show();
|
||||
|
||||
// set the local loopback interface for local sounds from audio scripts
|
||||
AudioScriptingInterface::getInstance().setLocalLoopbackInterface(&_audio);
|
||||
AudioScriptingInterface::getInstance().setLocalAudioInterface(&_audio);
|
||||
|
||||
#ifdef HAVE_RTMIDI
|
||||
// setup the MIDIManager
|
||||
|
|
|
@ -21,6 +21,8 @@
|
|||
#include "AudioInjectorOptions.h"
|
||||
#include "Sound.h"
|
||||
|
||||
class AbstractAudioInterface;
|
||||
|
||||
class AudioInjector : public QObject {
|
||||
Q_OBJECT
|
||||
public:
|
||||
|
@ -29,6 +31,8 @@ public:
|
|||
|
||||
bool isFinished() const { return _isFinished; }
|
||||
int getCurrentSendPosition() const { return _currentSendPosition; }
|
||||
|
||||
void setLocalAudioInterface(AbstractAudioInterface* localAudioInterface) { _localAudioInterface = localAudioInterface; }
|
||||
public slots:
|
||||
void injectAudio();
|
||||
void stop() { _shouldStop = true; }
|
||||
|
@ -45,6 +49,7 @@ private:
|
|||
float _loudness;
|
||||
bool _isFinished;
|
||||
int _currentSendPosition;
|
||||
AbstractAudioInterface* _localAudioInterface;
|
||||
|
||||
};
|
||||
|
||||
|
|
|
@ -22,7 +22,7 @@ AudioScriptingInterface& AudioScriptingInterface::getInstance() {
|
|||
}
|
||||
|
||||
AudioScriptingInterface::AudioScriptingInterface() :
|
||||
_localLoopbackInterface(NULL)
|
||||
_localAudioInterface(NULL)
|
||||
{
|
||||
|
||||
}
|
||||
|
@ -45,6 +45,7 @@ void AudioScriptingInterface::stopAllInjectors() {
|
|||
AudioInjector* AudioScriptingInterface::playSound(Sound* sound, const AudioInjectorOptions& injectorOptions) {
|
||||
|
||||
AudioInjector* injector = new AudioInjector(sound, injectorOptions);
|
||||
injector->setLocalAudioInterface(_localAudioInterface);
|
||||
|
||||
QThread* injectorThread = new QThread();
|
||||
|
||||
|
|
|
@ -18,8 +18,6 @@
|
|||
#include "AudioInjector.h"
|
||||
#include "Sound.h"
|
||||
|
||||
const AudioInjectorOptions DEFAULT_INJECTOR_OPTIONS;
|
||||
|
||||
class AudioScriptingInterface : public QObject {
|
||||
Q_OBJECT
|
||||
public:
|
||||
|
@ -27,7 +25,7 @@ public:
|
|||
|
||||
void stopAllInjectors();
|
||||
|
||||
void setLocalLoopbackInterface(AbstractAudioInterface* audioInterface) { _localLoopbackInterface = audioInterface; }
|
||||
void setLocalAudioInterface(AbstractAudioInterface* audioInterface) { _localAudioInterface = audioInterface; }
|
||||
public slots:
|
||||
|
||||
static float getLoudness(AudioInjector* injector);
|
||||
|
@ -42,7 +40,7 @@ public slots:
|
|||
private:
|
||||
AudioScriptingInterface();
|
||||
QList< QPointer<AudioInjector> > _activeInjectors;
|
||||
AbstractAudioInterface* _localLoopbackInterface;
|
||||
AbstractAudioInterface* _localAudioInterface;
|
||||
};
|
||||
|
||||
void registerAudioMetaTypes(QScriptEngine* engine);
|
||||
|
|
Loading…
Reference in a new issue