All Classes Namespaces Functions Variables Enumerations Enumerator Modules Pages
Public Member Functions | List of all members
AudioDisplayComponent::SampleArea Class Reference

Inherits Component.

Public Member Functions

 SampleArea (int areaType, AudioDisplayComponent *parentWaveform_)
 
Range< int > getSampleRange () const
 
void setSampleRange (Range< int > r)
 
int getXForSample (int sample, bool relativeToAudioDisplayComponent=false) const
 
int getSampleForX (int x, bool relativeToAudioDisplayComponent=false) const
 
void mouseDown (const MouseEvent &e) override
 
void mouseDrag (const MouseEvent &e) override
 
void mouseUp (const MouseEvent &e) override
 
void checkBounds ()
 
void setAllowedPixelRanges (Range< int > leftRangeInSamples, Range< int > rightRangeInSamples)
 
void setAreaEnabled (bool shouldBeEnabled)
 
Colour getAreaColour () const
 

Detailed Description

A rectangle that represents a range of samples.

Constructor & Destructor Documentation

SampleArea ( int  areaType,
AudioDisplayComponent parentWaveform_ 
)

Creates a new SampleArea.

Parameters
areathe AreaType that will be used.
parentWaveformthe waveform that owns this area.

Member Function Documentation

void checkBounds ( )

This can be used to limit the sample area bounds.

Colour getAreaColour ( ) const

Returns the hardcoded colour depending on the AreaType.

int getSampleForX ( int  x,
bool  relativeToAudioDisplayComponent = false 
) const
inline

Returns the sample index for the given x coordinate.

If 'relativeToAudioDisplayComponent' is set to true, the x coordinate is relative to the parent AudioDisplayComponent

Range<int> getSampleRange ( ) const
inline

Returns the sample range (0 ... numSamples).

int getXForSample ( int  sample,
bool  relativeToAudioDisplayComponent = false 
) const
inline

Returns the x-coordinate of the given sample within its parent.

If a SampleArea is a child of another SampleArea, you can still get the absolute x value by passing 'true'.a

void mouseDown ( const MouseEvent &  e)
override

Sets the current SampleArea.

void mouseDrag ( const MouseEvent &  e)
override

Updates the position by using a boundary check for legal bounds.

void mouseUp ( const MouseEvent &  e)
override

Sends a change message to all registered listeners of the parent AudioDisplayComponent.

void setAllowedPixelRanges ( Range< int >  leftRangeInSamples,
Range< int >  rightRangeInSamples 
)
inline

You can set a constrainer on the boundaries of the SampleArea. If you don't want a constrainer (which is the default), simply pass two empty ranges.

void setAreaEnabled ( bool  shouldBeEnabled)
inline

This toggles the area enabled (which is not the same as Component::setEnabled())

void setSampleRange ( Range< int >  r)
inline

Sets the sample range that this SampleArea represents.

©2017 HISE. This documentation is autogenerated from the HISE source code using Doxygen.