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

📄 echofiltertest.java

📁 Developing Games in Java 源代码
💻 JAVA
字号:
import java.io.*;

import com.brackeen.javagamebook.sound.*;

/**
    An example of playing a sound with an echo filter.
    @see EchoFilter
    @see SimpleSoundPlayer
*/
public class EchoFilterTest {

    public static void main(String[] args) {

        // load the sound
        SimpleSoundPlayer sound =
            new SimpleSoundPlayer("../sounds/voice.wav");

        // create the sound stream
        InputStream is =
            new ByteArrayInputStream(sound.getSamples());

        // create an echo with a 11025-sample buffer
        // (1/4 sec for 44100Hz sound) and a 60% decay
        EchoFilter filter = new EchoFilter(11025, .6f);

        // create the filtered sound stream
        is = new FilteredSoundStream(is, filter);

        // play the sound
        sound.play(is);

        // due to bug in Java Sound, explicitly exit the VM.
        System.exit(0);
    }

}

⌨️ 快捷键说明

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