AudioStream

class AudioStream(raw: ERROR CLASS: Symbol not found for CPointer<ERROR CLASS: Symbol not found for raylib.internal.AudioStream>) : Playable

Represents an audio stream in raylib, which is a dynamic audio data structure that can be used for streaming audio data. An audio stream should be unloaded when it is no longer needed.

Constructors

Link copied to clipboard
constructor(raw: ERROR CLASS: Symbol not found for CPointer<ERROR CLASS: Symbol not found for raylib.internal.AudioStream>)

Types

Link copied to clipboard
object Companion

Properties

Link copied to clipboard
open override val playing: Boolean

Whether the audio is currently playing.

Link copied to clipboard
open override val valid: Boolean

Whether the audio is valid and can be played.

Functions

Link copied to clipboard
fun attachProcessor(callback: (ERROR CLASS: Symbol not found for UByteArray) -> Unit)

Attaches a processor function to the audio stream, which will be called with the audio data before it is played. The processor function can be used to modify the audio data in real-time, such as applying effects or filters. The processor function should take a byte array as input, which will contain the audio data to be processed. The size of the byte array will be equal to the number of frames requested by the audio stream multiplied by the sample size and number of channels of the audio stream.

Link copied to clipboard

Detaches the processor function from the audio stream, which will stop calling the processor function with the audio data before it is played. After calling this function, the audio stream will no longer call the processor function and will play the audio data without any modifications.

Link copied to clipboard
open override fun pause(): ERROR CLASS: Unresolved name: PauseAudioStream

Pauses the audio. If the audio is not playing, this function does nothing. After calling this function, the audio will be paused at its current position and can be resumed with resume.

Link copied to clipboard
open override fun play(): ERROR CLASS: Unresolved name: PlayAudioStream

Plays the audio. If the audio is already playing, it will be restarted from the beginning.

Link copied to clipboard
open override fun resume(): ERROR CLASS: Unresolved name: ResumeAudioStream

Resumes the audio. If the audio is not paused, this function does nothing. After calling this function, the audio will continue playing from its current position.

Link copied to clipboard
fun setCallback(callback: (ERROR CLASS: Symbol not found for UByteArray) -> Unit)

Sets a callback function to be called when the audio stream needs more data. The callback function should take a byte array as input, which will be filled with the audio data to be streamed. The size of the byte array will be equal to the number of frames requested by the audio stream multiplied by the sample size and number of channels of the audio stream.

Link copied to clipboard
open override fun setPan(pan: Float): ERROR CLASS: Unresolved name: SetAudioStreamPan

Sets the pan of the audio, which can be set between 0.0 and 1.0. A pan of 0.0 means the audio is fully left, 1.0 means the audio is fully right, and 0.5 means the audio is centered (default).

Link copied to clipboard
open override fun setPitch(pitch: Float): ERROR CLASS: Unresolved name: SetAudioStreamPitch

Sets the pitch of the audio, which can be set between 0.5 and 2.0. A pitch of 1.0 means normal speed, less than 1.0 means slower, and greater than 1.0 means faster.

Link copied to clipboard
open override fun setVolume(volume: Float): ERROR CLASS: Unresolved name: SetAudioStreamVolume

Sets the volume of the audio, which can be set between 0.0 and 1.0.

Link copied to clipboard
open override fun stop(): ERROR CLASS: Unresolved name: StopAudioStream

Stops the audio. If the audio is not playing, this function does nothing. After calling this function, the audio will be reset to the beginning and can be played again with play.

Link copied to clipboard
fun unload(): ERROR CLASS: Unresolved name: UnloadAudioStream

Unloads the audio stream from memory. This should be called when the audio stream is no longer needed to free up resources.