Module audio

Module audio 

Source
Expand description

Audio service, widgets and other types.

§Service

The AUDIOS service manages audio loading and caching. Audio decoding is implemented by the view-process, for this reason the service must be used in a headed app or headless app with renderer, in a headless app without renderer no view-process is spawned so no audio format will be available.

The audio service also define security limits, the AUDIOS.limits variable to configure these limits. See AudioLimits::default for the defaults.

use zng::{audio, prelude::*};

audio::AUDIOS.limits().modify(|l| {
    l.allow_uri = audio::UriFilter::allow_host("httpbin.org");
    l.max_encoded_len = 1.megabytes();
    l.max_decoded_len = 10.megabytes();
}); }

The example above changes the global limits to allow audio downloads only from an specific host and only allow audio with sizes less or equal to 1 megabyte and that only expands to up to 10 megabytes after decoding.

§Full API

See zng_ext_audio for the full audio API.

Structs§

AUDIOS
Audio loading, cache and render service.
AudioFormat
Represents an audio codec capability.
AudioHash
A 256-bit hash for audio tracks.
AudioLimits
Limits for audio loading and decoding.
AudioMix
Represents an audio source.
AudioOptions
Options for AUDIOS.audio.
AudioOutput
Represents an open audio output stream.
AudioOutputId
Unique identifier of an open audio output.
AudioTrack
State of an AudioVar.

Enums§

AudioCacheMode
Cache mode of AUDIOS.
AudioDataFormat
Format of the audio bytes.
AudioOutputState
Represents the playback state if an audio output stream.
AudioSource
The different sources of an audio resource.
AudioSourceFilter
Represents a PathFilter and UriFilter.

Type Aliases§

AudioVar
Represents an AudioTrack tracked by the AUDIOS cache.
UriFilter
Represents an AudioSource::Download path request filter.