addTrack

suspend fun addTrack(name: String, filePath: String): Boolean

Add track from file path (auto-decodes).

This is the recommended way to add tracks. The file is automatically decoded from its format (MP3, M4A, WAV, etc.) to PCM.

Return

true if track was added successfully

Parameters

name

Unique name for this track

filePath

Path to audio file


fun addTrack(name: String, data: ByteArray, sampleRate: Int, channels: Int): Boolean

Add track from raw PCM data (for advanced use cases).

Use this when you have pre-decoded audio data or need to load audio from a custom source.

Return

true if track was added successfully

Parameters

name

Unique name for this track

data

PCM audio data (16-bit signed samples)

sampleRate

Sample rate in Hz

channels

Number of channels (1 = mono, 2 = stereo)