MCPcopy Create free account
hub / github.com/5zig/The-5zig-Mod / run

Method run

Minecraft-Utils/1.8/src/AudioButton.java:105–140  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

103 errorTicks = 1;
104 new Thread("Audio Record Thread") {
105 @Override
106 public void run() {
107 try {
108 DataLine.Info info = new DataLine.Info(TargetDataLine.class, format);
109 if (!AudioSystem.isLineSupported(info)) {
110 error(MinecraftFactory.getClassProxyCallback().translate("chat.audio.not_supported"));
111 return;
112 }
113 synchronized (LOCK) {
114 if (line != null) {
115 closeLine();
116 }
117 line = (TargetDataLine) AudioSystem.getLine(info);
118 line.open(format);
119 line.start();
120 }
121
122
123 AudioInputStream ais = new AudioInputStream(line);
124 if (tmpFile.exists())
125 org.apache.commons.io.FileUtils.deleteQuietly(tmpFile);
126 if (!tmpFile.createNewFile())
127 throw new IOException("Could not create Audio File!");
128
129 recording = true;
130 recordingStarted = System.currentTimeMillis();
131
132 AudioSystem.write(ais, AudioFileFormat.Type.WAVE, tmpFile);
133 } catch (LineUnavailableException e) {
134 error(MinecraftFactory.getClassProxyCallback().translate("chat.audio.unavailable"));
135 MinecraftFactory.getClassProxyCallback().getLogger().error("Audioline currently unavailable!", e);
136 } catch (Exception e) {
137 MinecraftFactory.getClassProxyCallback().getLogger().error("Could not record Audio!", e);
138 error(e.getMessage());
139 }
140 }
141 }.start();
142 }
143

Callers

nothing calls this directly

Calls 8

errorMethod · 0.95
getClassProxyCallbackMethod · 0.95
closeLineMethod · 0.95
translateMethod · 0.65
writeMethod · 0.65
getLoggerMethod · 0.65
startMethod · 0.45
getMessageMethod · 0.45

Tested by

no test coverage detected