Copyright © 2008-2023 MultiMedia Soft

Effects.VolumeFlatLevelApply method

Previous pageReturn to chapter overviewNext page

Remarks

 

Applies a flat volume to the given song's range.

 

A successful call to this method will fire the SoundEditStarted event followed by a number of SoundEditPerc events and finally by the SoundEditDone event.

 

For further details about methods related to the use of special effects refer to the EffectsMan class.

 

 

Syntax

 

[Visual Basic]

Public Function VolumeFlatLevelApply (

nStartPosition as Int32,

nEndPosition as Int32,

nAffectedChannel as enumChannelsMask,

fVolume as Single,

nScaleType as enumVolumeScales

) as enumErrorCodes


 

[C#]

public enumErrorCodes VolumeFlatLevelApply (

Int32 nStartPosition,

Int32 nEndPosition,

enumChannelsMask nAffectedChannel,

float fVolume,

enumVolumeScales nScaleType

);


 

[C++]

public: enumErrorCodes VolumeFlatLevelApply (

Int32 nStartPosition,

Int32 nEndPosition,

enumChannelsMask nAffectedChannel,

float fVolume,

enumVolumeScales nScaleType

);


 

 

Parameter

Description

 

 

nStartPosition

Start position, expressed in milliseconds, of the affected sound range.

nEndPosition

End position, expressed in milliseconds, of the affected sound range.. If set to -1 the end position will be set to the end of the sound.

nAffectedChannel

Numeric value that determines the combination of affected channels.

Supported values are the following:

Mnemonic constant

Value

Meaning

CHANNEL_MASK_0

1 (0x01)

Channel 0 or left channel

CHANNEL_MASK_1

2 (0x02)

Channel 1 or right channel

CHANNEL_MASK_2

4 (0x04)

Channel 2

CHANNEL_MASK_3

8 (0x08)

Channel 3

CHANNEL_MASK_4

16 (0x10)

Channel 4

CHANNEL_MASK_5

32 (0x20)

Channel 5

CHANNEL_MASK_6

64 (0x40)

Channel 6

CHANNEL_MASK_7

128 (0x80)

Channel 7

CHANNEL_MASK_LEFTS

85 (0x55)

All left channels

CHANNEL_MASK_RIGHTS

170 (0xAA)

All right channels

CHANNEL_MASK_ALL

255 (0xFF)

All available channels

fVolume

Floating point value representing the volume applied

nScaleType

The volume scaling type.

Supported values are the following:

Mnemonic constant

Value

Meaning

SCALE_LINEAR

0

The passed volume is based upon a linear scale:

- value 0.0 mutes the sound

- values higher than 0.0 and lower than 100.0 attenuate the sound

- value 100.0 keeps sound level unchanged

- values higher than 100.0 amplify the sound

SCALE_LOG

1

The passed volume, expressed in dB, is based upon a logarithmic scale:

- value -100.0 mutes the sound

- values higher than -100.0 and lower than 0.0 attenuate the sound

- value 0.0 keeps sound level unchanged

- values higher than 0.0 amplify the sound

 

The actual applied formula for converting a linear volume into a logarithmic volume is the following:

VolumeInDB = 20 * log10 (VolumeLinear/100)

The C syntax for converting a logarithmic volume into a linear volume is the following:

VolumeLinear = 100 * pow (10, VolumeInDB/20);

 

 

Return value

 

Value

Meaning

 

 

Negative value

An error occurred (see the LastError property for further error details)

enumErrorCodes.ERR_NOERROR (0)

The method call was successful.