app :: Sound :: defaultinit
app :: Sound :: play_channel
Play this sound onchannel (or any channel if -1) and return the channel
			app :: Sound :: soundpool=
The SoundPool who loaded this soundapp :: Sound :: soundpool_id=
The SoundID of this sound in his SoundPoolcore :: Object :: class_factory
Implementation used byget_class to create the specific class.
			app :: Sound :: defaultinit
app :: PlayableAudio :: defaultinit
core :: Object :: defaultinit
app :: PlayableAudio :: error=
app :: PlayableAudio :: error=
app :: PlayableAudio :: error=
core :: Object :: is_same_instance
Return true ifself and other are the same instance (i.e. same identity).
			core :: Object :: is_same_serialized
Isself the same as other in a serialization context?
			core :: Object :: is_same_type
Return true ifself and other have the same dynamic type.
			core :: Object :: output_class_name
Display class name on stdout (debug only).app :: PlayableAudio :: path=
Path to the audio file in the assets folderapp :: PlayableAudio :: paused=
Flag to know if the user paused the soundapp :: Sound :: play_channel
Play this sound onchannel (or any channel if -1) and return the channel
			app :: Sound :: soundpool=
The SoundPool who loaded this soundapp :: Sound :: soundpool_id=
The SoundID of this sound in his SoundPool
# Short sound
class Sound
	super PlayableAudio
end
					lib/app/audio.nit:56,1--59,3
				
redef class Sound
	private var native: nullable MixChunk = null
	redef fun load
	do
		if not fs_path_exists then return
		# SDL2 mixer load
		var native = mix.load_wav(fs_path.to_cstring)
		if native.address_is_null then
			error = new Error("Failed to load sound '{path}': {mix.error}")
			return
		end
		self.native = native
	end
	redef fun play do play_channel(-1, 0)
	# Play this sound on `channel` (or any channel if -1) and return the channel
	#
	# Repeat the sound `loops` times, `loops == 0` plays it once,
	# `loops == 1` plays it twice and `loops == -1` loops infinitely.
	fun play_channel(channel, loops: Int): Int
	do
		var native = native
		if native == null and error == null then
			# Lazy load
			load
			# Auto print errors on lazy loading only
			var error = error
			if error != null then print_error error
		end
		# If there's an error, silently skip
		if error != null then return -1
		native = self.native
		assert native != null
		# Play on any available channel
		return mix.play_channel(channel, native, loops)
	end
end
					lib/linux/audio.nit:41,1--86,3
				
redef class Sound
	# Resource ID of this sound
	var id: nullable Int is noinit
	# The SoundPool who loaded this sound
	var soundpool: SoundPool is noinit
	# The SoundID of this sound in his SoundPool
	var soundpool_id: Int is noinit
	private	init priv_init(id: nullable Int, soundpool_id: Int, soundpool: SoundPool, error: nullable Error) is nosuper do
		self.id = id
		self.soundpool_id = soundpool_id
		self.soundpool = soundpool
		if error != null then
			self.error = error
		else
			self.is_loaded = true
		end
	end
	redef fun load do
		if is_loaded then return
		# Try resources (res)
		var rid = app.default_soundpool.load_name_rid(app.resource_manager, app.native_activity, path.strip_extension)
		if rid > 0 then
			self.soundpool_id = rid
			self.soundpool = app.default_soundpool
			self.error = null
			self.soundpool.error = null
		else
			# Try assets
			var nam = app.asset_manager.open_fd(path)
			if nam.is_java_null then
				self.error = new Error("Failed to get file descriptor for " + path)
			else
				var retval_assets = app.default_soundpool.load_asset_fd_rid(nam)
				nam.close
				if retval_assets == -1 then
					self.error = new Error("Failed to load " + path)
				else
					self.soundpool_id = retval_assets
					self.soundpool = app.default_soundpool
					self.error = null
					self.soundpool.error = null
				end
			end
		end
		is_loaded = true
		var error = error
		if error != null then print_error error
	end
	redef fun play do
		if not is_loaded then load
		if self.error != null then return
		soundpool.play(soundpool_id)
	end
	redef fun pause do
		if self.error != null or not self.is_loaded then return
		soundpool.pause_stream(soundpool_id)
		paused = true
	end
	redef fun resume do
		if self.error != null or not self.is_loaded then return
		soundpool.resume(soundpool_id)
		paused = false
	end
end
					lib/android/audio.nit:521,1--595,3