⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 iaudiorecorder.java

📁 JAVA录音和播放
💻 JAVA
字号:
/*
 * IAudioRecorder.java
 *
 * Created on 2007年3月19日, 上午1:48
 *
 * To change this template, choose Tools | Template Manager
 * and open the template in the editor.
 */

package audio;

import javax.sound.sampled.AudioFormat;

/**
 *
 * @author 吕硕
 */
public interface IAudioRecorder 
{
    /**
     * Default AudioFormat with the folowing settings: Sampling rate = 44.1 kHz,
     * Sample Size = 16 bits, Num Channels = 2 (stareo), Frame Size = 4,
     * Frame Rate = 44.1 kHz (same as Sampling Rate), little endiain = false.
     * </br>
     * @see javax.sound.sampled.AudioFormat
     */
    public static final AudioFormat DEFAULT_AUDIO_FORMAT = new AudioFormat
    (
            AudioFormat.Encoding.PCM_SIGNED,
            44100.0f, //44.1 kHz sampling rate = CD quality audio
            16, //1 bytes, 8 bit audio (1 * 8 bit byte)
            1, //1 channels, stereo
            2, //frame size = number of bytes in a sample * number of channels = Default WAVE
            44100, //frame rate = sampling rate = Default WAVE
            false //little endian = Default WAVE
    );

    /**
     * Default Buffer Size used for recording. This is the amount to record in each
     * succesive read() call while recording.
     *
     * @see javax.sound.sampled.TargetDataLine#read
     */
    public static final int bufSize = 16384;


    /**
     * Starts recording
     *
     * @throws Exception
     */
    public void startRecording() throws Exception;

    /**
     * Stops recording or playback
     */
    public void stopRecording();

    /**
     * Clears the current recorded audio in buffer (if any)
     */
    public void reset();


    /**
     * @param format The AudioFormat to use for recording
     * @see javax.sound.sampled.AudioFormat
     */
    public void setAudioFormat(AudioFormat format);

    /**
     * @return the current AudioFormat used for recording
     * @see javax.sound.sampled.AudioFormat
     */
    public AudioFormat getAudioFormat();

    /**
     * Sets default audio format for recording
     */
    public void setDefaultAudioFormat();
}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -