1 package net.pterodactylus.sonitus.data;
3 import java.io.IOException;
6 * A sink is a destination for audio data. It can be played on speakers, it can
7 * be written to a file, or it can be sent to a remote streaming server.
9 * @author <a href="mailto:bombe@pterodactylus.net">David ‘Bombe’ Roden</a>
11 public interface Sink extends Controlled {
14 * Opens this sink using the format parameters of the given metadata.
17 * The metadata of the stream
19 * if an I/O error occurs
21 void open(Metadata metadata) throws IOException;
23 /** Closes this sink. */
27 * Processes the given buffer of data.
32 * if an I/O error occurs
34 void process(byte[] buffer) throws IOException;
37 * Notifies the sink that the metadata of the audio stream has changed. This
38 * method should return as fast as possible, i.e. every heavy lifting should be
39 * done from another thread.
44 void metadataUpdated(Metadata metadata);