Added ability to save attachments
This commit is contained in:
@ -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) {}
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user