Package org.openhab.core.audio.utils
Interface AudioSinkUtils
- All Known Implementing Classes:
AudioSinkUtilsImpl
@NonNullByDefault
public interface AudioSinkUtils
Some utility methods for sink
- Author:
- Gwendal Roulleau - Initial contribution
-
Method Summary
Modifier and TypeMethodDescriptiondefault @Nullable LongtransferAndAnalyzeLength(InputStream in, OutputStream out, AudioFormat audioFormat) Transfers data from an input stream to an output stream and computes on the fly its duration@Nullable LongtransferAndAnalyzeLength(InputStream in, OutputStream out, AudioFormat audioFormat, boolean flush) Transfers data from an input stream to an output stream and computes on the fly its duration
-
Method Details
-
transferAndAnalyzeLength
default @Nullable Long transferAndAnalyzeLength(InputStream in, OutputStream out, AudioFormat audioFormat) throws IOException Transfers data from an input stream to an output stream and computes on the fly its duration- Parameters:
in- the input stream giving audio data to playout- the output stream receiving data to playaudioFormat- the audio format of the stream- Returns:
- the timestamp (from System.nanoTime) when the sound should be fully played. Returns null if computing time fails.
- Throws:
IOException- if reading from the stream or writing to the stream failed
-
transferAndAnalyzeLength
@Nullable Long transferAndAnalyzeLength(InputStream in, OutputStream out, AudioFormat audioFormat, boolean flush) throws IOException Transfers data from an input stream to an output stream and computes on the fly its duration- Parameters:
in- the input stream giving audio data to playout- the output stream receiving data to playaudioFormat- the audio format of the streamflush- whether to immediately flush each written chunk (useful for low-latency live/piped streams)- Returns:
- the timestamp (from System.nanoTime) when the sound should be fully played. Returns null if computing time fails.
- Throws:
IOException- if reading from the stream or writing to the stream failed
-