Un4seen.Bass.MiscBaseDSP
More...
Namespace: Un4seen.Bass.Misc
Assembly: Bass.Net (in Bass.Net.dll) Version: 2.4.17.5
The BaseDSP type exposes the following members.
Name | Description | |
---|---|---|
BaseDSP |
Default constructor. Not assigning a DSP yet.
| |
BaseDSP(Int32, Int32, IntPtr) |
Default constructor, which already evaluates the channel handle and assigns the DSP (Start will be called automatically).
|
Name | Description | |
---|---|---|
ChannelBitwidth |
This property returns the actual bitwidth of the sample data of the channel (e.g. 8, 16, 32).
| |
ChannelHandle |
Gets or Sets the channel that the DSP is being applied to.
| |
ChannelInfo |
Gets the BASS_CHANNELINFO of the assigned ChannelHandle.
| |
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.).
| |
ChannelSampleRate |
This property returns the actual sample rate in Hz of the sample data BASS is using with the channel (e.g. 44100).
| |
DSPHandle |
Returns the actual DSP handle (or 0, if the DSP has not been assigned to the channel).
| |
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.
| |
DSPProc |
Returns the actual DSPPROC (callback delegate) which is used by the DSP.
| |
IsAssigned |
Is the DSP assigned to an active channel? (=assigned, =not assigned).
| |
IsBypassed |
Returns if the DSP is currently bypassed (=bypass).
| |
User |
Gets or Sets the value of the user instance data to pass to the callback function (see DSPCallback(Int32, Int32, IntPtr, Int32, IntPtr)).
|
Name | Description | |
---|---|---|
Dispose |
Implement IDisposable.
| |
DSPCallback |
User defined DSP callback function which needs to be implemented in the derived class.
| |
Finalize |
Finalization code.
(Overrides ObjectFinalize.) | |
OnBypassChanged |
This method will be called every time the SetBypass(Boolean) method had been called.
| |
OnChannelChanged |
This method will be called every time the ChannelHandle changed.
| |
OnStarted |
This method will be called every time the Start method had been called.
| |
OnStopped |
This method will be called every time the Stop method had been called.
| |
RaiseNotification |
Fires the Notification event.
| |
SetBypass |
Sets the Bypass mode.
| |
Start |
Assigns the DSP to the channel (actually starts using the DSP).
| |
Stop |
Stops (removes) the DSP from the channel.
| |
ToString |
Returns the name of the DSP implementation.
(Overrides ObjectToString.) |
Name | Description | |
---|---|---|
Notification |
Event handler used to notify that the DSP has processed some data.
|
The properties ChannelHandle, ChannelBitwidth, ChannelSampleRate, ChannelNumChans, DSPPriority, DSPHandle, DSPProc, User, IsBypassed and IsAssigned as well as the methods Start, Stop and SetBypass(Boolean) have been already implemented.
You might use this base class to derive your own DSP implementations. In this case a derived class must implement the DSPCallback(Int32, Int32, IntPtr, Int32, IntPtr) method and might override the OnChannelChanged method (e.g. in order to reset an internal buffer etc.).
The whole DSP framework is based on the standard BASS DSP functionality. So as with all DSP's - the DSP is automatically freed whenever the source stream is freed, e.g. when calling BASS_StreamFree(Int32) or when using the BASS_STREAM_AUTOFREE flag.
public class DSP_MyDsp : BaseDSP { // First Constructor overload public DSP_MyDsp() : base() { } // Second Constructor overload public DSP_MyDsp(int channel, int priority) : base(channel, priority, 0) { } // example implementation of the DSPCallback method unsafe public override void DSPCallback(int handle, int channel, IntPtr buffer, int length, IntPtr user) { if (IsBypassed) return; if (ChannelBitwidth == 16) { // process the data short *data = (short*)buffer; for (int a = 0; a < length/2; a++) { // your work goes here (16-bit sample data) } } else if (ChannelBitwidth == 32) { // process the data float *data = (float*)buffer; for (int a = 0; a < length/4; a++) { // your work goes here (32-bit sample data) } } else { // process the data byte *data = (byte*)buffer; for (int a = 0; a < length; a++) { // your work goes here (8-bit sample data) } } // if you have calculated UI relevant data you might raise the event // else comment out the following line RaiseNotification(); } public override void OnChannelChanged() { // override this method if you need to react on channel changes // e.g. usefull, if an internal buffer needs to be reset etc. } public override string ToString() { return "My DSP"; } }
Reference
Un4seen.Bass.MiscBaseDSP
Un4seen.Bass.MiscDSP_BufferStream
Un4seen.Bass.MiscDSP_Gain
Un4seen.Bass.MiscDSP_IIRDelay
Un4seen.Bass.MiscDSP_Mono
Un4seen.Bass.MiscDSP_Pan
Un4seen.Bass.MiscDSP_PeakLevelMeter
Un4seen.Bass.MiscDSP_SoftSaturation
Un4seen.Bass.MiscDSP_StereoEnhancer
Un4seen.Bass.MiscDSP_StreamCopy