Files
baji-vc/tests/session/AudioDoubles.kt
T

24 lines
1.1 KiB
Kotlin

package com.gorios.lanvoice.audio
import com.gorios.lanvoice.net.DownlinkFrame
enum class AecAvailability { AVAILABLE, UNAVAILABLE, UNKNOWN }
// No audio devices in callback propagation tests.
class AudioCapture {
companion object { var lastFrame: ((ByteArray) -> Unit)? = null; var lastError: ((Exception) -> Unit)? = null }
fun aecAvailability() = AecAvailability.UNKNOWN
fun start(onFrame: (ByteArray) -> Unit, onError: (Exception) -> Unit, onDiagnostic: (String) -> Unit = {}) { lastFrame = onFrame; lastError = onError; onDiagnostic("AudioRecord initialization ok") }
fun stop() {}
fun release() {}
}
class AudioPlayback(onDrained: (Long, Long) -> Unit, onError: (Long, Exception) -> Unit, onProgress: (Long, Long, String) -> Unit = { _, _, _ -> }) {
companion object { var interrupts = 0; var enqueued = 0 }
fun beginTurn(turn: Long) {}
fun endTurn(turn: Long) {}
fun enqueue(frame: DownlinkFrame): Boolean { enqueued++; return true }
fun isCurrent(turn: Long, epoch: Long) = true
fun isCurrent(epoch: Long) = true
fun interrupt() { interrupts++ }
fun release() {}
}