Interface AudioDialogProvider


@NonNullByDefault public interface AudioDialogProvider
This interface is designed so the voice bundle can inject the start dialog functionality for audio bundle to consume, which a programmatic way of trigger the dialog execution.
Author:
Miguel Álvarez Díez - Initial contribution
  • Method Summary

    Modifier and Type
    Method
    Description
    @Nullable Runnable
    startDialog(AudioSink audioSink, AudioSource audioSource, @Nullable String locationItem, @Nullable String listeningItem, @Nullable Runnable onAbort)
    Starts a dialog and returns a runnable that triggers it or null if the dialog initialization fails
    default boolean
    startKeywordSpottingDialog(AudioSink audioSink, AudioSource audioSource, @Nullable String locationItem, @Nullable String listeningItem, @Nullable Runnable onAbort)
    Starts a dialog that is triggered when the default keyword spotter spots the default magic word.
  • Method Details

    • startDialog

      @Nullable Runnable startDialog(AudioSink audioSink, AudioSource audioSource, @Nullable String locationItem, @Nullable String listeningItem, @Nullable Runnable onAbort)
      Starts a dialog and returns a runnable that triggers it or null if the dialog initialization fails
      Parameters:
      audioSink - the audio sink to play sound
      audioSource - the audio source to capture sound
      locationItem - an optional Item name to scope dialog commands
      listeningItem - an optional Item name to toggle while dialog is listening, overwrites default
      onAbort - an optional Runnable instance to call on abort.
      Returns:
      a Runnable instance to trigger dialog processing or null if the dialog initialization fails
    • startKeywordSpottingDialog

      default boolean startKeywordSpottingDialog(AudioSink audioSink, AudioSource audioSource, @Nullable String locationItem, @Nullable String listeningItem, @Nullable Runnable onAbort)
      Starts a dialog that is triggered when the default keyword spotter spots the default magic word.
      Parameters:
      audioSink - the audio sink to play sound
      audioSource - the audio source to capture sound
      locationItem - an optional Item name to scope dialog commands
      listeningItem - an optional Item name to toggle while dialog is listening, overwrites default
      onAbort - an optional Runnable instance to call when the started dialog is stopped
      Returns:
      true if the dialog was started, false if it failed to start or is not supported by this provider
      Throws:
      IllegalStateException - if the voice settings don't allow starting the dialog