BASS.NET API for the Un4seen BASS Audio LibraryBASS_BFX_VOLUME_ENV ClassBASS.NET API for the Un4seen BASS Audio Library
Used with BASS_ChannelSetFX(Int32, BASSFXType, Int32), BASS_FXSetParameters(Int32, Object) and BASS_FXGetParameters(Int32, Object) to retrieve and set the parameters of the DSP effect Volume Envelope.
Inheritance Hierarchy

SystemObject
  Un4seen.Bass.AddOn.FxBASS_BFX_VOLUME_ENV

Namespace: Un4seen.Bass.AddOn.Fx
Assembly: Bass.Net (in Bass.Net.dll) Version: 2.4.12.0
Syntax

[SerializableAttribute]
[StructLayoutAttribute(LayoutKind.Sequential, CharSet = CharSet.Unicode)]
public sealed class BASS_BFX_VOLUME_ENV

The BASS_BFX_VOLUME_ENV type exposes the following members.

Constructors

  NameDescription
Public methodBASS_BFX_VOLUME_ENV
Default constructor.
Public methodBASS_BFX_VOLUME_ENV(Int32)
Constructor assigning the number of volume envelope nodes to use.
Public methodBASS_BFX_VOLUME_ENV(BASS_BFX_ENV_NODE)
Constructor assigning the volume envelope nodes to use.
Top
Methods

  NameDescription
Public methodDispose
Implements the IDisposable interface.
Protected methodFinalize
Default Finilizer.
(Overrides ObjectFinalize.)
Top
Fields

  NameDescription
Public fieldbFollow
Follow the source position (default is )?
Public fieldlChannel
A BASSFXChan flag to define on which channels to apply the effect.

Default: -1 (BASS_BFX_CHANALL) - all channels.

Public fieldlNodeCount
The number of nodes contained in the pNodes array.
Public fieldpNodes
The array of envelope nodes (the first node must be at position 0.0).
Top
Remarks

Make sure that the first node is at position 0.0.

Envelopes are applied on top of the channel's attributes, as set via BASS_ChannelSetAttribute(Int32, BASSAttribute, Single). The final volume is a product of the channel attribute and the envelope.

Examples

Setting a volume envelope on a source channel:
VB
Dim fx As Integer = Bass.BASS_ChannelSetFX(source, BASSFXType.BASS_FX_BFX_VOLUME_ENV, 0) 
Dim ve As New BASS_BFX_VOLUME_ENV(
                  New BASS_BFX_ENV_NODE(0.0, 1F), 
                  New BASS_BFX_ENV_NODE(5.0, 1F), 
                  New BASS_BFX_ENV_NODE(7.0, 0.5F), 
                  New BASS_BFX_ENV_NODE(12.0, 0.5F), 
                  New BASS_BFX_ENV_NODE(14.0, 1F)) 
' which is the same as: 
Dim en As BASS_BFX_ENV_NODE() = New BASS_BFX_ENV_NODE(4) {} 
en(0).pos = 0.0 
en(0).val = 1F 
en(1).pos = 5.0 
en(2).val = 1F 
en(3).pos = 7.0 
en(3).val = 0.5F 
en(4).pos = 12.0 
en(4).val = 0.5F 
en(5).pos = 14.0 
en(5).val = 1F 
ve = New BASS_BFX_VOLUME_ENV(en) 

Bass.BASS_FXSetParameters(fx, ve)
int fx = Bass.BASS_ChannelSetFX(source, BASSFXType.BASS_FX_BFX_VOLUME_ENV, 0);
BASS_BFX_VOLUME_ENV ve = new BASS_BFX_VOLUME_ENV(
                                new BASS_BFX_ENV_NODE(0.0, 1f), 
                                new BASS_BFX_ENV_NODE(5.0, 1f), 
                                new BASS_BFX_ENV_NODE(7.0, 0.5f), 
                                new BASS_BFX_ENV_NODE(12.0, 0.5f), 
                                new BASS_BFX_ENV_NODE(14.0, 1f));
// which is the same as:
BASS_BFX_ENV_NODE[] en = new BASS_BFX_ENV_NODE[5];
en[0].pos = 0.0;
en[0].val = 1f;
en[1].pos = 5.0;
en[2].val = 1f;
en[3].pos = 7.0;
en[3].val = 0.5f;
en[4].pos = 12.0;
en[4].val = 0.5f;
en[5].pos = 14.0;
en[5].val = 1f;
ve = new BASS_BFX_VOLUME_ENV(en);

Bass.BASS_FXSetParameters(fx, ve);
Getting a volume envelope from a source channel:
VB
Dim ve As New BASS_BFX_VOLUME_ENV() 
If Bass.BASS_FXGetParameters(fx, ve) Then 
    For Each node As BASS_BFX_ENV_NODE In ve.pNodes 
            Console.WriteLine(node) 
    Next 
End If
BASS_BFX_VOLUME_ENV ve = new BASS_BFX_VOLUME_ENV();
if (Bass.BASS_FXGetParameters(fx, ve))
{
    foreach (BASS_BFX_ENV_NODE node in ve.pNodes)
        Console.WriteLine(node);
}
See Also

Reference