# `MobAudioIo.SelfTest`
[🔗](https://github.com/GenericJam/mob_audio_io/blob/main/lib/mob_audio_io/self_test.ex#L1)

The plugin's on-device proof (`Mob.Plugin.SelfTest`), run by
`mix mob.selftest` and mob_ci.

1. **Output**: opens a real output stream on the built-in `"mai_silence"`
   processor (nothing audible) through the NIF, waits 150 ms, and reads
   the stream's callback count from `:mob_audio_io_nif.stream_status/1`.
   The platform's audio thread calling the plugin is the answer.
2. **Input**, if the microphone is permitted: the same with an input
   stream. Without the permission (`{:error, :permission}`) this part is
   left out and the result rests on the output; the runner grants the
   manifest's permissions on emulators and simulators, so CI covers it.

Outcomes: `:pass` when every stream that opened had callbacks; a failure
naming the direction when a stream opened but no callback ran, when an
open answered another error, or when the NIF isn't linked
(`{:error, :unsupported}`).

Streams open with `session: :mix`, so music another app plays isn't
paused. Each is closed before `run/1` returns and its messages are
flushed.

---

*Consult [api-reference.md](api-reference.md) for complete listing*
