Sets the current position of an envelope on a channel.
Namespace: Un4seen.Bass.AddOn.Mix
Assembly: Bass.Net (in Bass.Net.dll) Version: 2.4.17.5
Syntax
[DllImportAttribute("bassmix")] public static bool BASS_Mixer_ChannelSetEnvelopePos( int handle, BASSMIXEnvelope type, long pos )
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 set 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. - pos
- Type: SystemInt64
The new envelope position, in bytes. If this is beyond the end of the envelope it will be capped or looped, depending on whether the envelope has looping enabled.
Return Value
Type: BooleanIf successful, the current position of the envelope is returned, else -1 is returned. Use BASS_ErrorGetCode to get the error code.
Remarks
Note: Envelopes deal in mixer positions, not sources! So when you are changing the source position (e.g. via BASS_Mixer_ChannelSetPosition(Int32, Int64, BASSMode) the envelope's positions doesn't change with it. You might use this method to align the envelope position accorting to the new source position (see example below).
ERROR CODE | Description |
---|---|
BASS_ERROR_HANDLE | handle is not plugged into a mixer. |
BASS_ERROR_ILLTYPE | type is not valid. |
BASS_ERROR_NOTAVAIL | There is no envelope of the requested type on the channel. |
Examples
// set a volume envelope on a source mixer channel (do this just once) BASS_MIXER_NODE[] nodes = { new BASS_MIXER_NODE(Bass.BASS_ChannelSeconds2Bytes(_mixer, 3d), 1f), new BASS_MIXER_NODE(Bass.BASS_ChannelSeconds2Bytes(_mixer, 5d), 0f), new BASS_MIXER_NODE(Bass.BASS_ChannelSeconds2Bytes(_mixer, 7d), 0f), new BASS_MIXER_NODE(Bass.BASS_ChannelSeconds2Bytes(_mixer, 9d), 1f) }; BassMix.BASS_Mixer_ChannelSetEnvelope(source, BASSMIXEnvelope.BASS_MIXER_ENV_VOL, nodes); ... // change the source position and align the envelope position to it // pause mixer Bass.BASS_ChannelLock(mixer, true); BassMix.BASS_Mixer_ChannelSetPosition(source, newPos); // convert source pos to mixer pos long envPos = Bass.BASS_ChannelSeconds2Bytes(mixer, Bass.BASS_ChannelBytes2Seconds(source, newPos)); BassMix.BASS_Mixer_ChannelSetEnvelopePos(source, BASSMIXEnvelope.BASS_MIXER_ENV_VOL, envPos); // resume mixer Bass.BASS_ChannelLock(mixer, false); ...
See Also