Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Sign in
Toggle navigation
F
Front-End
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
abdullh.alsoleman
Front-End
Commits
fa82f1a6
Commit
fa82f1a6
authored
Aug 13, 2015
by
Viktor Lidholt
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Refactors names of sound effect classes
parent
68953122
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
17 additions
and
17 deletions
+17
-17
game_demo_world.dart
examples/game/lib/game_demo_world.dart
+1
-1
sound.dart
examples/game/lib/sound.dart
+16
-16
No files found.
examples/game/lib/game_demo_world.dart
View file @
fa82f1a6
...
...
@@ -30,7 +30,7 @@ class GameDemoWorld extends NodeWithSize {
SpriteSheet
_spriteSheetUI
;
Map
<
String
,
SoundEffect
>
_sounds
;
Sound
Pool
_soundPool
=
SoundPool
.
sharedInstance
();
Sound
EffectPlayer
_soundPool
=
SoundEffectPlayer
.
sharedInstance
();
Navigator
_navigator
;
...
...
examples/game/lib/sound.dart
View file @
fa82f1a6
...
...
@@ -18,8 +18,8 @@ class SoundEffect {
Object
_data
;
}
class
SoundStream
{
SoundStream
(
class
Sound
Effect
Stream
{
Sound
Effect
Stream
(
this
.
sound
,
this
.
tag
,
this
.
loop
,
...
...
@@ -45,29 +45,29 @@ class SoundStream {
MediaPlayerProxy
_player
;
}
Sound
Pool
_sharedSoundPool
;
Sound
EffectPlayer
_sharedSoundPool
;
class
Sound
Pool
{
class
Sound
EffectPlayer
{
static
Sound
Pool
sharedInstance
()
{
static
Sound
EffectPlayer
sharedInstance
()
{
if
(
_sharedSoundPool
==
null
)
{
_sharedSoundPool
=
new
Sound
Pool
();
_sharedSoundPool
=
new
Sound
EffectPlayer
();
}
return
_sharedSoundPool
;
}
Sound
Pool
()
{
Sound
EffectPlayer
()
{
_mediaService
=
new
MediaServiceProxy
.
unbound
();
shell
.
requestService
(
null
,
_mediaService
);
}
MediaServiceProxy
_mediaService
;
List
<
SoundStream
>
_playingSounds
=
[];
List
<
Sound
Effect
Stream
>
_playingSounds
=
[];
// TODO: This should no longer be needed when moving to SoundPool backing
Map
<
SoundEffect
,
MediaPlayerProxy
>
_mediaPlayers
=
{};
Future
_prepare
(
SoundStream
playingSound
)
async
{
Future
_prepare
(
Sound
Effect
Stream
playingSound
)
async
{
await
playingSound
.
_player
.
ptr
.
prepare
(
playingSound
.
sound
.
_data
);
}
...
...
@@ -85,7 +85,7 @@ class SoundPool {
// TODO: Add paused property (should pause playback of all sounds)
bool
paused
;
SoundStream
play
(
Sound
Effect
Stream
play
(
SoundEffect
sound
,
[
Object
tag
,
bool
loop
=
false
,
...
...
@@ -95,7 +95,7 @@ class SoundPool {
SoundCompleteCallback
callback
=
null
])
{
// Create new PlayingSound object
Sound
Stream
playingSound
=
new
Sound
Stream
(
Sound
EffectStream
playingSound
=
new
SoundEffect
Stream
(
sound
,
tag
,
loop
,
...
...
@@ -131,7 +131,7 @@ class SoundPool {
void
stop
(
Object
tag
)
{
for
(
int
i
=
_playingSounds
.
length
;
i
>=
0
;
i
--)
{
SoundStream
playingSound
=
_playingSounds
[
i
];
Sound
Effect
Stream
playingSound
=
_playingSounds
[
i
];
if
(
playingSound
.
tag
==
tag
)
{
playingSound
.
_player
.
ptr
.
pause
();
_playingSounds
.
removeAt
(
i
);
...
...
@@ -139,9 +139,9 @@ class SoundPool {
}
}
List
<
SoundStream
>
playingSoundsForTag
(
Object
tag
)
{
List
<
SoundStream
>
list
=
[];
for
(
SoundStream
playingSound
in
_playingSounds
)
{
List
<
Sound
Effect
Stream
>
playingSoundsForTag
(
Object
tag
)
{
List
<
Sound
Effect
Stream
>
list
=
[];
for
(
Sound
Effect
Stream
playingSound
in
_playingSounds
)
{
if
(
playingSound
.
tag
==
tag
)
{
list
.
add
(
playingSound
);
}
...
...
@@ -150,7 +150,7 @@ class SoundPool {
}
void
stopAll
()
{
for
(
SoundStream
playingSound
in
_playingSounds
)
{
for
(
Sound
Effect
Stream
playingSound
in
_playingSounds
)
{
playingSound
.
_player
.
ptr
.
pause
();
}
_playingSounds
=
[];
...
...
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