Added ability to save attachments

This commit is contained in:
delvh
2020-07-27 12:00:49 +02:00
parent 1cdad2df0b
commit e216152e6b
5 changed files with 81 additions and 24 deletions

View File

@ -27,6 +27,11 @@ public final class AudioRecorder {
*/
public static final AudioFormat DEFAULT_AUDIO_FORMAT = new AudioFormat(16000, 16, 1, true, false);
/**
* The format in which audio files will be saved.
*/
public static final String FILE_FORMAT = "wav";
private final AudioFormat format;
private final DataLine.Info info;
@ -78,7 +83,7 @@ public final class AudioRecorder {
line.start();
// Prepare temp file
tempFile = Files.createTempFile("recording", "wav");
tempFile = Files.createTempFile("recording", FILE_FORMAT);
// Start the recording
final var ais = new AudioInputStream(line);
@ -117,6 +122,6 @@ public final class AudioRecorder {
line.close();
try {
Files.deleteIfExists(tempFile);
} catch (IOException e) {}
} catch (final IOException e) {}
}
}