📄 waverenderer.java
字号:
// Decompiled by Jad v1.5.7g. Copyright 2000 Pavel Kouznetsov.
// Jad home page: http://www.geocities.com/SiliconValley/Bridge/8617/jad.html
// Decompiler options: packimports(3) fieldsfirst ansi
package com.golden.gamedev.engine.audio;
import com.golden.gamedev.engine.BaseAudioRenderer;
import java.io.PrintStream;
import java.net.URL;
import javax.sound.sampled.*;
public class WaveRenderer extends BaseAudioRenderer
implements LineListener
{
private Clip c;
private static boolean d;
private static boolean e;
private static Mixer f;
private static int g = 0;
static Class a;
static Class b;
public WaveRenderer()
{
if(g == 0)
{
g = 1;
_cls1 _lcls1;
(_lcls1 = new _cls1()).setDaemon(true);
_lcls1.start();
}
}
public boolean isAvailable()
{
if(g != 2)
{
for(int i = 0; g != 2 && i++ < 50;)
try
{
Thread.sleep(50L);
}
catch(InterruptedException _ex) { }
if(g != 2)
{
g = 2;
d = false;
}
}
return d;
}
protected void playSound(URL url)
{
try
{
if(c != null)
{
c.drain();
c.close();
}
AudioInputStream audioinputstream;
AudioFormat audioformat;
if((audioformat = (audioinputstream = AudioSystem.getAudioInputStream(getAudioFile())).getFormat()).getEncoding() == javax.sound.sampled.AudioFormat.Encoding.ULAW || audioformat.getEncoding() == javax.sound.sampled.AudioFormat.Encoding.ALAW)
{
AudioFormat audioformat1;
audioinputstream = AudioSystem.getAudioInputStream(audioformat1 = new AudioFormat(javax.sound.sampled.AudioFormat.Encoding.PCM_SIGNED, audioformat.getSampleRate(), audioformat.getSampleSizeInBits() << 1, audioformat.getChannels(), audioformat.getFrameSize() << 1, audioformat.getFrameRate(), true), audioinputstream);
audioformat = audioformat1;
}
javax.sound.sampled.DataLine.Info info = new javax.sound.sampled.DataLine.Info(b != null ? b : (b = a("javax.sound.sampled.Clip")), audioinputstream.getFormat(), (int)audioinputstream.getFrameLength() * audioformat.getFrameSize());
if(f != null)
c = (Clip)f.getLine(info);
else
c = (Clip)AudioSystem.getLine(info);
c.addLineListener(this);
c.open(audioinputstream);
c.start();
if(volume != 1.0F)
setSoundVolume(volume);
return;
}
catch(Exception exception)
{
status = 4;
System.err.println("ERROR: Can not playing " + getAudioFile() + " caused by: " + exception);
return;
}
}
protected void replaySound(URL url)
{
c.setMicrosecondPosition(0L);
c.start();
c.addLineListener(this);
}
protected void stopSound()
{
c.stop();
c.setMicrosecondPosition(0L);
c.removeLineListener(this);
}
public void update(LineEvent lineevent)
{
if(lineevent.getType() == javax.sound.sampled.LineEvent.Type.STOP)
{
status = 3;
c.stop();
c.setMicrosecondPosition(0L);
c.removeLineListener(this);
}
}
protected void setSoundVolume(float f1)
{
if(c != null)
{
javax.sound.sampled.FloatControl.Type type = javax.sound.sampled.FloatControl.Type.VOLUME;
((FloatControl)c.getControl(type)).setValue(f1);
}
}
public boolean isVolumeSupported()
{
return e;
}
static Class a(String s)
{
return Class.forName(s);
ClassNotFoundException classnotfoundexception;
classnotfoundexception;
throw new NoClassDefFoundError(classnotfoundexception.getMessage());
}
static boolean b(boolean flag)
{
return e = flag;
}
static Mixer c(Mixer mixer)
{
return f = mixer;
}
static boolean d(boolean flag)
{
return d = flag;
}
static int e(int i)
{
return g = i;
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -