Add screensaver files

This commit is contained in:
Sem van der Hoeven
2025-09-02 20:34:20 +02:00
parent 3dd1b85b54
commit e347ea492f
67 changed files with 4048 additions and 26 deletions

View File

@@ -0,0 +1,56 @@
package sound;
import java.io.File;
import java.io.IOException;
import javax.sound.sampled.LineUnavailableException;
/**
* A sample program that tests the sound.SoundRecordingUtil utility class.
* @author www.codejava.net
*
*/
public class TestSoundRecordingUtil {
private static final int RECORD_TIME = 10000; // 1 seconds
public static void main(String[] args) {
File wavFile = new File("Record.wav");
final SoundRecordingUtil recorder = new SoundRecordingUtil();
// create a separate thread for recording
Thread recordThread = new Thread(new Runnable() {
@Override
public void run() {
try {
System.out.println("Start recording...");
recorder.start();
} catch (LineUnavailableException ex) {
ex.printStackTrace();
System.exit(-1);
}
}
});
recordThread.start();
try {
Thread.sleep(RECORD_TIME);
} catch (InterruptedException ex) {
ex.printStackTrace();
}
System.out.println("time over");
try {
recorder.stop();
System.out.println("stopped");
recorder.save(wavFile);
System.out.println("STOPPED");
} catch (IOException ex) {
ex.printStackTrace();
}
System.out.println("DONE");
}
}