Skip to content

Commit 7a53972

Browse files
committed
Specified what type of exception is thrown and implements Closeable to
Microphone class.
1 parent 115f503 commit 7a53972

1 file changed

Lines changed: 6 additions & 3 deletions

File tree

src/com/darkprograms/speech/microphone/Microphone.java

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,14 +2,15 @@
22

33
import javax.sound.sampled.*;
44

5+
import java.io.Closeable;
56
import java.io.File;
67

78
/***************************************************************************
89
* Microphone class that contains methods to capture audio from microphone
910
*
1011
* @author Luke Kuza, Aaron Gokaslan
1112
***************************************************************************/
12-
public class Microphone {
13+
public class Microphone implements Closeable{
1314

1415
/**
1516
* TargetDataLine variable to receive data from microphone
@@ -115,9 +116,10 @@ private void initTargetDataLine(){
115116
* Captures audio from the microphone and saves it a file
116117
*
117118
* @param audioFile The File to save the audio to
119+
* @throws LineUnavailableException
118120
* @throws Exception Throws an exception if something went wrong
119121
*/
120-
public void captureAudioToFile(File audioFile) throws Exception {
122+
public void captureAudioToFile(File audioFile) throws LineUnavailableException {
121123
setState(CaptureState.STARTING_CAPTURE);
122124
setAudioFile(audioFile);
123125

@@ -135,9 +137,10 @@ public void captureAudioToFile(File audioFile) throws Exception {
135137
* Captures audio from the microphone and saves it a file
136138
*
137139
* @param audioFile The fully path (String) to a file you want to save the audio in
140+
* @throws LineUnavailableException
138141
* @throws Exception Throws an exception if something went wrong
139142
*/
140-
public void captureAudioToFile(String audioFile) throws Exception {
143+
public void captureAudioToFile(String audioFile) throws LineUnavailableException {
141144
setState(CaptureState.STARTING_CAPTURE);
142145
File file = new File(audioFile);
143146
setAudioFile(file);

0 commit comments

Comments
 (0)