Namespace: Un4seen.Bass.AddOn.Mix
Assembly: Bass.Net (in Bass.Net.dll) Version: 2.4.17.5
[DllImportAttribute("bassmix")] public static bool BASS_Mixer_ChannelSetEnvelope( int handle, BASSMIXEnvelope type, BASS_MIXER_NODE[] nodes, int count )
Parameters
- handle
- Type: SystemInt32
The mixer source channel handle (which was add via BASS_Mixer_StreamAddChannel(Int32, Int32, BASSFlag) or BASS_Mixer_StreamAddChannelEx(Int32, Int32, BASSFlag, Int64, Int64)) beforehand). - type
- Type: Un4seen.Bass.AddOn.MixBASSMIXEnvelope
The envelope to get the position/value of. One of the following (see BASSMIXEnvelope):BASS_MIXER_ENV_FREQ Sample rate. BASS_MIXER_ENV_VOL Volume. BASS_MIXER_ENV_PAN Panning/balance. BASS_MIXER_ENV_LOOP Loop the envelope. This is a flag and can be used in combination with any of the above. BASS_MIXER_ENV_REMOVE Remove the source from the mixer at the end of the envelope. This is a flag and can be used in combination with any of the above. - nodes
- Type: Un4seen.Bass.AddOn.MixBASS_MIXER_NODE
The array of envelope nodes, which should have sequential positions. - count
- Type: SystemInt32
The number of elements in the nodes array... 0 = no envelope.
Return Value
Type: BooleanIf successful, is returned, else is returned. Use BASS_ErrorGetCode to get the error code.
Envelopes are applied on top of the channel's attributes, as set via BASS_ChannelSetAttribute(Int32, BASSAttribute, Single). In the case of BASS_MIXER_ENV_FREQ and BASS_MIXER_ENV_VOL, the final sample rate and volume is a product of the channel attribute and the envelope. While in the BASS_MIXER_ENV_PAN case, the final panning is a sum of the channel attribute and envelope.
BASS_Mixer_ChannelGetEnvelopePos(Int32, BASSMIXEnvelope, Single) can be used to get the current envelope position, and a BASS_SYNC_MIXER_ENVELOPE sync can be set via BASS_Mixer_ChannelSetSync(Int32, BASSSync, Int64, SYNCPROC, IntPtr) to be informed of when an envelope ends. The function can be called again from such a sync, in order to set a new envelope to follow 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.
Note: Envelopes deal in mixer positions, not sources! You might use BASS_Mixer_ChannelSetEnvelopePos(Int32, BASSMIXEnvelope, Int64) to adjust the envelope to a source channel position.
ERROR CODE | Description |
---|---|
BASS_ERROR_HANDLE | handle is not plugged into a mixer. |
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_NODE[] nodes = { new BASS_MIXER_NODE(Bass.BASS_ChannelSeconds2Bytes(_mixer, 0d), 0f), new BASS_MIXER_NODE(Bass.BASS_ChannelSeconds2Bytes(_mixer, 1d), -1f), new BASS_MIXER_NODE(Bass.BASS_ChannelSeconds2Bytes(_mixer, 3d), 1f), new BASS_MIXER_NODE(Bass.BASS_ChannelSeconds2Bytes(_mixer, 4d), 0f) }; BassMix.BASS_Mixer_ChannelSetEnvelope(_channel, BASSMIXEnvelope.BASS_MIXER_ENV_PAN | BASSMIXEnvelope.BASS_MIXER_ENV_LOOP, nodes, 4);
BassMix.BASS_Mixer_ChannelSetEnvelope(_channel, BASSMIXEnvelope.BASS_MIXER_ENV_PAN, null, 0);