• 大小: 84KB
    文件类型: .zip
    金币: 1
    下载: 0 次
    发布日期: 2021-09-01
  • 语言: Java
  • 标签: java  音频文件  

资源简介

java对音频文件的频谱分析,很好的东西 !

资源截图

代码片段和文件信息

/*
 * Light Development Spectrum Analyzer Component
 * Copyright (C) 2003-2005 Ulrich Hilger
 *
 * This program is free software; you can redistribute it and/or
 * modify it under the terms of the GNU General Public License
 * as published by the Free Software Foundation; either version 2
 * of the License or (at your option) any later version.
 *
 * This program is distributed in the hope that it will be useful
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU General Public License for more details.
 *
 * You should have received a copy of the GNU General Public License
 * along with this program; if not write to the Free Software
 * Foundation Inc. 59 Temple Place - Suite 330 Boston MA  02111-1307 USA.
 */

package com.lightdev.lib.audio.ui;

import java.awt.Graphics2D;
import java.awt.Color;
import java.awt.image.BufferedImage;

/**
 * a user interface component to show an amplitude value
 *
 * @author Ulrich Hilger
 * @author Light Development
 * @author http://www.lightdev.com
 * @author info@lightdev.com
 * @author published under the terms and conditions of the
 *      GNU General Public License
 *      for details see file license.txt in the distribution
 *      package of this software
 *
 * @version 1 January 20 2005
 */

public class LevelMeter {

  /**
   * constructor
   * @param bi BufferedImage  the offscreen image to use for painting
   * @param index int  index inside a group of level meters
   * @param width int  width of this level meter
   * @param height int  height of this level meter
   * @param min int  minimum value to display by this level meter
   * @param max int  maximum value to display by this level meter
   */
  public LevelMeter(BufferedImage bi int index int width int height int min
                    int max) {
    this.bi = bi;
    this.index = index;

    setSize(width height);

    this.min = min;
    this.max = max;
    sideMargin = barGap / 2;
  }

  /**
   * set the size of this component
   * @param width int  the width
   * @param height int  the height
   */
  public void setSize(int width int height) {
    if(width > 0 && height > 0) {
      this.outerWidth = width;
      this.meterHeight = height;
      meterWidth = outerWidth - barGap;
    }
  }

  /**
   * repaint this component
   * @param value double  the decibel value to display
   */
  private void repaintMeter(double value) {
    if(value > min && value < max) {
      double oldValue = meterValue;
      if (oldValue != value) {
        //paintValue = oldValue;
        meterValue = value;
        if(bi != null) {
          Graphics2D g2 = bi.createGraphics();
          if (oldValue < value) {
            increaseMeter(g2 value);
          }
          else {
            re

 属性            大小     日期    时间   名称
----------- ---------  ---------- -----  ----
     文件        5428  2005-01-21 22:02  ldsa.jar
     目录           0  2005-01-22 09:47  doc\api\
     文件         908  2005-01-22 09:46  doc\api\allclasses-frame.html
     文件         868  2005-01-22 09:46  doc\api\allclasses-noframe.html
     目录           0  2005-01-22 09:47  doc\api\com\
     目录           0  2005-01-22 09:47  doc\api\com\lightdev\
     目录           0  2005-01-22 09:47  doc\api\com\lightdev\lib\
     目录           0  2005-01-22 09:47  doc\api\com\lightdev\lib\audio\
     目录           0  2005-01-22 09:47  doc\api\com\lightdev\lib\audio\ui\
     文件       16084  2005-01-22 09:46  doc\api\com\lightdev\lib\audio\ui\LevelMeter.html
     文件        1113  2005-01-22 09:46  doc\api\com\lightdev\lib\audio\ui\package-frame.html
     文件        6931  2005-01-22 09:46  doc\api\com\lightdev\lib\audio\ui\package-summary.html
     文件        6910  2005-01-22 09:46  doc\api\com\lightdev\lib\audio\ui\package-tree.html
     文件       66671  2005-01-22 09:46  doc\api\com\lightdev\lib\audio\ui\SpectrumAnalyzer.html
     文件        4979  2005-01-22 09:46  doc\api\constant-values.html
     文件        4915  2005-01-22 09:46  doc\api\deprecated-list.html
     文件        8802  2005-01-22 09:46  doc\api\help-doc.html
     文件        1274  2005-01-22 09:46  doc\api\index.html
     文件       11373  2005-01-22 09:46  doc\api\index-all.html
     文件        6669  2005-01-22 09:46  doc\api\overview-tree.html
     文件          27  2005-01-22 09:46  doc\api\package-list
     目录           0  2005-01-22 09:47  doc\api\resources\
     文件          57  2005-01-22 09:46  doc\api\resources\inherit.gif
     文件        8383  2005-01-22 09:46  doc\api\serialized-form.html
     文件        1231  2005-01-22 09:46  doc\api\stylesheet.css
     目录           0  2005-01-21 17:02  src\com\
     目录           0  2005-01-21 17:02  src\com\lightdev\
     目录           0  2005-01-21 17:02  src\com\lightdev\lib\
     目录           0  2005-01-21 17:02  src\com\lightdev\lib\audio\
     目录           0  2005-01-21 17:02  src\com\lightdev\lib\audio\ui\
     文件        6411  2005-01-20 16:46  src\com\lightdev\lib\audio\ui\LevelMeter.java
............此处省略6个文件信息

评论

共有 条评论