SoundEffectorData Class Reference

#include <customgui_soundeffector.h>

Inheritance diagram for SoundEffectorData:

Detailed Description

Sound effector data type (CUSTOMDATATYPE_SOUNDEFFECTOR) for SoundEffectorCustomGui.

Note
Has to be created with Alloc() and destroyed with Free(). Use AutoAlloc to automate the allocation and destruction based on scope.
Since
R19

Private Constructor/Destructor

 SoundEffectorData ()
 
 ~SoundEffectorData ()
 

Alloc/Free

static SoundEffectorDataAlloc ()
 
static void Free (SoundEffectorData *&pData)
 

Init/Free Sampling

Bool InitSampling (BaseDocument *doc)
 
Bool FreeSampling ()
 

Copy

Bool CopyTo (SoundEffectorData *pDest) const
 

Sample

Bool Sample (Int index, Int count, Float &value, Vector &color)
 
Bool SampleArray (Int offset, Int count, Int totalCount, Float *values, Vector *colors)
 
Bool SampleArray (Int offset, Int count, Int totalCount, Float *values, Vector *colors) const
 

Probes

Int CreateProbe (Float left=1.0, Float right=22050.0, Float top=1.0, Float bottom=0.0, Bool selected=false)
 
Bool CreateDefaultProbe ()
 
Int GetProbeCount () const
 
ProbeGetProbe (Int index) const
 
Bool DeleteProbe (Int index)
 
void UpdateProbeOrder ()
 

Range

void GetRange (Float *xmin, Float *xmax, Float *ymin, Float *ymax) const
 
void SetRange (Float xmin, Float xmax, Float ymin, Float ymax)
 

Miscellaneous

Float GetLinLog () const
 
void SetLinLog (Float value)
 
Bool GetFreeze () const
 
void SetFreeze (Bool freeze)
 
const GradientGetGradient () const
 
Int32 GetGradientDirection () const
 
void SetGradientDirection (Int32 direction)
 
Bool IsFFTSamplingCacheDirty (const BaseDocument &doc) const
 

SoundTrack

Bool SetActiveSoundTrack (CTrack *track, BaseDocument *doc)
 
CTrackGetActiveSoundTrack (BaseDocument *doc)
 

Additional Inherited Members

- Static Public Attributes inherited from CustomDataTypeT< 440000257 >
static constexpr Int32 DATATYPEID
 

Constructor & Destructor Documentation

◆ SoundEffectorData()

SoundEffectorData ( )
private

◆ ~SoundEffectorData()

~SoundEffectorData ( )
private

Member Function Documentation

◆ Alloc()

static SoundEffectorData* Alloc ( )
static

Allocates a SoundEffectorData. Destroy the allocated SoundEffectorData with Free(). Use AutoAlloc to automate the allocation and destruction based on scope.

Returns
The allocated sound effector data, or nullptr if the allocation failed.

◆ Free()

static void Free ( SoundEffectorData *&  pData)
static

Destructs SoundEffectorDatas allocated with Alloc(). Use AutoAlloc to automate the allocation and destruction based on scope.

Parameters
[in,out]pDataThe sound effector data to destruct. If the pointer is nullptr nothing happens. The pointer is assigned nullptr afterwards.

◆ InitSampling()

Bool InitSampling ( BaseDocument doc)

Initializes the sampling functionality of the sound effector data.

Warning
Must be called before either Sample() of SampleArray() functions. FreeSampling() must be invoked afterwards.
Parameters
[in]docThe document.
Returns
true if successful, otherwise false.

◆ FreeSampling()

Bool FreeSampling ( )

Frees the memory used for sampling.

Warning
Must be invoked after InitSampling() has been called.
Returns
true if successful, otherwise false.

◆ CopyTo()

Bool CopyTo ( SoundEffectorData pDest) const

Copies the sound effector data values into the destination sound effector data.

Parameters
[in]pDestThe destination sound effector data data. The caller owns the pointed SoundEffectorData..
Returns
true if successful, otherwise false.

◆ Sample()

Bool Sample ( Int  index,
Int  count,
Float value,
Vector color 
)

Samples the sound file using the probes.

Parameters
[in]indexThe index of the element to sample.
[in]countThe number of elements in the array being sampled.
[out]valueThe output value.
[out]colorThe output color.
Returns
true if successful, otherwise false.

◆ SampleArray() [1/2]

Bool SampleArray ( Int  offset,
Int  count,
Int  totalCount,
Float values,
Vector colors 
)

Samples a subset portion or whole array of elements simultaneously.

Parameters
[in]offsetThe offset from the start of the array that sampling start at.
[in]countThe number of elements in this subset.
[in]totalCountThe total number of elements being sampled.
[out]valuesThe values, should be the same size as count.
[out]colorsThe colors, should be the same size as count.
Returns
true if successful, otherwise false.

◆ SampleArray() [2/2]

