/* * Decompiled with CFR 0.152. * * Could not load the following classes: * javax.baja.file.BAbstractFile * javax.baja.sys.BRelTime * javax.baja.sys.BValue */ package com.tridium.alarm.ui; import com.tridium.alarm.ui.SoundPlayer; import java.io.BufferedInputStream; import java.io.InputStream; import javax.baja.file.BAbstractFile; import javax.baja.sys.BRelTime; import javax.baja.sys.BValue; import javax.sound.sampled.AudioFormat; import javax.sound.sampled.AudioInputStream; import javax.sound.sampled.AudioSystem; import javax.sound.sampled.DataLine; import javax.sound.sampled.SourceDataLine; public class MediaPlayer extends SoundPlayer { static /* synthetic */ Class class$javax$sound$sampled$SourceDataLine; public MediaPlayer() { } public MediaPlayer(BValue bValue, BAbstractFile bAbstractFile) { this.addMediaObject(bValue, bAbstractFile); } public MediaPlayer(BValue bValue, BAbstractFile bAbstractFile, BRelTime bRelTime) { this.addMediaObject(bValue, bAbstractFile); this.delay = bRelTime; } protected void processMediaObject(Object object) throws Exception { BAbstractFile bAbstractFile; InputStream inputStream; BufferedInputStream bufferedInputStream; AudioInputStream audioInputStream; AudioFormat audioFormat; DataLine.Info info = new DataLine.Info(class$javax$sound$sampled$SourceDataLine == null ? (class$javax$sound$sampled$SourceDataLine = MediaPlayer.class$("javax.sound.sampled.SourceDataLine")) : class$javax$sound$sampled$SourceDataLine, audioFormat = (audioInputStream = AudioSystem.getAudioInputStream(bufferedInputStream = new BufferedInputStream(inputStream = (bAbstractFile = (BAbstractFile)object).getInputStream()))).getFormat()); if (!AudioSystem.isLineSupported(info)) { logger.warning("BAlarmConsole: audio system does not handle this type of audio: " + audioFormat); return; } SourceDataLine sourceDataLine = (SourceDataLine)AudioSystem.getLine(info); sourceDataLine.open(audioFormat); sourceDataLine.start(); int n = (int)bAbstractFile.getSize(); if (n > 4096) { n = 4096; } byte[] byArray = new byte[n]; int n2 = 0; int n3 = 0; while (!this.stopRequest) { ++n3; n2 = audioInputStream.read(byArray, 0, byArray.length); if (n2 < 0) break; sourceDataLine.write(byArray, 0, n2); } sourceDataLine.drain(); sourceDataLine.close(); } static /* synthetic */ Class class$(String string) { try { return Class.forName(string); } catch (ClassNotFoundException classNotFoundException) { throw new NoClassDefFoundError(classNotFoundException.getMessage()); } } }