Package-level declarations

Types

Link copied to clipboard
Link copied to clipboard
class AudioBufferOrHTMLMediaElement(val audioBuffer: AudioBuffer?, val htmlAudioElement: HTMLAudioElement?)
class AudioBufferOrHTMLMediaElement(val audioBuffer: AudioBuffer?, val htmlAudioElement: HTMLAudioElement?)
Link copied to clipboard
class AudioData(val rate: Int, val samples: AudioSamples, val name: String? = null) : Extra
Link copied to clipboard
Link copied to clipboard

Function might be called from different threads, so code must be thread-safe.

Link copied to clipboard
class AudioPlatformOutputSimple(val init: suspend (AudioSamplesInterleaved) -> Unit = { }, val output: suspend (AudioSamplesInterleaved) -> Unit = { }, val close: suspend (AudioSamplesInterleaved) -> Unit = { }, val paused: (paused: Boolean) -> Unit = { })
Link copied to clipboard
value class AudioSample(raw: Short)
Link copied to clipboard
Link copied to clipboard
class AudioSamples(val channels: Int, val totalSamples: Int, val data: Array<AudioSampleArray> = Array(channels) { AudioSampleArray(totalSamples) })
Link copied to clipboard
class AudioSamplesDeque(val channels: Int)
Link copied to clipboard
class AudioSamplesInterleaved(val channels: Int, val totalSamples: Int, val data: AudioSampleArray = AudioSampleArray(totalSamples * channels))
Link copied to clipboard
class AudioSamplesProcessor(val channels: Int, val totalSamples: Int, val data: Array<FloatArray> = Array(channels) { FloatArray(totalSamples) })
Link copied to clipboard
abstract class AudioStream(val rate: Int, val channels: Int, val name: String? = null) : AudioStreamable, AutoCloseable
Link copied to clipboard
interface AudioStreamable
Link copied to clipboard
object AudioTone
Link copied to clipboard
Link copied to clipboard
class DummySoundChannel(sound: Sound, val data: AudioData? = null) : SoundChannel
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
open class LogNativeSoundProvider(val onGen: (AudioData) -> Unit = { }) : NativeSoundProvider
Link copied to clipboard
data class PlaybackParameters(val times: PlaybackTimes = 1.playbackTimes, val startTime: Duration = 0.seconds, val bufferTime: Duration = 0.25.seconds, val volume: Double = 1.0, val pitch: Double = 1.0, val panning: Double = 0.0, val position: Vector3 = Vector3.ZERO, val onCancel: () -> Unit? = null, val onFinish: () -> Unit? = null) : ReadonlySoundProps
Link copied to clipboard
value class PlaybackTimes(val count: Int)
Link copied to clipboard
Link copied to clipboard
abstract class Sound(val creationCoroutineContext: CoroutineContext) : SoundProps, SoundPlay, AudioStreamable, Extra
Link copied to clipboard
class SoundAudioData(coroutineContext: CoroutineContext, val audioData: AudioData, var soundProvider: NativeSoundProvider, val name: String = audioData.name ?: "Unknown") : Sound
Link copied to clipboard
class SoundAudioStream(coroutineContext: CoroutineContext, val stream: AudioStream, var soundProvider: NativeSoundProvider, val closeStream: Boolean = false, val name: String = stream.name ?: "Unknown", val onComplete: suspend () -> Unit? = null) : Sound
Link copied to clipboard
abstract class SoundChannel(val sound: Sound) : SoundChannelBase, Extra
Link copied to clipboard
Link copied to clipboard
class SoundChannelGroup(volume: Double = 1.0, pitch: Double = 1.0, panning: Double = 0.0) : SoundChannelBase, SoundChannelPlay, Extra
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
interface SoundPlay
Link copied to clipboard

Properties

Functions

