Main Page   Modules   Class Hierarchy   Alphabetical List   Compound List   File List   Compound Members   Related Pages  

QwavWaveViewInterface Class Reference

Interface for widgets that display waveform data graphically. More...

#include <qwavwaveviewinterface.h>

Inheritance diagram for QwavWaveViewInterface:

Inheritance graph
[legend]
Collaboration diagram for QwavWaveViewInterface:

Collaboration graph
[legend]
List of all members.

Public Types

enum  State { NORMAL, MOVING_SEL_BEGIN, MOVING_SEL_END, MOVING_MARKER }

Public Methods

virtual const State & state (void) const=0
Layer
virtual int addLayer (QwavViewLayer *layer)=0
virtual QwavViewLayergetLayer (const string &name)=0
virtual QwavViewLayergetLayer (uint index)=0
virtual uint getNrOfLayers (void) const=0
virtual QPixmap * getBackbuf (void)=0
Samples and pixels
virtual int sample2Pixel (long sample) const=0
virtual long pixel2Sample (int pixel) const=0
virtual bool isSampleVisible (long sample) const=0
const long nrOfSamples (void) const
virtual const int nrOfPixels (void) const=0
virtual double zoomFac (void) const=0
virtual double zoomYFac (void) const=0
virtual double maxZoomFac (void) const=0
virtual const unsigned long firstSample (void) const=0
virtual const long lastSample (void) const=0
virtual const long samplesVisible (void) const=0
QwavWaveDataInterfacewaveData (void) const
void setWaveData (QwavWaveDataInterface *wd)
virtual void setPeakInterpolator (QwavPeakInterpolator *s)=0
virtual QwavPeakInterpolatorpeakInterpolator () const=0
void setBorderDist (uint topBorder, uint bottomBorder)
const uint & topBorderDist () const
const uint & bottomBorderDist () const
Position
virtual void setPosition (const ulong sample)=0
virtual const ulong & position () const=0
Selection
virtual uint addSelection (const QwavSelection &s)=0
virtual uint getNrOfSelections (void) const=0
virtual const QwavSelectiongetSelection (uint index=0) const=0
virtual QwavSelectiongetSelection (uint index=0)=0
virtual int isSelectionBegin (int pixel)=0
virtual int isSelectionEnd (int pixel)=0
virtual int activeSelection (void) const=0
virtual void clearSelections (void)=0
Signals
virtual void selBeginChanged (long sample)=0
virtual void selEndChanged (long sample)=0
virtual void zoomFacChanged (double fac)=0
virtual void positionChanged (ulong sample)=0
virtual void firstSampleChanged (ulong sample)=0
Customization
virtual void setBgColor (const QColor &c)=0
virtual const QColor & bgColor (void) const=0
virtual void setPeakColor (const QColor &c)=0
virtual const QColor & peakColor (void) const=0
virtual void setAvgColor (const QColor &c)=0
virtual const QColor & avgColor (void) const=0
Samples and pixels
virtual void setSamplesVisible (const long &newVal)=0
virtual void setZoomFac (double zoomFac)=0
virtual void setZoomYFac (double zoomYFac)=0
virtual void setFirstSample (ulong sample)=0
virtual void setChannel (uint channel=1)=0
virtual uint channel (void) const=0
virtual void scrollBy (int pixel)=0

Protected Methods

 QwavWaveViewInterface ()
 QwavWaveViewInterface (QwavWaveDataInterface *wd)

Friends

class QwavMonoWaveView
class QwavStereoWaveView

Detailed Description

Interface for widgets that display waveform data graphically.

Author:
Peter Eschler

nrOfSamples() is the number of samples per channel (stereo sounds are not supported for now, mono only)

nrOfPixels() is the number of available pixels, which simply is the width() of this wave view widget.

samplesVisible() is used to set the number of samples to be visible in the view (which is nrOfPixels() wide).

zoomFac() is the quotient samplesVisible/nrOfPixels and thus depends on samplesVisible()

firstSample() specifies the first visible sample. It can be set by setFirstSample() and is used to implement scrolling.

Layers

A QwavWaveView consists of several layers. The layers are used to paint things like the background, some helper lines and of course the waveform data itself.

A QwavWaveView automatically contains some standard layers (otherwise nothing would be painted). The five standard layers are:

These layers can be accessed by their name via getLayer(). The name is simply the classname of the layer (e.g. "QwavPeakDataLayer"). Alternatively a layer can be accessed via it's index using getLayer() and the index obtained by calling addLayer().


