Un4seen.Bass.MiscBaseDSP
Un4seen.Bass.MiscDSP_BufferStream
Namespace: Un4seen.Bass.Misc
Assembly: Bass.Net (in Bass.Net.dll) Version: 2.4.17.7
The DSP_BufferStream type exposes the following members.
| Name | Description | |
|---|---|---|
| DSP_BufferStream |
Creates a new instance of the Stream Buffer DSP, not assigning the DSP yet.
| |
| DSP_BufferStream(Int32, Int32) |
Creates a new instance of the Stream Buffer DSP, which already assigns the DSP (Start will be called automatically).
|
| Name | Description | |
|---|---|---|
| BufferPosition |
Gets or Sets the current buffer position in bytes.
| |
| BufferStream |
Gets the buffered BASS stream (the created custom stream).
| |
| BufferStreamFlags |
Gets the channel flags of the being used.
| |
| ChannelBitwidth |
This property returns the actual bitwidth of the sample data of the channel (e.g. 8, 16, 32).
(Inherited from BaseDSP.) | |
| ChannelHandle |
Gets or Sets the channel that the DSP is being applied to.
(Inherited from BaseDSP.) | |
| ChannelInfo |
Gets the BASS_CHANNELINFO of the assigned ChannelHandle.
(Inherited from BaseDSP.) | |
| ChannelNumChans |
This property returns the actual number of channles of the sample data BASS is using with the channel (e.g. 1=mono, 2=stereo, etc.).
(Inherited from BaseDSP.) | |
| ChannelSampleRate |
This property returns the actual sample rate in Hz of the sample data BASS is using with the channel (e.g. 44100).
(Inherited from BaseDSP.) | |
| ConfigBuffer |
Gets or Sets the buffer length in milliseconds to be used (between 1 and 5000).
| |
| ConfigBufferLength |
Gets the buffer length in bytes which is being used.
| |
| DSPHandle |
Returns the actual DSP handle (or 0, if the DSP has not been assigned to the channel).
(Inherited from BaseDSP.) | |
| DSPPriority |
Sets or reassigns the priority of the DSP, which determines it's position in the DSP chain - DSPs with higher priority are called before those with lower.
(Inherited from BaseDSP.) | |
| DSPProc |
Returns the actual DSPPROC (callback delegate) which is used by the DSP.
(Inherited from BaseDSP.) | |
| IsAssigned |
Is the DSP assigned to an active channel? (=assigned, =not assigned).
(Inherited from BaseDSP.) | |
| IsBypassed |
Returns if the DSP is currently bypassed (=bypass).
(Inherited from BaseDSP.) | |
| IsOutputBuffered |
Gets or Sets, if the BufferStream should be buffered or not (default is ).
| |
| OutputHandle |
Gets or Sets a buffered output BASS stream to synchronize the position with (0 = use a non-synchronized direct buffer).
| |
| User |
Gets or Sets the value of the user instance data to pass to the callback function (see DSPCallback(Int32, Int32, IntPtr, Int32, IntPtr)).
(Inherited from BaseDSP.) |
| Name | Description | |
|---|---|---|
| ClearBuffer |
Clears the internal buffer (zeros all elements) and resets the buffer pointer.
| |
| Dispose |
Implement IDisposable.
(Inherited from BaseDSP.) | |
| DSPCallback |
User defined DSP callback function which does the stream copy operation. Not for direct use in your application!
(Overrides BaseDSPDSPCallback(Int32, Int32, IntPtr, Int32, IntPtr).) | |
| Finalize |
Finalization code.
(Inherited from BaseDSP.) | |
| OnBypassChanged |
Occures when the SetBypass(Boolean) method was called.
Actually clears the internal copy buffer.
(Overrides BaseDSPOnBypassChanged.) | |
| OnChannelChanged |
Occures when the ChannelHandle has been changed.
(Overrides BaseDSPOnChannelChanged.) | |
| OnStarted |
Occures when the Start method was called.
Actually creates the BufferStream custom stream here.
(Overrides BaseDSPOnStarted.) | |
| OnStopped |
Occures when the Stop method was called.
Actually frees the BufferStream custom stream here.
(Overrides BaseDSPOnStopped.) | |
| RaiseNotification |
Fires the Notification event.
(Inherited from BaseDSP.) | |
| SetBypass |
Sets the Bypass mode.
(Inherited from BaseDSP.) | |
| Start |
Assigns the DSP to the channel (actually starts using the DSP).
(Inherited from BaseDSP.) | |
| Stop |
Stops (removes) the DSP from the channel.
(Inherited from BaseDSP.) | |
| ToString |
Returns the name of the DSP.
(Overrides BaseDSPToString.) |
| Name | Description | |
|---|---|---|
| Notification |
Event handler used to notify that the DSP has processed some data.
(Inherited from BaseDSP.) |
The DSP automatically handles 8-, 16- or 32-bit sample data accordingly. 8- and 16-bit sample data will be clipped if needed, 32-bit floating-point values will not be clipped. Note: The channel flags of the being used are actually the same as from the original ChannelHandle, but if you have FLOATDSP enabled the FLOAT flag will be added automatically.
Use Start to assign the DSP to the channel. Use Stop to remove the DSP (you can (re)assign the DSP at any time again by calling Start). Changing the DSPPriority when the DSP is already assigned will automatically reassign the DSP.
Use the ChannelHandle property to change the channel assignment at any time. If the DSP has already been assigned, the DSP will immediately be reassigned to the new channel.
Use the BufferStream property (which represents a custom decoding stream) to get the level or FFT data from it. If the ChannelHandle is attached to a buffered output stream (e.g. via BASSmix to a mixer stream) there will be a delay due to the additional output buffer. Use the OutputHandle property in order to compensate for that (or leave to it's default 0 value in order to simply use a non-synchronized direct buffer - in such case the internal buffer will return the data as being heard).
In addition you might use the IsOutputBuffered property to specify, if the created BufferStream will be used with a buffered output stream. In such case the decoding BufferStream position will be aligned to the output buffer (default is ).
By default the internal buffer size is determined from the current BASS_CONFIG_BUFFER setting. However, that might not always be correct, since the buffer size must also be equal to the one used with the ChannelHandle. So you might change that using the ConfigBuffer property.
NOTE: This DSP does NOT support the Notification event!
private DSP_BufferStream _bufferStream; ... // create a mixer outout stream _mixer1 = BassMix.BASS_MIXER_StreamCreate(44100, 2, BASSFlag.BASS_DEFAULT); Bass.BASS_ChannelPlay(_mixer1, false); _mixer2 = BassMix.BASS_MIXER_StreamCreate(44100, 2, BASSFlag.BASS_DEFAULT); Bass.BASS_ChannelPlay(_mixer2, false); // create a source stream and add it to the mixer1 _stream = Bass.BASS_StreamCreateFile(_fileName, 0, 0, BASSFlag.BASS_SAMPLE_FLOAT | BASSFlag.BASS_STREAM_DECODE); BassMix.BASS_Mixer_StreamAddChannel(_mixer1, _stream, BASSFlag.BASS_DEFAULT); ... // create a clone of the source stream to add it to mixer2 _bufferStream = new DSP_BufferStream(); _bufferStream.ChannelHandle = _stream; // the stream to copy _bufferStream.DSPPriority = -4000; _bufferStream.Start(); BassMix.BASS_Mixer_StreamAddChannel(_mixer1, _bufferStream.BufferStream, BASSFlag.BASS_DEFAULT);
private DSP_BufferStream _bufferStream; ... // create a mixer outout stream _mixer = BassMix.BASS_MIXER_StreamCreate(44100, 2, BASSFlag.BASS_DEFAULT); Bass.BASS_ChannelPlay(BASSFlag.BASS_DEFAULT, false); // create a source stream and add it to the mixer _stream = Bass.BASS_StreamCreateFile(_fileName, 0, 0, BASSFlag.BASS_SAMPLE_FLOAT | BASSFlag.BASS_STREAM_DECODE); BassMix.BASS_Mixer_StreamAddChannel(_mixer, _stream, BASSFlag.BASS_DEFAULT); ... // create a buffer of the source stream for level and/or FFT data retrival in sync with the mixer output _bufferStream = new DSP_BufferStream(); _bufferStream.ChannelHandle = _stream; // the stream to copy _bufferStream.OutputHandle = _mixer; // the stream to sync with (what's being heard) _bufferStream.DSPPriority = -4000; _bufferStream.Start(); ... float[] fft = new float[2048]; Bass.BASS_ChannelGetData(_bufferStream.BufferStream, fft, (int)BASSData.BASS_DATA_FFT4096);