Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Sign in / Register
Toggle navigation
T
Taiko Web
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Locked Files
Issues
0
Issues
0
List
Boards
Labels
Service Desk
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Security & Compliance
Security & Compliance
Dependency List
License Compliance
Packages
Packages
List
Container Registry
Analytics
Analytics
CI / CD
Code Review
Insights
Issues
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
nanahira
Taiko Web
Commits
c1985dde
Commit
c1985dde
authored
Jul 18, 2015
by
Clement Gournay
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Sound gestion improved
parent
b92d91c0
Changes
6
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
49 additions
and
57 deletions
+49
-57
src/js/assets.js
src/js/assets.js
+3
-1
src/js/loader.js
src/js/loader.js
+6
-4
src/js/loadsong.js
src/js/loadsong.js
+8
-4
src/js/songselect.js
src/js/songselect.js
+3
-3
src/js/soundsystem.js
src/js/soundsystem.js
+28
-44
src/js/titlescreen.js
src/js/titlescreen.js
+1
-1
No files found.
src/js/assets.js
View file @
c1985dde
...
@@ -44,6 +44,8 @@ var assets = {
...
@@ -44,6 +44,8 @@ var assets = {
fonts
:
new
Array
(
fonts
:
new
Array
(
'
Kozuka
'
,
'
Kozuka
'
,
'
TnT
'
'
TnT
'
)
),
sounds
:
{}
};
};
\ No newline at end of file
src/js/loader.js
View file @
c1985dde
...
@@ -24,11 +24,13 @@ function Loader(){
...
@@ -24,11 +24,13 @@ function Loader(){
assets
.
audio
.
forEach
(
function
(
name
){
assets
.
audio
.
forEach
(
function
(
name
){
var
id
=
name
.
substr
(
0
,
name
.
length
-
4
);
var
id
=
name
.
substr
(
0
,
name
.
length
-
4
);
var
audio
=
$
(
"
<audio id='
"
+
id
+
"
' src='/assets/audio/
"
+
name
+
"
' />
"
);
var
audio
=
new
Audio
();
audio
.
appendTo
(
"
#assets
"
);
audio
.
src
=
'
/assets/audio/
'
+
name
;
audio
.
on
(
'
canplay
'
,
function
(){
audio
.
load
();
audio
.
onloadeddata
=
function
(){
assets
.
sounds
[
id
]
=
audio
;
_this
.
assetLoaded
();
_this
.
assetLoaded
();
}
)
;
};
});
});
$
.
ajax
({
$
.
ajax
({
...
...
src/js/loadsong.js
View file @
c1985dde
...
@@ -10,19 +10,23 @@ function loadSong(selectedSong){
...
@@ -10,19 +10,23 @@ function loadSong(selectedSong){
this
.
run
=
function
(){
this
.
run
=
function
(){
document
.
getElementById
(
"
start
"
).
play
();
//assets.sounds["start"]["audio"][0].play();
$
(
"
#assets
"
).
append
(
"
<audio id='main-music' src='/songs/
"
+
_selectedSong
.
folder
+
"
/
"
+
_selectedSong
.
title
+
"
.mp3'></audio>
"
);
$
(
"
#assets
"
).
append
(
"
<img id='music-bg' src='/songs/
"
+
_selectedSong
.
folder
+
"
/bg.png' />
"
);
$
(
"
#assets
"
).
append
(
"
<img id='music-bg' src='/songs/
"
+
_selectedSong
.
folder
+
"
/bg.png' />
"
);
var
audio
=
new
Audio
();
audio
.
src
=
'
/songs/
'
+
_selectedSong
.
folder
+
'
/
'
+
_selectedSong
.
title
+
'
.mp3
'
;
audio
.
load
();
$
(
"
#music-bg
"
).
load
(
function
(){
$
(
"
#music-bg
"
).
load
(
function
(){
_bgLoaded
=
true
;
_bgLoaded
=
true
;
_this
.
checkIfEverythingLoaded
();
_this
.
checkIfEverythingLoaded
();
});
});
$
(
"
#main-music
"
).
on
(
'
canplay
'
,
function
(){
audio
.
onloadeddata
=
function
(){
_musicLoaded
=
true
;
_musicLoaded
=
true
;
assets
.
sounds
[
"
main-music
"
]
=
audio
;
_this
.
checkIfEverythingLoaded
();
_this
.
checkIfEverythingLoaded
();
}
)
;
};
$
.
ajax
({
$
.
ajax
({
url
:
_songFilePath
,
url
:
_songFilePath
,
...
...
src/js/songselect.js
View file @
c1985dde
...
@@ -38,7 +38,7 @@ function SongSelect(){
...
@@ -38,7 +38,7 @@ function SongSelect(){
});
});
$
(
"
.song:not(.opened)
"
).
click
(
function
(){
$
(
"
.song:not(.opened)
"
).
click
(
function
(){
document
.
getElementById
(
"
don
"
)
.
play
();
//assets.sounds["ka"][0]
.play();
$
(
"
.difficulty
"
).
hide
();
$
(
"
.difficulty
"
).
hide
();
$
(
"
.opened
"
).
removeClass
(
"
opened
"
,
300
);
$
(
"
.opened
"
).
removeClass
(
"
opened
"
,
300
);
$
(
this
).
addClass
(
"
opened
"
,
300
,
"
linear
"
,
function
(){
$
(
this
).
addClass
(
"
opened
"
,
300
,
"
linear
"
,
function
(){
...
@@ -61,9 +61,9 @@ function SongSelect(){
...
@@ -61,9 +61,9 @@ function SongSelect(){
songDifficulties
.
sort
(
function
(
a
,
b
){
songDifficulties
.
sort
(
function
(
a
,
b
){
if
(
a
.
difficulty
<
b
.
difficulty
)
if
(
a
.
difficulty
<
b
.
difficulty
)
return
-
1
;
if
(
a
.
difficulty
>
b
.
difficulty
)
return
1
;
return
1
;
if
(
a
.
difficulty
>
b
.
difficulty
)
return
-
1
;
return
0
;
return
0
;
});
});
...
...
src/js/soundsystem.js
View file @
c1985dde
...
@@ -5,59 +5,43 @@ function soundSystem(controller){
...
@@ -5,59 +5,43 @@ function soundSystem(controller){
var
_circles
=
[];
var
_circles
=
[];
var
_circleID
=
-
1
;
var
_circleID
=
-
1
;
var
_measures
=
[];
var
_measures
=
[];
var
_channel_max
=
10
;
// number of channels
var
_sounds
=
assets
.
sounds
;
var
_mainMusicChannel
=-
1
;
var
_channels
=
[];
var
_channelMAX
=
20
;
var
_audiochannels
=
new
Array
();
for
(
var
a
=
0
;
a
<
_channel_max
;
a
++
)
{
// prepare the channels
for
(
var
i
=
0
;
i
<
_channelMAX
;
i
++
)
{
// prepare the channels
_
audiochannels
[
a
]
=
new
Array
()
;
_
channels
[
i
]
=
{}
;
_
audiochannels
[
a
][
'
channel
'
]
=
new
Audio
();
// create a new audio object
_
channels
[
i
][
"
end
"
]
=
-
1
;
_
audiochannels
[
a
][
'
finished
'
]
=
-
1
;
// expected end time for this channel
_
channels
[
i
][
"
audio
"
]
=
new
Audio
();
}
}
this
.
playSound
=
function
(
soundID
){
this
.
playSound
=
function
(
soundID
){
if
(
soundID
==
"
main-music
"
&&
_mainMusicChannel
!=-
1
&&
_mainMusicChannel
.
currentTime
>
0
){
//if music was paused but is going to be played
for
(
var
i
=
0
;
i
<
_channelMAX
;
i
++
){
//play in different sounds in different channels
_mainMusicChannel
.
play
();
var
now
=
new
Date
();
}
if
(
_channels
[
i
][
"
end
"
]
<
now
.
getTime
())
{
// is this channel finished?
else
{
_channels
[
i
][
"
end
"
]
=
now
.
getTime
()
+
_sounds
[
soundID
].
duration
*
1000
;
_channels
[
i
][
"
audio
"
].
src
=
_sounds
[
soundID
].
src
;
for
(
var
i
=
0
;
i
<
_audiochannels
.
length
;
i
++
){
_channels
[
i
][
"
audio
"
].
load
();
_channels
[
i
][
"
audio
"
].
play
();
var
thistime
=
new
Date
();
break
;
if
(
_audiochannels
[
i
][
'
finished
'
]
<
thistime
.
getTime
())
{
// is this channel finished?
}
_audiochannels
[
i
][
'
finished
'
]
=
thistime
.
getTime
()
+
document
.
getElementById
(
soundID
).
duration
*
1000
;
}
_audiochannels
[
i
][
'
channel
'
].
src
=
document
.
getElementById
(
soundID
).
src
;
_audiochannels
[
i
][
'
channel
'
].
load
();
_audiochannels
[
i
][
'
channel
'
].
play
();
if
(
soundID
==
"
main-music
"
&&
_mainMusicChannel
==-
1
){
_mainMusicChannel
=
_audiochannels
[
i
][
'
channel
'
];
}
break
;
}
}
}
}
}
this
.
pauseSound
=
function
(
soundID
,
stop
){
this
.
pauseSound
=
function
(
soundID
,
stop
){
for
(
var
i
=
0
;
i
<
_audiochannels
.
length
;
i
++
){
_sounds
[
soundID
].
pause
();
if
(
_audiochannels
[
i
][
'
channel
'
].
src
==
document
.
getElementById
(
soundID
).
src
){
if
(
stop
)
_sounds
[
soundID
].
currentTime
=
0
;
_audiochannels
[
i
][
'
channel
'
].
pause
();
}
if
(
stop
)
_audiochannels
[
i
][
'
channel
'
].
currentTime
=
0
;
}
}
}
this
.
fadeOutMusic
=
function
(){
this
.
fadeOutMusic
=
function
(){
if
(
_
mainMusicChannel
.
volume
.
toFixed
(
1
)
!=
0.0
){
if
(
_
sounds
[
"
main-music
"
]
.
volume
.
toFixed
(
1
)
!=
0.0
){
_
mainMusicChannel
.
volume
-=
0.1
;
_
sounds
[
"
main-music
"
]
.
volume
-=
0.1
;
}
}
else
{
else
{
_
mainMusicChannel
.
pause
();
_
sounds
[
"
main-music
"
]
.
pause
();
controller
.
fadeOutOver
();
controller
.
fadeOutOver
();
}
}
}
}
...
...
src/js/titlescreen.js
View file @
c1985dde
...
@@ -35,7 +35,7 @@ function Titlescreen(){
...
@@ -35,7 +35,7 @@ function Titlescreen(){
}
}
this
.
goNext
=
function
(){
this
.
goNext
=
function
(){
document
.
getElementById
(
"
don
"
)
.
play
();
//assets.sounds["don"][0]
.play();
new
SongSelect
();
new
SongSelect
();
}
}
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment