com.groovemanager.sampled.waveform
Class ZoomedWaveForm

java.lang.Object
  extended by com.groovemanager.sampled.waveform.AbstractWaveForm
      extended by com.groovemanager.sampled.waveform.ZoomedWaveForm
All Implemented Interfaces:
WaveForm

public class ZoomedWaveForm
extends AbstractWaveForm

A ZoomedWaveForm is a WaeForm that displays the data of another WaveForm in a smaller width.

Author:
Manu Robledo

Field Summary
protected  double factor
          The zoom factor.
protected  WaveForm source
          The source WaveForm
 
Fields inherited from class com.groovemanager.sampled.waveform.AbstractWaveForm
channels, displayWidth, intervallSize, nullWave, position, realLength
 
Constructor Summary
ZoomedWaveForm(WaveForm source, int newWidth)
          Create a new ZoomedWaveForm in the given width
 
Method Summary
 boolean canProvide(int begin, int length, int width)
          Tells if this WaveForm sees itself capable of providing a SubWaveForm with the given parameters
protected  java.lang.String getAdditionalToString()
          Get an additional String describing this WaveForm.
 byte getMax(int channel)
          Get the maximum value at the current read position in the given channel
 byte getMin(int channel)
          Get the minimum value at the current read position in the given channel
 int getRealLength()
          Get the Length of the original sample which this WaveForm represents
 WaveForm subWaveForm(int begin, int length, int width)
          Get a WaveForm Object that represents the part of this WaveForm specified by begin and length and displays this part in the specified width
 
Methods inherited from class com.groovemanager.sampled.waveform.AbstractWaveForm
getChannels, getData, getDisplayableLength, getIntervallSize, getPosition, getRealPosition, getZoomFactor, next, rewind, setPosition, setRealPosition, toString
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

factor

protected double factor
The zoom factor. Reoresents the relation between the source´s width and this WaveForm´s width. A factor of 2.0 for example means that the source WaveForm´s width is two times the width of this WaveForm.


source

protected WaveForm source
The source WaveForm

Constructor Detail

ZoomedWaveForm

public ZoomedWaveForm(WaveForm source,
                      int newWidth)
Create a new ZoomedWaveForm in the given width

Parameters:
source - The source WaveForm
newWidth - The width of the new WaveForm
Method Detail

canProvide

public boolean canProvide(int begin,
                          int length,
                          int width)
Description copied from interface: WaveForm
Tells if this WaveForm sees itself capable of providing a SubWaveForm with the given parameters

Specified by:
canProvide in interface WaveForm
Overrides:
canProvide in class AbstractWaveForm
Parameters:
begin - The offset to the beginning of this WaveForm. May also be negative.
length - The length in steps of this WaveForm that should be represented by the returned WaveForm.
width - The new width in which the part should be displayed.
Returns:
true if this WaveForm can provide the wanted subWaveForm, false otherwise
See Also:
WaveForm.canProvide(int, int, int)

getAdditionalToString

protected java.lang.String getAdditionalToString()
Description copied from class: AbstractWaveForm
Get an additional String describing this WaveForm. Will be used in toString()

Overrides:
getAdditionalToString in class AbstractWaveForm
Returns:
An optional String describing special characteristics of this WaveForm

getMax

public byte getMax(int channel)
Description copied from interface: WaveForm
Get the maximum value at the current read position in the given channel

Parameters:
channel - the zero-based index of the channel
Returns:
the maximum value at this position as byte

getMin

public byte getMin(int channel)
Description copied from interface: WaveForm
Get the minimum value at the current read position in the given channel

Parameters:
channel - the zero-based index of the channel
Returns:
the minimum value at this position as byte

getRealLength

public int getRealLength()
Description copied from interface: WaveForm
Get the Length of the original sample which this WaveForm represents

Specified by:
getRealLength in interface WaveForm
Overrides:
getRealLength in class AbstractWaveForm
Returns:
The length of the original sample in sample frames.
See Also:
WaveForm.getRealLength()

subWaveForm

public WaveForm subWaveForm(int begin,
                            int length,
                            int width)
Description copied from interface: WaveForm
Get a WaveForm Object that represents the part of this WaveForm specified by begin and length and displays this part in the specified width

Specified by:
subWaveForm in interface WaveForm
Overrides:
subWaveForm in class AbstractWaveForm
Parameters:
begin - The offset to the beginning of this WaveForm. May also be negative.
length - The length in steps of this WaveForm that should be represented by the returned WaveForm.
width - The new width in which the part should be displayed.
Returns:
A WaveForm Object that represents the specified Part of this WaveForm and displays it in the given width. Can also be the same Object with adapted attributes
See Also:
WaveForm.subWaveForm(int, int, int)