Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
车家大少爷
three.js
提交
e207eb57
T
three.js
项目概览
车家大少爷
/
three.js
与 Fork 源项目一致
从无法访问的项目Fork
通知
2
Star
0
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
T
three.js
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
体验新版 GitCode,发现更多精彩内容 >>
提交
e207eb57
编写于
3月 18, 2016
作者:
M
Mr.doob
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Added THREE.AudioContext.
上级
9e21864f
变更
6
隐藏空白更改
内联
并排
Showing
6 changed file
with
37 addition
and
12 deletion
+37
-12
examples/misc_sound.html
examples/misc_sound.html
+2
-3
src/audio/Audio.js
src/audio/Audio.js
+4
-2
src/audio/AudioContext.js
src/audio/AudioContext.js
+25
-0
src/audio/AudioListener.js
src/audio/AudioListener.js
+1
-1
src/loaders/AudioLoader.js
src/loaders/AudioLoader.js
+4
-6
utils/build/includes/common.json
utils/build/includes/common.json
+1
-0
未找到文件。
examples/misc_sound.html
浏览文件 @
e207eb57
...
...
@@ -78,9 +78,6 @@
var
listener
=
new
THREE
.
AudioListener
();
camera
.
add
(
listener
);
var
audioLoader
=
new
THREE
.
AudioLoader
(
listener
.
context
);
scene
=
new
THREE
.
Scene
();
scene
.
fog
=
new
THREE
.
FogExp2
(
0x000000
,
0.0025
);
...
...
@@ -96,6 +93,8 @@
// sound spheres
var
audioLoader
=
new
THREE
.
AudioLoader
();
var
mesh1
=
new
THREE
.
Mesh
(
sphere
,
material_sphere1
);
mesh1
.
position
.
set
(
-
250
,
30
,
0
);
scene
.
add
(
mesh1
);
...
...
src/audio/Audio.js
浏览文件 @
e207eb57
...
...
@@ -41,12 +41,14 @@ THREE.Audio.prototype.load = function ( file ) {
console
.
warn
(
'
THREE.Audio: .load has been deprecated. Please use THREE.AudioLoader.
'
);
var
audioLoader
=
new
THREE
.
AudioLoader
(
this
.
context
);
var
scope
=
this
;
var
audioLoader
=
new
THREE
.
AudioLoader
();
audioLoader
.
load
(
file
,
function
(
buffer
)
{
scope
.
setBuffer
(
buffer
);
});
}
);
return
this
;
...
...
src/audio/AudioContext.js
0 → 100644
浏览文件 @
e207eb57
/**
* @author mrdoob / http://mrdoob.com/
*/
Object
.
defineProperty
(
THREE
,
'
AudioContext
'
,
{
get
:
(
function
()
{
var
context
;
return
function
()
{
if
(
context
===
undefined
)
{
context
=
new
(
window
.
AudioContext
||
window
.
webkitAudioContext
)();
}
return
context
;
};
}
)()
}
);
src/audio/AudioListener.js
浏览文件 @
e207eb57
...
...
@@ -8,7 +8,7 @@ THREE.AudioListener = function () {
this
.
type
=
'
AudioListener
'
;
this
.
context
=
new
(
window
.
AudioContext
||
window
.
webkitAudioContext
)()
;
this
.
context
=
THREE
.
AudioContext
;
this
.
gain
=
this
.
context
.
createGain
();
this
.
gain
.
connect
(
this
.
context
.
destination
);
...
...
src/loaders/AudioLoader.js
浏览文件 @
e207eb57
...
...
@@ -2,9 +2,7 @@
* @author Reece Aaron Lecrivain / http://reecenotes.com/
*/
THREE
.
AudioLoader
=
function
(
context
,
manager
)
{
this
.
context
=
(
context
!==
undefined
)
?
context
:
new
(
window
.
AudioContext
||
window
.
webkitAudioContext
)();
THREE
.
AudioLoader
=
function
(
manager
)
{
this
.
manager
=
(
manager
!==
undefined
)
?
manager
:
THREE
.
DefaultLoadingManager
;
...
...
@@ -16,13 +14,13 @@ THREE.AudioLoader.prototype = {
load
:
function
(
url
,
onLoad
,
onProgress
,
onError
)
{
var
scope
=
this
;
var
loader
=
new
THREE
.
XHRLoader
(
this
.
manager
);
loader
.
setResponseType
(
'
arraybuffer
'
);
loader
.
load
(
url
,
function
(
buffer
)
{
scope
.
context
.
decodeAudioData
(
buffer
,
function
(
audioBuffer
)
{
var
context
=
THREE
.
AudioContext
;
context
.
decodeAudioData
(
buffer
,
function
(
audioBuffer
)
{
onLoad
(
audioBuffer
);
...
...
utils/build/includes/common.json
浏览文件 @
e207eb57
...
...
@@ -54,6 +54,7 @@
"src/animation/tracks/VectorKeyframeTrack.js"
,
"src/audio/Audio.js"
,
"src/audio/AudioAnalyser.js"
,
"src/audio/AudioContext.js"
,
"src/audio/PositionalAudio.js"
,
"src/audio/AudioListener.js"
,
"src/cameras/Camera.js"
,
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录