Member Function Documentation

virtual int QwavWaveViewInterface::activeSelection void    const [pure virtual]
 

Returns the index of the active selection or -1 of no active selection. The returned index can be just with getQwavSelection() to obtain the active selection.

Returns:
index to the active selection

Implemented in QwavMonoWaveView, QwavStereoWaveView, and QwavWaveView.

virtual int QwavWaveViewInterface::addLayer QwavViewLayer   layer [pure virtual]
 

Adds a layer to this view.

If there is no layer of layer's type present, layer is added and it's index returned.

If a layer with the same type as layer is already present (the type is determined by layer->getName()), layer is not added and -1 is returned.

Parameters:
layer  the layer to add
Returns:
index of the added layer, or -1 if layer was not added
See also:
getLayer

Implemented in QwavMonoWaveView, QwavStereoWaveView, and QwavWaveView.

virtual uint QwavWaveViewInterface::addSelection const QwavSelection   s [pure virtual]
 

Adds the selection s to the selection vector. For now only single selection is implemented. The selection s is added as a deep copy.

Parameters:
s  the selection to add
Returns:
the index of s in the selection vector

Implemented in QwavMonoWaveView, QwavStereoWaveView, and QwavWaveView.

virtual const QColor& QwavWaveViewInterface::avgColor void    const [pure virtual]
 

Returns the average color of this view.

Returns:
the actual average color
See also:
setAvgColor

Implemented in QwavMonoWaveView, QwavStereoWaveView, and QwavWaveView.

virtual const QColor& QwavWaveViewInterface::bgColor void    const [pure virtual]
 

Returns the background color of this view.

Returns:
the actual background color
See also:
setBgColor

Implemented in QwavMonoWaveView, QwavStereoWaveView, and QwavWaveView.

virtual void QwavWaveViewInterface::clearSelections void    [pure virtual]
 

Clears the selection vector and repaints the view.

Implemented in QwavMonoWaveView, QwavStereoWaveView, and QwavWaveView.

virtual const unsigned long QwavWaveViewInterface::firstSample void    const [pure virtual]
 

Returns the first visible sample in this view.

Returns:
the first visible sample [0,nrOfSamples()]

Implemented in QwavMonoWaveView, QwavStereoWaveView, and QwavWaveView.

virtual void QwavWaveViewInterface::firstSampleChanged ulong    sample [pure virtual]
 

Is emitted when the first visible sample has changed.

Implemented in QwavMonoWaveView, QwavStereoWaveView, and QwavWaveView.

virtual QPixmap* QwavWaveViewInterface::getBackbuf void    [pure virtual]
 

Returns a pointer to the backbuffer QPixmap which is used for flicker-free drawing.

Returns:
pointer to the pixmap

Implemented in QwavMonoWaveView, QwavStereoWaveView, and QwavWaveView.

virtual QwavViewLayer* QwavWaveViewInterface::getLayer uint    index [pure virtual]
 

Returns the view layer with the specified index.

Parameters:
index  index of the layer
Returns:
the QwavViewLayer with that index, or 0 if no layer with that index

Implemented in QwavMonoWaveView, QwavStereoWaveView, and QwavWaveView.

virtual QwavViewLayer* QwavWaveViewInterface::getLayer const string &    name [pure virtual]
 

Returns a pointer to the layer name if present, otherwise 0 is returned.

Parameters:
name  the name of the layer
Returns:
pointer to the layer

Implemented in QwavMonoWaveView, QwavStereoWaveView, and QwavWaveView.

virtual uint QwavWaveViewInterface::getNrOfLayers void    const [pure virtual]
 

Returns the number of layers currently used.

Returns:
the number of layers

Implemented in QwavMonoWaveView, QwavStereoWaveView, and QwavWaveView.

virtual uint QwavWaveViewInterface::getNrOfSelections void    const [pure virtual]
 

Returns the number of selections.

Returns:
the number of selections

Implemented in QwavMonoWaveView, QwavStereoWaveView, and QwavWaveView.

virtual QwavSelection& QwavWaveViewInterface::getSelection uint    index = 0 [pure virtual]
 

Returns a reference to the selection with the given index. If no selection with index exists, Selection::NullSelection is returned.

Parameters:
index  the selection to get
Returns:
the selection at index, or Selection::NullSelection

Implemented in QwavMonoWaveView, QwavStereoWaveView, and QwavWaveView.

virtual const QwavSelection& QwavWaveViewInterface::getSelection uint    index = 0 const [pure virtual]
 

