ContainedVoiceInputIndicator

Functions summary

Unit
@Composable
ContainedVoiceInputIndicator(
    level: () -> Float,
    modifier: Modifier,
    backgroundColor: Color
)

A voice input indicator with a background container that displays sound activity to the user.

Functions

ContainedVoiceInputIndicator

@Composable
fun ContainedVoiceInputIndicator(
    level: () -> Float,
    modifier: Modifier = Modifier,
    backgroundColor: Color = GlimmerTheme.colors.primary
): Unit

A voice input indicator with a background container that displays sound activity to the user. In this version of the component, the indicator bars are transparent and cut through its background container.

This component can be used when accepting voice input to show that the app is listening to the user's input. The indicator responds to the level provided, showing a visual representation of the audio intensity.

See VoiceInputIndicator for the version of this component with solid indicator bars and no background container.

import androidx.compose.runtime.Composable
import androidx.xr.glimmer.VoiceInputIndicator

// Get audio input from microphone.
// Normalize audio input to level 0...1

// Pass normalized level to Composable.
VoiceInputIndicator(level = { level })
Parameters
level: () -> Float

The level of the voice input, ranging from 0.0 (silence) to 1.0 (loudest).

modifier: Modifier = Modifier

The modifier to be applied to the indicator.

backgroundColor: Color = GlimmerTheme.colors.primary

The color of the background container.