📄 soundrecorder.java
字号:
package net.betterjava.design.sideeffect;
/**
* A Class represent a Winows sound recorder
*/
public class SoundRecorder {
private byte[] audio; //当前打开的声音文件
private long currentPosition; //当前声音文件播放的位置
private int currentCommand; //当前执行的命令:停止,播放或录音
private final static int STOP = 0; //用于currentCommand,停止
private final static int PLAY = 1; //用于currentCommand,播放
private final static int RECORD = 2; //用于currentCommand,录音
//用于currentCommand,回退至开头
private final static int SEEK_TO_START = 3;
//用于currentCommand,前进至末尾
private final static int SEEK_TO_END = 4;
public void play() {
//play a sound file
}
public void stop() {
//stop play or recorder
}
public void seekToStart() {
//back to the start of the audio file
}
public void seekToEnd() {
//forward to the end of the audio file
}
public void record() {
//record sound to a audio file
}
public long getPosition() {
return currentPosition;
}
public long getLength() {
return audio.length;
}
public void setPosition(long pos) {
currentPosition = pos;
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -