Skip to content

Commit

Permalink
Soundクラスにsrcプロパティーを追加、NoCodeToolに合わせた関数を追加
Browse files Browse the repository at this point in the history
  • Loading branch information
ienaga committed Jan 6, 2023
1 parent 3b6af02 commit e3d3a10
Show file tree
Hide file tree
Showing 3 changed files with 40 additions and 2 deletions.
2 changes: 1 addition & 1 deletion gulpfile.js
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ const options = minimist(process.argv.slice(2), {
"string": ["distPath", "version"],
"default": {
"prodBuild": false,
"version": "1.12.5",
"version": "1.13.0",
"distPath": "."
}
});
Expand Down
28 changes: 27 additions & 1 deletion src/next2d/media/Sound.js
Original file line number Diff line number Diff line change
Expand Up @@ -89,6 +89,13 @@ class Sound extends EventDispatcher
* @private
*/
this._$stopFlag = true;

/**
* @type {string}
* @default ""
* @private
*/
this._$src = "";
}

/**
Expand Down Expand Up @@ -192,6 +199,23 @@ class Sound extends EventDispatcher
this._$loopCount = loop_count;
}

/**
* @description 外部サウンドのURL
* URL for external sound.
*
* @member {string}
* @default ""
* @public
*/
get src ()
{
return this._$src;
}
set src (url)
{
this.load(new URLRequest(url));
}

/**
* @description ボリュームです。範囲は 0(無音)~ 1(フルボリューム)です。
* The volume, ranging from 0 (silent) to 1 (full volume).
Expand Down Expand Up @@ -257,6 +281,8 @@ class Sound extends EventDispatcher
*/
load (request)
{
this._$src = request.url;

Util.$ajax({
"format": URLLoaderDataFormat.ARRAY_BUFFER,
"url": request.url,
Expand Down Expand Up @@ -428,7 +454,7 @@ class Sound extends EventDispatcher
* @method
* @private
*/
_$build(tag, parent)
_$build (tag, parent)
{
this._$character = parent
._$loaderInfo
Expand Down
12 changes: 12 additions & 0 deletions src/player/Player.js
Original file line number Diff line number Diff line change
Expand Up @@ -541,6 +541,18 @@ class Player
this._$initialize();
}

/**
* @return {void}
* @method
* @private
*/
_$loadWebAudio ()
{
if (!Util.$audioContext) {
Util.$loadAudioData();
}
}

/**
* @return {void}
* @method
Expand Down

0 comments on commit e3d3a10

Please sign in to comment.