mirror of
https://github.com/HifiExperiments/overte.git
synced 2025-05-20 15:09:39 +02:00
switch bare pointers to AudioInjector objects to be QSharedPointers
This commit is contained in:
parent
4a35ad105b
commit
3670a04d8e
13 changed files with 148 additions and 120 deletions
|
@ -678,7 +678,7 @@ private:
|
||||||
QTimer _addAssetToWorldErrorTimer;
|
QTimer _addAssetToWorldErrorTimer;
|
||||||
|
|
||||||
FileScriptingInterface* _fileDownload;
|
FileScriptingInterface* _fileDownload;
|
||||||
AudioInjector* _snapshotSoundInjector { nullptr };
|
AudioInjectorPointer _snapshotSoundInjector;
|
||||||
SharedSoundPointer _snapshotSound;
|
SharedSoundPointer _snapshotSound;
|
||||||
|
|
||||||
DisplayPluginPointer _autoSwitchDisplayModeSupportedHMDPlugin;
|
DisplayPluginPointer _autoSwitchDisplayModeSupportedHMDPlugin;
|
||||||
|
|
|
@ -434,8 +434,7 @@ void AvatarManager::handleCollisionEvents(const CollisionEvents& collisionEvents
|
||||||
// but most avatars are roughly the same size, so let's not be so fancy yet.
|
// but most avatars are roughly the same size, so let's not be so fancy yet.
|
||||||
const float AVATAR_STRETCH_FACTOR = 1.0f;
|
const float AVATAR_STRETCH_FACTOR = 1.0f;
|
||||||
|
|
||||||
|
_collisionInjectors.remove_if([](AudioInjectorPointer injector) {
|
||||||
_collisionInjectors.remove_if([](QPointer<AudioInjector>& injector) {
|
|
||||||
return !injector || injector->isFinished();
|
return !injector || injector->isFinished();
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
|
@ -25,8 +25,8 @@
|
||||||
|
|
||||||
#include "AvatarMotionState.h"
|
#include "AvatarMotionState.h"
|
||||||
#include "MyAvatar.h"
|
#include "MyAvatar.h"
|
||||||
|
#include "AudioInjector.h"
|
||||||
|
|
||||||
class AudioInjector;
|
|
||||||
|
|
||||||
class AvatarManager : public AvatarHashMap {
|
class AvatarManager : public AvatarHashMap {
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
|
@ -104,7 +104,7 @@ private:
|
||||||
std::shared_ptr<MyAvatar> _myAvatar;
|
std::shared_ptr<MyAvatar> _myAvatar;
|
||||||
quint64 _lastSendAvatarDataTime = 0; // Controls MyAvatar send data rate.
|
quint64 _lastSendAvatarDataTime = 0; // Controls MyAvatar send data rate.
|
||||||
|
|
||||||
std::list<QPointer<AudioInjector>> _collisionInjectors;
|
std::list<AudioInjectorPointer> _collisionInjectors;
|
||||||
|
|
||||||
RateCounter<> _myAvatarSendRate;
|
RateCounter<> _myAvatarSendRate;
|
||||||
int _numAvatarsUpdated { 0 };
|
int _numAvatarsUpdated { 0 };
|
||||||
|
|
|
@ -1203,11 +1203,11 @@ bool AudioClient::mixLocalAudioInjectors(float* mixBuffer) {
|
||||||
// lock the injectors
|
// lock the injectors
|
||||||
Lock lock(_injectorsMutex);
|
Lock lock(_injectorsMutex);
|
||||||
|
|
||||||
QVector<AudioInjector*> injectorsToRemove;
|
QVector<AudioInjectorPointer> injectorsToRemove;
|
||||||
|
|
||||||
memset(mixBuffer, 0, AudioConstants::NETWORK_FRAME_SAMPLES_STEREO * sizeof(float));
|
memset(mixBuffer, 0, AudioConstants::NETWORK_FRAME_SAMPLES_STEREO * sizeof(float));
|
||||||
|
|
||||||
for (AudioInjector* injector : _activeLocalAudioInjectors) {
|
for (AudioInjectorPointer injector : _activeLocalAudioInjectors) {
|
||||||
// the lock guarantees that injectorBuffer, if found, is invariant
|
// the lock guarantees that injectorBuffer, if found, is invariant
|
||||||
AudioInjectorLocalBuffer* injectorBuffer = injector->getLocalBuffer();
|
AudioInjectorLocalBuffer* injectorBuffer = injector->getLocalBuffer();
|
||||||
if (injectorBuffer) {
|
if (injectorBuffer) {
|
||||||
|
@ -1278,7 +1278,7 @@ bool AudioClient::mixLocalAudioInjectors(float* mixBuffer) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
for (AudioInjector* injector : injectorsToRemove) {
|
for (AudioInjectorPointer injector : injectorsToRemove) {
|
||||||
qCDebug(audioclient) << "removing injector";
|
qCDebug(audioclient) << "removing injector";
|
||||||
_activeLocalAudioInjectors.removeOne(injector);
|
_activeLocalAudioInjectors.removeOne(injector);
|
||||||
}
|
}
|
||||||
|
@ -1369,7 +1369,7 @@ void AudioClient::setIsStereoInput(bool isStereoInput) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
bool AudioClient::outputLocalInjector(AudioInjector* injector) {
|
bool AudioClient::outputLocalInjector(AudioInjectorPointer injector) {
|
||||||
AudioInjectorLocalBuffer* injectorBuffer = injector->getLocalBuffer();
|
AudioInjectorLocalBuffer* injectorBuffer = injector->getLocalBuffer();
|
||||||
if (injectorBuffer) {
|
if (injectorBuffer) {
|
||||||
// local injectors are on the AudioInjectorsThread, so we must guard access
|
// local injectors are on the AudioInjectorsThread, so we must guard access
|
||||||
|
|
|
@ -143,7 +143,7 @@ public:
|
||||||
|
|
||||||
Q_INVOKABLE void setAvatarBoundingBoxParameters(glm::vec3 corner, glm::vec3 scale);
|
Q_INVOKABLE void setAvatarBoundingBoxParameters(glm::vec3 corner, glm::vec3 scale);
|
||||||
|
|
||||||
bool outputLocalInjector(AudioInjector* injector) override;
|
bool outputLocalInjector(AudioInjectorPointer injector) override;
|
||||||
|
|
||||||
QAudioDeviceInfo getActiveAudioDevice(QAudio::Mode mode) const;
|
QAudioDeviceInfo getActiveAudioDevice(QAudio::Mode mode) const;
|
||||||
QList<QAudioDeviceInfo> getAudioDevices(QAudio::Mode mode) const;
|
QList<QAudioDeviceInfo> getAudioDevices(QAudio::Mode mode) const;
|
||||||
|
@ -380,7 +380,7 @@ private:
|
||||||
|
|
||||||
bool _hasReceivedFirstPacket { false };
|
bool _hasReceivedFirstPacket { false };
|
||||||
|
|
||||||
QVector<AudioInjector*> _activeLocalAudioInjectors;
|
QVector<AudioInjectorPointer> _activeLocalAudioInjectors;
|
||||||
|
|
||||||
bool _isPlayingBackRecording { false };
|
bool _isPlayingBackRecording { false };
|
||||||
|
|
||||||
|
|
|
@ -18,6 +18,7 @@
|
||||||
#include <udt/PacketHeaders.h>
|
#include <udt/PacketHeaders.h>
|
||||||
|
|
||||||
#include "AudioInjectorOptions.h"
|
#include "AudioInjectorOptions.h"
|
||||||
|
#include "AudioInjector.h"
|
||||||
|
|
||||||
class AudioInjector;
|
class AudioInjector;
|
||||||
class AudioInjectorLocalBuffer;
|
class AudioInjectorLocalBuffer;
|
||||||
|
@ -35,7 +36,7 @@ public:
|
||||||
// threadsafe
|
// threadsafe
|
||||||
// moves injector->getLocalBuffer() to another thread (so removes its parent)
|
// moves injector->getLocalBuffer() to another thread (so removes its parent)
|
||||||
// take care to delete it when ~AudioInjector, as parenting Qt semantics will not work
|
// take care to delete it when ~AudioInjector, as parenting Qt semantics will not work
|
||||||
virtual bool outputLocalInjector(AudioInjector* injector) = 0;
|
virtual bool outputLocalInjector(AudioInjectorPointer injector) = 0;
|
||||||
|
|
||||||
public slots:
|
public slots:
|
||||||
virtual bool shouldLoopbackInjectors() { return false; }
|
virtual bool shouldLoopbackInjectors() { return false; }
|
||||||
|
|
|
@ -132,7 +132,7 @@ void AudioInjector::restart() {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
bool AudioInjector::inject(bool(AudioInjectorManager::*injection)(AudioInjector*)) {
|
bool AudioInjector::inject(bool(AudioInjectorManager::*injection)(AudioInjectorPointer)) {
|
||||||
_state = AudioInjectorState::NotFinished;
|
_state = AudioInjectorState::NotFinished;
|
||||||
|
|
||||||
int byteOffset = 0;
|
int byteOffset = 0;
|
||||||
|
@ -150,7 +150,7 @@ bool AudioInjector::inject(bool(AudioInjectorManager::*injection)(AudioInjector*
|
||||||
bool success = true;
|
bool success = true;
|
||||||
if (!_options.localOnly) {
|
if (!_options.localOnly) {
|
||||||
auto injectorManager = DependencyManager::get<AudioInjectorManager>();
|
auto injectorManager = DependencyManager::get<AudioInjectorManager>();
|
||||||
if (!(*injectorManager.*injection)(this)) {
|
if (!(*injectorManager.*injection)(getThisPointer())) {
|
||||||
success = false;
|
success = false;
|
||||||
finishNetworkInjection();
|
finishNetworkInjection();
|
||||||
}
|
}
|
||||||
|
@ -173,7 +173,7 @@ bool AudioInjector::injectLocally() {
|
||||||
|
|
||||||
// call this function on the AudioClient's thread
|
// call this function on the AudioClient's thread
|
||||||
// this will move the local buffer's thread to the LocalInjectorThread
|
// this will move the local buffer's thread to the LocalInjectorThread
|
||||||
success = _localAudioInterface->outputLocalInjector(this);
|
success = _localAudioInterface->outputLocalInjector(getThisPointer());
|
||||||
|
|
||||||
if (!success) {
|
if (!success) {
|
||||||
qCDebug(audio) << "AudioInjector::injectLocally could not output locally via _localAudioInterface";
|
qCDebug(audio) << "AudioInjector::injectLocally could not output locally via _localAudioInterface";
|
||||||
|
@ -429,7 +429,8 @@ void AudioInjector::stopAndDeleteLater() {
|
||||||
QMetaObject::invokeMethod(this, "deleteLater", Qt::QueuedConnection);
|
QMetaObject::invokeMethod(this, "deleteLater", Qt::QueuedConnection);
|
||||||
}
|
}
|
||||||
|
|
||||||
AudioInjector* AudioInjector::playSound(SharedSoundPointer sound, const float volume, const float stretchFactor, const glm::vec3 position) {
|
AudioInjectorPointer AudioInjector::playSound(SharedSoundPointer sound, const float volume,
|
||||||
|
const float stretchFactor, const glm::vec3 position) {
|
||||||
if (!sound || !sound->isReady()) {
|
if (!sound || !sound->isReady()) {
|
||||||
return nullptr;
|
return nullptr;
|
||||||
}
|
}
|
||||||
|
@ -462,8 +463,8 @@ AudioInjector* AudioInjector::playSound(SharedSoundPointer sound, const float vo
|
||||||
return playSoundAndDelete(resampled, options);
|
return playSoundAndDelete(resampled, options);
|
||||||
}
|
}
|
||||||
|
|
||||||
AudioInjector* AudioInjector::playSoundAndDelete(const QByteArray& buffer, const AudioInjectorOptions options) {
|
AudioInjectorPointer AudioInjector::playSoundAndDelete(const QByteArray& buffer, const AudioInjectorOptions options) {
|
||||||
AudioInjector* sound = playSound(buffer, options);
|
AudioInjectorPointer sound = playSound(buffer, options);
|
||||||
|
|
||||||
if (sound) {
|
if (sound) {
|
||||||
sound->_state |= AudioInjectorState::PendingDelete;
|
sound->_state |= AudioInjectorState::PendingDelete;
|
||||||
|
@ -473,10 +474,27 @@ AudioInjector* AudioInjector::playSoundAndDelete(const QByteArray& buffer, const
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
AudioInjector* AudioInjector::playSound(const QByteArray& buffer, const AudioInjectorOptions options) {
|
AudioInjectorPointer AudioInjector::playSound(const QByteArray& buffer, const AudioInjectorOptions options) {
|
||||||
AudioInjector* injector = new AudioInjector(buffer, options);
|
AudioInjectorPointer injector = AudioInjectorPointer(new AudioInjector(buffer, options));
|
||||||
|
injector->setThisPointer(injector);
|
||||||
|
|
||||||
if (!injector->inject(&AudioInjectorManager::threadInjector)) {
|
if (!injector->inject(&AudioInjectorManager::threadInjector)) {
|
||||||
qWarning() << "AudioInjector::playSound failed to thread injector";
|
qWarning() << "AudioInjector::playSound failed to thread injector";
|
||||||
}
|
}
|
||||||
return injector;
|
return injector;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
AudioInjectorPointer AudioInjector::getThisPointer() {
|
||||||
|
std::lock_guard<std::mutex> lock(_refLock);
|
||||||
|
QSharedPointer<AudioInjector> this_ref(_self);
|
||||||
|
if (this_ref.isNull()) {
|
||||||
|
this_ref = QSharedPointer<AudioInjector>(this);
|
||||||
|
_self = this_ref.toWeakRef();
|
||||||
|
}
|
||||||
|
return this_ref;
|
||||||
|
}
|
||||||
|
|
||||||
|
void AudioInjector::setThisPointer(AudioInjectorPointer self) {
|
||||||
|
std::lock_guard<std::mutex> lock(_refLock);
|
||||||
|
_self = self.toWeakRef();
|
||||||
|
}
|
||||||
|
|
|
@ -32,6 +32,8 @@
|
||||||
|
|
||||||
class AbstractAudioInterface;
|
class AbstractAudioInterface;
|
||||||
class AudioInjectorManager;
|
class AudioInjectorManager;
|
||||||
|
class AudioInjector;
|
||||||
|
using AudioInjectorPointer = QSharedPointer<AudioInjector>;
|
||||||
|
|
||||||
|
|
||||||
enum class AudioInjectorState : uint8_t {
|
enum class AudioInjectorState : uint8_t {
|
||||||
|
@ -72,9 +74,14 @@ public:
|
||||||
|
|
||||||
bool stateHas(AudioInjectorState state) const ;
|
bool stateHas(AudioInjectorState state) const ;
|
||||||
static void setLocalAudioInterface(AbstractAudioInterface* audioInterface) { _localAudioInterface = audioInterface; }
|
static void setLocalAudioInterface(AbstractAudioInterface* audioInterface) { _localAudioInterface = audioInterface; }
|
||||||
static AudioInjector* playSoundAndDelete(const QByteArray& buffer, const AudioInjectorOptions options);
|
static AudioInjectorPointer playSoundAndDelete(const QByteArray& buffer, const AudioInjectorOptions options);
|
||||||
static AudioInjector* playSound(const QByteArray& buffer, const AudioInjectorOptions options);
|
static AudioInjectorPointer playSound(const QByteArray& buffer, const AudioInjectorOptions options);
|
||||||
static AudioInjector* playSound(SharedSoundPointer sound, const float volume, const float stretchFactor, const glm::vec3 position);
|
static AudioInjectorPointer playSound(SharedSoundPointer sound, const float volume,
|
||||||
|
const float stretchFactor, const glm::vec3 position);
|
||||||
|
|
||||||
|
QWeakPointer<AudioInjector> weakRef() const { return _self; }
|
||||||
|
AudioInjectorPointer getThisPointer();
|
||||||
|
void setThisPointer(AudioInjectorPointer self);
|
||||||
|
|
||||||
public slots:
|
public slots:
|
||||||
void restart();
|
void restart();
|
||||||
|
@ -98,7 +105,7 @@ signals:
|
||||||
|
|
||||||
private:
|
private:
|
||||||
int64_t injectNextFrame();
|
int64_t injectNextFrame();
|
||||||
bool inject(bool(AudioInjectorManager::*injection)(AudioInjector*));
|
bool inject(bool(AudioInjectorManager::*injection)(AudioInjectorPointer));
|
||||||
bool injectLocally();
|
bool injectLocally();
|
||||||
void deleteLocalBuffer();
|
void deleteLocalBuffer();
|
||||||
|
|
||||||
|
@ -121,8 +128,11 @@ private:
|
||||||
AudioHRTF _localHRTF;
|
AudioHRTF _localHRTF;
|
||||||
AudioFOA _localFOA;
|
AudioFOA _localFOA;
|
||||||
friend class AudioInjectorManager;
|
friend class AudioInjectorManager;
|
||||||
|
|
||||||
|
QWeakPointer<AudioInjector> _self;
|
||||||
|
mutable std::mutex _refLock;
|
||||||
};
|
};
|
||||||
|
|
||||||
Q_DECLARE_METATYPE(AudioInjector*)
|
Q_DECLARE_METATYPE(AudioInjectorPointer)
|
||||||
|
|
||||||
#endif // hifi_AudioInjector_h
|
#endif // hifi_AudioInjector_h
|
||||||
|
|
|
@ -139,7 +139,7 @@ bool AudioInjectorManager::wouldExceedLimits() { // Should be called inside of a
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool AudioInjectorManager::threadInjector(AudioInjector* injector) {
|
bool AudioInjectorManager::threadInjector(AudioInjectorPointer injector) {
|
||||||
if (_shouldStop) {
|
if (_shouldStop) {
|
||||||
qCDebug(audio) << "AudioInjectorManager::threadInjector asked to thread injector but is shutting down.";
|
qCDebug(audio) << "AudioInjectorManager::threadInjector asked to thread injector but is shutting down.";
|
||||||
return false;
|
return false;
|
||||||
|
@ -159,7 +159,7 @@ bool AudioInjectorManager::threadInjector(AudioInjector* injector) {
|
||||||
injector->moveToThread(_thread);
|
injector->moveToThread(_thread);
|
||||||
|
|
||||||
// add the injector to the queue with a send timestamp of now
|
// add the injector to the queue with a send timestamp of now
|
||||||
_injectors.emplace(usecTimestampNow(), InjectorQPointer { injector });
|
_injectors.emplace(usecTimestampNow(), AudioInjectorPointer { injector });
|
||||||
|
|
||||||
// notify our wait condition so we can inject two frames for this injector immediately
|
// notify our wait condition so we can inject two frames for this injector immediately
|
||||||
_injectorReady.notify_one();
|
_injectorReady.notify_one();
|
||||||
|
@ -168,7 +168,7 @@ bool AudioInjectorManager::threadInjector(AudioInjector* injector) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
bool AudioInjectorManager::restartFinishedInjector(AudioInjector* injector) {
|
bool AudioInjectorManager::restartFinishedInjector(AudioInjectorPointer injector) {
|
||||||
if (_shouldStop) {
|
if (_shouldStop) {
|
||||||
qCDebug(audio) << "AudioInjectorManager::threadInjector asked to thread injector but is shutting down.";
|
qCDebug(audio) << "AudioInjectorManager::threadInjector asked to thread injector but is shutting down.";
|
||||||
return false;
|
return false;
|
||||||
|
@ -181,7 +181,7 @@ bool AudioInjectorManager::restartFinishedInjector(AudioInjector* injector) {
|
||||||
return false;
|
return false;
|
||||||
} else {
|
} else {
|
||||||
// add the injector to the queue with a send timestamp of now
|
// add the injector to the queue with a send timestamp of now
|
||||||
_injectors.emplace(usecTimestampNow(), InjectorQPointer { injector });
|
_injectors.emplace(usecTimestampNow(), injector->getThisPointer());
|
||||||
|
|
||||||
// notify our wait condition so we can inject two frames for this injector immediately
|
// notify our wait condition so we can inject two frames for this injector immediately
|
||||||
_injectorReady.notify_one();
|
_injectorReady.notify_one();
|
||||||
|
|
|
@ -23,7 +23,7 @@
|
||||||
|
|
||||||
#include <DependencyManager.h>
|
#include <DependencyManager.h>
|
||||||
|
|
||||||
class AudioInjector;
|
#include "AudioInjector.h"
|
||||||
|
|
||||||
class AudioInjectorManager : public QObject, public Dependency {
|
class AudioInjectorManager : public QObject, public Dependency {
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
|
@ -34,8 +34,7 @@ private slots:
|
||||||
void run();
|
void run();
|
||||||
private:
|
private:
|
||||||
|
|
||||||
using InjectorQPointer = QPointer<AudioInjector>;
|
using TimeInjectorPointerPair = std::pair<uint64_t, AudioInjectorPointer>;
|
||||||
using TimeInjectorPointerPair = std::pair<uint64_t, InjectorQPointer>;
|
|
||||||
|
|
||||||
struct greaterTime {
|
struct greaterTime {
|
||||||
bool operator() (const TimeInjectorPointerPair& x, const TimeInjectorPointerPair& y) const {
|
bool operator() (const TimeInjectorPointerPair& x, const TimeInjectorPointerPair& y) const {
|
||||||
|
@ -49,8 +48,8 @@ private:
|
||||||
using Mutex = std::mutex;
|
using Mutex = std::mutex;
|
||||||
using Lock = std::unique_lock<Mutex>;
|
using Lock = std::unique_lock<Mutex>;
|
||||||
|
|
||||||
bool threadInjector(AudioInjector* injector);
|
bool threadInjector(AudioInjectorPointer injector);
|
||||||
bool restartFinishedInjector(AudioInjector* injector);
|
bool restartFinishedInjector(AudioInjectorPointer injector);
|
||||||
void notifyInjectorReadyCondition() { _injectorReady.notify_one(); }
|
void notifyInjectorReadyCondition() { _injectorReady.notify_one(); }
|
||||||
bool wouldExceedLimits();
|
bool wouldExceedLimits();
|
||||||
|
|
||||||
|
|
|
@ -29,10 +29,10 @@ void injectorFromScriptValue(const QScriptValue& object, ScriptAudioInjector*& o
|
||||||
out = qobject_cast<ScriptAudioInjector*>(object.toQObject());
|
out = qobject_cast<ScriptAudioInjector*>(object.toQObject());
|
||||||
}
|
}
|
||||||
|
|
||||||
ScriptAudioInjector::ScriptAudioInjector(AudioInjector* injector) :
|
ScriptAudioInjector::ScriptAudioInjector(AudioInjectorPointer injector) :
|
||||||
_injector(injector)
|
_injector(injector)
|
||||||
{
|
{
|
||||||
QObject::connect(injector, &AudioInjector::finished, this, &ScriptAudioInjector::finished);
|
QObject::connect(injector.data(), &AudioInjector::finished, this, &ScriptAudioInjector::finished);
|
||||||
}
|
}
|
||||||
|
|
||||||
ScriptAudioInjector::~ScriptAudioInjector() {
|
ScriptAudioInjector::~ScriptAudioInjector() {
|
||||||
|
|
|
@ -23,7 +23,7 @@ class ScriptAudioInjector : public QObject {
|
||||||
Q_PROPERTY(float loudness READ getLoudness)
|
Q_PROPERTY(float loudness READ getLoudness)
|
||||||
Q_PROPERTY(AudioInjectorOptions options WRITE setOptions READ getOptions)
|
Q_PROPERTY(AudioInjectorOptions options WRITE setOptions READ getOptions)
|
||||||
public:
|
public:
|
||||||
ScriptAudioInjector(AudioInjector* injector);
|
ScriptAudioInjector(AudioInjectorPointer injector);
|
||||||
~ScriptAudioInjector();
|
~ScriptAudioInjector();
|
||||||
public slots:
|
public slots:
|
||||||
void restart() { _injector->restart(); }
|
void restart() { _injector->restart(); }
|
||||||
|
@ -41,7 +41,7 @@ signals:
|
||||||
protected slots:
|
protected slots:
|
||||||
void stopInjectorImmediately();
|
void stopInjectorImmediately();
|
||||||
private:
|
private:
|
||||||
QPointer<AudioInjector> _injector;
|
AudioInjectorPointer _injector;
|
||||||
|
|
||||||
friend QScriptValue injectorToScriptValue(QScriptEngine* engine, ScriptAudioInjector* const& in);
|
friend QScriptValue injectorToScriptValue(QScriptEngine* engine, ScriptAudioInjector* const& in);
|
||||||
};
|
};
|
||||||
|
|
|
@ -15,6 +15,7 @@
|
||||||
#include <SoundCache.h>
|
#include <SoundCache.h>
|
||||||
|
|
||||||
class AudioInjector;
|
class AudioInjector;
|
||||||
|
using AudioInjectorPointer = QSharedPointer<AudioInjector>;
|
||||||
|
|
||||||
// SoundEffect object, exposed to qml only, not interface JavaScript.
|
// SoundEffect object, exposed to qml only, not interface JavaScript.
|
||||||
// This is used to play spatial sound effects on tablets/web entities from within QML.
|
// This is used to play spatial sound effects on tablets/web entities from within QML.
|
||||||
|
@ -38,7 +39,7 @@ protected:
|
||||||
QUrl _url;
|
QUrl _url;
|
||||||
float _volume { 1.0f };
|
float _volume { 1.0f };
|
||||||
SharedSoundPointer _sound;
|
SharedSoundPointer _sound;
|
||||||
AudioInjector* _injector { nullptr };
|
AudioInjectorPointer _injector;
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif // hifi_SoundEffect_h
|
#endif // hifi_SoundEffect_h
|
||||||
|
|
Loading…
Reference in a new issue