From a66aa061570bdfa5207fdd009389dfa515269bd2 Mon Sep 17 00:00:00 2001 From: BlackMinou Date: Tue, 20 Jan 2015 14:37:34 +0100 Subject: [PATCH] mnit simple : improved audio tests Signed-off-by: BlackMinou --- examples/mnit_simple/src/test_audio.nit | 26 ++++++++++++++------------ 1 file changed, 14 insertions(+), 12 deletions(-) diff --git a/examples/mnit_simple/src/test_audio.nit b/examples/mnit_simple/src/test_audio.nit index decf7c5..88a2812 100644 --- a/examples/mnit_simple/src/test_audio.nit +++ b/examples/mnit_simple/src/test_audio.nit @@ -21,27 +21,29 @@ import simple_android 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 - - default_mediaplayer.reset - 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.prepare 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 -- 1.7.9.5