mirror of
https://github.com/HifiExperiments/overte.git
synced 2025-07-23 21:14:57 +02:00
change Sound property to hasDownloaded
This commit is contained in:
parent
92f2794ea8
commit
c1e54d370c
2 changed files with 7 additions and 3 deletions
|
@ -67,7 +67,8 @@ Sound::Sound(float volume, float frequency, float duration, float decay, QObject
|
||||||
}
|
}
|
||||||
|
|
||||||
Sound::Sound(const QUrl& sampleURL, QObject* parent) :
|
Sound::Sound(const QUrl& sampleURL, QObject* parent) :
|
||||||
QObject(parent)
|
QObject(parent),
|
||||||
|
_hasDownloaded(false)
|
||||||
{
|
{
|
||||||
// assume we have a QApplication or QCoreApplication instance and use the
|
// assume we have a QApplication or QCoreApplication instance and use the
|
||||||
// QNetworkAccess manager to grab the raw audio file at the given URL
|
// QNetworkAccess manager to grab the raw audio file at the given URL
|
||||||
|
@ -111,6 +112,8 @@ void Sound::replyFinished() {
|
||||||
} else {
|
} else {
|
||||||
qDebug() << "Network reply without 'Content-Type'.";
|
qDebug() << "Network reply without 'Content-Type'.";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
_hasDownloaded = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
void Sound::replyError(QNetworkReply::NetworkError code) {
|
void Sound::replyError(QNetworkReply::NetworkError code) {
|
||||||
|
|
|
@ -23,12 +23,13 @@ public:
|
||||||
Sound(const QUrl& sampleURL, QObject* parent = NULL);
|
Sound(const QUrl& sampleURL, QObject* parent = NULL);
|
||||||
Sound(float volume, float frequency, float duration, float decay, 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; }
|
const QByteArray& getByteArray() { return _byteArray; }
|
||||||
|
|
||||||
private:
|
private:
|
||||||
QByteArray _byteArray;
|
QByteArray _byteArray;
|
||||||
|
bool _hasDownloaded;
|
||||||
|
|
||||||
void downSample(const QByteArray& rawAudioByteArray);
|
void downSample(const QByteArray& rawAudioByteArray);
|
||||||
void interpretAsWav(const QByteArray& inputAudioByteArray, QByteArray& outputAudioByteArray);
|
void interpretAsWav(const QByteArray& inputAudioByteArray, QByteArray& outputAudioByteArray);
|
||||||
|
|
Loading…
Reference in a new issue