nitlanguage
/
nit.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Merge: Audio management for android + audio Abstraction API
[nit.git]
/
examples
/
mnit_simple
/
src
/
test_audio.nit
diff --git
a/examples/mnit_simple/src/test_audio.nit
b/examples/mnit_simple/src/test_audio.nit
index
5d8981e
..
88a2812
100644
(file)
--- a/
examples/mnit_simple/src/test_audio.nit
+++ b/
examples/mnit_simple/src/test_audio.nit
@@
-21,25
+21,29
@@
import simple_android
import android::audio
redef class App
import android::audio
redef class App
- var soundsp: Sound
- var soundmp: Sound
+ var soundsp: nullable Sound
+ var soundmp: nullable Sound
+ var test_assets = false
+ var test_ressources = true
- redef fun init_window
+ redef fun window_created
do
super
do
super
- manage_audio_mode
-
- # Retrieve sound
- soundsp = load_sound("sound.ogg")
- soundmp = load_music("xylofon.ogg")
+ if test_assets then
+ soundsp = load_sound("testsound.ogg")
+ soundmp = load_music("xylofon.ogg")
+ end
+ if test_ressources then
+ soundsp = load_sound_from_res("testsound")
+ soundmp = load_music_from_res("xylofon")
+ end
default_mediaplayer.looping = true
default_mediaplayer.looping = true
- default_mediaplayer.prepare
soundmp.play
end
redef fun input( ie )
do
soundmp.play
end
redef fun input( ie )
do
- if ie isa PointerEvent and ie.depressed then
+ if ie isa PointerEvent and ie.depressed then
soundsp.play
end
return super
soundsp.play
end
return super