Sets an envelope to modify the sample rate, volume or pan of a mixer source 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 | handle is not a mixer source. |
BASS_ERROR_ILLTYPE | type is not valid. |
BASS_ERROR_NOTAVAIL | The BASS_MIXER_ENV_PAN envelope is not available when matrix mixing is enabled. |
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[4]; nodes[0].pos = 0; nodes[0].val = 0; // start at centre nodes[1].pos = BASS_ChannelSeconds2Bytes(mixer, 1); nodes[1].val = -1; // full left after 1 second nodes[2].pos = BASS_ChannelSeconds2Bytes(mixer, 3); nodes[2].val = 1; // full right after 3 seconds nodes[3].pos = BASS_ChannelSeconds2Bytes(mixer, 4); nodes[3].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