()
| 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 |
nothing calls this directly
no test coverage detected