audio: move some services between the abstraction and the Android layers
[nit.git] / lib / app / audio.nit
index 17310d8..b26ae7b 100644 (file)
@@ -31,26 +31,25 @@ import android::audio is conditional(android)
 # Abstraction of a playable Audio
 abstract class PlayableAudio
 
+       init do sounds.add self
+
        # Path to the audio file in the assets folder
        var path: String
 
        # Last error on this sound, if any
-       var error: nullable Error = null is writable
-
-       # Is `self` already loaded?
-       protected var is_loaded = false is writable
+       fun error: nullable Error do return null
 
        # 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
@@ -62,3 +61,9 @@ end
 class Music
        super PlayableAudio
 end
+
+redef class Sys
+
+       # All instantiated sounds
+       var sounds = new Array[PlayableAudio]
+end