From c1e54d370c3e56adf84bcd6d2205ff229a4b35a5 Mon Sep 17 00:00:00 2001 From: Stephen Birarda Date: Fri, 18 Apr 2014 14:46:56 -0700 Subject: [PATCH 1/3] change Sound property to hasDownloaded --- libraries/audio/src/Sound.cpp | 5 ++++- libraries/audio/src/Sound.h | 5 +++-- 2 files changed, 7 insertions(+), 3 deletions(-) diff --git a/libraries/audio/src/Sound.cpp b/libraries/audio/src/Sound.cpp index bcae878259..5bd63b7959 100644 --- a/libraries/audio/src/Sound.cpp +++ b/libraries/audio/src/Sound.cpp @@ -67,7 +67,8 @@ Sound::Sound(float volume, float frequency, float duration, float decay, QObject } Sound::Sound(const QUrl& sampleURL, QObject* parent) : - QObject(parent) + QObject(parent), + _hasDownloaded(false) { // assume we have a QApplication or QCoreApplication instance and use the // QNetworkAccess manager to grab the raw audio file at the given URL @@ -111,6 +112,8 @@ void Sound::replyFinished() { } else { qDebug() << "Network reply without 'Content-Type'."; } + + _hasDownloaded = true; } void Sound::replyError(QNetworkReply::NetworkError code) { diff --git a/libraries/audio/src/Sound.h b/libraries/audio/src/Sound.h index ae2fd391a1..c953ae1b33 100644 --- a/libraries/audio/src/Sound.h +++ b/libraries/audio/src/Sound.h @@ -23,13 +23,14 @@ public: Sound(const QUrl& sampleURL, QObject* parent = NULL); Sound(float volume, float frequency, float duration, float decay, QObject* parent = NULL); - bool isEmpty() const { return _byteArray.isEmpty(); } + bool hasDownloaded() const { return _hasDownloaded; } const QByteArray& getByteArray() { return _byteArray; } private: QByteArray _byteArray; - + bool _hasDownloaded; + void downSample(const QByteArray& rawAudioByteArray); void interpretAsWav(const QByteArray& inputAudioByteArray, QByteArray& outputAudioByteArray); From 72fe9b94b1c25f5e11086bea97346ba9ab32c75e Mon Sep 17 00:00:00 2001 From: Stephen Birarda Date: Fri, 18 Apr 2014 14:48:26 -0700 Subject: [PATCH 2/3] fix property in sound --- libraries/audio/src/Sound.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/libraries/audio/src/Sound.h b/libraries/audio/src/Sound.h index c953ae1b33..c473cdff83 100644 --- a/libraries/audio/src/Sound.h +++ b/libraries/audio/src/Sound.h @@ -18,7 +18,7 @@ class Sound : public QObject { Q_OBJECT - Q_PROPERTY(bool empty READ isEmpty) + Q_PROPERTY(bool downloaded READ hasDownloaded) public: Sound(const QUrl& sampleURL, QObject* parent = NULL); Sound(float volume, float frequency, float duration, float decay, QObject* parent = NULL); From 0a7ea17d43c7ad69645e496c458e21074d4235be Mon Sep 17 00:00:00 2001 From: Stephen Birarda Date: Fri, 18 Apr 2014 15:10:15 -0700 Subject: [PATCH 3/3] fix a geometry race condition crash --- interface/src/renderer/Model.cpp | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/interface/src/renderer/Model.cpp b/interface/src/renderer/Model.cpp index f8de7210ea..ef0911f673 100644 --- a/interface/src/renderer/Model.cpp +++ b/interface/src/renderer/Model.cpp @@ -468,8 +468,13 @@ void Model::clearShapes() { void Model::rebuildShapes() { clearShapes(); + + if (!_geometry) { + return; + } + const FBXGeometry& geometry = _geometry->getFBXGeometry(); - + if (geometry.joints.isEmpty()) { return; }