import net.pterodactylus.sonitus.io.IntegralWriteOutputStream;
import com.google.common.base.Preconditions;
+import com.google.common.eventbus.EventBus;
/**
* {@link Sink} implementation that uses the JDK’s {@link AudioSystem} to play
/** The logger. */
private static final Logger logger = Logger.getLogger(AudioSink.class.getName());
+ /** The event bus. */
+ private final EventBus eventBus;
+
/** The volume fader. */
private final Fader volumeFader;
}
}, 1024);
- /** Creates a new audio sink. */
- public AudioSink() {
+ /**
+ * Creates a new audio sink.
+ *
+ * @param eventBus
+ * The event bus
+ */
+ public AudioSink(EventBus eventBus) {
+ this.eventBus = eventBus;
volumeFader = new Fader("Volume") {
@Override
}
@Override
+ public Metadata metadata() {
+ return metadata;
+ }
+
+ @Override
public List<Controller<?>> controllers() {
return Arrays.<Controller<?>>asList(volumeFader, muteSwitch);
}
@Override
public void metadataUpdated(Metadata metadata) {
logger.info(String.format("Now playing %s.", metadata));
+ this.metadata = metadata;
}
@Override