/* $Id$
 *
 * Copyright (c) 1999 Xenonsoft Limited. All Rights Reserved.
 *
 * This software is protected by copyright. You are hereby notified from
 * now by reading this message. This software is also the confidential 
 * and proprietary information of Xenonsoft Limited.  ("Confidential
 * Information"). 
 *
 * This software is distributed under the Xenonsoft Public end user 
 * License ("XPeL"), where the machine-readable source code is provided 
 * under the "Open Source" model.
 * For more information, please read the file "LICENSE-XPL.txt" 
 */

// `WhiteNoiseWave.java'

//
// Description:
//	Sound wave that produces pseudo white noise

//	  
// Author:
//      Peter Pilgrim 
//	Wed May 26 12:52:02 BST 1999
//	  
// RCS HEADER 
// 
// $Author$
// $Date$
// $Source$
// $Revision$    $State$    $Locker$
//
// ================================================================================
// History
//	  $Log$
// 
// 
//

package xenon.soundkit;

import java.util.*;

/**
 * A white noise waveform
 * 
 * @author Peter Pilgrim , Sun Jun 20 13:45:25 BST 1999
 * @version $Id$
 *
 */
public class WhiteNoiseWave extends Wave
{
    /** Construct the white noise waveform */
    public WhiteNoiseWave() 
    {
	super();
	
	// Indicate the wavelength is infinite
	WAVELENGTH = Integer.MAX_VALUE;
    }
    
    /** generates the waveform ; this is no brainer for white noise
     * because <em>mathematically</em> the wavelength is infinite!
     * Hence this method does nothing.
     */
    protected void generateWaveform() 
    {
    }

    /**
     * Gets the waveform amplitude at the Nth index of the waveform buffer 
     *
     * <b>NB:</b> this method always return a random value for any index N
     * even if N is constant. In other N is ignored completely
     *
     * @param index the index in to the buffer
     */
    public double elementAt( int index )
    {
	return ( -1.0 + 2.0 * Math.random() );
    }
    
    /** Returns the waveform buffer size */
    public int getLength()
    {
	return WAVELENGTH;
    }

    /** Returns displayable name for the waveform */
    public String getDisplayName()
    {
	return "White Noise";
    }
    
}

// fini