Returns a reference to the selection with the given index. If no selection with index exists, Selection::NullSelection is returned.

Parameters:
index  the selection to get
Returns:
the selection at index, or Selection::NullSelection

Implemented in QwavMonoWaveView, QwavStereoWaveView, and QwavWaveView.

virtual bool QwavWaveViewInterface::isSampleVisible long    sample const [pure virtual]
 

Checks if sample is visible in this view. If sample is visible true is returned, otherwise false.

Parameters:
sample  the sample to check
Returns:
true if true
false if not

Implemented in QwavMonoWaveView, QwavStereoWaveView, and QwavWaveView.

virtual int QwavWaveViewInterface::isSelectionBegin int    pixel [pure virtual]
 

If pixel is the begin of an available selection, the index of that selection is returned. If pixel is not the begin of any selection -1 is returned.

Parameters:
pixel  the pixel to test
Returns:
index of the selection or -1

Implemented in QwavMonoWaveView, QwavStereoWaveView, and QwavWaveView.

virtual int QwavWaveViewInterface::isSelectionEnd int    pixel [pure virtual]
 

If pixel is the end of an available selection, the index of that selection is returned. If pixel is not the end of any selection -1 is returned.

Parameters:
pixel  the pixel to test
Returns:
index of the selection or -1

Implemented in QwavMonoWaveView, QwavStereoWaveView, and QwavWaveView.

virtual const long QwavWaveViewInterface::lastSample void    const [pure virtual]
 

Returns the first visible sample in this view.

Returns:
the first visible sample [0,nrOfSamples()]

Implemented in QwavMonoWaveView, QwavStereoWaveView, and QwavWaveView.

virtual double QwavWaveViewInterface::maxZoomFac void    const [pure virtual]
 

Returns the maximum zoom factor.

Parameters:
the  maximum zoom factor

Implemented in QwavMonoWaveView, QwavStereoWaveView, and QwavWaveView.

virtual const int QwavWaveViewInterface::nrOfPixels void    const [pure virtual]
 

Returns the number of pixels available. The number of pixel is equal to the width of this widget.

Returns:
the numer of pixels available

Implemented in QwavMonoWaveView, QwavStereoWaveView, and QwavWaveView.

const long QwavWaveViewInterface::nrOfSamples void    const [inline]
 

Returns the number of samples of the waveform displayed by this view. This is a convenient function that calls

getDocument()->getWave()->getNrOfSamples();
.
Returns:
the number of samples

virtual const QColor& QwavWaveViewInterface::peakColor void    const [pure virtual]
 

Returns the peak color of this view.

Returns:
the actual peak color
See also:
setPeakColor

Implemented in QwavMonoWaveView, QwavStereoWaveView, and QwavWaveView.

virtual QwavPeakInterpolator* QwavWaveViewInterface::peakInterpolator   const [pure virtual]
 

Returns the peak interpolator used.

Returns:
the QwavPeakInterpolator used

Implemented in QwavMonoWaveView, QwavStereoWaveView, and QwavWaveView.

virtual long QwavWaveViewInterface::pixel2Sample int    pixel const [pure virtual]
 

Converts pixel from pixel-space to sample-space. pixel is not bounds checked to allow negative pixel's for some drawing calculations.

The returned position in sample-space is possibly lesser than zero or greater than the number of samples in the waveform.

Parameters:
pixel  the pixel to convert
Returns:
pixel in sample-space

Implemented in QwavMonoWaveView, QwavStereoWaveView, and QwavWaveView.

virtual const ulong& QwavWaveViewInterface::position   const [pure virtual]
 

Returns the current position of the position marker.

Returns:
the current position

Implemented in QwavMonoWaveView, QwavStereoWaveView, and QwavWaveView.

virtual void QwavWaveViewInterface::positionChanged ulong    sample [pure virtual]
 

Is emitted when the current position has changed.

Implemented in QwavMonoWaveView, QwavStereoWaveView, and QwavWaveView.

virtual int QwavWaveViewInterface::sample2Pixel long    sample const [pure virtual]
 

Converts sample from sample-space to pixel-space. sample is not bounds checked to allow negative sample's for some drawing calculations.

The returned position in pixel-space is possibly lesser than zero or greater than the width of the widget.

Parameters:
sample  the sample to convert
Returns:
sample in pixel-space

Implemented in QwavMonoWaveView, QwavStereoWaveView, and QwavWaveView.

