X-Git-Url: https://git.pterodactylus.net/?a=blobdiff_plain;f=src%2Fmain%2Fjava%2Fnet%2Fpterodactylus%2Fsonitus%2Fdata%2FSource.java;h=cf2dd66f94886e154a4e90b305f572c1e2633b51;hb=f554e51504f7e39e658a84d79c041e0b0d8a6393;hp=e75b920d0f0128d86abb39a21f4a4ec8b54ddfb1;hpb=d33602f1921d7c12833cdfd144f7207de0fcc67b;p=sonitus.git
diff --git a/src/main/java/net/pterodactylus/sonitus/data/Source.java b/src/main/java/net/pterodactylus/sonitus/data/Source.java
index e75b920..cf2dd66 100644
--- a/src/main/java/net/pterodactylus/sonitus/data/Source.java
+++ b/src/main/java/net/pterodactylus/sonitus/data/Source.java
@@ -1,55 +1,32 @@
-/*
- * Sonitus - Source.java - Copyright © 2013 David Roden
- *
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation, either version 3 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program. If not, see .
- */
-
package net.pterodactylus.sonitus.data;
-import java.io.EOFException;
import java.io.IOException;
/**
- * Defines an arbitrary media source. This can be almost anything; an MP3 file,
- * a FastTracker module, or a decoded WAVE file.
+ * A source produces an audio stream and accompanying metadata.
*
* @author David âBombeâ Roden
*/
-public interface Source {
+public interface Source extends Controlled {
/**
- * Returns the format of this source.
+ * Returns the metadata of the audio stream.
*
- * @return The format of this source
+ * @return The metadata of the audio stream
*/
- Format format();
+ Metadata metadata();
/**
- * Retrieves the given name of bytes from this source. The source should always
- * try to read as much data as was requested but is free to return a byte array
- * with less elements that requested. However, the byte array will always be
- * the same size as the data that was actually read, i.e. there are no excess
- * elements in the returned array.
+ * Retrieves data from the audio stream.
*
* @param bufferSize
- * The size of the buffer
- * @return A buffer that contains the read data
- * @throws EOFException
- * if the end of the source was reached
+ * The maximum amount of bytes to retrieve from the audio stream
+ * @return A buffer filled with up to {@code bufferSize} bytes of data; the
+ * returned buffer may contain less data than requested but will not
+ * contain excess elements
* @throws IOException
* if an I/O error occurs
*/
- byte[] get(int bufferSize) throws EOFException, IOException;
+ byte[] get(int bufferSize) throws IOException;
}