From 3f129bda135b06c955102f8e9b4d0718f413d839 Mon Sep 17 00:00:00 2001 From: milad Date: Wed, 18 Apr 2018 20:04:41 -0700 Subject: [PATCH] More done on audio --- .../AccountServicesScriptingInterface.h | 67 +++++++++++++- interface/src/scripting/Audio.h | 58 +++++++++++- .../src/AssetScriptingInterface.h | 92 +++++++++++++++++-- 3 files changed, 206 insertions(+), 11 deletions(-) diff --git a/interface/src/scripting/AccountServicesScriptingInterface.h b/interface/src/scripting/AccountServicesScriptingInterface.h index cfa51697af..2cd1de5bf4 100644 --- a/interface/src/scripting/AccountServicesScriptingInterface.h +++ b/interface/src/scripting/AccountServicesScriptingInterface.h @@ -34,7 +34,31 @@ void DownloadInfoResultFromScriptValue(const QScriptValue& object, DownloadInfoR class AccountServicesScriptingInterface : public QObject { Q_OBJECT - + /**jsdoc + * The AccountServices API contains helper functions related to user connectivity + * + * @namespace AccountServices + */ + /**jsdoc + * To be completed + * @property {string} AccountServices.username + * @static + */ + /**jsdoc + * To be completed + * @property {bool} AccountServices.loggedIn + * @static + */ + /**jsdoc + * To be completed + * @property {QString} AccountServices.findableBy + * @static + */ + /**jsdoc + * To be completed + * @property {QUrl} AccountServices.metaverseServerURL + * @static + */ Q_PROPERTY(QString username READ getUsername NOTIFY myUsernameChanged) Q_PROPERTY(bool loggedIn READ loggedIn NOTIFY loggedInChanged) Q_PROPERTY(QString findableBy READ getFindableBy WRITE setFindableBy NOTIFY findableByChanged) @@ -52,6 +76,12 @@ public slots: void updateDownloadInfo(); bool isLoggedIn(); + /**jsdoc + * To be completed + * @function AccountServices.checkAndSignalForAccessToken + * @static + * @returns {bool} + */ bool checkAndSignalForAccessToken(); void logOut(); @@ -66,11 +96,46 @@ private slots: void onUsernameChanged(const QString& username); signals: + /**jsdoc + * To be completed + * @function AccountServices.connected + * @returns {Signal} + */ void connected(); + /**jsdoc + * To be completed + * @function AccountServices.disconnected + * @params {string} reason + * @returns {Signal} + */ void disconnected(const QString& reason); + /**jsdoc + * To be completed + * @function AccountServices.myUsernameChanged + * @params {string} username + * @returns {Signal} + */ void myUsernameChanged(const QString& username); + /**jsdoc + * To be completed + * @function AccountServices.downloadInfoChanged + * @params {} info + * @returns {Signal} + */ void downloadInfoChanged(DownloadInfoResult info); + /**jsdoc + * To be completed + * @function AccountServices.findableByChanged + * @params {string} discoverabilityMode + * @returns {Signal} + */ void findableByChanged(const QString& discoverabilityMode); + /**jsdoc + * To be completed + * @function AccountServices.loggedInChanged + * @params {bool} loggedIn + * @returns {Signal} + */ void loggedInChanged(bool loggedIn); private: diff --git a/interface/src/scripting/Audio.h b/interface/src/scripting/Audio.h index 0f0043510c..1e40ac0560 100644 --- a/interface/src/scripting/Audio.h +++ b/interface/src/scripting/Audio.h @@ -24,6 +24,18 @@ class Audio : public AudioScriptingInterface { Q_OBJECT SINGLETON_DEPENDENCY + /**jsdoc + * The Audio API features tools to help control audio contexts and settings. + * + * @namespace Audio + * @property {bool} muted - To Be Completed + * @property {bool} noiseReduction - To Be Completed + * @property {bool} inputVolume - To Be Completed + * @property {bool} inputLevel - To Be Completed + * @property {QString} context - To Be Completed + * @property {} devices - To Be Completed + */ + Q_PROPERTY(bool muted READ isMuted WRITE setMuted NOTIFY mutedChanged) Q_PROPERTY(bool noiseReduction READ noiseReductionEnabled WRITE enableNoiseReduction NOTIFY noiseReductionChanged) Q_PROPERTY(float inputVolume READ getInputVolume WRITE setInputVolume NOTIFY inputVolumeChanged) @@ -51,11 +63,49 @@ public: void showMicMeter(bool show); void setInputVolume(float volume); - Q_INVOKABLE void setInputDevice(const QAudioDeviceInfo& device, bool isHMD); - Q_INVOKABLE void setOutputDevice(const QAudioDeviceInfo& device, bool isHMD); - Q_INVOKABLE void setReverb(bool enable); - Q_INVOKABLE void setReverbOptions(const AudioEffectOptions* options); + /**jsdoc + * The Audio API features tools to help control audio contexts and settings. + * + * @namespace Audio + * @property {bool} muted - To Be Completed + * @property {bool} noiseReduction - To Be Completed + * @property {bool} inputVolume - To Be Completed + * @property {bool} inputLevel - To Be Completed + * @property {QString} context - To Be Completed + * @property {} devices - To Be Completed + */ + /**jsdoc + * To Be Completed + * @function Audio.setInputDevice + * @param {} device + * @param {bool} isHMD + */ + Q_INVOKABLE void setInputDevice(const QAudioDeviceInfo& device, bool isHMD); + /**jsdoc + * To Be Completed + * @function Audio.setOutputDevice + * @param {} device + * @param {bool} isHMD + */ + Q_INVOKABLE void setOutputDevice(const QAudioDeviceInfo& device, bool isHMD); + /**jsdoc + * To Be Completed + * @function Audio.setReverb + * @param {bool} enable + */ + Q_INVOKABLE void setReverb(bool enable); + /**jsdoc + * To Be Completed + * @function Audio.setReverbOptions + * @param {} options + */ + Q_INVOKABLE void setReverbOptions(const AudioEffectOptions* options); + /**jsdoc + * To Be Completed + * @function Audio.setReverbOptions + * @param {} options + */ Q_INVOKABLE bool startRecording(const QString& filename); Q_INVOKABLE void stopRecording(); Q_INVOKABLE bool getRecording(); diff --git a/libraries/script-engine/src/AssetScriptingInterface.h b/libraries/script-engine/src/AssetScriptingInterface.h index fdce173dfe..5fda6af067 100644 --- a/libraries/script-engine/src/AssetScriptingInterface.h +++ b/libraries/script-engine/src/AssetScriptingInterface.h @@ -25,6 +25,8 @@ #include /**jsdoc + The Assets API allows you to communicate with the Asset Browser + * @namespace Assets */ class AssetScriptingInterface : public BaseAssetScriptingInterface, QScriptable { @@ -54,7 +56,7 @@ public: * Download data from the connected domain's asset server. * @function Assets.downloadData * @static - * @param url {string} url of asset to download, must be atp scheme url. + * @param url {string} URL of asset to download, must be ATP scheme URL. * @param callback {Assets~downloadDataCallback} */ @@ -93,11 +95,17 @@ public: /**jsdoc * Called when getMapping is complete. * @callback Assets~getMappingCallback - * @param error {string} error description if the path could not be resolved; otherwise a null value. * @param assetID {string} hash value if found, else an empty string + * @param error {string} error description if the path could not be resolved; otherwise a null value. */ Q_INVOKABLE void getMapping(QString path, QScriptValue callback); + /**jsdoc + * Called when getMapping is complete. + * @callback Assets~getMappingCallback + * @param assetID {string} hash value if found, else an empty string + * @param error {string} error description if the path could not be resolved; otherwise a null value. + */ Q_INVOKABLE void setBakingEnabled(QString path, bool enabled, QScriptValue callback); #if (PR_BUILD || DEV_BUILD) @@ -167,22 +175,94 @@ public: */ Q_INVOKABLE void putAsset(QScriptValue options, QScriptValue scope, QScriptValue callback = QScriptValue()); + /**jsdoc + * To be completed + * @function Assets.deleteAsset + * @property {} options + * @property {} scope + * @property {} callback + */ Q_INVOKABLE void deleteAsset(QScriptValue options, QScriptValue scope, QScriptValue callback = QScriptValue()); + + /**jsdoc + * To be completed + * @function Assets.resolveAsset + * @property {} options + * @property {} scope + * @property {} callback + */ Q_INVOKABLE void resolveAsset(QScriptValue options, QScriptValue scope, QScriptValue callback = QScriptValue()); + /**jsdoc + * To be completed + * @function Assets.decompressData + * @property {} options + * @property {} scope + * @property {} callback + */ Q_INVOKABLE void decompressData(QScriptValue options, QScriptValue scope, QScriptValue callback = QScriptValue()); + /**jsdoc + * To be completed + * @function Assets.compressData + * @property {} options + * @property {} scope + * @property {} callback + */ Q_INVOKABLE void compressData(QScriptValue options, QScriptValue scope, QScriptValue callback = QScriptValue()); - + /**jsdoc + * To be completed + * @function Assets.initializeCache + * @returns {bool} + */ Q_INVOKABLE bool initializeCache() { return Parent::initializeCache(); } - + /**jsdoc + * To be completed + * @function Assets.canWriteCacheValue + * @property {string} url + * @returns {bool} + */ Q_INVOKABLE bool canWriteCacheValue(const QUrl& url); - + /**jsdoc + * To be completed + * @function Assets.getCacheStatus + * @property {} scope + * @property {} callback + */ Q_INVOKABLE void getCacheStatus(QScriptValue scope, QScriptValue callback = QScriptValue()) { jsPromiseReady(Parent::getCacheStatus(), scope, callback); } - + /**jsdoc + * To be completed + * @function Assets.queryCacheMeta + * @property {} options + * @property {} scope + * @property {} callback + */ Q_INVOKABLE void queryCacheMeta(QScriptValue options, QScriptValue scope, QScriptValue callback = QScriptValue()); + /**jsdoc + * To be completed + * @function Assets.loadFromCache + * @property {} options + * @property {} scope + * @property {} callback + */ Q_INVOKABLE void loadFromCache(QScriptValue options, QScriptValue scope, QScriptValue callback = QScriptValue()); + /**jsdoc + * To be completed + * @function Assets.saveToCache + * @property {} options + * @property {} scope + * @property {} callback + */ Q_INVOKABLE void saveToCache(QScriptValue options, QScriptValue scope, QScriptValue callback = QScriptValue()); + /**jsdoc + * To be completed + * @function Assets.saveToCache + * @property {} url + * @property {} data + * @property {} metadata + * @property {} scope + * @property {} callback + */ Q_INVOKABLE void saveToCache(const QUrl& url, const QByteArray& data, const QVariantMap& metadata, QScriptValue scope, QScriptValue callback = QScriptValue()); protected: