Ggwave.kt

1.1 KB · raw

1package com.peachpasswords.sync23enum class GgwaveProtocol {4    AUDIBLE_NORMAL,5    AUDIBLE_FAST,6    AUDIBLE_FASTEST,7    ULTRASOUND_NORMAL,8    ULTRASOUND_FAST,9    ULTRASOUND_FASTEST,10    DT_NORMAL,11    DT_FAST,12    DT_FASTEST,13}1415interface ChirpCodec {16    fun encode(payload: ByteArray): FloatArray17    fun decode(samples: FloatArray): ByteArray?18    fun free()19}2021data class ChirpCodecOptions(22    val sampleRate: Int,23    val protocol: GgwaveProtocol = GgwaveProtocol.ULTRASOUND_FASTEST,24    val volumePercent: Int = 10,25)2627typealias ChirpCodecFactory = suspend (ChirpCodecOptions) -> ChirpCodec2829/**30 * Native ggwave binding placeholder.31 *32 * The browser source loads vendored JS/WASM at runtime. Android needs a33 * platform-specific audio bridge plus native codec binding, which is a34 * separate implementation step. The coordinator and tests inject their own35 * codec so the pairing protocol can still be exercised now.36 */37suspend fun createChirpCodec(opts: ChirpCodecOptions): ChirpCodec {38    throw UnsupportedOperationException(39        "Android ggwave codec is not yet implemented (sampleRate=${opts.sampleRate})",40    )41}