Public Member Functions | List of all members
AudioDisplayComponent::SampleArea Class Reference

A rectangle that represents a range of samples. More...

Inherits Component.

Public Member Functions

void checkBounds ()
 This can be used to limit the sample area bounds. More...
 
Colour getAreaColour () const
 Returns the hardcoded colour depending on the AreaType. More...
 
int getSampleForX (int x, bool relativeToAudioDisplayComponent=false) const
 Returns the sample index for the given x coordinate. More...
 
Range< int > getSampleRange () const
 Returns the sample range (0 ... More...
 
int getXForSample (int sample, bool relativeToAudioDisplayComponent=false) const
 Returns the x-coordinate of the given sample within its parent. More...
 
void mouseDown (const MouseEvent &e) override
 Sets the current SampleArea. More...
 
void mouseDrag (const MouseEvent &e) override
 Updates the position by using a boundary check for legal bounds. More...
 
void mouseUp (const MouseEvent &e) override
 Sends a change message to all registered listeners of the parent AudioDisplayComponent. More...
 
 SampleArea (int areaType, AudioDisplayComponent *parentWaveform_)
 Creates a new SampleArea. More...
 
void setAllowedPixelRanges (Range< int > leftRangeInSamples, Range< int > rightRangeInSamples)
 You can set a constrainer on the boundaries of the SampleArea. More...
 
void setAreaEnabled (bool shouldBeEnabled)
 This toggles the area enabled (which is not the same as Component::setEnabled())
 
void setSampleRange (Range< int > r)
 Sets the sample range that this SampleArea represents. More...
 

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

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

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 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.