Sets an envelope to modify the sample rate, volume or pan of a channel over a period of time.
BOOL BASS_Mixer_ChannelSetEnvelope( DWORD handle, DWORD type, BASS_MIXER_NODE *nodes, DWORD count );
|handle||The channel handle.|
|type||The attribute to modify with the envelope. One of the following.
|nodes||The array of envelope nodes, which should have sequential positions.|
|count||The number of elements in the nodes array... 0 = no envelope.|
|BASS_ERROR_HANDLE||The channel is not plugged into a mixer.|
|BASS_ERROR_ILLTYPE||type is not valid.|
BASS_Mixer_ChannelSetEnvelopePos and BASS_Mixer_ChannelGetEnvelopePos can be used to set and get the current envelope position. A BASS_SYNC_MIXER_ENVELOPE sync can be set via BASS_Mixer_ChannelSetSync to be informed of when an envelope ends. This function can be called again from such a sync, in order to set a new envelope to follow on from the old one.
Any previous envelope of the same type is replaced by the new envelope. A copy is made of the nodes array, so it does not need to persist beyond this function call.
BASS_MIXER_NODE nodes; nodes.pos=0; nodes.val=0; // start at centre nodes.pos=BASS_ChannelSeconds2Bytes(mixer, 1); nodes.val=-1; // full left after 1 second nodes.pos=BASS_ChannelSeconds2Bytes(mixer, 3); nodes.val=1; // full right after 3 seconds nodes.pos=BASS_ChannelSeconds2Bytes(mixer, 4); nodes.val=0; // back at centre after 4 seconds BASS_Mixer_ChannelSetEnvelope(channel, BASS_MIXER_ENV_PAN|BASS_MIXER_ENV_LOOP, nodes, 4); // apply the envelope, looped