BASS.NET API for the Un4seen BASS Audio LibraryBassBASS_SetConfigPtr Method BASS.NET API for the Un4seen BASS Audio Library
Sets the value of a pointer config option.

Namespace: Un4seen.Bass
Assembly: Bass.Net (in Bass.Net.dll) Version: 2.4.12.0
Syntax

[DllImportAttribute("bass.dll", CharSet = CharSet.Unicode)]
public static bool BASS_SetConfigPtr(
	BASSConfig option,
	IntPtr newvalue
)

Parameters

option
Type: Un4seen.BassBASSConfig
The option to set the value of... one of the following (BASSConfig).
newvalue
Type: SystemIntPtr
The new option value (as an IntPtr). See the option's documentation for details on the possible values.

Return Value

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

Options:

BASS_CONFIG_NET_AGENT"User-Agent" header.

newvalue (IntPtr): The "User-Agent" header.

BASS does make a copy of the header string, so it doesn't have to reside in the heap.

Changes take effect from the next internet stream creation call.

BASS_CONFIG_NET_PROXYProxy server settings.

newvalue (IntPtr): The "User-Agent" header.

The proxy server settings, in the form of "user:pass@server:port"... = don't use a proxy. "" (empty string) = use the default proxy settings. If only the "user:pass@" part is specified, then those authorization credentials are used with the default proxy server. If only the "server:port" part is specified, then that proxy server is used without any authorization credentials.

BASS does make a copy of the proxy string, so it doesn't have to reside in the heap.

Changes take effect from the next internet stream creation call. By default, BASS will use the Windows proxy settings, as set in the Internet Properties control panel.

Other config options may be supported by Add-Ons, see the documentation.

ERROR CODEDescription
BASS_ERROR_ILLPARAMoption is invalid.

Examples

As the BASS_CONFIG_NET_PROXY and BASS_CONFIG_NET_AGENT options take a pointer to an ANSI string as an argument (unless you add the BASS_UNICODE flag). Alternatively you might also use the BASS_SetConfigString(BASSConfig, String) method, which always supports unicode.

The following example copies the contents of a managed String into unmanaged memory:

VB
' create an unmanaged pointer containing a copy of the string
Dim myUserAgentPtr As IntPtr = Marshal.StringToHGlobalAnsi("radio42")
Bass.BASS_SetConfigPtr(BASSConfig.BASS_CONFIG_NET_AGENT, myUserAgentPtr)
' make sure to free the myUserAgentPtr!
Marshal.FreeHGlobal(myUserAgentPtr)
// create an unmanaged pointer containing a copy of the string
IntPtr myUserAgentPtr = Marshal.StringToHGlobalAnsi("radio42");
Bass.BASS_SetConfigPtr(BASSConfig.BASS_CONFIG_NET_AGENT, myUserAgentPtr);
// make sure to free the myUserAgentPtr!
Marshal.FreeHGlobal(myUserAgentPtr);
If you need to dynamically change the BASS_CONFIG_NET_PROXY or BASS_CONFIG_NET_AGENT option, you will need to call BASS_SetConfig(BASSConfig, Int32) each time again!
See Also

Reference