Gin
Loading...
Searching...
No Matches
Public Types | Public Member Functions | List of all members
WaveformComponent Class Reference

Visual component for displaying audio waveforms with zoom and scroll. More...

#include <gin_waveformcomponent.h>

Inherits juce::Component.

Public Types

enum  ColourIds { lineColourId = 0x1231e10 , backgroundColourId = 0x1231e11 , traceColourId = 0x1231e12 , envelopeColourId = 0x1231f13 }
 

Public Member Functions

 WaveformComponent ()
 
 ~WaveformComponent () override
 Destructor.
 
void setHorizontalZoom (float zoom)
 
void setHorizontalOffset (float offset)
 
void setBuffer (juce::AudioSampleBuffer &buffer)
 
void paint (juce::Graphics &g) override
 
void resized () override
 

Detailed Description

Visual component for displaying audio waveforms with zoom and scroll.

WaveformComponent renders multi-channel audio waveforms with support for horizontal zooming and panning. It efficiently displays large audio buffers by downsampling to min/max envelopes at the current zoom level, providing smooth visualization even for long audio files.

Key Features:

Color Customization:

The component automatically processes the audio buffer into min/max pairs for efficient rendering at any zoom level, avoiding the need to draw individual samples when zoomed out.

Usage:

waveform.setBounds(0, 0, 800, 200);
// Set audio to display
AudioBuffer<float> audioData(2, 44100); // 2 channels, 1 second
// ... fill with audio data ...
waveform.setBuffer(audioData);
// Customize colors
// Zoom and scroll
waveform.setHorizontalZoom(2.0f); // 2x zoom
waveform.setHorizontalOffset(0.25f); // Start at 25% through buffer
A lightweight 2D point class for projects that don't use juce_graphics.
Definition gin_point.h:25
Point()=default
Creates a point at the origin (0, 0).
Visual component for displaying audio waveforms with zoom and scroll.
Definition gin_waveformcomponent.h:57
@ envelopeColourId
Definition gin_waveformcomponent.h:69
@ traceColourId
Definition gin_waveformcomponent.h:68
See also
juce::AudioSampleBuffer, juce::Component

Member Enumeration Documentation

◆ ColourIds

Enumerator
lineColourId 
backgroundColourId 
traceColourId 
envelopeColourId 

Constructor & Destructor Documentation

◆ WaveformComponent()

WaveformComponent::WaveformComponent ( )

◆ ~WaveformComponent()

WaveformComponent::~WaveformComponent ( )
override

Destructor.

Member Function Documentation

◆ setHorizontalZoom()

void WaveformComponent::setHorizontalZoom ( float  zoom)

◆ setHorizontalOffset()

void WaveformComponent::setHorizontalOffset ( float  offset)

◆ setBuffer()

void WaveformComponent::setBuffer ( juce::AudioSampleBuffer &  buffer)

◆ paint()

void WaveformComponent::paint ( juce::Graphics &  g)
override

◆ resized()

void WaveformComponent::resized ( )
override

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