C# Class xZune.Bass.BassManager

Bass global manager.
Datei anzeigen Open project: higankanshi/xZune.Bass

Public Methods

Method Description
Apply3DChanges ( ) : void

Applies changes made to the 3D system.

This function must be called to apply any changes made with Set3DFactors, Set3DPosition, Channel.Set3DAttribute or Channel.Set3DPosition. This allows multiple changes to be synchronized, and also improves performance.

FreeBass ( ) : void

Frees all resources used by the output device, including all its samples, streams and MOD musics.

This function should be called for all initialized devices before the program closes. It is not necessary to individually free the samples/streams/musics as these are all automatically freed by this function. When using multiple devices, the current thread's device setting (as set with SetDevice) determines which device this function call applies to.

Get3DFactors ( float &distf, float &rollf, float &dollf ) : void

Get the factors that affect the calculations of 3D sound.

Get3DPosition ( Vector3 &pos, Vector3 &vel, Vector3 &front, Vector3 &top ) : void

Get the position, velocity, and orientation of the listener.

GetDSoundObject ( DSoundObjectType type ) : IntPtr

Get a pointer to a DirectSound object interface.

GetDeviceInfo ( int device ) : DeviceInfo

Get information on an output device.

GetErrorCode ( ) : ErrorCode

Retrieves the error code for the most recent Bass function call in the current thread.

Initialize ( String bassLibraryPath, int device, uint freq, InitializationConfig configs, IntPtr windowHandle, xZune.Bass.Interop.Core.Guid dSoundGuid ) : void

Load Bass library and initialize it, it will automatically call InitializeBass.

This function must be successfully called before using any functions, others remarks see InitializeBass.

Initialize ( int device, uint freq, InitializationConfig configs, IntPtr windowHandle, xZune.Bass.Interop.Core.Guid dSoundGuid ) : void

Load Bass library and initialize it, it will automatically call InitializeBass, we will try find Bass library in last time used directory and current directory.

This function must be successfully called before using any functions, others remarks see InitializeBass.

InitializeBass ( int device, uint freq, InitializationConfig configs, IntPtr windowHandle, xZune.Bass.Interop.Core.Guid dSoundGuid ) : void

Initializes an output device.

This function must be successfully called before using any sample, stream or MOD music functions. The recording functions may be used without having called this function. Playback is not possible with the "no sound" device, but it does allow the use of "decoding channels", eg. to decode files. Simultaneously using multiple devices is supported in the Bass API via a context switching system; instead of there being an extra "device" parameter in the function calls, the device to be used is set prior to calling the functions. SetDevice is used to switch the current device. When successful, InitializeBass automatically sets the current thread's device to the one that was just initialized. When using the default device (device = -1), GetDevice can be used to find out which device it was mapped to.

PauseAll ( ) : void

Stops the output, pausing all musics/samples/streams on it.

ReleaseAll ( ) : void

Free Bass library and release all resource it used, it will automatically call FreeBass.

Set3DFactors ( float distf, float rollf, float dollf ) : void

Set the factors that affect the calculations of 3D sound.

Set3DPosition ( Vector3 pos, Vector3 vel, Vector3 front, Vector3 top ) : void

Set the position, velocity, and orientation of the listener.

StartAll ( ) : void

Starts (or resumes) the all output.

StopAll ( ) : void

Stops the output, stopping all musics/samples/streams on it.

Update ( int length ) : void

Updates the StreamMedia and MusicMedia channel playback buffers.

When automatic updating is disabled, this function or ChannelUpdate needs to be used to keep the playback buffers updated. The length parameter should include some safety margin, in case the next update cycle gets delayed. For example, if calling this function every 100ms, 200 would be a reasonable length parameter.

Method Details

Apply3DChanges() public static method

Applies changes made to the 3D system.
This function must be called to apply any changes made with Set3DFactors, Set3DPosition, Channel.Set3DAttribute or Channel.Set3DPosition. This allows multiple changes to be synchronized, and also improves performance.
public static Apply3DChanges ( ) : void
return void

FreeBass() public static method

Frees all resources used by the output device, including all its samples, streams and MOD musics.
This function should be called for all initialized devices before the program closes. It is not necessary to individually free the samples/streams/musics as these are all automatically freed by this function. When using multiple devices, the current thread's device setting (as set with SetDevice) determines which device this function call applies to.
/// Some error occur to call a Bass function, check the error code and error message /// to get more error information. /// /// Bass DLL not loaded, you must use to /// load Bass DLL first. ///
public static FreeBass ( ) : void
return void

Get3DFactors() public static method

Get the factors that affect the calculations of 3D sound.
public static Get3DFactors ( float &distf, float &rollf, float &dollf ) : void
distf float The distance factor.
rollf float The rolloff factor.
dollf float The doppler factor.
return void

Get3DPosition() public static method

Get the position, velocity, and orientation of the listener.
public static Get3DPosition ( Vector3 &pos, Vector3 &vel, Vector3 &front, Vector3 &top ) : void
pos Vector3 The position of the listener.
vel Vector3 The listener's velocity.
front Vector3 The direction that the listener's front is pointing.
top Vector3 The direction that the listener's top is pointing.
return void

GetDSoundObject() public static method

Get a pointer to a DirectSound object interface.
public static GetDSoundObject ( DSoundObjectType type ) : IntPtr
type DSoundObjectType DirectSound object type.
return System.IntPtr

GetDeviceInfo() public static method

Get information on an output device.
Bass DLL not loaded, you must use to load Bass DLL first. Some error occur to call a Bass function, check the error code and error message to get more error information.
public static GetDeviceInfo ( int device ) : DeviceInfo
device int The device to get the information of... 0 = first.
return xZune.Bass.Interop.Core.DeviceInfo

GetErrorCode() public static method

Retrieves the error code for the most recent Bass function call in the current thread.
public static GetErrorCode ( ) : ErrorCode
return ErrorCode

Initialize() public static method

Load Bass library and initialize it, it will automatically call InitializeBass.
This function must be successfully called before using any functions, others remarks see InitializeBass.
/// Bass has initialized, maybe you should call /// to dispose all resource, then call /// initialize Bass again. /// Can't find Bass DLL. /// Can't load Bass DLL, check the platform and Bass target platform (should be same, x86 or x64). /// /// Bass DLL not loaded, you must use Bass to load Bass DLL /// first. /// /// Can't find /// in this Bass function. /// A custom attribute type cannot be loaded. Can't find this function in Bass DLL. /// Some error occur to call a Bass function, check the error code and error message /// to get more error information. ///
public static Initialize ( String bassLibraryPath, int device, uint freq, InitializationConfig configs, IntPtr windowHandle, xZune.Bass.Interop.Core.Guid dSoundGuid ) : void
bassLibraryPath String /// Path of the Bass library, if it is a file, will load this file, if it is a directory, /// will search "bass.dll" in it. ///
device int /// The device to use... -1 = default device, 0 = no sound, 1 = first real output device. /// can be used to enumerate the available devices. ///
freq uint Output sample rate.
configs InitializationConfig Configures of initialize Bass.
windowHandle System.IntPtr The application's main window... 0 = the desktop window (use this for console applications).
dSoundGuid xZune.Bass.Interop.Core.Guid /// Class identifier of the object to create, that will be used to initialize DirectSound... NULL /// = use default. ///
return void

Initialize() public static method

Load Bass library and initialize it, it will automatically call InitializeBass, we will try find Bass library in last time used directory and current directory.
This function must be successfully called before using any functions, others remarks see InitializeBass.
/// Bass has initialized, maybe you should call /// to dispose all resource, then call /// initialize Bass again. /// Can't find Bass DLL. /// Can't load Bass DLL, check the platform and Bass target platform (should be same, x86 or x64). /// /// Bass DLL not loaded, you must use Bass to load Bass DLL /// first. /// /// Can't find /// in this Bass function. /// A custom attribute type cannot be loaded. Can't find this function in Bass DLL. /// Some error occur to call a Bass function, check the error code and error message /// to get more error information. ///
public static Initialize ( int device, uint freq, InitializationConfig configs, IntPtr windowHandle, xZune.Bass.Interop.Core.Guid dSoundGuid ) : void
device int /// The device to use... -1 = default device, 0 = no sound, 1 = first real output device. /// can be used to enumerate the available devices. ///
freq uint Output sample rate.
configs InitializationConfig Configures of initialize Bass.
windowHandle System.IntPtr The application's main window... 0 = the desktop window (use this for console applications).
dSoundGuid xZune.Bass.Interop.Core.Guid /// Class identifier of the object to create, that will be used to initialize DirectSound... NULL /// = use default. ///
return void

