Creates a reversed stream from a decoding channel.
Namespace: Un4seen.Bass.AddOn.Fx
Assembly: Bass.Net (in Bass.Net.dll) Version: 2.4.17.2
Syntax
[DllImportAttribute("bass_fx")] public static int BASS_FX_ReverseCreate( int channel, float dec_block, BASSFlag flags )
Parameters
- channel
- Type: SystemInt32
Stream/music/wma/cd/any other supported add-on format using a decoding channel. - dec_block
- Type: SystemSingle
Length of decoding blocks in seconds. Larger blocks means less seeking overhead but larger spikes. - flags
- Type: Un4seen.BassBASSFlag
A combination of the following flags (see BASSFlag):BASS_SAMPLE_LOOP Looped? Note that only complete sample loops are allowed by DirectSound (ie. you can't loop just part of a sample). BASS_SAMPLE_SOFTWARE Force the sample to not use hardware mixing. BASS_SAMPLE_3D Use 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_FX Requires 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_AUTOFREE Automatically free the stream's resources when it has reached the end, or when BASS_ChannelStop(Int32) (or BASS_Stop) is called. BASS_STREAM_DECODE Decode 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_xxx Speaker assignment flags. BASS_FX_FREESOURCE Free the source handle as well when the reverse channel is freed.
Return Value
Type: Int32If successful, the handle of the reversed stream is returned, else 0 is returned. Use BASS_ErrorGetCode to get the error code.
Remarks
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_DIR | The playback direction of a reverse channel (-1(less than 0)=reverse, 1(greater or equal 0)=forward, or use one of the BASSFXReverse flags). |
ERROR CODE | Description |
---|---|
BASS_ERROR_HANDLE | channel is not valid. |
BASS_ERROR_DECODE | The channel is not a decoding channel. Make sure the channel was created using the BASS_STREAM_DECODE or BASS_MUSIC_DECODE flag. |
BASS_ERROR_HANDLE | channel is not valid. |
Examples
// the source channel int stream = Bass.BASS_StreamCreateFile("test.mp3", 0L, 0L, BASSFlag.BASS_STREAM_DECODE | BASSFlag.BASS_STREAM_PRESCAN); // 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