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

📄 filtersequence.java

📁 用Java实现简单的3D动画实现
💻 JAVA
字号:
package com.brackeen.javagamebook.sound;

/**
    The FilterSequence class is a SoundFilter that combines
    several SoundFilters at once.
    <p>This class wasn't listed in the book ;)
    @see FilteredSoundStream
*/
public class FilterSequence extends SoundFilter {

    private SoundFilter[] filters;

    /**
        Creates a new FilterSequence object with the specified
        array of SoundFilters. The samples run through each
        SoundFilter in the order of this array.
    */
    public FilterSequence(SoundFilter[] filters) {
        this.filters = filters;
    }


    /**
        Returns the maximum remaining size of all SoundFilters
        in this FilterSequence.
    */
    public int getRemainingSize() {
        int max = 0;
        for (int i=0; i<filters.length; i++) {
            max = Math.max(max, filters[i].getRemainingSize());
        }
        return max;
    }


    /**
        Resets each SoundFilter in this FilterSequence.
    */
    public void reset() {
        for (int i=0; i<filters.length; i++) {
            filters[i].reset();
        }
    }


    /**
        Filters the sound simple through each SoundFilter in this
        FilterSequence.
    */
    public void filter(byte[] samples, int offset, int length) {
        for (int i=0; i<filters.length; i++) {
            filters[i].filter(samples, offset, length);
        }
    }
}

⌨️ 快捷键说明

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