InitializeBass() public static method

Initializes an output device.
This function must be successfully called before using any sample, stream or MOD music functions. The recording functions may be used without having called this function. Playback is not possible with the "no sound" device, but it does allow the use of "decoding channels", eg. to decode files. Simultaneously using multiple devices is supported in the Bass API via a context switching system; instead of there being an extra "device" parameter in the function calls, the device to be used is set prior to calling the functions. SetDevice is used to switch the current device. When successful, InitializeBass automatically sets the current thread's device to the one that was just initialized. When using the default device (device = -1), GetDevice can be used to find out which device it was mapped to.
/// Bass DLL not loaded, you must use to /// load Bass DLL first. /// /// Some error occur to call a Bass function, check the error code and error message /// to get more error information. ///
public static InitializeBass ( int device, uint freq, InitializationConfig configs, IntPtr windowHandle, xZune.Bass.Interop.Core.Guid dSoundGuid ) : void
device int /// The device to use... -1 = default device, 0 = no sound, 1 = first real output device. /// can be used to enumerate the available devices. ///
freq uint Output sample rate.
configs InitializationConfig Configures of initialize Bass.
windowHandle System.IntPtr The application's main window... 0 = the desktop window (use this for console applications).
dSoundGuid xZune.Bass.Interop.Core.Guid /// Class identifier of the object to create, that will be used to initialize DirectSound... NULL /// = use default. ///
return void

PauseAll() public static method

Stops the output, pausing all musics/samples/streams on it.
Bass DLL not loaded, you must use to load Bass DLL first. Some error occur to call a Bass function, check the error code and error message to get more error information.
public static PauseAll ( ) : void
return void

ReleaseAll() public static method

Free Bass library and release all resource it used, it will automatically call FreeBass.
/// Bass DLL not loaded, you must use to load Bass DLL /// first. /// /// Some error occur to call a Bass function, check the error code and error message /// to get more error information. ///
public static ReleaseAll ( ) : void
return void

Set3DFactors() public static method

Set the factors that affect the calculations of 3D sound.
public static Set3DFactors ( float distf, float rollf, float dollf ) : void
distf float The distance factor.
rollf float The rolloff factor.
dollf float The doppler factor.
return void

Set3DPosition() public static method

Set the position, velocity, and orientation of the listener.
public static Set3DPosition ( Vector3 pos, Vector3 vel, Vector3 front, Vector3 top ) : void
pos Vector3 The position of the listener.
vel Vector3 The listener's velocity.
front Vector3 The direction that the listener's front is pointing.
top Vector3 The direction that the listener's top is pointing.
return void

StartAll() public static method

Starts (or resumes) the all output.
Bass DLL not loaded, you must use to load Bass DLL first. Some error occur to call a Bass function, check the error code and error message to get more error information.
public static StartAll ( ) : void
return void

StopAll() public static method

Stops the output, stopping all musics/samples/streams on it.
Bass DLL not loaded, you must use to load Bass DLL first. Some error occur to call a Bass function, check the error code and error message to get more error information.
public static StopAll ( ) : void
return void

Update() public static method

Updates the StreamMedia and MusicMedia channel playback buffers.
When automatic updating is disabled, this function or ChannelUpdate needs to be used to keep the playback buffers updated. The length parameter should include some safety margin, in case the next update cycle gets delayed. For example, if calling this function every 100ms, 200 would be a reasonable length parameter.
public static Update ( int length ) : void
length int The amount of data to render, in milliseconds.
return void