mirror of
https://github.com/HifiExperiments/overte.git
synced 2025-08-04 02:13:09 +02:00
Merge branch 'master' of https://github.com/highfidelity/hifi into temp1
This commit is contained in:
commit
dc748a85a3
22 changed files with 139 additions and 34 deletions
|
@ -54,6 +54,8 @@ EntityPropertyDialogBox = (function () {
|
||||||
index++;
|
index++;
|
||||||
array.push({ label: "Textures:", value: properties.textures });
|
array.push({ label: "Textures:", value: properties.textures });
|
||||||
index++;
|
index++;
|
||||||
|
array.push({ label: "Original Textures:\n" + properties.originalTextures, type: "header" });
|
||||||
|
index++;
|
||||||
}
|
}
|
||||||
array.push({ label: "Position:", type: "header" });
|
array.push({ label: "Position:", type: "header" });
|
||||||
index++;
|
index++;
|
||||||
|
@ -239,6 +241,7 @@ EntityPropertyDialogBox = (function () {
|
||||||
properties.animationFPS = array[index++].value;
|
properties.animationFPS = array[index++].value;
|
||||||
properties.animationFrameIndex = array[index++].value;
|
properties.animationFrameIndex = array[index++].value;
|
||||||
properties.textures = array[index++].value;
|
properties.textures = array[index++].value;
|
||||||
|
index++; // skip textureNames label
|
||||||
}
|
}
|
||||||
index++; // skip header
|
index++; // skip header
|
||||||
properties.position.x = array[index++].value;
|
properties.position.x = array[index++].value;
|
||||||
|
|
|
@ -416,6 +416,9 @@ Application::Application(int& argc, char** argv, QElapsedTimer &startup_time) :
|
||||||
|
|
||||||
_trayIcon->show();
|
_trayIcon->show();
|
||||||
|
|
||||||
|
// set the local loopback interface for local sounds from audio scripts
|
||||||
|
AudioScriptingInterface::getInstance().setLocalLoopbackInterface(&_audio);
|
||||||
|
|
||||||
#ifdef HAVE_RTMIDI
|
#ifdef HAVE_RTMIDI
|
||||||
// setup the MIDIManager
|
// setup the MIDIManager
|
||||||
MIDIManager& midiManagerInstance = MIDIManager::getInstance();
|
MIDIManager& midiManagerInstance = MIDIManager::getInstance();
|
||||||
|
|
|
@ -184,9 +184,9 @@ QAudioDeviceInfo getNamedAudioDeviceForMode(QAudio::Mode mode, const QString& de
|
||||||
QAudioDeviceInfo::defaultOutputDevice();
|
QAudioDeviceInfo::defaultOutputDevice();
|
||||||
#else
|
#else
|
||||||
foreach(QAudioDeviceInfo audioDevice, QAudioDeviceInfo::availableDevices(mode)) {
|
foreach(QAudioDeviceInfo audioDevice, QAudioDeviceInfo::availableDevices(mode)) {
|
||||||
qDebug() << audioDevice.deviceName() << " " << deviceName;
|
|
||||||
if (audioDevice.deviceName().trimmed() == deviceName.trimmed()) {
|
if (audioDevice.deviceName().trimmed() == deviceName.trimmed()) {
|
||||||
result = audioDevice;
|
result = audioDevice;
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
@ -1331,9 +1331,22 @@ void Audio::startDrumSound(float volume, float frequency, float duration, float
|
||||||
_drumSoundSample = 0;
|
_drumSoundSample = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
void Audio::handleAudioByteArray(const QByteArray& audioByteArray) {
|
void Audio::handleAudioByteArray(const QByteArray& audioByteArray, const AudioInjectorOptions& injectorOptions) {
|
||||||
// TODO: either create a new audio device (up to the limit of the sound card or a hard limit)
|
if (audioByteArray.size() > 0) {
|
||||||
// or send to the mixer and use delayed loopback
|
QAudioFormat localFormat = _outputFormat;
|
||||||
|
|
||||||
|
if (!injectorOptions.isStereo()) {
|
||||||
|
localFormat.setChannelCount(1);
|
||||||
|
}
|
||||||
|
|
||||||
|
QAudioOutput* localSoundOutput = new QAudioOutput(getNamedAudioDeviceForMode(QAudio::AudioOutput, _outputAudioDeviceName), localFormat, this);
|
||||||
|
|
||||||
|
QIODevice* localIODevice = localSoundOutput->start();
|
||||||
|
qDebug() << "Writing" << audioByteArray.size() << "to" << localIODevice;
|
||||||
|
localIODevice->write(audioByteArray);
|
||||||
|
} else {
|
||||||
|
qDebug() << "Audio::handleAudioByteArray called with an empty byte array. Sound is likely still downloading.";
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void Audio::renderToolBox(int x, int y, bool boxed) {
|
void Audio::renderToolBox(int x, int y, bool boxed) {
|
||||||
|
@ -1903,6 +1916,7 @@ bool Audio::switchInputToAudioDevice(const QAudioDeviceInfo& inputDeviceInfo) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return supportedFormat;
|
return supportedFormat;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1961,6 +1975,7 @@ bool Audio::switchOutputToAudioDevice(const QAudioDeviceInfo& outputDeviceInfo)
|
||||||
supportedFormat = true;
|
supportedFormat = true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return supportedFormat;
|
return supportedFormat;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -155,7 +155,7 @@ public slots:
|
||||||
void selectAudioFilterBassCut();
|
void selectAudioFilterBassCut();
|
||||||
void selectAudioFilterSmiley();
|
void selectAudioFilterSmiley();
|
||||||
|
|
||||||
virtual void handleAudioByteArray(const QByteArray& audioByteArray);
|
virtual void handleAudioByteArray(const QByteArray& audioByteArray, const AudioInjectorOptions& options);
|
||||||
|
|
||||||
void sendDownstreamAudioStatsPacket();
|
void sendDownstreamAudioStatsPacket();
|
||||||
|
|
||||||
|
|
|
@ -24,10 +24,10 @@
|
||||||
const int HAIR_CONSTRAINTS = 2;
|
const int HAIR_CONSTRAINTS = 2;
|
||||||
|
|
||||||
const int DEFAULT_HAIR_STRANDS = 20;
|
const int DEFAULT_HAIR_STRANDS = 20;
|
||||||
const int DEFAULT_HAIR_LINKS = 10;
|
const int DEFAULT_HAIR_LINKS = 11;
|
||||||
const float DEFAULT_HAIR_RADIUS = 0.075f;
|
const float DEFAULT_HAIR_RADIUS = 0.075f;
|
||||||
const float DEFAULT_HAIR_LINK_LENGTH = 0.06f;
|
const float DEFAULT_HAIR_LINK_LENGTH = 0.1f;
|
||||||
const float DEFAULT_HAIR_THICKNESS = 0.025f;
|
const float DEFAULT_HAIR_THICKNESS = 0.07f;
|
||||||
const glm::vec3 DEFAULT_GRAVITY(0.0f, -9.8f, 0.0f);
|
const glm::vec3 DEFAULT_GRAVITY(0.0f, -9.8f, 0.0f);
|
||||||
|
|
||||||
class Hair {
|
class Hair {
|
||||||
|
|
|
@ -61,11 +61,13 @@ EntityTreeRenderer::~EntityTreeRenderer() {
|
||||||
|
|
||||||
void EntityTreeRenderer::clear() {
|
void EntityTreeRenderer::clear() {
|
||||||
OctreeRenderer::clear();
|
OctreeRenderer::clear();
|
||||||
|
_entityScripts.clear();
|
||||||
}
|
}
|
||||||
|
|
||||||
void EntityTreeRenderer::init() {
|
void EntityTreeRenderer::init() {
|
||||||
OctreeRenderer::init();
|
OctreeRenderer::init();
|
||||||
static_cast<EntityTree*>(_tree)->setFBXService(this);
|
EntityTree* entityTree = static_cast<EntityTree*>(_tree);
|
||||||
|
entityTree->setFBXService(this);
|
||||||
|
|
||||||
if (_wantScripts) {
|
if (_wantScripts) {
|
||||||
_entitiesScriptEngine = new ScriptEngine(NO_SCRIPT, "Entities",
|
_entitiesScriptEngine = new ScriptEngine(NO_SCRIPT, "Entities",
|
||||||
|
@ -77,6 +79,8 @@ void EntityTreeRenderer::init() {
|
||||||
// first chance, we'll check for enter/leave entity events.
|
// first chance, we'll check for enter/leave entity events.
|
||||||
glm::vec3 avatarPosition = Application::getInstance()->getAvatar()->getPosition();
|
glm::vec3 avatarPosition = Application::getInstance()->getAvatar()->getPosition();
|
||||||
_lastAvatarPosition = avatarPosition + glm::vec3(1.f, 1.f, 1.f);
|
_lastAvatarPosition = avatarPosition + glm::vec3(1.f, 1.f, 1.f);
|
||||||
|
|
||||||
|
connect(entityTree, &EntityTree::deletingEntity, this, &EntityTreeRenderer::deletingEntity);
|
||||||
}
|
}
|
||||||
|
|
||||||
QScriptValue EntityTreeRenderer::loadEntityScript(const EntityItemID& entityItemID) {
|
QScriptValue EntityTreeRenderer::loadEntityScript(const EntityItemID& entityItemID) {
|
||||||
|
@ -762,4 +766,7 @@ void EntityTreeRenderer::mouseMoveEvent(QMouseEvent* event, unsigned int deviceI
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void EntityTreeRenderer::deletingEntity(const EntityItemID& entityID) {
|
||||||
|
_entityScripts.remove(entityID);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
|
@ -101,6 +101,9 @@ signals:
|
||||||
|
|
||||||
void enterEntity(const EntityItemID& entityItemID);
|
void enterEntity(const EntityItemID& entityItemID);
|
||||||
void leaveEntity(const EntityItemID& entityItemID);
|
void leaveEntity(const EntityItemID& entityItemID);
|
||||||
|
|
||||||
|
public slots:
|
||||||
|
void deletingEntity(const EntityItemID& entityID);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
QList<Model*> _releasedModels;
|
QList<Model*> _releasedModels;
|
||||||
|
|
|
@ -62,10 +62,21 @@ void RenderableModelEntityItem::remapTextures() {
|
||||||
return; // nothing to do if we don't have a model
|
return; // nothing to do if we don't have a model
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (!_model->isLoadedWithTextures()) {
|
||||||
|
return; // nothing to do if the model has not yet loaded it's default textures
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!_originalTexturesRead && _model->isLoadedWithTextures()) {
|
||||||
|
const QSharedPointer<NetworkGeometry>& networkGeometry = _model->getGeometry();
|
||||||
|
if (networkGeometry) {
|
||||||
|
_originalTextures = networkGeometry->getTextureNames();
|
||||||
|
_originalTexturesRead = true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
if (_currentTextures == _textures) {
|
if (_currentTextures == _textures) {
|
||||||
return; // nothing to do if our recently mapped textures match our desired textures
|
return; // nothing to do if our recently mapped textures match our desired textures
|
||||||
}
|
}
|
||||||
qDebug() << "void RenderableModelEntityItem::remapTextures()....";
|
|
||||||
|
|
||||||
// since we're changing here, we need to run through our current texture map
|
// since we're changing here, we need to run through our current texture map
|
||||||
// and any textures in the recently mapped texture, that is not in our desired
|
// and any textures in the recently mapped texture, that is not in our desired
|
||||||
|
@ -234,6 +245,14 @@ bool RenderableModelEntityItem::needsSimulation() const {
|
||||||
return _needsInitialSimulation || simulationState == Moving || simulationState == Changing;
|
return _needsInitialSimulation || simulationState == Moving || simulationState == Changing;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
EntityItemProperties RenderableModelEntityItem::getProperties() const {
|
||||||
|
EntityItemProperties properties = ModelEntityItem::getProperties(); // get the properties from our base class
|
||||||
|
if (_originalTexturesRead) {
|
||||||
|
properties.setTextureNames(_originalTextures);
|
||||||
|
}
|
||||||
|
return properties;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -37,10 +37,12 @@ public:
|
||||||
_model(NULL),
|
_model(NULL),
|
||||||
_needsInitialSimulation(true),
|
_needsInitialSimulation(true),
|
||||||
_needsModelReload(true),
|
_needsModelReload(true),
|
||||||
_myRenderer(NULL) { }
|
_myRenderer(NULL),
|
||||||
|
_originalTexturesRead(false) { }
|
||||||
|
|
||||||
virtual ~RenderableModelEntityItem();
|
virtual ~RenderableModelEntityItem();
|
||||||
|
|
||||||
|
virtual EntityItemProperties getProperties() const;
|
||||||
virtual bool setProperties(const EntityItemProperties& properties, bool forceCopy);
|
virtual bool setProperties(const EntityItemProperties& properties, bool forceCopy);
|
||||||
virtual int readEntitySubclassDataFromBuffer(const unsigned char* data, int bytesLeftToRead,
|
virtual int readEntitySubclassDataFromBuffer(const unsigned char* data, int bytesLeftToRead,
|
||||||
ReadBitstreamToTreeParams& args,
|
ReadBitstreamToTreeParams& args,
|
||||||
|
@ -59,6 +61,8 @@ private:
|
||||||
bool _needsModelReload;
|
bool _needsModelReload;
|
||||||
EntityTreeRenderer* _myRenderer;
|
EntityTreeRenderer* _myRenderer;
|
||||||
QString _currentTextures;
|
QString _currentTextures;
|
||||||
|
QStringList _originalTextures;
|
||||||
|
bool _originalTexturesRead;
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif // hifi_RenderableModelEntityItem_h
|
#endif // hifi_RenderableModelEntityItem_h
|
||||||
|
|
|
@ -734,6 +734,32 @@ void NetworkGeometry::setTextureWithNameToURL(const QString& name, const QUrl& u
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
QStringList NetworkGeometry::getTextureNames() const {
|
||||||
|
QStringList result;
|
||||||
|
for (int i = 0; i < _meshes.size(); i++) {
|
||||||
|
const NetworkMesh& mesh = _meshes[i];
|
||||||
|
for (int j = 0; j < mesh.parts.size(); j++) {
|
||||||
|
const NetworkMeshPart& part = mesh.parts[j];
|
||||||
|
|
||||||
|
if (!part.diffuseTextureName.isEmpty()) {
|
||||||
|
QString textureURL = part.diffuseTexture->getURL().toString();
|
||||||
|
result << part.diffuseTextureName + ":" + textureURL;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!part.normalTextureName.isEmpty()) {
|
||||||
|
QString textureURL = part.normalTexture->getURL().toString();
|
||||||
|
result << part.normalTextureName + ":" + textureURL;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!part.specularTextureName.isEmpty()) {
|
||||||
|
QString textureURL = part.specularTexture->getURL().toString();
|
||||||
|
result << part.specularTextureName + ":" + textureURL;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
/// Reads geometry in a worker thread.
|
/// Reads geometry in a worker thread.
|
||||||
class GeometryReader : public QRunnable {
|
class GeometryReader : public QRunnable {
|
||||||
public:
|
public:
|
||||||
|
|
|
@ -112,6 +112,7 @@ public:
|
||||||
virtual void clearLoadPriority(const QPointer<QObject>& owner);
|
virtual void clearLoadPriority(const QPointer<QObject>& owner);
|
||||||
|
|
||||||
void setTextureWithNameToURL(const QString& name, const QUrl& url);
|
void setTextureWithNameToURL(const QString& name, const QUrl& url);
|
||||||
|
QStringList getTextureNames() const;
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
|
|
||||||
|
|
|
@ -14,6 +14,8 @@
|
||||||
|
|
||||||
#include <QtCore/QObject>
|
#include <QtCore/QObject>
|
||||||
|
|
||||||
|
#include "AudioInjectorOptions.h"
|
||||||
|
|
||||||
class AbstractAudioInterface : public QObject {
|
class AbstractAudioInterface : public QObject {
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
public:
|
public:
|
||||||
|
@ -22,7 +24,7 @@ public:
|
||||||
virtual void startCollisionSound(float magnitude, float frequency, float noise, float duration, bool flashScreen) = 0;
|
virtual void startCollisionSound(float magnitude, float frequency, float noise, float duration, bool flashScreen) = 0;
|
||||||
virtual void startDrumSound(float volume, float frequency, float duration, float decay) = 0;
|
virtual void startDrumSound(float volume, float frequency, float duration, float decay) = 0;
|
||||||
public slots:
|
public slots:
|
||||||
virtual void handleAudioByteArray(const QByteArray& audioByteArray) = 0;
|
virtual void handleAudioByteArray(const QByteArray& audioByteArray, const AudioInjectorOptions& options) = 0;
|
||||||
};
|
};
|
||||||
|
|
||||||
Q_DECLARE_METATYPE(AbstractAudioInterface*)
|
Q_DECLARE_METATYPE(AbstractAudioInterface*)
|
||||||
|
|
|
@ -62,14 +62,6 @@ void AudioInjector::injectAudio() {
|
||||||
|
|
||||||
// make sure we actually have samples downloaded to inject
|
// make sure we actually have samples downloaded to inject
|
||||||
if (soundByteArray.size()) {
|
if (soundByteArray.size()) {
|
||||||
// give our sample byte array to the local audio interface, if we have it, so it can be handled locally
|
|
||||||
if (_options.getLoopbackAudioInterface()) {
|
|
||||||
// assume that localAudioInterface could be on a separate thread, use Qt::AutoConnection to handle properly
|
|
||||||
QMetaObject::invokeMethod(_options.getLoopbackAudioInterface(), "handleAudioByteArray",
|
|
||||||
Qt::AutoConnection,
|
|
||||||
Q_ARG(QByteArray, soundByteArray));
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
// setup the packet for injected audio
|
// setup the packet for injected audio
|
||||||
QByteArray injectAudioPacket = byteArrayWithPopulatedHeader(PacketTypeInjectAudio);
|
QByteArray injectAudioPacket = byteArrayWithPopulatedHeader(PacketTypeInjectAudio);
|
||||||
|
@ -86,7 +78,7 @@ void AudioInjector::injectAudio() {
|
||||||
packetStream << _options.isStereo();
|
packetStream << _options.isStereo();
|
||||||
|
|
||||||
// pack the flag for loopback
|
// pack the flag for loopback
|
||||||
uchar loopbackFlag = (uchar) (!_options.getLoopbackAudioInterface());
|
uchar loopbackFlag = (uchar) true;
|
||||||
packetStream << loopbackFlag;
|
packetStream << loopbackFlag;
|
||||||
|
|
||||||
// pack the position for injected audio
|
// pack the position for injected audio
|
||||||
|
|
|
@ -18,8 +18,7 @@ AudioInjectorOptions::AudioInjectorOptions(QObject* parent) :
|
||||||
_loop(false),
|
_loop(false),
|
||||||
_orientation(glm::vec3(0.0f, 0.0f, 0.0f)),
|
_orientation(glm::vec3(0.0f, 0.0f, 0.0f)),
|
||||||
_isStereo(false),
|
_isStereo(false),
|
||||||
_ignorePenumbra(false),
|
_ignorePenumbra(false)
|
||||||
_loopbackAudioInterface(NULL)
|
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -30,7 +29,6 @@ AudioInjectorOptions::AudioInjectorOptions(const AudioInjectorOptions& other) {
|
||||||
_orientation = other._orientation;
|
_orientation = other._orientation;
|
||||||
_isStereo = other._isStereo;
|
_isStereo = other._isStereo;
|
||||||
_ignorePenumbra = other._ignorePenumbra;
|
_ignorePenumbra = other._ignorePenumbra;
|
||||||
_loopbackAudioInterface = other._loopbackAudioInterface;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void AudioInjectorOptions::operator=(const AudioInjectorOptions& other) {
|
void AudioInjectorOptions::operator=(const AudioInjectorOptions& other) {
|
||||||
|
@ -40,5 +38,4 @@ void AudioInjectorOptions::operator=(const AudioInjectorOptions& other) {
|
||||||
_orientation = other._orientation;
|
_orientation = other._orientation;
|
||||||
_isStereo = other._isStereo;
|
_isStereo = other._isStereo;
|
||||||
_ignorePenumbra = other._ignorePenumbra;
|
_ignorePenumbra = other._ignorePenumbra;
|
||||||
_loopbackAudioInterface = other._loopbackAudioInterface;
|
|
||||||
}
|
}
|
|
@ -19,8 +19,6 @@
|
||||||
|
|
||||||
#include <RegisteredMetaTypes.h>
|
#include <RegisteredMetaTypes.h>
|
||||||
|
|
||||||
#include "AbstractAudioInterface.h"
|
|
||||||
|
|
||||||
class AudioInjectorOptions : public QObject {
|
class AudioInjectorOptions : public QObject {
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
|
|
||||||
|
@ -53,9 +51,6 @@ public:
|
||||||
const bool ignorePenumbra() const {return _ignorePenumbra; }
|
const bool ignorePenumbra() const {return _ignorePenumbra; }
|
||||||
void setIgnorePenumbra(bool ignorePenumbra) { _ignorePenumbra = ignorePenumbra; }
|
void setIgnorePenumbra(bool ignorePenumbra) { _ignorePenumbra = ignorePenumbra; }
|
||||||
|
|
||||||
AbstractAudioInterface* getLoopbackAudioInterface() const { return _loopbackAudioInterface; }
|
|
||||||
void setLoopbackAudioInterface(AbstractAudioInterface* loopbackAudioInterface)
|
|
||||||
{ _loopbackAudioInterface = loopbackAudioInterface; }
|
|
||||||
private:
|
private:
|
||||||
glm::vec3 _position;
|
glm::vec3 _position;
|
||||||
float _volume;
|
float _volume;
|
||||||
|
@ -63,7 +58,8 @@ private:
|
||||||
glm::quat _orientation;
|
glm::quat _orientation;
|
||||||
bool _isStereo;
|
bool _isStereo;
|
||||||
bool _ignorePenumbra;
|
bool _ignorePenumbra;
|
||||||
AbstractAudioInterface* _loopbackAudioInterface;
|
|
||||||
};
|
};
|
||||||
|
|
||||||
|
Q_DECLARE_METATYPE(AudioInjectorOptions)
|
||||||
|
|
||||||
#endif // hifi_AudioInjectorOptions_h
|
#endif // hifi_AudioInjectorOptions_h
|
||||||
|
|
|
@ -16,6 +16,12 @@ AudioScriptingInterface& AudioScriptingInterface::getInstance() {
|
||||||
return staticInstance;
|
return staticInstance;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
AudioScriptingInterface::AudioScriptingInterface() :
|
||||||
|
_localLoopbackInterface(NULL)
|
||||||
|
{
|
||||||
|
qRegisterMetaType<AudioInjectorOptions>("AudioInjectorOptions");
|
||||||
|
}
|
||||||
|
|
||||||
void AudioScriptingInterface::stopAllInjectors() {
|
void AudioScriptingInterface::stopAllInjectors() {
|
||||||
QList<QPointer<AudioInjector> >::iterator injector = _activeInjectors.begin();
|
QList<QPointer<AudioInjector> >::iterator injector = _activeInjectors.begin();
|
||||||
while (injector != _activeInjectors.end()) {
|
while (injector != _activeInjectors.end()) {
|
||||||
|
@ -31,6 +37,18 @@ void AudioScriptingInterface::stopAllInjectors() {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void AudioScriptingInterface::playLocalSound(Sound* sound, const AudioInjectorOptions* injectorOptions) {
|
||||||
|
if (sound->isStereo()) {
|
||||||
|
const_cast<AudioInjectorOptions*>(injectorOptions)->setIsStereo(true);
|
||||||
|
}
|
||||||
|
|
||||||
|
// assume that localAudioInterface could be on a separate thread, use Qt::AutoConnection to handle properly
|
||||||
|
QMetaObject::invokeMethod(_localLoopbackInterface, "handleAudioByteArray",
|
||||||
|
Qt::AutoConnection,
|
||||||
|
Q_ARG(QByteArray, sound->getByteArray()),
|
||||||
|
Q_ARG(const AudioInjectorOptions&, *injectorOptions));
|
||||||
|
}
|
||||||
|
|
||||||
AudioInjector* AudioScriptingInterface::playSound(Sound* sound, const AudioInjectorOptions* injectorOptions) {
|
AudioInjector* AudioScriptingInterface::playSound(Sound* sound, const AudioInjectorOptions* injectorOptions) {
|
||||||
|
|
||||||
if (sound->isStereo()) {
|
if (sound->isStereo()) {
|
||||||
|
|
|
@ -14,6 +14,7 @@
|
||||||
|
|
||||||
#include <qpointer.h>
|
#include <qpointer.h>
|
||||||
|
|
||||||
|
#include "AbstractAudioInterface.h"
|
||||||
#include "AudioInjector.h"
|
#include "AudioInjector.h"
|
||||||
#include "Sound.h"
|
#include "Sound.h"
|
||||||
|
|
||||||
|
@ -25,20 +26,23 @@ public:
|
||||||
static AudioScriptingInterface& getInstance();
|
static AudioScriptingInterface& getInstance();
|
||||||
|
|
||||||
void stopAllInjectors();
|
void stopAllInjectors();
|
||||||
|
|
||||||
|
void setLocalLoopbackInterface(AbstractAudioInterface* audioInterface) { _localLoopbackInterface = audioInterface; }
|
||||||
public slots:
|
public slots:
|
||||||
|
|
||||||
static float getLoudness(AudioInjector* injector);
|
static float getLoudness(AudioInjector* injector);
|
||||||
|
|
||||||
|
void playLocalSound(Sound *sound, const AudioInjectorOptions* injectorOptions = NULL);
|
||||||
AudioInjector* playSound(Sound* sound, const AudioInjectorOptions* injectorOptions = NULL);
|
AudioInjector* playSound(Sound* sound, const AudioInjectorOptions* injectorOptions = NULL);
|
||||||
|
|
||||||
void stopInjector(AudioInjector* injector);
|
void stopInjector(AudioInjector* injector);
|
||||||
bool isInjectorPlaying(AudioInjector* injector);
|
bool isInjectorPlaying(AudioInjector* injector);
|
||||||
|
|
||||||
void injectorStopped();
|
void injectorStopped();
|
||||||
|
|
||||||
private:
|
private:
|
||||||
AudioScriptingInterface() {};
|
AudioScriptingInterface();
|
||||||
QList< QPointer<AudioInjector> > _activeInjectors;
|
QList< QPointer<AudioInjector> > _activeInjectors;
|
||||||
|
AbstractAudioInterface* _localLoopbackInterface;
|
||||||
|
|
||||||
};
|
};
|
||||||
#endif // hifi_AudioScriptingInterface_h
|
#endif // hifi_AudioScriptingInterface_h
|
||||||
|
|
|
@ -243,6 +243,9 @@ QScriptValue EntityItemProperties::copyToScriptValue(QScriptEngine* engine) cons
|
||||||
boundingBox.setProperty("dimensions", boundingBoxDimensions);
|
boundingBox.setProperty("dimensions", boundingBoxDimensions);
|
||||||
COPY_PROPERTY_TO_QSCRIPTVALUE_GETTER(boundingBox, boundingBox); // gettable, but not settable
|
COPY_PROPERTY_TO_QSCRIPTVALUE_GETTER(boundingBox, boundingBox); // gettable, but not settable
|
||||||
|
|
||||||
|
QString textureNamesList = _textureNames.join(",\n");
|
||||||
|
COPY_PROPERTY_TO_QSCRIPTVALUE_GETTER(originalTextures, textureNamesList); // gettable, but not settable
|
||||||
|
|
||||||
return properties;
|
return properties;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -285,6 +285,9 @@ public:
|
||||||
|
|
||||||
const QString& getTextures() const { return _textures; }
|
const QString& getTextures() const { return _textures; }
|
||||||
void setTextures(const QString& value) { _textures = value; _texturesChanged = true; }
|
void setTextures(const QString& value) { _textures = value; _texturesChanged = true; }
|
||||||
|
|
||||||
|
const QStringList& getTextureNames() const { return _textureNames; }
|
||||||
|
void setTextureNames(const QStringList& value) { _textureNames = value; }
|
||||||
|
|
||||||
void setLastEdited(quint64 usecTime) { _lastEdited = usecTime; }
|
void setLastEdited(quint64 usecTime) { _lastEdited = usecTime; }
|
||||||
|
|
||||||
|
@ -381,6 +384,7 @@ private:
|
||||||
// properties of model geometry. But these properties are not serialized like other properties.
|
// properties of model geometry. But these properties are not serialized like other properties.
|
||||||
QVector<SittingPoint> _sittingPoints;
|
QVector<SittingPoint> _sittingPoints;
|
||||||
glm::vec3 _naturalDimensions;
|
glm::vec3 _naturalDimensions;
|
||||||
|
QStringList _textureNames;
|
||||||
};
|
};
|
||||||
Q_DECLARE_METATYPE(EntityItemProperties);
|
Q_DECLARE_METATYPE(EntityItemProperties);
|
||||||
QScriptValue EntityItemPropertiesToScriptValue(QScriptEngine* engine, const EntityItemProperties& properties);
|
QScriptValue EntityItemPropertiesToScriptValue(QScriptEngine* engine, const EntityItemProperties& properties);
|
||||||
|
|
|
@ -185,6 +185,8 @@ void EntityTree::trackDeletedEntity(const EntityItemID& entityID) {
|
||||||
}
|
}
|
||||||
|
|
||||||
void EntityTree::deleteEntity(const EntityItemID& entityID) {
|
void EntityTree::deleteEntity(const EntityItemID& entityID) {
|
||||||
|
emit deletingEntity(entityID);
|
||||||
|
|
||||||
// NOTE: callers must lock the tree before using this method
|
// NOTE: callers must lock the tree before using this method
|
||||||
DeleteEntityOperator theOperator(this, entityID);
|
DeleteEntityOperator theOperator(this, entityID);
|
||||||
recurseTreeWithOperator(&theOperator);
|
recurseTreeWithOperator(&theOperator);
|
||||||
|
@ -197,6 +199,7 @@ void EntityTree::deleteEntities(QSet<EntityItemID> entityIDs) {
|
||||||
foreach(const EntityItemID& entityID, entityIDs) {
|
foreach(const EntityItemID& entityID, entityIDs) {
|
||||||
// tell our delete operator about this entityID
|
// tell our delete operator about this entityID
|
||||||
theOperator.addEntityIDToDeleteList(entityID);
|
theOperator.addEntityIDToDeleteList(entityID);
|
||||||
|
emit deletingEntity(entityID);
|
||||||
}
|
}
|
||||||
|
|
||||||
recurseTreeWithOperator(&theOperator);
|
recurseTreeWithOperator(&theOperator);
|
||||||
|
|
|
@ -141,6 +141,9 @@ public:
|
||||||
void trackDeletedEntity(const EntityItemID& entityID);
|
void trackDeletedEntity(const EntityItemID& entityID);
|
||||||
|
|
||||||
QList<EntityItem*>& getMovingEntities() { return _movingEntities; }
|
QList<EntityItem*>& getMovingEntities() { return _movingEntities; }
|
||||||
|
|
||||||
|
signals:
|
||||||
|
void deletingEntity(const EntityItemID& entityID);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
|
||||||
|
|
|
@ -123,6 +123,8 @@ public:
|
||||||
void setCache(ResourceCache* cache) { _cache = cache; }
|
void setCache(ResourceCache* cache) { _cache = cache; }
|
||||||
|
|
||||||
Q_INVOKABLE void allReferencesCleared();
|
Q_INVOKABLE void allReferencesCleared();
|
||||||
|
|
||||||
|
const QUrl& getURL() const { return _url; }
|
||||||
|
|
||||||
signals:
|
signals:
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue