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

QwavMonoWaveView Class Reference

#include <qwavmonowaveview.h>

Inheritance diagram for QwavMonoWaveView:

Inheritance graph
[legend]
Collaboration diagram for QwavMonoWaveView:

Collaboration graph
[legend]
List of all members.

Public Slots

void activatePeakLayer (bool)
void activateAverageLayer (bool)
void activateZeroLineLayer (bool)
Customization
void setBgColor (const QColor &c)
const QColor & bgColor (void) const
void setPeakColor (const QColor &c)
const QColor & peakColor (void) const
void setAvgColor (const QColor &c)
const QColor & avgColor (void) const
Samples and pixels
void setSamplesVisible (const long &newVal)
void setZoomFac (double zoomFac)
void setZoomYFac (double zoomYFac)
void setFirstSample (ulong sample)
void setChannel (uint channel=1)
uint channel (void) const
void scrollBy (int pixel)

Signals

void selBeginChanged (long sample)
void selEndChanged (long sample)
void zoomFacChanged (double fac)
void positionChanged (ulong sample)
void firstSampleChanged (ulong sample)

Public Methods

const State & state (void) const
Constructor & Destructor
 QwavMonoWaveView (QwavWaveDataInterface *waveData, QWidget *parent, const char *name=0, int wflags=0)
 QwavMonoWaveView (const string &filename, QWidget *parent, const char *name=0) throw (InvalidNrOfChannels, FileOpenError, FileReadError)
virtual ~QwavMonoWaveView ()
Document / View
virtual void update (QwavMonoWaveView *pSender)
Layer
int addLayer (QwavViewLayer *layer)
QwavViewLayer * getLayer (const string &name)
QwavViewLayer * getLayer (uint index)
uint getNrOfLayers (void) const
QPixmap * getBackbuf (void)
Samples and pixels
int sample2Pixel (long sample) const
long pixel2Sample (int pixel) const
bool isSampleVisible (long sample) const
const int nrOfPixels (void) const
double zoomFac (void) const
double zoomYFac (void) const
double maxZoomFac (void) const
const ulong firstSample (void) const
const long lastSample (void) const
const long samplesVisible (void) const
void setPeakInterpolator (QwavPeakInterpolator *s)
QwavPeakInterpolator * peakInterpolator () const
Position
void setPosition (const ulong sample)
const ulong & position () const
Selection
uint addSelection (const QwavSelection &s)
uint getNrOfSelections (void) const
const QwavSelection & getSelection (uint index=0) const
QwavSelection & getSelection (uint index=0)
int isSelectionBegin (int pixel)
int isSelectionEnd (int pixel)
int activeSelection (void) const
void clearSelections (void)

Protected Slots

void onZoomFacChanged (double)
void onZoomFacInQwavWaveViewChanged (double)
void onZoomFacEntered ()
void onPeakColor ()
void onBgColor ()
void onHScrollBarChanged (int)
void onSelChanged (long)
void onFirstSampleChanged (ulong)

Protected Methods

virtual void resizeEvent (QResizeEvent *e)
void updateHorScrollBar ()

Detailed Description

Author:
Peter Eschler
Frames the aggregated SoneView with some additional widgets.


Constructor & Destructor Documentation

Qwav_BEGIN_NAMESPACE QwavMonoWaveView::QwavMonoWaveView (  QwavWaveDataInterface *    waveData,
QWidget *    parent,
const char *    name = 0,
int    wflags = 0
) 
 

Constructor.

Used to construct a view on the waveform in the soundfile file. The view is constructed as parent's child and can be given a name.

Parameters:
file  filename of the waveform to display
parent  the parent widget.
name  optional name for the widget
wflags  widget style flags

QwavMonoWaveView::QwavMonoWaveView (  const string &    file,
QWidget *    parent,
const char *    name = 0
)  throw (InvalidNrOfChannels, FileOpenError, FileReadError)
 

Constructor.

Used to construct a view on the waveform in the soundfile file. The view is constructed as parent's child and can be given a name.

