From a669196536534aa133343982d9c7600253fbf4a8 Mon Sep 17 00:00:00 2001 From: =?utf8?q?David=20=E2=80=98Bombe=E2=80=99=20Roden?= Date: Mon, 18 Mar 2013 13:56:02 +0100 Subject: [PATCH] Save current source, update metadata after starting the connection. --- src/main/java/net/pterodactylus/sonitus/data/sink/AudioSink.java | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) 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); } -- 2.7.4