ASPiK SDK
VSTGUI::WaveView Class Reference

This object displays an audio histogram waveform view.
. More...

#include <customviews.h>

Inheritance diagram for VSTGUI::WaveView:
ICustomView ICustomView

Public Member Functions

 WaveView (const CRect &size, IControlListener *listener, int32_t tag)
 
virtual void updateView () override
 
virtual void pushDataValue (double data) override
 
void addWaveDataPoint (float fSample)
 
void clearBuffer ()
 
void showXAxis (bool _paintXAxis)
 
void draw (CDrawContext *pContext) override
 
 WaveView (const CRect &size, IControlListener *listener, int32_t tag)
 
virtual void updateView () override
 
virtual void pushDataValue (double data) override
 
void addWaveDataPoint (float fSample)
 
void clearBuffer ()
 
void showXAxis (bool _paintXAxis)
 
void draw (CDrawContext *pContext) override
 
- Public Member Functions inherited from ICustomView
virtual void sendMessage (void *data)
 
virtual void sendMessage (void *data)
 

Protected Attributes

bool paintXAxis = true
 flag for painting X Axis
 
double * circularBuffer = nullptr
 circular buffer to store peak values
 
int writeIndex = 0
 circular buffer write location
 
int readIndex = 0
 circular buffer read location
 
int circularBufferLength = 0
 circular buffer length
 
CRect currentRect
 the rect to draw into
 

Detailed Description

This object displays an audio histogram waveform view.
.

WaveView:

  • uses a lock-free ring buffer for queueing up input data from the plugin
  • implements ICustomView::pushDataValue() and ICustomView::updateView()
  • the updateData() function finds the largest value that was pushed into the data queue and adds that to the waveform buffer (circular)
  • uses a circular buffer to make waveform appear to scroll
  • each new input point pushes oldest sample out of the buffer
Author
Will Pirkle http://www.willpirkle.com
Remarks
This object is included in Designing Audio Effects Plugins in C++ 2nd Ed. by Will Pirkle
Version
Revision : 1.0
Date
Date : 2018 / 09 / 7

Member Function Documentation

◆ addWaveDataPoint() [1/2]

void VSTGUI::WaveView::addWaveDataPoint ( float  fSample)

add a new point to the circular buffer for painting

Parameters
fSamplethe absolute value of the sample

◆ addWaveDataPoint() [2/2]

void VSTGUI::WaveView::addWaveDataPoint ( float  fSample)

add a new point to the circular buffer for painting

Parameters
fSamplethe absolute value of the sample

◆ clearBuffer() [1/2]

void VSTGUI::WaveView::clearBuffer ( )

reset the circular buffer for a new run

◆ clearBuffer() [2/2]

void VSTGUI::WaveView::clearBuffer ( )

reset the circular buffer for a new run

◆ draw() [1/2]

void VSTGUI::WaveView::draw ( CDrawContext *  pContext)
override

override of drawing function

Parameters
pContextincoming draw context

◆ draw() [2/2]

void VSTGUI::WaveView::draw ( CDrawContext *  pContext)
override

override of drawing function

Parameters
pContextincoming draw context

◆ pushDataValue() [1/2]

virtual void VSTGUI::WaveView::pushDataValue ( double  data)
overridevirtual

ICustomView method: push a new audio sample into the ring buffer

Reimplemented from ICustomView.

◆ pushDataValue() [2/2]

void VSTGUI::WaveView::pushDataValue ( double  data)
overridevirtual

ICustomView method: push a new audio sample into the ring buffer

Reimplemented from ICustomView.

◆ showXAxis() [1/2]

void VSTGUI::WaveView::showXAxis ( bool  _paintXAxis)
inline

toggles showng of x axis

Parameters
_paintXAxisenable/disable functionality

◆ showXAxis() [2/2]

void VSTGUI::WaveView::showXAxis ( bool  _paintXAxis)
inline

toggles showng of x axis

Parameters
_paintXAxisenable/disable functionality

◆ updateView() [1/2]

virtual void VSTGUI::WaveView::updateView ( )
overridevirtual

ICustomView method: this repaints the control

Implements ICustomView.

◆ updateView() [2/2]

void VSTGUI::WaveView::updateView ( )
overridevirtual

ICustomView method: this repaints the control

Implements ICustomView.


The documentation for this class was generated from the following files: