BASS.NET API for the Un4seen BASS Audio LibraryBassVstBASS_VST_SetScope Method BASS.NET API for the Un4seen BASS Audio Library
Sets the scope of an Editor to a given ID.

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

[DllImportAttribute("bass_vst.dll", CharSet = CharSet.Auto)]
public static bool BASS_VST_SetScope(
	int vstHandle,
	int scope


Type: SystemInt32
The VST effect handle as returned by BASS_VST_ChannelSetDSP(Int32, String, BASSVSTDsp, Int32).
Type: SystemInt32
The ID to set the scope to.

Return Value

Type: Boolean
If successful, is returned, else is returned. Use BASS_ErrorGetCode to get the error code.

If you create an editor window with BASS_VST_EmbedEditor(Int32, IntPtr) independently of a real channel (by skipping the channel parameter when calling BASS_VST_ChannelSetDSP(Int32, String, BASSVSTDsp, Int32)) and the editor displays any spectrums, VU-meters or such, the data for this come from the most recent channel using the same effect and the same scope. The scope can be set by this method to any ID, the default is 0.

The 'scope' is used to forward 'real' audio data to 'unchanneled' editors (you may want to use these editors as you may want the user to open the editor window at any time, independent of a playing channel). Imaging the following code, where two streams are prepared for crossfading:

ch1 = BASS_StreamCreateFile(false, "sth1.mp3", ...);
dsp1 = BASS_VST_ChannelSetDSP(ch1, "sth.dll", ...);
ch2 = BASS_StreamCreateFile(false, "sth2.mp3", ...);
dsp2 = BASS_VST_ChannelSetDSP(ch2, "sth.dll", ...);
For the user, this is one logical channel. If the user opens the editor for the 'sth' effect, it should display first the spectrum/vu/etc. from the first, after crossfading from the second channel. To let the editor know this, you should use the 'scope'. The 'scope' simply brings independent channels together to one logical unit - mainly for displaying the correct spectrum/vu/etc. in the editors.

So before the crossfade, you should set the scope:

BASS_VST_SetScope(dsp1, 123); // any number, scope is created implicitly
BASS_VST_SetScope(dsp2, 123); // any number, scope is created implicitly

To open the unchanneled editor, you can then simply use the following code:

editor = BASS_VST_ChannelSetDSP(0, "sth.dll", ...);
BASS_VST_SetScope(editor, 123);
BASS_VST_EmbedEditor(editor, ...);
The editor can then be opened, closed, created and destroyed independingly of the playing stuff.

If you use BASSmix, maybe you won't need the VST-scopes as you can add the effects to the finaly mix. However, even in this case, there may be situations where BASS_VST_SetScope(Int32, Int32) is just fine and simplifies your code.

See Also