package app.chanora.poc.audio

import android.content.Context

object NativeAudio {
    init {
        System.loadLibrary("audio_capture_playback_android_spike")
    }

    /**
     * Must be called once after `System.loadLibrary` with the
     * application Context. Initialises the Rust-side `ndk_context`
     * that cpal/Oboe relies on to locate Android audio services.
     */
    external fun initContext(context: Context)

    /** Returns the number of frames emitted, or -1 on error. */
    external fun playSine440(durationMs: Long): Long

    /** Returns the number of frames captured, or -1 on error. */
    external fun record1sToFile(path: String, durationMs: Long): Long
}