virtual const long QwavWaveViewInterface::samplesVisible void    const [pure virtual]
 

Returns the number of samples visible in this view.

Returns:
the number of visible samples

Implemented in QwavMonoWaveView, QwavStereoWaveView, and QwavWaveView.

virtual void QwavWaveViewInterface::selBeginChanged long    sample [pure virtual]
 

Is emitted when the selection begin has changed.

Implemented in QwavMonoWaveView, QwavStereoWaveView, and QwavWaveView.

virtual void QwavWaveViewInterface::selEndChanged long    sample [pure virtual]
 

Is emitted when the selection end has changed.

Implemented in QwavMonoWaveView, QwavStereoWaveView, and QwavWaveView.

virtual void QwavWaveViewInterface::setAvgColor const QColor &    c [pure virtual]
 

Sets the average color of this view to the color c.

Parameters:
c  the new average color
See also:
averageColor

Implemented in QwavMonoWaveView, QwavStereoWaveView, and QwavWaveView.

virtual void QwavWaveViewInterface::setBgColor const QColor &    c [pure virtual]
 

Sets the background color of this view to the color c.

Parameters:
c  the new background color
See also:
bgColor

Implemented in QwavMonoWaveView, QwavStereoWaveView, and QwavWaveView.

virtual void QwavWaveViewInterface::setFirstSample ulong    sample [pure virtual]
 

Sets the first visible sample to be sample.

Parameters:
sample  the sample to make the first one visible
Todo:
should this check sample < nrOfSamples

Implemented in QwavMonoWaveView, QwavStereoWaveView, and QwavWaveView.

virtual void QwavWaveViewInterface::setPeakColor const QColor &    c [pure virtual]
 

Sets the peak color of this view to the color c.

Parameters:
c  the new peak color
See also:
peakColor

Implemented in QwavMonoWaveView, QwavStereoWaveView, and QwavWaveView.

virtual void QwavWaveViewInterface::setPosition const ulong    sample [pure virtual]
 

Sets the position of the position marker to sample.

Parameters:
sample  the new position

Implemented in QwavMonoWaveView, QwavStereoWaveView, and QwavWaveView.

void QwavWaveViewInterface::setWaveData QwavWaveDataInterface   wd [inline]
 

Sets the wave data.

Parameters:
wd  the wave data

virtual void QwavWaveViewInterface::setZoomFac double    zoomFac [pure virtual]
 

Sets the zoom factor of this view.

Parameters:
zoomFac  the zoom factor to set

Implemented in QwavMonoWaveView, QwavStereoWaveView, and QwavWaveView.

virtual void QwavWaveViewInterface::setZoomYFac double    zoomYFac [pure virtual]
 

Sets the vertical zoom factor of this view.

Parameters:
zoomYFac  the vertical zoom factor

Implemented in QwavMonoWaveView, QwavStereoWaveView, and QwavWaveView.

virtual const State& QwavWaveViewInterface::state void    const [pure virtual]
 

Returns the state of this view.

Returns:
the state
See also:
State

Implemented in QwavMonoWaveView, QwavStereoWaveView, and QwavWaveView.

QwavWaveDataInterface * QwavWaveViewInterface::waveData void    const [inline]
 

Returns a pointer to the wave data.

Returns:
pointer to the wave data

virtual double QwavWaveViewInterface::zoomFac void    const [pure virtual]
 

Returns the zoom factor of this view. The zoom factor is the quotient
visibleSamples() / width()

The zoom factor is measured in samples per pixel. It tells how much samples are visualised by one pixel. Thus if zoom is 1.0 you get a 1:1 visualization (one sample=one pixel).

To zoom out from the waveform use zoom values greater than 1. The maximum value for zoom is limited to the double of the number of samples.

See also:
samplesVisible
Returns:
the zoom factor

Implemented in QwavMonoWaveView, QwavStereoWaveView, and QwavWaveView.

virtual void QwavWaveViewInterface::zoomFacChanged double    fac [pure virtual]
 

Is emitted when the zoom factor has changed.

Implemented in QwavMonoWaveView, QwavStereoWaveView, and QwavWaveView.

virtual double QwavWaveViewInterface::zoomYFac void    const [pure virtual]
 

Return the vertical zoom factor of this view.

Returns:
the vertical zoom factor

Implemented in QwavMonoWaveView, QwavStereoWaveView, and QwavWaveView.


The documentation for this class was generated from the following file:
Generated on Mon Jan 20 00:24:57 2003 for Qwav by doxygen1.2.16