From: David ‘Bombe’ Roden Date: Mon, 18 Mar 2013 12:56:02 +0000 (+0100) Subject: Save current source, update metadata after starting the connection. X-Git-Url: https://git.pterodactylus.net/?a=commitdiff_plain;h=a669196536534aa133343982d9c7600253fbf4a8;p=sonitus.git Save current source, update metadata after starting the connection. --- diff --git a/src/main/java/net/pterodactylus/sonitus/data/sink/AudioSink.java b/src/main/java/net/pterodactylus/sonitus/data/sink/AudioSink.java index b3aa7e7..f29bde8 100644 --- a/src/main/java/net/pterodactylus/sonitus/data/sink/AudioSink.java +++ b/src/main/java/net/pterodactylus/sonitus/data/sink/AudioSink.java @@ -42,9 +42,12 @@ public class AudioSink implements Sink { /** The logger. */ private static final Logger logger = Logger.getLogger(AudioSink.class.getName()); + /** The current source. */ + private Source source; + @Override public void connect(Source source) throws ConnectException { - checkNotNull(source, "source must not be null"); + this.source = checkNotNull(source, "source must not be null"); checkState(source.metadata().encoding().equalsIgnoreCase("PCM"), "source must be PCM-encoded"); final Metadata sourceMetadata = source.metadata(); @@ -71,6 +74,7 @@ public class AudioSink implements Sink { sourceDataLine.stop(); } }).start(); + metadataUpdated(); } catch (LineUnavailableException lue1) { throw new ConnectException(lue1); }