ASPiK SDK
Loading...
Searching...
No Matches
VSTGUI::WaveView Class Reference

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

#include <customviews.h>

Inheritance diagram for VSTGUI::WaveView:
ICustomView

Public Member Functions

 WaveView (const CRect &size, IControlListener *listener, int32_t tag)
 WaveView constructor.
 
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 updateView ()=0
 
virtual void pushDataValue (double 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

Constructor & Destructor Documentation

◆ WaveView()

VSTGUI::WaveView::WaveView ( const CRect &  size,
IControlListener *  listener,
int32_t  tag 
)

WaveView constructor.

Parameters
size- the control rectangle
listener- the control's listener (usuall PluginGUI object)
tag- the control ID value

Member Function Documentation

◆ addWaveDataPoint()

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

add a new point to the circular buffer for painting

Parameters
fSamplethe absolute value of the sample

◆ clearBuffer()

void VSTGUI::WaveView::clearBuffer ( )

reset the circular buffer for a new run

◆ draw()

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

override of drawing function

Parameters
pContextincoming draw context

◆ pushDataValue()

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

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

Reimplemented from ICustomView.

◆ showXAxis()

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

toggles showng of x axis

Parameters
_paintXAxisenable/disable functionality

◆ updateView()

void VSTGUI::WaveView::updateView ( )
overridevirtual

ICustomView method: this repaints the control

Implements ICustomView.


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