Link copied to clipboard
Link copied to clipboard
fun arraycopy(src: AudioSampleArray, srcPos: Int, dst: AudioSampleArray, dstPos: Int, size: Int)
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
suspend fun SoundChannelBase.await()
suspend fun SoundChannel.await(progress: SoundChannel.(current: Duration, total: Duration) -> Unit = { current, total -> })
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
fun createAudioElement(src: String, currentTime: Double = 0.0, autoplay: Boolean = false, crossOrigin: String? = "anonymous"): Audio
fun createAudioElement(src: String, currentTime: Double = 0.0, autoplay: Boolean = false, crossOrigin: String? = "anonymous"): Audio
Link copied to clipboard
suspend fun NativeSoundProvider.createNonStreamingSound(data: AudioData, name: String = "Unknown"): Sound
Link copied to clipboard
suspend fun NativeSoundProvider.createSound(file: FinalVfsFile, streaming: Boolean = false, props: AudioDecodingProps = AudioDecodingProps.DEFAULT): Sound
suspend fun NativeSoundProvider.createSound(file: VfsFile, streaming: Boolean = false, props: AudioDecodingProps = AudioDecodingProps.DEFAULT): Sound
suspend fun NativeSoundProvider.createSound(data: AudioData, formats: AudioFormats = defaultAudioFormats, streaming: Boolean = false, name: String = "Unknown"): Sound
suspend fun NativeSoundProvider.createSound(vfs: Vfs, path: String, streaming: Boolean = false, props: AudioDecodingProps = AudioDecodingProps.DEFAULT): Sound
suspend fun NativeSoundProvider.createSound(data: ByteArray, streaming: Boolean = false, props: AudioDecodingProps = AudioDecodingProps.DEFAULT, name: String = "Unknown"): Sound
Link copied to clipboard
suspend fun NativeSoundProvider.createStreamingSound(stream: AudioStream, closeStream: Boolean = false, name: String = "Unknown", onComplete: suspend () -> Unit? = null): Sound
Link copied to clipboard
suspend fun AudioData.encodeToByteArray(format: AudioFormat = WAV, props: AudioEncodingProps = AudioEncodingProps.DEFAULT): ByteArray
Link copied to clipboard
suspend fun AudioData.encodeToFile(file: VfsFile, format: AudioFormats = defaultAudioFormats, props: AudioEncodingProps = AudioEncodingProps.DEFAULT)
Link copied to clipboard
suspend fun AudioData.encodeToStream(out: AsyncOutputStream, format: AudioFormat = WAV, props: AudioEncodingProps = AudioEncodingProps.DEFAULT)
Link copied to clipboard
Link copied to clipboard
fun AudioSamples.interleaved(out: AudioSamplesInterleaved = AudioSamplesInterleaved(channels, totalSamples)): AudioSamplesInterleaved
Link copied to clipboard
suspend fun AudioStream.playAndWait(params: PlaybackParameters = PlaybackParameters.DEFAULT)
suspend fun NativeSoundProvider.playAndWait(stream: AudioStream, params: PlaybackParameters = PlaybackParameters.DEFAULT)
suspend fun AudioStream.playAndWait(times: PlaybackTimes = 1.playbackTimes, startTime: Duration = 0.seconds, bufferTime: Duration = 0.1.seconds)
Link copied to clipboard
suspend fun VfsFile.readAudioData(formats: AudioFormat = defaultAudioFormats, props: AudioDecodingProps = AudioDecodingProps.DEFAULT): AudioData
Link copied to clipboard
suspend fun VfsFile.readAudioStream(formats: AudioFormat = defaultAudioFormats + nativeSoundProvider.audioFormats, props: AudioDecodingProps = AudioDecodingProps.DEFAULT): AudioStream
Link copied to clipboard
suspend fun VfsFile.readAudioStreamOrNull(formats: AudioFormat = defaultAudioFormats + nativeSoundProvider.audioFormats, props: AudioDecodingProps = AudioDecodingProps.DEFAULT): AudioStream?
Link copied to clipboard
suspend fun VfsFile.readMusic(props: AudioDecodingProps = AudioDecodingProps.DEFAULT): Sound
suspend fun ByteArray.readMusic(props: AudioDecodingProps = AudioDecodingProps.DEFAULT): Sound
Link copied to clipboard
suspend fun VfsFile.readSound(props: AudioDecodingProps = AudioDecodingProps.DEFAULT, streaming: Boolean = false): Sound
suspend fun ByteArray.readSound(props: AudioDecodingProps = AudioDecodingProps.DEFAULT, streaming: Boolean = false): Sound
Link copied to clipboard
fun AudioSamples.resample(srcFreq: Int, dstFreq: Int): AudioSamples
Link copied to clipboard
Link copied to clipboard
fun AudioSamplesInterleaved.separated(out: AudioSamples = AudioSamples(channels, totalSamples)): AudioSamples
Link copied to clipboard
suspend fun AudioStream.toData(maxSamples: Int = DEFAULT_MAX_SAMPLES): AudioData
Link copied to clipboard
suspend fun AudioData.toSound(soundProvider: NativeSoundProvider = nativeSoundProvider): Sound
suspend fun AudioStream.toSound(closeStream: Boolean = false, name: String = "Unknown"): Sound
suspend fun AudioStream.toSound(closeStream: Boolean = false, name: String = "Unknown", onComplete: suspend () -> Unit? = null): Sound
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
suspend fun AudioStreamable.withProcessor(block: suspend (inp: AudioStream, outp: AudioSamplesDeque) -> Unit): Sound
Link copied to clipboard

Change the rate, changing the pitch and the duration of the sound.

Link copied to clipboard
suspend fun VfsFile.writeAudio(data: AudioData, formats: AudioFormat = defaultAudioFormats + nativeSoundProvider.audioFormats, props: AudioEncodingProps = AudioEncodingProps.DEFAULT)