Parameters:
file  filename of the waveform to display
parent  the parent widget.
name  optional name for the widget
Exceptions:
InvalidNrOfChannels  the sound in file is not a mono sound (nr of channels > 1)

QwavMonoWaveView::~QwavMonoWaveView (    )  [virtual]
 

Destructor.


Member Function Documentation

void QwavMonoWaveView::activateZeroLineLayer (  bool    b )  [slot]
 

Activates the layer that paints the zero and two helper lines.

Parameters:
b  true to turn the layer on, false to turn it off

int QwavMonoWaveView::activeSelection (  void    )  const [inline, 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

Implements QwavWaveViewInterface.

int QwavMonoWaveView::addLayer (  QwavViewLayer *    layer )  [inline, 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

Implements QwavWaveViewInterface.

uint QwavMonoWaveView::addSelection (  const QwavSelection &    s )  [inline, 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

Implements QwavWaveViewInterface.

const QColor & QwavMonoWaveView::avgColor (  void    )  const [inline, virtual, slot]
 

Returns the average color of this view.

Returns:
the actual average color
See also:
setAvgColor

Implements QwavWaveViewInterface.

const QColor & QwavMonoWaveView::bgColor (  void    )  const [inline, virtual, slot]
 

Returns the background color of this view.

Returns:
the actual background color
See also:
setBgColor

Implements QwavWaveViewInterface.

void QwavMonoWaveView::clearSelections (  void    )  [inline, virtual]
 

Clears the selection vector and repaints the view.

Implements QwavWaveViewInterface.

const ulong QwavMonoWaveView::firstSample (  void    )  const [inline, virtual]
 

Returns the first visible sample in this view.

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

Implements QwavWaveViewInterface.

void QwavMonoWaveView::firstSampleChanged (  ulong    sample )  [virtual, signal]
 

Is emitted when the first visible sample has changed.

Implements QwavWaveViewInterface.

QPixmap * QwavMonoWaveView::getBackbuf (  void    )  [inline, virtual]
 

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

Returns:
pointer to the pixmap

Implements QwavWaveViewInterface.

QwavViewLayer * QwavMonoWaveView::getLayer (  uint    index )  [inline, 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

Implements QwavWaveViewInterface.

QwavViewLayer * QwavMonoWaveView::getLayer (  const string &    name )  [inline, 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

Implements QwavWaveViewInterface.

uint QwavMonoWaveView::getNrOfLayers (  void    )  const [inline, virtual]
 

Returns the number of layers currently used.

Returns:
the number of layers

Implements QwavWaveViewInterface.

uint QwavMonoWaveView::getNrOfSelections (  void    )  const [inline, virtual]
 

Returns the number of selections.

Returns:
the number of selections

Implements QwavWaveViewInterface.

QwavSelection & QwavMonoWaveView::getSelection (  uint    index = 0 )  [inline, 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

Implements QwavWaveViewInterface.

const QwavSelection & QwavMonoWaveView::getSelection (  uint    index = 0 )  const [inline, 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

Implements QwavWaveViewInterface.

bool QwavMonoWaveView::isSampleVisible (  long    sample )  const [inline, 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

Implements QwavWaveViewInterface.

int QwavMonoWaveView::isSelectionBegin (  int    pixel )  [inline, 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

Implements QwavWaveViewInterface.

int QwavMonoWaveView::isSelectionEnd (  int    pixel )  [inline, 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

Implements QwavWaveViewInterface.

const long QwavMonoWaveView::lastSample (  void    )  const [inline, virtual]
 

Returns the first visible sample in this view.

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

Implements QwavWaveViewInterface.

double QwavMonoWaveView::maxZoomFac (  void    )  const [inline, virtual]
 

Returns the maximum zoom factor.

Parameters:
the  maximum zoom factor

Implements QwavWaveViewInterface.

const int QwavMonoWaveView::nrOfPixels (  void    )  const [inline, 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

Implements QwavWaveViewInterface.

void QwavMonoWaveView::onBgColor (    )  [protected, slot]
 

This slot is called when the background button was clicked.

const QColor & QwavMonoWaveView::peakColor (  void    )  const [inline, virtual, slot]
 

Returns the peak color of this view.

Returns:
the actual peak color
See also:
setPeakColor

Implements QwavWaveViewInterface.

QwavPeakInterpolator * QwavMonoWaveView::peakInterpolator (    )  const [inline, virtual]
 

Returns the peak interpolator used.

Returns:
the QwavPeakInterpolator used

Implements QwavWaveViewInterface.

long QwavMonoWaveView::pixel2Sample (  int    pixel )  const [inline, 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

Implements QwavWaveViewInterface.

const ulong & QwavMonoWaveView::position (    )  const [inline, virtual]
 

Returns the current position of the position marker.

Returns:
the current position

Implements QwavWaveViewInterface.

void QwavMonoWaveView::positionChanged (  ulong    sample )  [virtual, signal]
 

Is emitted when the current position has changed.

Implements QwavWaveViewInterface.

int QwavMonoWaveView::sample2Pixel (  long    sample )  const [inline, 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

Implements QwavWaveViewInterface.

const long QwavMonoWaveView::samplesVisible (  void    )  const [inline, virtual]
 

Returns the number of samples visible in this view.

Returns:
the number of visible samples

Implements QwavWaveViewInterface.

void QwavMonoWaveView::selBeginChanged (  long    sample )  [virtual, signal]
 

Is emitted when the selection begin has changed.

Implements QwavWaveViewInterface.

void QwavMonoWaveView::selEndChanged (  long    sample )  [virtual, signal]
 

Is emitted when the selection end has changed.

Implements QwavWaveViewInterface.

void QwavMonoWaveView::setAvgColor (  const QColor &    c )  [inline, virtual, slot]
 

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

Parameters:
c  the new average color
See also:
averageColor

Implements QwavWaveViewInterface.

void QwavMonoWaveView::setBgColor (  const QColor &    c )  [inline, virtual, slot]
 

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

Parameters:
c  the new background color
See also:
bgColor

Implements QwavWaveViewInterface.

void QwavMonoWaveView::setFirstSample (  ulong    sample )  [inline, virtual, slot]
 

Sets the first visible sample to be sample.

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

Implements QwavWaveViewInterface.

void QwavMonoWaveView::setPeakColor (  const QColor &    c )  [inline, virtual, slot]
 

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

Parameters:
c  the new peak color
See also:
peakColor

Implements QwavWaveViewInterface.

void QwavMonoWaveView::setPosition (  const ulong    sample )  [inline, virtual]
 

Sets the position of the position marker to sample.

Parameters:
sample  the new position

Implements QwavWaveViewInterface.

void QwavMonoWaveView::setZoomFac (  double    zoomFac )  [inline, virtual, slot]
 

Sets the zoom factor of this view.

Parameters:
zoomFac  the zoom factor to set

Implements QwavWaveViewInterface.

void QwavMonoWaveView::setZoomYFac (  double    zoomYFac )  [inline, virtual, slot]
 

Sets the vertical zoom factor of this view.

Parameters:
zoomYFac  the vertical zoom factor

Implements QwavWaveViewInterface.

const QwavWaveViewInterface::State & QwavMonoWaveView::state (  void    )  const [inline, virtual]
 

Returns the state of this view.

Returns:
the state
See also:
State

Implements QwavWaveViewInterface.

void QwavMonoWaveView::update (  QwavMonoWaveView *    pSender )  [virtual]
 

gets called to redraw the document contents if it has been modified

double QwavMonoWaveView::zoomFac (  void    )  const [inline, 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

Implements QwavWaveViewInterface.

void QwavMonoWaveView::zoomFacChanged (  double    fac )  [virtual, signal]
 

Is emitted when the zoom factor has changed.

Implements QwavWaveViewInterface.

double QwavMonoWaveView::zoomYFac (  void    )  const [inline, virtual]
 

Return the vertical zoom factor of this view.

Returns:
the vertical zoom factor

Implements QwavWaveViewInterface.


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