Package org.openhab.core.audio
Interface AudioSink
@NonNullByDefault
public interface AudioSink
Definition of an audio output like headphones, a speaker or for writing to
a file / clip.
- Author:
- Harald Kuhn - Initial contribution, Kelly Davis - Modified to match discussion in #584, Christoph Weitkamp - Added getSupportedStreams() and UnsupportedAudioStreamException
-
Method Summary
Modifier and TypeMethodDescriptiongetId()
Returns a simple string that uniquely identifies this service@Nullable String
Returns a localized human readable label that can be used within UIs.Gets a set containing all supported audio formatsSet<Class<? extends AudioStream>>
Gets a set containing all supported audio stream formatsGets the volumevoid
process
(@Nullable AudioStream audioStream) Processes the passedAudioStream
If the passedAudioStream
is not supported by this instance, anUnsupportedAudioStreamException
is thrown.void
setVolume
(PercentType volume) Sets the volume
-
Method Details
-
getId
String getId()Returns a simple string that uniquely identifies this service- Returns:
- an id that identifies this service
-
getLabel
Returns a localized human readable label that can be used within UIs.- Parameters:
locale
- the locale to provide the label for- Returns:
- a localized string to be used in UIs
-
process
void process(@Nullable AudioStream audioStream) throws UnsupportedAudioFormatException, UnsupportedAudioStreamException Processes the passedAudioStream
If the passedAudioStream
is not supported by this instance, anUnsupportedAudioStreamException
is thrown. If the passedAudioStream
has anAudioFormat
not supported by this instance, anUnsupportedAudioFormatException
is thrown. In case the audioStream is null, this should be interpreted as a request to end any currently playing stream.- Parameters:
audioStream
- the audio stream to play or null to keep quiet- Throws:
UnsupportedAudioFormatException
- If audioStream format is not supportedUnsupportedAudioStreamException
- If audioStream is not supported
-
getSupportedFormats
Set<AudioFormat> getSupportedFormats()Gets a set containing all supported audio formats- Returns:
- A Set containing all supported audio formats
-
getSupportedStreams
Set<Class<? extends AudioStream>> getSupportedStreams()Gets a set containing all supported audio stream formats- Returns:
- A Set containing all supported audio stream formats
-
getVolume
Gets the volume- Returns:
- a PercentType value between 0 and 100 representing the actual volume
- Throws:
IOException
- if the volume can not be determined
-
setVolume
Sets the volume- Parameters:
volume
- a PercentType value between 0 and 100 representing the desired volume- Throws:
IOException
- if the volume can not be set
-