BASS.NET API for the Un4seen BASS Audio Library

BassFxBASS_FX_ReverseCreate Method

BASS.NET API for the Un4seen BASS Audio Library
Creates a reversed stream from a decoding channel.

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

public static int BASS_FX_ReverseCreate(
	int channel,
	float dec_block,
	BASSFlag flags


Type: SystemInt32
Stream/music/wma/cd/any other supported add-on format using a decoding channel.
Type: SystemSingle
Length of decoding blocks in seconds. Larger blocks means less seeking overhead but larger spikes.
Type: Un4seen.BassBASSFlag
A combination of the following flags (see BASSFlag):
BASS_SAMPLE_LOOPLooped? Note that only complete sample loops are allowed by DirectSound (ie. you can't loop just part of a sample).
BASS_SAMPLE_SOFTWAREForce the sample to not use hardware mixing.
BASS_SAMPLE_3DUse 3D functionality. This is ignored if BASS_DEVICE_3D wasn't specified when calling BASS_Init(Int32, Int32, BASSInit, IntPtr, IntPtr). 3D samples must be mono (use BASS_SAMPLE_MONO).
BASS_SAMPLE_FXRequires DirectX 8 or above: Enable the old implementation of DirectX 8 effects. See the DX8 effect implementations section for details. Use BASS_ChannelSetFX(Int32, BASSFXType, Int32) to add effects to the stream.
BASS_STREAM_AUTOFREEAutomatically free the stream's resources when it has reached the end, or when BASS_ChannelStop(Int32) (or BASS_Stop) is called.
BASS_STREAM_DECODEDecode the sample data, without outputting it. Use BASS_ChannelGetData(Int32, IntPtr, Int32) to retrieve decoded sample data. The BASS_SAMPLE_SOFTWARE, BASS_SAMPLE_3D, BASS_SAMPLE_FX, BASS_STREAM_AUTOFREE and SPEAKER flags can not be used together with this flag.
BASS_SPEAKER_xxxSpeaker assignment flags.
BASS_FX_FREESOURCEFree the source handle as well when the reverse channel is freed.

Return Value

Type: Int32
If successful, the handle of the reversed stream is returned, else 0 is returned. Use BASS_ErrorGetCode to get the error code.

MODs are supported, if BASS_MUSIC_PRESCAN flag was applied to a source handle. Enable reverse supported flags in BASS_FX_ReverseCreate(Int32, Single, BASSFlag) and the others to source handle.

For better MP3/2/1 reverse playback create the source stream using the BASS_STREAM_PRESCAN flag.

Use BASS_ChannelSetAttribute(Int32, BASSAttribute, Single)/BASS_ChannelGetAttribute(Int32, BASSAttribute, Single) to get or set the attributes of a reverse stream:

BASS_ATTRIB_REVERSE_DIRThe playback direction of a reverse channel (-1(less than 0)=reverse, 1(greater or equal 0)=forward, or use one of the BASSFXReverse flags).
These attributes can either be applied to the reverse channel or the underlying decoding source channel. Note, that when playing the channel reverse, the end of a reverse stream is reached at the logial beginning of the stream (this also applies to BASS_SYNC_END).

ERROR CODEDescription
BASS_ERROR_HANDLEchannel is not valid.
BASS_ERROR_DECODEThe channel is not a decoding channel. Make sure the channel was created using the BASS_STREAM_DECODE or BASS_MUSIC_DECODE flag.
BASS_ERROR_HANDLEchannel is not valid.


Create a reverse stream with 2 seconds decoding blocks:
// the source channel
int stream = Bass.BASS_StreamCreateFile("test.mp3", 0L, 0L, BASSFlag.BASS_STREAM_DECODE | 
// the reverse channel
int streamFX = BassFx.BASS_FX_ReverseCreate(stream, 2f, BASSFlag.BASS_FX_FREESOURCE);
// play the channel reverse
Bass.BASS_ChannelSetAttribute(streamFX, BASSAttribute.BASS_ATTRIB_REVERSE_DIR, -1f);
// or
Bass.BASS_ChannelSetAttribute(streamFX, BASSAttribute.BASS_ATTRIB_REVERSE_DIR, (float)BASSFXReverse.BASS_FX_RVS_REVERSE);

// play the channel forward
Bass.BASS_ChannelSetAttribute(streamFX, BASSAttribute.BASS_ATTRIB_REVERSE_DIR, 1f);
// or
Bass.BASS_ChannelSetAttribute(streamFX, BASSAttribute.BASS_ATTRIB_REVERSE_DIR, (float)BASSFXReverse.BASS_FX_RVS_FORWARD);
See Also