====== std.audio.alsa ====== ALSA (Advanced Linux Sound Architecture) ist die Standard-Soundschnittstelle unter Linux und direkter Nachfolger von OSS. Die Unit bietet Zugriff auf PCM-Geräte für Wiedergabe und Aufnahme von Audiosignalen mit konfigurierbarem Format (Samplerate, Kanalanzahl, Bittiefe). Der Zugriff erfolgt direkt auf Kernel-Ebene ohne zwischengeschaltete Abstraktionsschicht. Typische Einsatzbereiche sind Audioanwendungen, Sprachausgabe (Text-to-Speech), Signalverarbeitung, Loopback-Tests und eingebettete Systeme mit Audioausgabe. ---- ===== Konstanten ===== ^ Name ^ Typ ^ Wert ^ Sichtbarkeit ^ | ''ALSA_OK'' | ''int64'' | ''0'' | pub | | ''ALSA_ERROR'' | ''int64'' | ''-1'' | pub | | ''ALSA_TIMEOUT'' | ''int64'' | ''-11'' | pub | | ''SND_PCM_STREAM_PLAYBACK'' | ''int64'' | ''0'' | pub | | ''SND_PCM_STREAM_CAPTURE'' | ''int64'' | ''1'' | pub | | ''SND_PCM_ACCESS_MMAP_INTERLEAVED'' | ''int64'' | ''0'' | pub | | ''SND_PCM_ACCESS_RW_INTERLEAVED'' | ''int64'' | ''3'' | pub | | ''SND_PCM_FORMAT_S8'' | ''int64'' | ''1'' | pub | | ''SND_PCM_FORMAT_U8'' | ''int64'' | ''2'' | pub | | ''SND_PCM_FORMAT_S16_LE'' | ''int64'' | ''2'' | pub | | ''SND_PCM_FORMAT_S16_BE'' | ''int64'' | ''3'' | pub | | ''SND_PCM_FORMAT_U16_LE'' | ''int64'' | ''4'' | pub | | ''SND_PCM_FORMAT_U16_BE'' | ''int64'' | ''5'' | pub | | ''SND_PCM_OPEN_READ'' | ''int64'' | ''1'' | pub | | ''SND_PCM_OPEN_WRITE'' | ''int64'' | ''2'' | pub | ---- ===== Externe Funktionen ===== ^ Signatur ^ Beschreibung ^ | ''snd_pcm_open(handlePtr: int64, device: pchar, stream: int64, mode: int64): int64'' | Öffnet ALSA-PCM-Gerät | | ''snd_pcm_close(handle: int64): int64'' | Schließt ALSA-PCM-Gerät | | ''snd_pcm_hw_params_malloc(paramsPtr: int64): int64'' | Allociert Hardware-Parameter-Struktur | | ''snd_pcm_hw_params_free(params: int64): int64'' | Gibt Hardware-Parameter-Struktur frei | | ''snd_pcm_hw_params_any(handle: int64, params: int64): int64'' | Füllt Parameter mit Gerätestandardwerten | | ''snd_pcm_hw_params_set_access(handle: int64, params: int64, access: int64): int64'' | Setzt PCM-Zugriffsmodus | | ''snd_pcm_hw_params_set_format(handle: int64, params: int64, format: int64): int64'' | Setzt PCM-Sampleformat | | ''snd_pcm_hw_params_set_rate_near(handle: int64, params: int64, rate: int64, dir: int64): int64'' | Setzt Samplerate nächstmöglichem Wert | | ''snd_pcm_hw_params_set_channels(handle: int64, params: int64, channels: int64): int64'' | Setzt Kanalanzahl | | ''snd_pcm_hw_params(handle: int64, params: int64): int64'' | Überträgt Parameter an Hardware | | ''snd_pcm_prepare(handle: int64): int64'' | Bereitet PCM-Stream zur Wiedergabe vor | | ''snd_pcm_writei(handle: int64, buffer: int64, frames: int64): int64'' | Schreibt interleaved PCM-Frames | | ''snd_pcm_drain(handle: int64): int64'' | Wartet auf Abspielung aller Frames | ---- ===== Typen ===== ==== ALSAHandle = int64 ==== ---- ===== Funktionen ===== ^ Signatur ^ Sichtbarkeit ^ Beschreibung ^ | ''ALSAAudioOpen(): ALSAHandle'' | pub | Öffnet Standard-PCM-Gerät für Wiedergabe | | ''ALSASetFormat(handle: int64, sampleRate: int64, channels: int64, bitsPerSample: int64): int64'' | pub | Konfiguriert Samplerate, Kanäle, Bittiefe | | ''ALSAPrepare(handle: int64): int64'' | pub | Bereitet PCM-Handle zur Ausgabe vor | | ''ALSAWrite(handle: int64, buffer: int64, byteCount: int64): int64'' | pub | Schreibt Bytes in PCM-Ausgabepuffer | | ''ALSAClose(handle: int64): int64'' | pub | Draint und schließt PCM-Gerät |