Update Files

This commit is contained in:
2025-01-22 16:18:30 +01:00
parent ed4603cf95
commit a36294b518
16718 changed files with 2960346 additions and 0 deletions

View File

@ -0,0 +1,38 @@
package iron.system;
import kha.audio1.AudioChannel;
/**
Audio playback. This class wraps around `kha.audio1.Audio`.
**/
class Audio {
#if lnx_audio
public function new() {}
/**
Plays the given sound.
If `stream` is `true` and the sound has compressed data, it is streamed
from disk instead of being fully loaded into memory. This is useful for
longer sounds such as background music.
This function returns `null` if:
- there is no unoccupied audio channel available for playback.
- the sound has compressed data only but `stream` is `false`. In this
case, call `kha.Sound.uncompress()` first.
**/
public static function play(sound: kha.Sound, loop = false, stream = false): Null<AudioChannel> {
if (stream && sound.compressedData != null) {
return kha.audio1.Audio.stream(sound, loop);
}
else if (sound.uncompressedData != null) {
return kha.audio1.Audio.play(sound, loop);
}
else return null;
}
#end
}