app: minor refactor of the audio services
authorAlexis Laferrière <alexis.laf@xymus.net>
Fri, 24 Feb 2017 16:36:12 +0000 (11:36 -0500)
committerAlexis Laferrière <alexis.laf@xymus.net>
Mon, 27 Feb 2017 19:50:11 +0000 (14:50 -0500)
Signed-off-by: Alexis Laferrière <alexis.laf@xymus.net>

lib/app/audio.nit
lib/linux/audio.nit

index 17310d8..0f1ab76 100644 (file)
@@ -41,16 +41,16 @@ abstract class PlayableAudio
        protected var is_loaded = false is writable
 
        # Load this playable audio
-       fun load is abstract
+       fun load do end
 
        # Play the sound
-       fun play is abstract
+       fun play do end
 
        # Pause the sound
-       fun pause is abstract
+       fun pause do end
 
        # Resume the sound
-       fun resume is abstract
+       fun resume do end
 end
 
 # Short sound
index 09ddfff..85f572a 100644 (file)
@@ -20,22 +20,7 @@ module audio
 import app::audio
 import linux
 
-redef class Sound
-
-       redef fun play do
-               if path.has_suffix(".wav") then
-                       sys.system "aplay -q {app.assets_dir}{path} &"
-               else if path.has_suffix(".mp3") then
-                       sys.system "mpg123 -q {app.assets_dir}{path} &"
-               end
-       end
-
-       redef fun load do end
-       redef fun pause do end
-       redef fun resume do end
-end
-
-redef class Music
+redef class PlayableAudio
 
        redef fun play do
                if path.has_suffix(".wav") then