Bool SampleArray ( Int  offset,
Int  count,
Int  totalCount,
Float values,
Vector colors 
) const

Samples a subset portion or whole array of elements simultaneously (const version).

Parameters
[in]offsetThe offset from the start of the array that sampling start at.
[in]countThe number of elements in this subset.
[in]totalCountThe total number of elements being sampled.
[out]valuesThe values, should be the same size as count.
[out]colorsThe colors, should be the same size as count.
Returns
true if successful, otherwise false.

◆ CreateProbe()

Int CreateProbe ( Float  left = 1.0,
Float  right = 22050.0,
Float  top = 1.0,
Float  bottom = 0.0,
Bool  selected = false 
)

Creates a probe.

Parameters
[in]leftThe left side of the probe in Hertz [1...22050].
[in]rightThe right side of the probe in Hertz [1...22050].
[in]topThe top edge of the probe in the range [0...1].
[in]bottomThe bottom edge of the probe in the range [0...1].
[in]selectedpass true to select the created probe (other probes are not deselected in the operation).
Returns
The created probe's index.

◆ CreateDefaultProbe()

Bool CreateDefaultProbe ( )

Create default probe

Returns
true if successful, otherwise false.

◆ GetProbeCount()

Int GetProbeCount ( ) const

Retrieves the number of probes owned by the sound effector data.

Returns
The probe count.

◆ GetProbe()

Probe* GetProbe ( Int  index) const

Retrieves the probe at the specified index.

Parameters
[in]indexThe probe index.
Returns
The probe, or nullptr if the function fails. The SoundEffectorData owns the pointed probe.

◆ DeleteProbe()

Bool DeleteProbe ( Int  index)

Deletes the probe at the specified index.

Parameters
[in]indexThe index of the probe to delete.
Returns
true if successful, otherwise false.

◆ UpdateProbeOrder()

void UpdateProbeOrder ( )

Updates the probes.

Note
Must be called after adjusting any probes left or right values to update the order that the probes are calculated in.

◆ GetRange()

void GetRange ( Float xmin,
Float xmax,
Float ymin,
Float ymax 
) const

Retrieves the range of the sound effector data.

Warning
Only valid if the sound effector data is shown in the sound data GUI.
Parameters
[out]xminAssigned the minimum X value.
[out]xmaxAssigned the maximum X value.
[out]yminAssigned the minimum Y value.
[out]ymaxAssigned the maximum Y value.

◆ SetRange()

void SetRange ( Float  xmin,
Float  xmax,
Float  ymin,
Float  ymax 
)

Sets the range of the sound effector data.

Warning
Only valid if the sound effector data is shown in the sound data GUI.
Parameters
[in]xminThe minimum X value.
[in]xmaxThe maximum X value.
[in]yminThe minimum Y value.
[in]ymaxThe maximum Y value.

◆ GetLinLog()

Float GetLinLog ( ) const

Retrieves the blend value for the linear/logarithmic slider.

Returns
The blend percentage: 0% = linear, 100% = log10.

◆ SetLinLog()

void SetLinLog ( Float  value)

Sets the the blend value for the linear/logarithmic slider.

Parameters
[in]valueThe blend percentage to set: 0% = linear, 100% = log10.

◆ GetFreeze()

Bool GetFreeze ( ) const

Retrieves the freeze state.

Returns
true if freeze is enabled, otherwise false.

◆ SetFreeze()

void SetFreeze ( Bool  freeze)

Sets the freeze state.

Parameters
[in]freezetrue to enable freeze, otherwise false.

◆ GetGradient()

const Gradient* GetGradient ( ) const

Retrieves the global gradient.

Returns
The global gradient, or nullptr if the function fails. The SoundEffectorData owns the pointed gradient.

◆ GetGradientDirection()

Int32 GetGradientDirection ( ) const

Retrieves the global gradient direction.

Returns
The global gradient direction: 0 for vertical (volume), 1 for horizontal (frequency).

◆ SetGradientDirection()

void SetGradientDirection ( Int32  direction)

Sets the global gradient direction.

Parameters
[in]directionThe global gradient direction to set: 0 for vertical (volume), 1 for horizontal (frequency).

◆ IsFFTSamplingCacheDirty()

Bool IsFFTSamplingCacheDirty ( const BaseDocument doc) const

Check if an FFT Cache is currently up to date.

Parameters
[in]docThe document.
Returns
true if successful, otherwise false.

◆ SetActiveSoundTrack()

Bool SetActiveSoundTrack ( CTrack track,
BaseDocument doc 
)

Sets the active sound track

Parameters
[in]trackSound track.
[in]docThe document.
Returns
true if successful, otherwise false.

◆ GetActiveSoundTrack()

CTrack* GetActiveSoundTrack ( BaseDocument doc)

Retrieves the active sound track.

Parameters
[in]docThe document.
Returns
The active sound track, or nullptr if the function fails. The SoundEffectorData owns the pointed CTrack.