BlitzMax/Modules/BaH/BASS

From Wikibooks, open books for an open world
< BlitzMax‎ | Modules‎ | BaH
Jump to navigation Jump to search

BASS is an audio library for use in Windows and Mac OSX software.
Its purpose is to provide developers with powerful and efficient sample, stream (MP3, MP2, MP1, OGG, WAV, AIFF, custom generated, and more via add-ons), MOD music (XM, IT, S3M, MOD, MTM, UMX), MO3 music (MP3/OGG compressed MODs), and recording functions.

This BlitzMax module, as well as the standard streaming functionality also supports the use of TStream, allowing even more flexibility than BASS already provides.

How to package the library with your App

You can find the runtime libraries in the lib/^platform^ folder of the module distribution, where ^platform^ is either win32 or macos.

On Windows, you should place the bass.dll file in the same folder as your app.

On OS X, the libbass.dylib should be placed inside the application bundle. For example, if your application was called MyApp, then the library would need to be placed in MyApp.app/Contents/MacOS/.

Types[edit | edit source]

TBassInfo[edit | edit source]

Used with TBass.GetInfo to retrieve information on the current device.

OSX notes: Only the latency, minbuf, initflags, speakers and freq members are used. Hardware mixing and EAX are unavailable in OS X. The speakers and freq values will change as the device's output is changed, e.g. via its control panel.

Methods
  • GetFlags
  • GetHWSize
  • GetHWFree
  • GetFreeSam
  • GetFree3d
  • GetMinRate
  • GetMaxRate
  • GetEAX
  • GetMinBuf
  • GetDSVer
  • GetLatency
  • GetInitFlags
  • GetSpeakers
  • GetFreq

TBassInfo: Methods[edit | edit source]

GetFlags

Method GetFlags:Int()

Description: flagsThe device's capabilities... a combination of these flags.

GetHWSize

Method GetHWSize:Int()

Description: The device's total amount of hardware memory.

GetHWFree

Method GetHWFree:Int()

Description: The device's amount of free hardware memory.

GetFreeSam

Method GetFreeSam:Int()

Description: The number of free sample slots in the hardware.

GetFree3d

Method GetFree3d:Int()

Description: The number of free 3D sample slots in the hardware.

GetMinRate

Method GetMinRate:Int()

Description: The minimum sample rate supported by the hardware.

GetMaxRate

Method GetMaxRate:Int()

Description: The maximum sample rate supported by the hardware.

GetEAX

Method GetEAX:Int()

Description: The device supports EAX and has it enabled?

Information: The device's "Hardware acceleration" needs to be set to "Full" in its "Advanced Properties" setup, else EAX is disabled. This is always FALSE if BASS_DEVICE_3D was not specified when TBass.Init was called.

GetMinBuf

Method GetMinBuf:Int()

Description: The minimum buffer length (rounded up to the nearest millisecond) recommended for use (with the BASS_CONFIG_BUFFER config option).

Information: Requires that BASS_DEVICE_LATENCY was used when TBass.Init was called

GetDSVer

Method GetDSVer:Int()

Description: DirectSound version...

Information: 9 = DX9/8/7/5 features are available, 8 = DX8/7/5 features are available, 7 = DX7/5 features are available, 5 = DX5 features are available. 0 = none of the DX9/8/7/5 features are available.

GetLatency

Method GetLatency:Int()

Description: The average delay (rounded up to the nearest millisecond) for playback of TBassStream/TBassMusic channels to start and be heard.

Information: Requires that BASS_DEVICE_LATENCY was used when TBass.Init was called.

GetInitFlags

Method GetInitFlags:Int()

Description: The flags parameter of the TBass.Init call.

GetSpeakers

Method GetSpeakers:Int()

Description: The number of speakers the device/drivers supports...

Information: 2 means that there is no support for speaker assignment (this will always be the case with VxD drivers). It's also possible that it could mistakenly be 2 with some devices/drivers, when the device in fact supports more speakers. In that case the BASS_DEVICE_CPSPEAKERS flag can be used in the TBass.Init call to use the Windows control panel setting, or the BASS_DEVICE_SPEAKERS flag can be used to force the enabling of speaker assignment.

GetFreq

Method GetFreq:Int()

Description: The device's current output sample rate.

Information: This is only available on Windows Vista and OS X.

TBassChannel[edit | edit source]

A "channel" can be a sample playback channel (TBassSample), a sample stream (TBassStream), a MOD music (TBassMusic), or a recording (TBassRecord). Each "Channel" function can be used with one or more of these channel types.

Methods
  • Play
  • Pause
  • Stop
  • GetLength
  • GetLevel
  • GetTags
  • IsActive
  • GetPosition
  • GetPositionLowHigh
  • Update
  • SlideAttribute
  • IsSliding
  • Bytes2Seconds
  • Flags
  • SetFX
  • GetAttribute
  • SetAttribute
  • SetLink
  • Get3DPosition
  • Set3DPosition
  • Set3DAttributes
  • Get3DAttributes
  • GetData
  • GetDevice
  • GetInfo
  • Lock
  • Seconds2Bytes
  • SetSync
  • SetPosition

TBassChannel: Methods[edit | edit source]

Play

Method Play:Int(restart:Int = True)

Description: Starts (or resumes) playback of a sample, stream, MOD music, or recording.

Returns: If successful, TRUE is returned, else FALSE is returned. Use BASS_ErrorGetCode to get the error code.

Information: Parameters:

  • restart : Restart playback from the beginning? If channel is a user stream, its current buffer contents are cleared.
If it is a MOD music, its BPM/etc are reset to their initial values.

When streaming in blocks (BASS_STREAM_BLOCK), the restart parameter is ignored as it's not possible to go back to the start. The restart parameter is also of no consequence with recording channels.

Pause

Method Pause:Int()

Description: Pauses a sample, stream, MOD music, or recording.

Returns: If successful, TRUE is returned, else FALSE is returned. Use BASS_ErrorGetCode to get the error code.

Information: Use Play to resume a paused channel. Stop can be used to stop a paused channel.

Stop

Method Stop:Int()

Description: Stops a sample, stream, MOD music, or recording.

GetLength

Method GetLength:Long(mode:Int)

Description: Retrieves the playback length of a channel.

Returns: If successful, then the channel's length is returned, else -1 is returned. Use TBass.ErrorGetCode to get the error code.

Information: The exact length of a stream will be returned once the whole file has been streamed, until then it's not always possible to 100% accurately estimate the length of a stream. The length is always exact for MP3/MP2/MP1 files when the BASS_STREAM_PRESCAN flag is used in the BASS_StreamCreateFile call. When the BASS_STREAM_PRESCAN flag is not used, the length is an (usually accurate) estimation based on the file size, until the whole file has been streamed. The length returned for OGG files will usually be exact (assuming the file is not corrupt), but for OGG files streamed from the internet (or "buffered" user file stream) it can be a very rough estimation until the whole file has been downloaded. Retrieving the byte length of a MOD music requires that the BASS_MUSIC_PRESCAN flag was used in the BASS_MusicLoad call. Parameters:

  • mode : How to retrieve the length. One of the following.
ConstantDescription
BASS_POS_BYTEGet the length in bytes.
BASS_POS_MUSIC_ORDERGet the length in orders. (HMUSIC only)
GetLevel

Method GetLevel:Int(leftLevel:Int Var, rightLevel:Int Var)

Description: Retrieves the level (peak amplitude) of a stream, MOD music or recording channel.

Information: This method measures the level of the channel's sample data, not the level of the channel in the final output mix, so the channel's volume (BASS_ATTRIB_VOL attribute) does not affect it. For channels that are more than stereo, the left level will include all left channels (e.g. front-left, rear-left, center), and the right will include all right (front-right, rear-right, LFE). If there are an odd number of channels then the left and right levels will include all channels. If the level of each individual channel is required, that can be calculated from the sample data that GetData provides. When used with a decoding channel, this method has to decode data (20ms worth) from the channel in order to calculate the level. Which means that data is gone, e.g. it is not available to GetData. If an error occurs, -1 is returned, use TBass.ErrorGetCode to get the error code. If successful, the level of the left channel is returned in the low word (low 16-bits), and the level of the right channel is returned in the high word (high 16-bits). If the channel is mono, then the low word is duplicated in the high word. The level ranges linearly from 0 (silent) to 32768 (max). 0 will be returned when a channel is stalled.

GetTags

Method GetTags:String[](tags:Int)

Description: Retrieves tags/headers from a channel.

Returns: If successful, the requested tags are returned, else NULL is returned. Use TBass.ErrorGetCode to get the error code.

Information: Parameters:

  • tags : The tags/headers wanted... one of the following.
ConstantDescription
BASS_TAG_ID3BASS_TAG_ID3ID3v1 tags. A pointer to a 128 byte block is returned. See http://www.id3.org/ID3v1 for details of the block's structure.
BASS_TAG_ID3V2xxxxxxxxxxxxxxxxxxx
BASS_TAG_LYRICS3xxxxxxxxxxxxxxxxxxx
BASS_TAG_OGGxxxxxxxxxxxxxxxxxxx
BASS_TAG_VENDORxxxxxxxxxxxxxxxxxxx
BASS_TAG_HTTPxxxxxxxxxxxxxxxxxxx
BASS_TAG_ICYxxxxxxxxxxxxxxxxxxx
BASS_TAG_METAxxxxxxxxxxxxxxxxxxx
BASS_TAG_RIFF_INFOxxxxxxxxxxxxxxxxxxx
BASS_TAG_MUSIC_NAMExxxxxxxxxxxxxxxxxxx
BASS_TAG_MUSIC_MESSAGExxxxxxxxxxxxxxxxxxx
BASS_TAG_MUSIC_INSTxxxxxxxxxxxxxxxxxxx
BASS_TAG_MUSIC_SAMPLExxxxxxxxxxxxxxxxxxx

ID3v1 tags are located at the end of the file, so when streaming a file with ID3v1 tags from the internet, the tags will not be available until the download is complete. A BASS_SYNC_DOWNLOAD sync can be set via BASS_ChannelSetSync, to be informed of when the download is complete. A BASS_SYNC_META sync can be used to be informed of new Shoutcast metadata, and a BASS_SYNC_OGG_CHANGE sync for when a new logical bitstream begins in a chained OGG stream, which generally brings new OGG tags.

IsActive

Method IsActive:Int()

Description: Checks if a sample, stream, or MOD music is active (playing) or stalled.

Information: Can also check if a recording is in progress. When using this method with a decoding channel, BASS_ACTIVE_PLAYING will be returned while there is still data to decode. Once the end has been reached, BASS_ACTIVE_STOPPED will be returned. BASS_ACTIVE_STALLED is never returned for decoding channels; you can tell a decoding channel is stalled if BASS_ChannelGetData returns less data than requested, and this function still returns BASS_ACTIVE_PLAYING.

GetPosition

Method GetPosition:Long(mode:Int)

Description: Retrieves the playback position of a sample, stream, or MOD music.

Returns: If successful, then the channel's position is returned, else -1 is returned. Use TBass.ErrorGetCode to get the error code.

Information: Can also be used with a recording channel. Parameters:

  • mode : How to retrieve the position. One of the following.
ConstantDescription
BASS_POS_BYTEGet the position in bytes.
BASS_POS_MUSIC_ORDERGet the position in orders and rows... LOWORD = order, HIWORD = row * scaler (BASS_ATTRIB_MUSIC_PSCALER). (TBassMusic only)
Other modes may be supported by add-ons, see the documentation.
GetPositionLowHigh

Method GetPositionLowHigh:Long(mode:Int, low:Int Var, high:Int Var)

Update

Method Update:Int(length:Int)

Description: Updates the playback buffer of a stream or MOD music.

Returns: If successful, TRUE is returned, else FALSE is returned. Use ErrorGetCode to get the error code.

Information: Parameters:

  • length : The amount to render, in milliseconds... 0 = default (2 x update period). This is capped
at the space available in the buffer.

When starting playback of a stream or MOD music, after creating it or changing its position, there will be a slight delay while the initial data is decoded for playback. Usually the delay is not noticeable or important, but if you need playback to start instantly when you call Play, then use this method first. The length parameter should be at least equal to the update period. It may not always be possible to render the requested amount of data, in which case this method will still succeed. GetData(BASS_DATA_AVAILABLE) can be used to check how much data a channel has buffered for playback. When automatic updating is disabled (BASS_CONFIG_UPDATEPERIOD = 0), this method could be used instead of TBass.Update to implement different update periods for different channels, instead of a single update period for all. Unlike TBass.Update, this method can also be used while automatic updating is enabled. The CPU usage of this method is not included in the TBass.GetCPU reading.

SlideAttribute

Method SlideAttribute:Int(attrib:Int, value:Float, time:Int)

Description: Slides a channel's attribute from its current value to a new value.

Returns: If successful, then TRUE is returned, else FALSE is returned. Use TBass.ErrorGetCode to get the error code.

Information: This method is similar to SetAttribute, except that the attribute is ramped to the value over the specified period of time. Another difference is that the value is not pre-checked. If it is invalid, the slide will simply end early. If an attribute is already sliding, then the old slide is stopped and replaced by the new one. IsSliding can be used to check if an attribute is currently sliding. A BASS_SYNC_SLIDE sync can also be set via SetSync, to be triggered at the end of a slide. The sync will not be triggered in the case of an existing slide being replaced by a new one. Attribute slides are unaffected by whether the channel is playing, paused or stopped. They carry on regardless.

IsSliding

Method IsSliding:Int(attrib:Int)

Description: Checks if an attribute (or any attribute) of a sample, stream, or MOD music is sliding.

Returns: If the attribute is sliding, then TRUE is returned, else FALSE is returned.

Bytes2Seconds

Method Bytes2Seconds:Double(pos:Long)

Description: Translates a byte position into time (seconds), based on a channel's format.

Returns: If successful, then the translated length is returned, else a negative value is returned. Use TBass.ErrorGetCode to get the error code.

Information: The translation is based on the channel's initial sample rate, when it was created.

Flags

Method Flags:Int(flags:Int, mask:Int)

Description: Modifies and retrieves a channel's flags.

Returns: If successful, the channel's updated flags are returned, else -1 is returned. Use BASS_ErrorGetCode to get the error code.

Information: Some flags may not be adjustable in some circumstances, so the return value should be checked to confirm any changes. The flags listed above are just the flags that can be modified, and there may be additional flags present in the return value. See the BASS_CHANNELINFO documentation for a full list of flags. Streams that are created by add-ons may have additional flags available. There is a limited number of possible flag values though, so some add-ons may use the same flag value for different things. This means that when using add-on specific flags with a stream created via the plugin system, it is a good idea to first confirm that the add-on is handling the stream, by checking its ctype via BASS_ChannelGetInfo. During playback, the effects of flag changes are not heard instantaneously, due to buffering. To reduce the delay, use the BASS_CONFIG_BUFFER config option to reduce the buffer length.

SetFX

Method SetFX:TBassFX(fxType:Int, priority:Int)

Description: Sets an effect on a stream, MOD music, or recording channel.

Returns: If successful, then the new effect's handle is returned, else Null is returned. Use TBass.ErrorGetCode to get the error code.

GetAttribute

Method GetAttribute:Int(attrib:Int, value:Float Var)

Description: Retrieves the value of a channel's attribute.

Returns: If successful, then TRUE is returned, else FALSE is returned. Use TBass.ErrorGetCode to get the error code.

Information: Parameters:

  • attrib : The attribute to set the value of... one of the following.
ConstantDescription
BASS_ATTRIB_EAXMIXEAX wet/dry mix. (TBassSample/TBassMusic/TBassStream only)
BASS_ATTRIB_FREQSample rate.
BASS_ATTRIB_MUSIC_AMPLIFYAmplification level. (TBassMusic)
BASS_ATTRIB_MUSIC_BPMBPM. (TBassMusic)
BASS_ATTRIB_MUSIC_PANSEPPan separation level. (TBassMusic)
BASS_ATTRIB_MUSIC_PSCALERPosition scaler. (TBassMusic)
BASS_ATTRIB_MUSIC_SPEEDSpeed. (TBassMusic)
BASS_ATTRIB_MUSIC_VOL_CHANA channel volume level. (TBassMusic)
BASS_ATTRIB_MUSIC_VOL_GLOBALGlobal volume level. (TBassMusic)
BASS_ATTRIB_MUSIC_VOL_INSTAn instrument/sample volume level. (TBassMusic)
BASS_ATTRIB_PANPanning/balance position.
BASS_ATTRIB_VOLVolume level.
Other attributes may be supported by add-ons, see the documentation.
  • value : A variable to receive the attribute value.
SetAttribute

Method SetAttribute:Int(attrib:Int, value:Float)

Description: Sets the value of a channel's attribute.

Returns: If successful, then TRUE is returned, else FALSE is returned. Use TBass.ErrorGetCode to get the error code.

Information: Parameters:

  • attrib : The attribute to set the value of... one of the following.
ConstantDescription
BASS_ATTRIB_EAXMIXEAX wet/dry mix. (TBassSample/TBassMusic/TBassStream only)

The wet / dry ratio... 0 (full dry) to 1 (full wet), -1 = automatically calculate the mix based on the distance (the default).

BASS_ATTRIB_FREQSample rate.

The sample rate... 100 (min) to 100000 (max), 0 = original rate (when the channel was created). The value will be rounded down to a whole number. This attribute applies to playback of the channel, and does not affect the channel's sample data, so has no real effect on decoding channels. It is still adjustable though, so that it can be used by the BASSmix add-on, and anything else that wants to use it. Although the standard valid sample rate range is 100 to 100000, some devices/drivers may have a different valid range. See the minrate and maxrate members of the TBassInfo Type. It is not possible to change the sample rate of a channel if the "with FX flag" DX8 effect implementation enabled on it, unless DirectX 9 or above is installed. It requires an increased amount of CPU processing to play MOD musics and streams at increased sample rates. If you plan to play MOD musics or streams at greatly increased sample rates, then you should increase the buffer lengths (BASS_CONFIG_BUFFER) to avoid possible break-ups in the sound.

BASS_ATTRIB_MUSIC_AMPLIFYAmplification level. (TBassMusic)

Amplification level... 0 (min) to 100 (max). This will be rounded down to a whole number. As the amplification level get's higher, the sample data's range increases, and therefore, the resolution increases. But if the level is set too high, then clipping can occur, which can result in distortion of the sound. You can check the current level of a MOD music at any time by using TBassChannel.GetLevel. By doing so, you can decide if a MOD music's amplification level needs adjusting. The default amplification level is 50. During playback, the effect of changes to this attribute are not heard instantaneously, due to buffering. To reduce the delay, use the BASS_CONFIG_BUFFER config option to reduce the buffer length.

BASS_ATTRIB_MUSIC_BPMBPM. (TBassMusic)

The BPM... 1 (min) to 255 (max). This will be rounded down to a whole number. This attribute is a direct mapping of the MOD's BPM, so the value can be changed via effects in the MOD itself. Note that by changing this attribute, you are changing the playback length. During playback, the effect of changes to this attribute are not heard instantaneously, due to buffering. To reduce the delay, use the BASS_CONFIG_BUFFER config option to reduce the buffer length.

BASS_ATTRIB_MUSIC_PANSEPPan separation level. (TBassMusic)

Pan separation... 0 (min) to 100 (max), 50 = linear. This will be rounded down to a whole number. By default BASS uses a linear panning "curve". If you want to use the panning of FT2, use a pan separation setting of around 35. To use the Amiga panning (i.e. full left and right) set it to 100.

BASS_ATTRIB_MUSIC_PSCALERPosition scaler. (TBassMusic)

The scaler... 1 (min) to 256 (max). This will be rounded down to a whole number. When getting the order position via TBassChannel.GetPosition, the row will be scaled by this value. By using a higher scaler, you can get a more precise position indication. The default position scaler is 1.

BASS_ATTRIB_MUSIC_SPEEDSpeed. (TBassMusic)

The speed... 0 (min) to 255 (max). This will be rounded down to a whole number. This attribute is a direct mapping of the MOD's speed, so the value can be changed via effects in the MOD itself. The "speed" is the number of ticks per row. Setting it to 0, stops and ends the music. Note that by changing this attribute, you are changing the playback length. During playback, the effect of changes to this attribute are not heard instantaneously, due to buffering. To reduce the delay, use the BASS_CONFIG_BUFFER config option to reduce the buffer length.

BASS_ATTRIB_MUSIC_VOL_CHAN + channelA channel volume level. (TBassMusic)

For channels, 0 = first channel. The volume curve used by this attribute is always linear, e.g. 0.5 = 50. The BASS_CONFIG_CURVE_VOL config option setting has no effect on this. The volume level of all channels is initially 1 (full). During playback, the effect of changes to this attribute are not heard instantaneously, due to buffering. To reduce the delay, use the BASS_CONFIG_BUFFER config option to reduce the buffer length. This attribute can also be used to count the number of channels in a MOD Music.

BASS_ATTRIB_MUSIC_VOL_GLOBALGlobal volume level. (TBassMusic)

The global volume level... 0 (min) to 64 (max, 128 for IT format). This will be rounded down to a whole number. This attribute is a direct mapping of the MOD's global volume, so the value can be changed via effects in the MOD itself. During playback, the effect of changes to this attribute are not heard instantaneously, due to buffering. To reduce the delay, use the BASS_CONFIG_BUFFER config option to reduce the buffer length.

BASS_ATTRIB_MUSIC_VOL_INST + instAn instrument/sample volume level. (TBassMusic)

For instruments, 0 = first instrument. The volume curve used by this attribute is always linear, e.g. 0.5 = 50. The BASS_CONFIG_CURVE_VOL config option setting has no effect on this. The volume level of all instruments is initially 1 (full). For MOD formats that do not use instruments, read "sample" for "instrument". During playback, the effect of changes to this attribute are not heard instantaneously, due to buffering. To reduce the delay, use the BASS_CONFIG_BUFFER config option to reduce the buffer length. This attribute can also be used to count the number of instruments in a MOD music.

BASS_ATTRIB_PANPanning/balance position.

The pan position... -1 (full left) to +1 (full right), 0 = centre. This attribute applies to playback of the channel, and does not affect the channel's sample data, so has no real effect on decoding channels. It is still adjustable though, so that it can be used by the BASSmix add-on, and anything else that wants to use it. It is not possible to set the pan position of a 3D channel. It is also not possible to set the pan position when using speaker assignment, but if needed, it can be done via a DSP function instead (not on mono channels).

BASS_ATTRIB_VOLVolume level.

The volume level... 0 (silent) to 1 (full). This attribute applies to playback of the channel, and does not affect the channel's sample data, so has no real effect on decoding channels. It is still adjustable though, so that it can be used by the BASSmix add-on, and anything else that wants to use it. When using BASS_ChannelSlideAttribute to slide this attribute, a negative volume value can be used to fade-out and then stop the channel.

Other attributes may be supported by add-ons, see the documentation.
  • value : A variable to receive the attribute value.
SetLink

Method SetLink:Int(channel:TBassChannel)

Description: Links two MOD music or stream channels together.

Returns: If successful, then TRUE is returned, else FALSE is returned. Use TBass.ErrorGetCode to get the error code.

Information: Linked channels are started/stopped/paused/resumed together. Links are one-way, for example, channel chan will be started by channel handle, but not vice versa unless another link has been set in that direction. If a linked channel has reached the end, it will not be restarted when a channel it is linked to is started. If you want a linked channel to be restarted, you need to have resetted its position using SetPosition beforehand.

Get3DPosition

Method Get3DPosition:Int(pos:TBass3DVector = Null, orient:TBass3DVector = Null, vel:TBass3DVector = Null)

Description: Retrieves the 3D position of a sample, stream, or MOD music channel with 3D functionality.

Set3DPosition

Method Set3DPosition:Int(pos:TBass3DVector = Null, orient:TBass3DVector = Null, vel:TBass3DVector = Null)

Description: Sets the 3D position of a sample, stream, or MOD music channel with 3D functionality.

Returns: If successful, then TRUE is returned, else FALSE is returned. Use TBass.ErrorGetCode to get the error code.

Set3DAttributes

Method Set3DAttributes:Int(mode:Int = -1, minDist:Float = 0, maxDist:Float = 0, iangle:Int = -1, ..

Description: Sets the 3D attributes of a sample, stream, or MOD music channel with 3D functionality.

Returns: If successful, then TRUE is returned, else FALSE is returned. Use TBass.ErrorGetCode to get the error code.

Get3DAttributes

Method Get3DAttributes:Int(mode:Int Var, minDist:Float Var, maxDist:Float Var, iangle:Int Var, oangle:Int Var, ..

Description: Retrieves the 3D attributes of a sample, stream, or MOD music channel with 3D functionality.

Returns: If successful, then TRUE is returned, else FALSE is returned. Use TBass.ErrorGetCode to get the error code.

GetData

Method GetData:Int(buffer:Byte Ptr, length:Int)

Description: Retrieves the immediate sample data (or an FFT representation of it) of a stream or MOD music channel.

Returns: If an error occurs, -1 is returned, use BASS_ErrorGetCode to get the error code. When requesting FFT data, the number of bytes read from the channel (to perform the FFT) is returned. When requesting sample data, the number of bytes written to buffer will be returned (not necessarily the same as the number of bytes read when using the BASS_DATA_FLOAT flag). When using the BASS_DATA_AVAILABLE flag, the number of bytes in the channel's buffer is returned.

Information: Can also be used with a recording channel. This method can only return as much data as has been written to the channel's buffer, so it may not always be possible to get the amount of data requested, especially if you request large amounts. If you really do need large amounts, then increase the buffer lengths (BASS_CONFIG_BUFFER). The BASS_DATA_AVAILABLE flag can be used to check how much data a channel's buffer contains at any time, including when stopped or stalled. When requesting data from a "decoding channel" (BASS_STREAM_DECODE or BASS_MUSIC_DECODE was used at creation), there are no intermediate buffers involved, so as much data as is available can be decoded in one go. When retrieving sample data, 8-bit samples are unsigned (0 to 255) , 16-bit samples are signed (-32768 to 32767), 32-bit floating-point samples range from -1 to +1 (not clipped, so can actually be outside this range). That's unless the BASS_DATA_FLOAT flag is used, in which case, the sample data will be converted to 32-bit floating-point (if it isn't already). When requesting FFT data, floating-point values ranging from 0 to 1 are returned. Only the first half of the FFT is useful, so that's what BASS returns. For example, with a 2048 sample FFT, it will return 1024 values; the 1st value being the DC component, the 2nd being the amplitude at 1/2048 of the channel's sample rate, then the amplitude at 2/2048, 3/2048, etc... A Hann window is applied to the sample data to reduce leakage, unless the BASS_DATA_FFT_NOWINDOW flag is used. Channels that have 2 or more sample channels (i.e. stereo or above) may have FFT performed on each individual channel, using the BASS_DATA_FFT_INDIVIDUAL flag. Without this flag, all the channels are combined, and a single mono FFT is performed. Performing the extra individual FFTs of course increases the amount of processing required. The return values are interleaved in the same order as the channel's sample data, e.g. stereo = left, right,left,etc... This method is most useful if you wish to visualize (e.g. spectrum analyze) the sound.

GetDevice

Method GetDevice:Int()

Description: Retrieves the device that a channel is using.

Returns: If successful, the device number is returned, else -1 is returned. Use BASS_ErrorGetCode to get the error code.

GetInfo

Method GetInfo:TBassChannelInfo()

Description: Retrieves information on a channel.

Lock

Method Lock:Int(value:Int)

Description: Locks a stream, MOD music or recording channel to the current thread.

Information: Locking a channel prevents other threads from performing most functions on it, including buffer updates. Other threads wanting to access a locked channel will block until it is unlocked, so a channel should only be locked very briefly. A channel must be unlocked in the same thread that it was locked.

Seconds2Bytes

Method Seconds2Bytes:Long(pos:Double)

Description: Translates a time (seconds) position into bytes, based on a channel's format.

Returns: If successful, then the translated length is returned, else -1 is returned. Use BASS_ErrorGetCode to get the error code.

Information: The translation is based on the channel's initial sample rate, when it was created. The return value is rounded down to the position of the nearest sample.

SetSync

Method SetSync(stype:Int, param:Long, syncData:TBassSyncData)

SetPosition

Method SetPosition:Int(pos:Long, mode:Int)

Description: Sets the playback position of a sample, MOD music, or stream.

Information: Setting the position of a MOD music in bytes (other than 0) requires that the BASS_MUSIC_PRESCAN flag was used in the BASS_MusicLoad call. When setting the position in orders and rows, the channel's byte position (as reported by BASS_ChannelGetPosition) is reset to 0. This is because it is not possible to get the byte position of an order/row position; it is possible that a position may never be played in the normal course of events, or it may be played multiple times. When setting the position of a MOD music, and the BASS_MUSIC_POSRESET flag is active, all notes that were playing before the position changed will be stopped. Otherwise, the notes will continue playing until they are stopped in the MOD music. When setting the position in bytes, the BPM, speed and global volume are updated to what they would normally be at the new position. Otherwise they are left as they were prior to the position change, unless the seek position is 0 (the start), in which case they are also reset to the starting values (with the BASS_MUSIC_POSRESET flag). When the BASS_MUSIC_POSRESETEX flag is active, the BPM, speed and global volume are reset with every seek. For MP3/MP2/MP1 streams, if the BASS_STREAM_PRESCAN flag was used when BASS_StreamCreateFile was called to create the stream, seeking will be accurate to the exact requested byte. Otherwise it will be an approximation, which is generally still quite accurate. Seeking in internet file (and "buffered" user file) streams is possible once the download has reached the requested position, so long as the file is not being streamed in blocks (BASS_STREAM_BLOCK flag).

TBassSyncData[edit | edit source]

Used in SetSync method.

TBassFX[edit | edit source]

Used in SetFX method.

Methods
  • Reset
  • GetParameters
  • SetParameters

TBassFX: Methods[edit | edit source]

Reset

Method Reset:Int()

Description: Reset FX data.

GetParameters

Method GetParameters:TBassFXType()

Description: Get current FX parameters.

SetParameters

Method SetParameters:Int(fx:TBassFXType)

Description: Set FX parameters.

TBassFXType[edit | edit source]

Used in GetParameters, SetParameters and FXForType methods.

TBassDX8Chorus[edit | edit source]

Not used.

TBassStream[edit | edit source]

Bass stream type.

Methods
  • Create
  • CreateFile
  • CreateMem
  • CreateFileUser
  • CreateURL
  • CreateTStream
  • GetFilePosition
  • PutData
  • PutFileData
  • Free
Functions
  • StreamCreate
  • StreamCreateFile
  • StreamCreateMem
  • StreamCreateFileUser
  • StreamCreateURL
  • StreamCreateTStream

TBassStream: Methods[edit | edit source]

Create

Method Create:TBassStream(freq:Int, chans:Int, flags:Int, proc:Int(handle:TBassStream, buffer:Byte Ptr, length:Int, user:Object), user:Object)

Description: Creates a new stream.

CreateFile

Method CreateFile:TBassStream(filename:String, offset:Long, length:Long, flags:Int)

Description: Creates a new file.

CreateMem

Method CreateMem:TBassStream(mem:Byte Ptr, length:Long, flags:Int)

Description: Creates a sample stream from an MP3, MP2, MP1, OGG, WAV, AIFF or plugin supported file in memory.

Returns: If successful, the new stream's handle is returned, else 0 is returned. Use TBass.ErrorGetCode to get the error code.

Information: Parameters:

  • mem : Memory Location
  • length : Length of sample in memory.
  • flags : Any combination of these flags.
ConstantDescription
BASS_SAMPLE_FLOATUse 32-bit floating-point sample data. See Floating-point channels for info.
BASS_SAMPLE_MONODecode/play the stream (MP3/MP2/MP1 only) in mono, reducing the CPU usage (if

it was originally stereo). This flag is automatically applied if BASS_DEVICE_MONO was specified when calling

BASS_Init.
BASS_SAMPLE_SOFTWAREForce the stream to not use hardware mixing.
BASS_SAMPLE_3DEnable 3D functionality. This requires that the BASS_DEVICE_3D flag was

specified when calling BASS_Init, and the stream must be mono. The SPEAKER flags can not be used together with

this flag.
BASS_SAMPLE_LOOPLoop the file. This flag can be toggled at any time using BASS_ChannelFlags.
BASS_SAMPLE_FXEnable the old implementation of DirectX 8 effects. See the DX8 effect implementations section for details. Use BASS_ChannelSetFX to add effects to the stream.
BASS_STREAM_PRESCANEnable pin-point accurate seeking (to the exact byte) on the MP3/MP2/MP1

stream. This also increases the time taken to create the stream, due to the entire file being pre-scanned for

the seek points.
BASS_STREAM_AUTOFREEAutomatically free the stream when playback ends.
BASS_STREAM_DECODEDecode the sample data, without playing it. Use BASS_ChannelGetData to

retrieve decoded sample data. The BASS_SAMPLE_3D, BASS_STREAM_AUTOFREE and SPEAKER flags can not be used

together with this flag. The BASS_SAMPLE_SOFTWARE and BASS_SAMPLE_FX flags are also ignored.
BASS_SPEAKER_xxxSpeaker assignment flags. These flags have no effect when the stream is more than stereo.
BASS_UNICODEfile is a Unicode (UTF-16) filename.

BASS has built-in support for MPEG, OGG, WAV and AIFF files. Support for additional formats is available via add-ons, which can be downloaded from the BASS website: http://www.un4seen.com/ MPEG 1.0, 2.0 and 2.5 layer 3 (MP3) files are supported, layers 1 (MP1) and 2 (MP2) are also supported. WAV files can be in standard PCM format or they can be compressed with any ACM codec, but the codec is required to be installed on the user's computer for the WAV to be decoded. So you should either distribute the codec with your software, or use a codec that comes with Windows (e.g. Microsoft ADPCM). All PCM formats from 8 to 32-bit are supported in WAV and AIFF files, but the output will be restricted to 16-bit unless the BASS_SAMPLE_FLOAT flag is used. The file's original resolution is available via GetInfo. Multi-channel (i.e. more than stereo) OGG, WAV and AIFF files are supported. Use GetInfo to retrieve information on the format (sample rate, resolution, channels) of the stream. The playback length of the stream can be retrieved using GetLength. When streaming from memory, the memory generally must not be freed before the stream is.

OSX notes: Filenames are in UTF-8 form, and the BASS_UNICODE flag has no effect. All mixing is done in software (by BASS), so the BASS_SAMPLE_SOFTWARE flag has no effect. Compressed WAV files are not supported, only standard PCM are.

CreateFileUser

Method CreateFileUser:TBassStream()

Description: Not implemented yet.

CreateURL

Method CreateURL:TBassStream(url:String, offset:Int, flags:Int, proc(buffer:Byte Ptr, length:Int, data:Object), user:Object)

Description: Creates a sample stream from an MP3, MP2, MP1, OGG, WAV, AIFF or plugin supported file on the internet, optionally receiving the downloaded data in a callback function.

CreateTStream

Method CreateTStream:TBassStream(stream:TStream, system:Int, flags:Int)

Description: Creates a standard stream.

GetFilePosition

Method GetFilePosition:Long(mode:Int)

Description: Retrieves the file position/status of a stream.

PutData

Method PutData(buffer:Byte Ptr, length:Int)

Description: Not implemented yet.

PutFileData

Method PutFileData(buffer:Byte Ptr, length:Int)

Description: Not implemented yet.

Free

Method Free:Int()

Description: Frees a sample stream's resources, including any sync/DSP/FX it has.

Returns: If successful, TRUE is returned, else FALSE is returned. Use TBass.ErrorGetCode to get the error code.

TBassStream: Functions[edit | edit source]

StreamCreate

Function StreamCreate:TBassStream(freq:Int, chans:Int, flags:Int, proc:Int(handle:TBassStream, buffer:Byte Ptr, length:Int, user:Object), user:Object)

Description: Creates a new stream.

StreamCreateFile

Function StreamCreateFile:TBassStream(filename:String, offset:Int, length:Int, flags:Int)

Description: Creates a new file stream.

StreamCreateMem

Function StreamCreateMem:TBassStream(mem:Byte Ptr, length:Long, flags:Int)

Description: Creates a sample stream from an MP3, MP2, MP1, OGG, WAV, AIFF or plugin supported file in memory.

StreamCreateFileUser

Function StreamCreateFileUser:TBassStream()

Description: Not implemented yet.

StreamCreateURL

Function StreamCreateURL:TBassStream(url:String, offset:Int, flags:Int, proc(buffer:Byte Ptr, length:Int, user:Object), data:Object)

Description: Creates a sample stream from an MP3, MP2, MP1, OGG, WAV, AIFF or plugin supported file on the internet, optionally receiving the downloaded data in a callback function.

StreamCreateTStream

Function StreamCreateTStream:TBassStream(stream:TStream, system:Int, flags:Int)

Description: Creates a standard stream.

TBassSample[edit | edit source]

An audio sample.

Methods
  • Create
  • FileLoad
  • MemLoad
  • Free
  • GetChannel
  • Stop
  • GetInfo
  • SetInfo
  • GetData
  • SetData
  • GetChannels
Functions
  • SampleCreate
  • SampleFileLoad
  • SampleMemLoad

TBassSample: Methods[edit | edit source]

Create

Method Create:TBassSample(length:Int, freq:Int, channels:Int, maxPlaybacks:Int, flags:Int)

Description: Creates a new sample.

FileLoad

Method FileLoad:TBassSample(file:String, offset:Long, length:Int, maxPlaybacks:Int, flags:Int)

Description: Loads a file sample.

MemLoad

Method MemLoad:TBassSample(mem:Byte Ptr, length:Int, maxPlaybacks:Int, flags:Int)

Description: Loads a file sample from memory.

Free

Method Free:Int()

Description: Frees a sample's resources.

Returns: If successful, TRUE is returned, else FALSE is returned. Use TBass.ErrorGetCode to get the error code.

GetChannel

Method GetChannel:TBassChannel(onlyNew:Int)

Description: Creates/initializes a playback channel for a sample.

Returns: If successful, the new channel is returned, else Null is returned. Use TBass.ErrorGetCode() to get the error code.

Information: Use GetInfo() and SetInfo() to set a sample's default attributes, which are used when creating a channel. After creation, a channel's attributes can be changed via TBassChannel::SetAttribute, TBassChannel::Set3DAttributes and TBassChannel::Set3DPosition. TBass.Apply3D should be called before starting playback of a 3D sample, even if you just want to use the default settings. A sample channel is automatically freed when it's overridden by a new channel, or when stopped by TBassChannel::Stop, TBassSample::Stop or TBass::Stop. If you wish to stop a channel and re-use it, TBassChannel::Pause should be used to pause it instead. Determining whether a channel still exists can be done by trying to use the handle in a function call. A list of all the sample's existing channels can also be retrieved via TBassSample::GetChannels. The new channel will have an initial state of being paused (BASS_ACTIVE_PAUSED). This prevents the channel being claimed by another call of this function before it has been played, unless it gets overridden due to a lack of free channels. All of a sample's channels share the same sample data, and just have their own individual playback state information (volume/position/etc). Parameters:

  • onlyNew : Do not recycle/override one of the sample's existing channels?
Stop

Method Stop:Int()

Description: Stops all instances of a sample.

Returns: If successful, TRUE is returned, else FALSE is returned. Use TBass.ErrorGetCode to get the error code.

Information: If a sample is playing simultaneously multiple times, calling this function will stop them all, which is obviously simpler than calling BASS_ChannelStop multiple times.

GetInfo

Method GetInfo:TBassSampleInfo()

Description: Retrieves a sample's default attributes and other information.

SetInfo

Method SetInfo:Int(info:TBassSampleInfo)

Description: Sets a sample's default attributes.

Returns: If successful, True is returned, else False is returned. Use TBass.ErrorGetCode to get the error code.

Information: Use this method and GetInfo() to edit a sample's default attributes. Changing a sample's default attributes does not affect any existing channels, it only affects channels subsequently created via GetChannel(). The exception is the VAM settings, changes to that apply to all the sample's channels at their next playback (TBassChannel::Play). Use TBassChannel::SetAttribute and TBassChannel::Set3DAttributes to change the attributes of an existing sample channel. The length, max, origres and chans members of TBassSampleInfo can't be modified; any changes are ignored. The BASS_SAMPLE_8BITS, BASS_SAMPLE_MONO, BASS_SAMPLE_3D, BASS_SAMPLE_MUTEMAX, BASS_SAMPLE_SOFTWARE and BASS_SAMPLE_VAM flags also can't be changed.

GetData

Method GetData:Int(buffer:Byte Ptr)

Description: Retrieves a copy of a sample's data.

Information: Parameters:

  • buffer : Pointer to a buffer to receive the data. The buffer must be big enough to receive the sample's data,
the size of which can be retrieved via GetInfo().
SetData

Method SetData:Int(buffer:Byte Ptr)

Description: Sets a sample's data.

Returns: If successful, True is returned, else False is returned. Use TBass.ErrorGetCode to get the error code.

Information: The required length and format of the data can be retrieved via GetInfo(). A sample's data can be set at any time, including during playback. Parameters:

  • buffer : Pointer to a buffer to receive the data.
GetChannels

Method GetChannels:TBassSample[]()

Description: TODO

TBassSample: Functions[edit | edit source]

SampleCreate

Function SampleCreate:TBassSample(length:Int, freq:Int, channels:Int, maxPlaybacks:Int, flags:Int)

Description: Creates a new sample.

Information: The sample's initial content is undefined. SetData() should be used to set the sample's data. Unless the BASS_SAMPLE_SOFTWARE flag is used, the sample will use hardware mixing if hardware resources are available. Use BASS_GetInfo to see if there are hardware mixing resources available, and which sample formats are supported by the hardware. The BASS_SAMPLE_VAM flag allows a sample to be played by both hardware and software, with the decision made when the sample is played rather than when it's loaded. A sample's VAM options are set via SetInfo(). To play a sample, first a channel must be obtained using GetChannel(), which can then be played using TBassChannel::Play. If you want to play a large or one-off sample, then it would probably be better to stream it instead with TBassStream::Create.

SampleFileLoad

Function SampleFileLoad:TBassSample(file:String, offset:Long, length:Int, maxPlaybacks:Int, flags:Int)

Description: Loads a file sample.

SampleMemLoad

Function SampleMemLoad:TBassSample(mem:Byte Ptr, length:Int, maxPlaybacks:Int, flags:Int)

Description: Loads a file sample from memory.

TBassSampleInfo[edit | edit source]

Used with TBassSample::GetInfo and TBassSample::SetInfo to retrieve and set the default playback attributes of a sample.

Methods
  • GetFreq
  • SetFreq
  • GetVolume
  • SetVolume
  • GetPan
  • SetPan
  • GetFlags
  • SetFlags
  • GetLength
  • GetMax
  • GetOrigRes
  • GetChans
  • GetMinGap
  • SetMinGap
  • GetMode3D
  • SetMode3D
  • GetMinDist
  • SetMinDist
  • GetMaxDist
  • SetMaxDist
  • GetIAngle
  • SetIAngle
  • GetOAngle
  • SetOAngle
  • GetOutVol
  • SetOutVol
  • GetVAM
  • SetVAM
  • GetPriority
  • SetPriority

TBassSampleInfo: Methods[edit | edit source]

GetFreq

Method GetFreq:Int()

Description: Default sample rate.

SetFreq

Method SetFreq(value:Int)

Description: Default sample rate.

GetVolume

Method GetVolume:Float()

Description: Default volume... 0 (silent) to 1 (full).

SetVolume

Method SetVolume(value:Float)

Description: Default volume... 0 (silent) to 1 (full).

GetPan

Method GetPan:Float()

Description: Default panning position... -1 (full left) to +1 (full right), 0 = centre.

SetPan

Method SetPan(value:Float)

Description: Default panning position... -1 (full left) to +1 (full right), 0 = centre.

GetFlags

Method GetFlags:Int()

Description: A combination of these flags.

Information:

ConstantDescription
BASS_SAMPLE_8BITS8-bit resolution. If neither this or the BASS_SAMPLE_FLOAT flags are present, then the sample is 16-bit.
BASS_SAMPLE_FLOAT32-bit floating-point.
BASS_SAMPLE_LOOPLooped?
BASS_SAMPLE_3DThe sample has 3D functionality enabled.
BASS_SAMPLE_MUTEMAXMute the sample when it is at (or beyond) its max distance (3D samples only).
BASS_SAMPLE_SOFTWAREThe sample is not using hardware mixing... it is being mixed in software by DirectSound.
BASS_SAMPLE_VAMDX7 voice allocation and management features are enabled (see VAM).
BASS_SAMPLE_OVER_VOLOverride: the channel with the lowest volume is overridden.
BASS_SAMPLE_OVER_POSOverride: the longest playing channel is overridden.
BASS_SAMPLE_OVER_DISTOverride: the channel furthest away (from the listener) is overridden (3D samples only).
SetFlags

Method SetFlags(flags:Int)

Description: A combination of these flags.

Information:

ConstantDescription
BASS_SAMPLE_8BITS8-bit resolution. If neither this or the BASS_SAMPLE_FLOAT flags are present, then the sample is 16-bit.
BASS_SAMPLE_FLOAT32-bit floating-point.
BASS_SAMPLE_LOOPLooped?
BASS_SAMPLE_3DThe sample has 3D functionality enabled.
BASS_SAMPLE_MUTEMAXMute the sample when it is at (or beyond) its max distance (3D samples only).
BASS_SAMPLE_SOFTWAREThe sample is not using hardware mixing... it is being mixed in software by DirectSound.
BASS_SAMPLE_VAMDX7 voice allocation and management features are enabled (see VAM).
BASS_SAMPLE_OVER_VOLOverride: the channel with the lowest volume is overridden.
BASS_SAMPLE_OVER_POSOverride: the longest playing channel is overridden.
BASS_SAMPLE_OVER_DISTOverride: the channel furthest away (from the listener) is overridden (3D samples only).
GetLength

Method GetLength:Int()

Description: The length in bytes.

GetMax

Method GetMax:Int()

Description: Maximum number of simultaneous playbacks.

GetOrigRes

Method GetOrigRes:Int()

Description: The original resolution (bits per sample)... 0 = undefined.

GetChans

Method GetChans:Int()

Description: Number of channels... 1 = mono, 2 = stereo, etc...

GetMinGap

Method GetMinGap:Int()

Description: Minimum time gap in milliseconds between creating channels using TBassSample.GetChannel.

Information: This can be used to prevent flanging effects caused by playing a sample multiple times very close to each other. The default setting, after loading/creating a sample, is 0 (disabled).

SetMinGap

Method SetMinGap(value:Int)

Description: Minimum time gap in milliseconds between creating channels using TBassSample.GetChannel.

Information: This can be used to prevent flanging effects caused by playing a sample multiple times very close to each other. The default setting, after loading/creating a sample, is 0 (disabled).

GetMode3D

Method GetMode3D:Int()

Description: The 3D processing mode... one of these flags.

Information:

ConstantDescription
BASS_3DMODE_NORMALNormal 3D processing.
BASS_3DMODE_RELATIVEThe sample's 3D position (position/velocity/orientation) is relative to the

listener. When the listener's position/velocity/orientation is changed with BASS_Set3DPosition, the sample's

position relative to the listener does not change.
BASS_3DMODE_OFFTurn off 3D processing on the sample, the sound will be played in the center.
SetMode3D

Method SetMode3D(value:Int)

Description: The 3D processing mode... one of these flags.

Information:

ConstantDescription
BASS_3DMODE_NORMALNormal 3D processing.
BASS_3DMODE_RELATIVEThe sample's 3D position (position/velocity/orientation) is relative to the

listener. When the listener's position/velocity/orientation is changed with BASS_Set3DPosition, the sample's

position relative to the listener does not change.
BASS_3DMODE_OFFTurn off 3D processing on the sample, the sound will be played in the center.
GetMinDist

Method GetMinDist:Float()

Description: The minimum distance.

Information: The sample's volume is at maximum when the listener is within this distance.

SetMinDist

Method SetMinDist(value:Float)

Description: The minimum distance.

Information: The sample's volume is at maximum when the listener is within this distance.

GetMaxDist

Method GetMaxDist:Float()

Description: The maximum distance.

Information: The sample's volume stops decreasing when the listener is beyond this distance.

SetMaxDist

Method SetMaxDist(value:Float)

Description: The maximum distance.

Information: The sample's volume stops decreasing when the listener is beyond this distance.

GetIAngle

Method GetIAngle:Int()

Description: The angle of the inside projection cone in degrees... 0 (no cone) to 360 (sphere).

SetIAngle

Method SetIAngle(value:Int)

Description: The angle of the inside projection cone in degrees... 0 (no cone) to 360 (sphere).

GetOAngle

Method GetOAngle:Int()

Description: The angle of the outside projection cone in degrees... 0 (no cone) to 360 (sphere).

SetOAngle

Method SetOAngle(value:Int)

Description: The angle of the outside projection cone in degrees... 0 (no cone) to 360 (sphere).

GetOutVol

Method GetOutVol:Float()

Description: The delta-volume outside the outer projection cone... 0 (silent) to 1 (full).

SetOutVol

Method SetOutVol(value:Float)

Description: The delta-volume outside the outer projection cone... 0 (silent) to 1 (full).

GetVAM

Method GetVAM:Int()

Description: Voice allocation/management flags... a combination of these

ConstantDescription
BASS_VAM_HARDWAREPlay the sample in hardware. If no hardware voices are available then the play call will fail.
BASS_VAM_SOFTWAREPlay the sample in software (i.e. non-accelerated). No other VAM flags may be used together with this flag.
BASS_VAM_TERM_TIMEIf there are no free hardware voices, the buffer to be terminated will be the one with the least time left to play. (Note: This flag enables hardware resource stealing... if the hardware has no available voices, a currently playing buffer will be stopped to make room for the new buffer. Only samples with VAM enabled are considered for termination.)
BASS_VAM_TERM_DISTIf there are no free hardware voices, the buffer to be terminated will be one that

was loaded/created with the BASS_SAMPLE_MUTEMAX flag and is beyond its max distance (maxdist). If there are no buffers

that match this criteria, then the play call will fail. (Note: This flag enables hardware resource stealing... if the hardware has no available voices, a currently playing buffer will be stopped to make room for the new buffer. Only samples with VAM enabled are considered for termination.)
BASS_VAM_TERM_PRIOIf there are no free hardware voices, the buffer to be terminated will be the one

with the lowest priority. This flag may be used with the TERM_TIME or TERM_DIST flag, if multiple voices have the same

priority then the time or distance is used to decide which to terminate. (Note: This flag enables hardware resource stealing... if the hardware has no available voices, a currently playing buffer will be stopped to make room for the new buffer. Only samples with VAM enabled are considered for termination.)
SetVAM

Method SetVAM(value:Int)

Description: Voice allocation/management flags... a combination of these

ConstantDescription
BASS_VAM_HARDWAREPlay the sample in hardware. If no hardware voices are available then the play call will fail.
BASS_VAM_SOFTWAREPlay the sample in software (i.e. non-accelerated). No other VAM flags may be used together with this flag.
BASS_VAM_TERM_TIMEIf there are no free hardware voices, the buffer to be terminated will be the one with the least time left to play. (Note: This flag enables hardware resource stealing... if the hardware has no available voices, a currently playing buffer will be stopped to make room for the new buffer. Only samples with VAM enabled are considered for termination.)
BASS_VAM_TERM_DISTIf there are no free hardware voices, the buffer to be terminated will be one that

was loaded/created with the BASS_SAMPLE_MUTEMAX flag and is beyond its max distance (maxdist). If there are no buffers

that match this criteria, then the play call will fail. (Note: This flag enables hardware resource stealing... if the hardware has no available voices, a currently playing buffer will be stopped to make room for the new buffer. Only samples with VAM enabled are considered for termination.)
BASS_VAM_TERM_PRIOIf there are no free hardware voices, the buffer to be terminated will be the one with the lowest priority. This flag may be used with the TERM_TIME or TERM_DIST flag, if multiple voices have the same priority then the time or distance is used to decide which to terminate. (Note: This flag enables hardware resource stealing... if the hardware has no available voices, a currently playing buffer will be stopped to make room for the new buffer. Only samples with VAM enabled are considered for termination.)
GetPriority

Method GetPriority:Int()

Description: Priority, used with the BASS_VAM_TERM_PRIO flag... 0 (min) to $FFFFFFFF (max).

SetPriority

Method SetPriority(value:Int)

Description: Priority, used with the BASS_VAM_TERM_PRIO flag... 0 (min) to $FFFFFFFF (max).

TBassMusic[edit | edit source]

A Mod music file : MO3 / IT / XM / S3M / MTM / MOD / UMX formats.

Methods
  • FileLoad
  • MemLoad
  • Free
Functions
  • MusicFileLoad
  • MusicMemLoad

TBassMusic: Methods[edit | edit source]

FileLoad

Method FileLoad:TBassMusic(file:String, offset:Long, length:Int, flags:Int, freq:Int)

Description: Loads a MOD music file; MO3 / IT / XM / S3M / MTM / MOD / UMX formats.

Returns: If successful, the loaded MOD music's handle is returned, else Null is returned. Use TBass.ErrorGetCode to get the error code.

MemLoad

Method MemLoad:TBassMusic(mem:Byte Ptr, length:Int, flags:Int, freq:Int)

Description: Loads a MOD music file from memory; MO3 / IT / XM / S3M / MTM / MOD / UMX formats.

Returns: If successful, the loaded MOD music's handle is returned, else Null is returned. Use TBass.ErrorGetCode to get the error code.

Free

Method Free:Int()

Description: Frees a MOD music's resources, including any sync/DSP/FX it has.

Returns: If successful, TRUE is returned, else FALSE is returned. Use TBass.ErrorGetCode to get the error code.

TBassMusic: Functions[edit | edit source]

MusicFileLoad

Function MusicFileLoad:TBassMusic(file:String, offset:Long, length:Int, flags:Int, freq:Int)

Description: Loads a MOD music file; MO3 / IT / XM / S3M / MTM / MOD / UMX formats.

Returns: If successful, the loaded MOD music's handle is returned, else Null is returned. Use TBass.ErrorGetCode to get the error code.

Information: Parameters:

  • file : Filename
  • offset : File offset to load the MOD music from
  • length : Data length... 0 = use all data up to the end of file
  • flags : A combination of these flags.
ConstantDescription
BASS_SAMPLE_8BITSUse 8-bit resolution. If neither this or the BASS_SAMPLE_FLOAT flags are specified, then the sample data will be 16-bit.
BASS_SAMPLE_FLOATUse 32-bit floating-point sample data. See Floating-point channels for info.
BASS_SAMPLE_MONODecode/play the MOD music in mono (uses less CPU than stereo). This flag is automatically applied if BASS_DEVICE_MONO was specified when calling BASS_Init.
BASS_SAMPLE_SOFTWAREForce the MOD music to not use hardware mixing.
BASS_SAMPLE_3DEnable 3D functionality. This requires that the BASS_DEVICE_3D flag was specified when calling BASS_Init. 3D channels must also be mono, so BASS_SAMPLE_MONO is automatically applied. The SPEAKER flags can not be used together with this flag.
BASS_SAMPLE_FXEnable the old implementation of DirectX 8 effects. See the DX8 effect implementations section for details. Use BASS_ChannelSetFX to add effects to the music.
BASS_SAMPLE_LOOPLoop the music.
BASS_MUSIC_NONINTERUse non-interpolated sample mixing. This generally reduces the sound quality, but can be good for chip-tunes.
BASS_MUSIC_SINCINTERUse sinc interpolated sample mixing. This increases the sound quality, but also requires more processing. If neither this or the BASS_MUSIC_NONINTER flag is specified, linear interpolation is used.
BASS_MUSIC_RAMPUse "normal" ramping (as used in FastTracker 2).
BASS_MUSIC_RAMPSUse "sensitive" ramping.
BASS_MUSIC_SURROUNDApply XMPlay's surround sound to the music (ignored in mono).
BASS_MUSIC_SURROUND2Apply XMPlay's surround sound mode 2 to the music (ignored in mono).
BASS_MUSIC_FT2MODPlay .MOD file as FastTracker 2 would.
BASS_MUSIC_PT1MODPlay .MOD file as ProTracker 1 would.
BASS_MUSIC_POSRESETStop all notes when seeking (BASS_ChannelSetPosition).
BASS_MUSIC_POSRESETEXStop all notes and reset bpm/etc when seeking.
BASS_MUSIC_STOPBACKStop the music when a backward jump effect is played. This stops musics that never reach the end from going into endless loops. Some MOD musics are designed to jump all over the place, so this flag would cause those to be stopped prematurely. If this flag is used together with the BASS_SAMPLE_LOOP flag, then the music would not be stopped but any BASS_SYNC_END sync would be triggered.
BASS_MUSIC_PRESCANCalculate the playback length of the music, and enable seeking in bytes. This slightly increases the time taken to load the music, depending on how long it is. In the case of musics that loop, the length until the loop occurs is calculated. Use BASS_ChannelGetLength to retrieve the length.
BASS_MUSIC_NOSAMPLEDon't load the samples. This reduces the time (and memory) taken to load the music, notably with MO3 files, which is useful if you just want to get the text and/or length of the music without playing it.
BASS_MUSIC_AUTOFREEAutomatically free the music when playback ends. Note that some musics have infinite loops, so never actually end on their own.
BASS_MUSIC_DECODEDecode/render the sample data, without playing it. Use BASS_ChannelGetData to retrieve decoded sample data. The BASS_SAMPLE_3D, BASS_STREAM_AUTOFREE and SPEAKER flags can not be used together with this flag. The BASS_SAMPLE_SOFTWARE and BASS_SAMPLE_FX flags are also ignored.
BASS_SPEAKER_xxxSpeaker assignment flags. The BASS_SAMPLE_MONO flag is automatically applied when using a mono speaker assignment flag.
BASS_UNICODEfile is a Unicode (UTF-16) filename.
  • freq : Sample rate to render/play the MOD music at... 0 = the rate specified in the TBass.Init call.

BASS uses the same code as XMPlay for its MOD music support, giving the most accurate reproduction of MO3 / IT / XM / S3M / MTM / MOD / UMX files available. MO3s are treated and used in exactly the same way as normal MOD musics. The advantage of MO3s is that they can be a lot smaller with virtually identical quality. Playing a MO3 does not use any more CPU power than playing the original MOD version does. The only difference is a slightly longer load time as the samples are being decoded. MO3 files are created using the MO3 encoder available at the BASS website. DMO effects (the same as available with BASS_ChannelSetFX) can be used in IT and XM files (and MO3 versions of them) created with Modplug Tracker. This allows effects to be added to a track without having to resort to an MP3 or OGG version, so it can remain small and still sound fancy. Of course, the effects require some CPU, so should not be used carelessly if performance is key. DirectX 8 (or above) is required for the effects to be heard; without that, the music can still be played, but the effects are disabled. Ramping doesn't take a lot of extra processing and improves the sound quality by removing "clicks". Sensitive ramping leaves sharp attacked samples, while normal ramping can cause them to lose a bit of their impact. Generally, normal ramping is recommended for XMs, and sensitive ramping for the other formats. But, some XMs may also sound better using sensitive ramping. After loading a MOD music from memory (mem = TRUE), the memory can safely be discarded.

OSX notes: Filenames are in UTF-8 form, and the BASS_UNICODE flag has no effect. All mixing is done in software (by BASS), so the BASS_SAMPLE_SOFTWARE flag has no effect.

MusicMemLoad

Function MusicMemLoad:TBassMusic(mem:Byte Ptr, length:Int, flags:Int, freq:Int)

Description: Loads a MOD music file from memory; MO3 / IT / XM / S3M / MTM / MOD / UMX formats.

Returns: If successful, the loaded MOD music's handle is returned, else Null is returned. Use TBass.ErrorGetCode to get the error code.

TBassChannelInfo[edit | edit source]

Used with TBassChannel.GetInfo to retrieve information on a channel.

The BASS_SAMPLE_SOFTWARE flag indicates whether or not the channel's sample data is being mixed into the final output by the hardware. It does not indicate (in the case of a stream or MOD music) whether the processing required to generate the sample data is being done by the hardware, this processing is always done in software.

With a recording channel, the BASS_STREAM_DECODE flag indicates that it's not using a RECORDPROC callback function.

BASS supports 8/16/32-bit sample data, so if a WAV file, for example, uses another sample resolution, it'll have to be converted by BASS. The origres member can be used to check what the resolution originally was.

Methods
  • GetFreq
  • GetChannels
  • GetFlags
  • GetCType
  • GetOrigRes
  • GetSample
  • GetFilename

TBassChannelInfo: Methods[edit | edit source]

GetFreq

Method GetFreq:Int()

Description: Default playback rate.

GetChannels

Method GetChannels:Int()

Description: Number of channels... 1=mono, 2=stereo, etc...

GetFlags

Method GetFlags:Int()

Description: A combination of these flags.

Information:

ConstantDescription
BASS_SAMPLE_8BITSThe channel's resolution is 8-bit. If neither this or the BASS_SAMPLE_FLOAT flags are present, then the channel's resolution is 16-bit.
BASS_SAMPLE_FLOATThe channel's resolution is 32-bit floating-point.
BASS_SAMPLE_LOOPThe channel is looped.
BASS_SAMPLE_3DThe channel has 3D functionality enabled.
BASS_SAMPLE_SOFTWAREThe channel is NOT using hardware mixing.
BASS_SAMPLE_VAMThe channel is using the DX7 voice allocation and management features. (HCHANNEL only)
BASS_SAMPLE_MUTEMAXThe channel is muted when at (or beyond) its max distance. (HCHANNEL)
BASS_SAMPLE_FXThe channel has the "with FX flag" DX8 effect implementation enabled. (HSTREAM/HMUSIC)
BASS_STREAM_RESTRATEThe internet file download rate is restricted. (HSTREAM)
BASS_STREAM_BLOCKThe internet file (or "buffered" user file) is streamed in small blocks. (HSTREAM)
BASS_STREAM_AUTOFREEThe channel will automatically be freed when it ends. (HSTREAM/HMUSIC)
BASS_STREAM_DECODEThe channel is a "decoding channel". (HSTREAM/HMUSIC/HRECORD)
BASS_MUSIC_RAMPThe MOD music is using "normal" ramping. (HMUSIC)
BASS_MUSIC_RAMPSThe MOD music is using "sensitive" ramping. (HMUSIC)
BASS_MUSIC_SURROUNDThe MOD music is using surround sound. (HMUSIC)
BASS_MUSIC_SURROUND2The MOD music is using surround sound mode 2. (HMUSIC)
BASS_MUSIC_NONINTERThe MOD music is using non-interpolated mixing. (HMUSIC)
BASS_MUSIC_FT2MODThe MOD music is using FastTracker 2 .MOD playback. (HMUSIC)
BASS_MUSIC_PT1MODThe MOD music is using ProTracker 1 .MOD playback. (HMUSIC)
BASS_MUSIC_STOPBACKThe MOD music will be stopped when a backward jump effect is played. (HMUSIC)
BASS_SPEAKER_xxxSpeaker assignment flags. (HSTREAM/HMUSIC)
BASS_UNICODEfilename is a Unicode (UTF-16) filename.
GetCType

Method GetCType:Int()

Description: The type of channel it is, which can be one of the following.

Information:

ConstantDescription
BASS_CTYPE_SAMPLESample channel. (HCHANNEL)
BASS_CTYPE_STREAMUser sample stream. This can also be used as a flag to test if the channel is any kind of HSTREAM.
BASS_CTYPE_STREAM_OGGOgg Vorbis format stream.
BASS_CTYPE_STREAM_MP1MPEG layer 1 format stream.
BASS_CTYPE_STREAM_MP2MPEG layer 2 format stream.
BASS_CTYPE_STREAM_MP3MPEG layer 3 format stream.
BASS_CTYPE_STREAM_AIFFAudio IFF format stream.
BASS_CTYPE_STREAM_WAV_PCMInteger PCM WAVE format stream.
BASS_CTYPE_STREAM_WAV_FLOATFloating-point PCM WAVE format stream.
BASS_CTYPE_STREAM_WAVWAVE format flag. This can be used to test if the channel is any kind of WAVE format. The codec (the file's "wFormatTag") is specified in the LOWORD.
BASS_CTYPE_MUSIC_MODGeneric MOD format music. This can also be used as a flag to test if the channel is any kind of HMUSIC.
BASS_CTYPE_MUSIC_MTMMultiTracker format music.
BASS_CTYPE_MUSIC_S3MScreamTracker 3 format music.
BASS_CTYPE_MUSIC_XMFastTracker 2 format music.
BASS_CTYPE_MUSIC_ITImpulse Tracker format music.
BASS_CTYPE_MUSIC_MO3MO3 format flag, used in combination with one of the BASS_CTYPE_MUSIC types.
BASS_CTYPE_RECORDRecording channel. (HRECORD)
GetOrigRes

Method GetOrigRes:Int()

Description: The original resolution (bits per sample)... 0 = undefined.

GetSample

Method GetSample:TBassSample()

Description: The sample that is playing on the channel. (HCHANNEL only)

GetFilename

Method GetFilename:String()

Description: The filename associated with the channel. (HSTREAM only)

TBass[edit | edit source]

Bass data type.

Functions
  • Free
  • Init
  • ErrorGetCode
  • GetVolume
  • SetVolume
  • Start
  • SetDevice
  • GetDevice
  • GetCPU
  • Pause
  • GetVersion
  • Update
  • GetDeviceInfo
  • GetConfig
  • SetConfig
  • Apply3D
  • GetEAXParameters
  • SetEAXParameters
  • Get3DFactors
  • Set3DFactors
  • GetInfo
  • PluginLoad

TBass: Functions[edit | edit source]

Free

Function Free:Int()

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

Init

Function Init:Int(device:Int, freq:Int, flags:Int, win:Byte Ptr = Null, clsid:Byte Ptr = Null)

Description: Initializes an output device.

Returns: If the device was successfully initialized, True is returned, else False is returned. Use TBass.ErrorGetCode to get the error code.

Information: 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. The "no sound" device allows loading and playing of MOD musics, but most other functions will fail. This is so that you can still use MOD musics as synchronizers when there is no soundcard present (or without DirectX installed). Decoding channels can also still be used with the "no sound" device. When using the "no sound" device, you should still set the other parameters as you would do normally. The format (sample rate, etc...) specified when calling this function only actually has effect on the device's output with VxD drivers. With WDM drivers, the output format is automatically set depending on the format of the channels that are played and what the device supports. While in Vista, the output format is determined by the user's choice in the control panel; BASS_GetInfo can be used to check what that is. For reference... Windows XP/2000 use only WDM drivers. Windows Me/98SE can use either WDM or the older VxD driver model. Windows 98/95 only use VxD drivers. When specifying a class identifier (clsid), after successful initialization, you can use BASS_GetDSoundObject to retrieve the DirectSound object, and through that access any special interfaces that the object may provide. 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, BASS_Init 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.

OSX notes: The win and clsid parameters are not used. The BASS_DEVICE_LATENCY, BASS_DEVICE_CPSPEAKERS and BASS_DEVICE_SPEAKERS flags are also ignored; the latency is calculated automatically and the number of speakers is always detected accurately. The sample format specified has no effect on the device output; BASS_GetInfo can be used to check what that is.

ErrorGetCode

Function ErrorGetCode:Int()

Description: Retrieves the error code for the most recent BASS function call in the current thread.

GetVolume

Function GetVolume:Float()

Description: Retrieves the current master volume level.

Returns: If successful, the volume level is returned, else -1 is returned. Use TBass.ErrorGetCode to get the error code.

SetVolume

Function SetVolume:Int(volume:Float)

Description: Sets the output master volume.

Returns: If successful, then TRUE is returned, else FALSE is returned. Use TBass.ErrorGetCode to get the error code.

Information: The actual volume level may not be exactly the same as requested, due to underlying precision differences. BASS_GetVolume can be used to confirm what the volume is. This function affects the volume level of all applications using the same output device. If you wish to only affect the level of your application's sounds, the BASS_ATTRIB_VOL attribute and/or the BASS_CONFIG_GVOL_MUSIC / BASS_CONFIG_GVOL_SAMPLE / BASS_CONFIG_GVOL_STREAM config options should be used instead. When using multiple devices, the current thread's device setting (as set with BASS_SetDevice) determines which device this function call applies to.

Start

Function Start:Int()

Description: Starts (or resumes) the output.

Returns: If successful, then True is returned, else False is returned. Use TBass.ErrorGetCode to get the error code.

Information: The output is automatically started by TBass.Init, so there is no need to use this function unless you've stopped or paused the output. When using multiple devices, the current thread's device setting (as set with TBass.SetDevice) determines which device this function call applies to.

SetDevice

Function SetDevice:Int(device:Int)

Description: Sets the device to use for subsequent calls.

Returns: If successful, then TRUE is returned, else FALSE is returned. Use BASS_ErrorGetCode to get the error code.

Information: 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. The functions that use the device selection are the following: Free, GetDSoundObject, GetInfo, Start, Stop, Pause, SetVolume, GetVolume, Set3DFactors, Get3DFactors, Set3DPosition, Get3DPosition, SetEAXParameters, GetEAXParameters. It also determines which device is used by a new sample/stream/music: BASS_MusicLoad, BASS_SampleLoad, BASS_StreamCreateFile, etc... When one of the above functions (or GetDevice) is called, BASS will check the device setting, and if no device is selected (or the selected device is not initialized), BASS will automatically select the lowest device that is initialized. This means that when using a single device, there is no need to use this function; BASS will automatically use the device that's initialized. Even if you free the device, and initialize another, BASS will automatically switch to the one that is initialized. Parameters:

  • device : The device to use... 0 = no sound, 1 = first real output device.
GetDevice

Function GetDevice:Int()

Description: Retrieves the device setting of the current thread.

Returns: If successful, the device number is returned, else -1 is returned. Use TBass.ErrorGetCode to get the error code.

GetCPU

Function GetCPU:Float()

Description: Retrieves the current CPU usage of BASS.

Returns: The BASS CPU usage as a percentage of total CPU time.

Information: This function includes the time taken to render stream (TBassStream) and MOD music (TBassMusic) channels during playback, and any DSP functions set on those channels. It does not include sample (TBassSample) channels, which are mixed by the output device (hardware accelerated) or DirectSound/drivers. The rendering of some add-on stream formats may not be entirely included, if they use additional decoding threads. See the add-on documentation for details. This function does not strictly tell the CPU usage, but rather how timely the buffer updates are. For example, if it takes 10ms to render 100ms of data, that would be 10. If the reported usage gets to 100, that means the channel data is being played faster than it can be rendered, and buffer underruns are likely to occur. If automatic updating is disabled, then the value returned by this function is only updated after each call to Update. TBassChannel.Update usage is not included.

OSX notes: The CPU usage does include sample playback.

Pause

Function Pause:Int()

Description: Stops the output, pausing all musics/samples/streams.

Returns: If successful, then TRUE is returned, else FALSE is returned. Use TBass.ErrorGetCode to get the error code.

Information: Use Start to resume the output and paused channels. When using multiple devices, the current thread's device setting (as set with SetDevice) determines which device this function call applies to.

GetVersion

Function GetVersion:Int()

Description: Retrieves the version of BASS that is loaded.

Returns: The BASS version. For example, 0x02040103 (hex), would be version 2.4.1.3

Information: There is no guarantee that a previous or future version of BASS supports all the BASS functions that you are using, so you should always use this function to make sure the correct version is loaded. It is safe to assume that future revisions (indicated in the LOWORD) will be fully compatible. The BASS API includes a BASSVERSION constant, which can be used to check that the loaded BASS.DLL matches the API version used, ignoring revisions.

Update

Function Update:Int(length:Int)

Description: Manually updates the TBassStream and TBassMusic channel playback buffers.

Returns: If successful, TRUE is returned, else FALSE is returned. Use TBass.ErrorGetCode to get the error code.

Information: Parameters:

  • length : The amount to render, in milliseconds.

When automatic updating is disabled, this function (or TBassChannel.Update) needs to be called 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.

GetDeviceInfo

Function GetDeviceInfo:TBassDeviceInfo(device:Int)

Description: Retrieves information on an output device.

Returns: If successful, then TRUE is returned, else FALSE is returned. Use TBass.ErrorGetCode to get the error code.

Information: This method can be used to enumerate the available devices for a setup dialog. Device 0 is always the "no sound" device, so if you should start at device 1 if you only want to list real devices.

GetConfig

Function GetConfig:Int(option:Int)

Description: Retrieves the value of a config option.

Returns: If successful, the value of the requested config option is returned, else -1 is returned. Use TBass.ErrorGetCode to get the error code.

Information: Retrieves the value of a config option. Parameters:

  • option :
ConstantDescription
BASS_CONFIG_3DALGORITHMThe 3D algorithm for software mixed 3D channels.
BASS_CONFIG_BUFFERPlayback buffer length.
BASS_CONFIG_CURVE_PANPanning translation curve.
BASS_CONFIG_CURVE_VOLVolume translation curve.
BASS_CONFIG_FLOATDSPPass 32-bit floating-point sample data to all DSP functions?
BASS_CONFIG_GVOL_MUSICGlobal MOD music volume.
BASS_CONFIG_GVOL_SAMPLEGlobal sample volume.
BASS_CONFIG_GVOL_STREAMGlobal stream volume.
BASS_CONFIG_MUSIC_VIRTUALIT virtual channels.
BASS_CONFIG_NET_BUFFERInternet download buffer length.
BASS_CONFIG_NET_PASSIVEUse passive mode in FTP connections?
BASS_CONFIG_NET_PLAYLISTProcess URLs in playlists?
BASS_CONFIG_NET_PREBUFAmount to pre-buffer when opening internet streams.
BASS_CONFIG_NET_TIMEOUTTime to wait for a server to respond to a connection request.
BASS_CONFIG_PAUSE_NOPLAYPrevent channels being played when the output is paused?
BASS_CONFIG_REC_BUFFERRecording buffer length.
BASS_CONFIG_UPDATEPERIODUpdate period of playback buffers.
BASS_CONFIG_UPDATETHREADSNumber of update threads.
BASS_CONFIG_VERIFYFile format verification length.
SetConfig

Function SetConfig:Int(option:Int, value:Int)

Description: Sets the value of a config option.

Returns: If successful, TRUE is returned, else FALSE is returned. Use TBass.ErrorGetCode to get the error code.

Information: The option to set the value of... one of the following. Parameters:

  • option :
ConstantDescription
BASS_CONFIG_3DALGORITHMThe 3D algorithm for software mixed 3D channels.
BASS_CONFIG_BUFFERPlayback buffer length.
BASS_CONFIG_CURVE_PANPanning translation curve.
BASS_CONFIG_CURVE_VOLVolume translation curve.
BASS_CONFIG_FLOATDSPPass 32-bit floating-point sample data to all DSP functions?
BASS_CONFIG_GVOL_MUSICGlobal MOD music volume.
BASS_CONFIG_GVOL_SAMPLEGlobal sample volume.
BASS_CONFIG_GVOL_STREAMGlobal stream volume.
BASS_CONFIG_MUSIC_VIRTUALIT virtual channels.
BASS_CONFIG_NET_BUFFERInternet download buffer length.
BASS_CONFIG_NET_PASSIVEUse passive mode in FTP connections?
BASS_CONFIG_NET_PLAYLISTProcess URLs in playlists?
BASS_CONFIG_NET_PREBUFAmount to pre-buffer when opening internet streams.
BASS_CONFIG_NET_TIMEOUTTime to wait for a server to respond to a connection request.
BASS_CONFIG_PAUSE_NOPLAYPrevent channels being played when the output is paused?
BASS_CONFIG_REC_BUFFERRecording buffer length.
BASS_CONFIG_UPDATEPERIODUpdate period of playback buffers.
BASS_CONFIG_UPDATETHREADSNumber of update threads.
BASS_CONFIG_VERIFYFile format verification length.
  • value : The new option setting. See the option's documentation for details on the possible values.
Apply3D

Function Apply3D()

Description: Applies changes made to the 3D system.

Information: This function must be called to apply any changes made with TBass.Set3DFactors, TBass.Set3DPosition, TBassChannel.Set3DAttributes or TBassChannel.Set3DPosition. This allows multiple changes to be synchronized, and also improves performance. This function applies 3D changes on all the initialized devices. There is no need to re-call it for each individual device when using multiple devices.

GetEAXParameters

Function GetEAXParameters:Int(env:Int Var, vol:Float Var, decay:Float Var, damp:Float Var)

Description: Retrieves the current type of EAX environment and its parameters.

Returns: If successful, then TRUE is returned, else FALSE is returned. Use TBass.ErrorGetCode to get the error code.

SetEAXParameters

Function SetEAXParameters:Int(env:Int, vol:Float, decay:Float, damp:Float)

Description: Sets the type of EAX environment and its parameters.

Returns: If successful, then TRUE is returned, else FALSE is returned. Use TBass.ErrorGetCode to get the error code.

Get3DFactors

Function Get3DFactors:Int(distf:Float Var, rollf:Float Var, doppf:Float Var)

Description: Retrieves the factors that affect the calculations of 3D sound.

Returns: If successful, then TRUE is returned, else FALSE is returned. Use TBass.ErrorGetCode to get the error code.

Information: Parameters:

  • distf : The distance factor
  • rollf : The rolloff factor
  • doppf : The doppler factor

When using multiple devices, the current thread's device setting (as set with BASS_SetDevice) determines which device this function call applies to.

Set3DFactors

Function Set3DFactors:Int(distf:Float, rollf:Float, doppf:Float)

Description: Sets the factors that affect the calculations of 3D sound.

Returns: If successful, then TRUE is returned, else FALSE is returned. Use TBass.ErrorGetCode to get the error code.

Information: Parameters

  • distf : The distance factor... 0 or less = leave current... examples: 1.0 = use meters,

0.9144 = use yards, 0.3048 = use feet. By default BASS measures distances in meters, you can change this

setting if you are using a different unit of measurement.
  • rollf : The rolloff factor, how fast the sound quietens with distance... 0.0 (min) - 10.0 (max),

less than 0.0 = leave current...

examples: 0.0 = no rolloff, 1.0 = real world, 2.0 = 2x real.
  • doppf : The doppler factor... 0.0 (min) - 10.0 (max), less than 0.0 = leave current... examples:

0.0 = no doppler, 1.0 = real world, 2.0 = 2x real. The doppler effect is the way a sound appears to change pitch when it is moving towards or away from you. The listener and sound velocity settings are used to

calculate this effect, this doppf value can be used to lessen or exaggerate the effect.

As with all 3D functions, use Apply3D to apply the changes. When using multiple devices, the current thread's device setting (as set with BASS_SetDevice) determines which device this function call applies to.

GetInfo

Function GetInfo:TBassInfo()

Description: Retrieves information on the device being used.

Returns: If successful, a TBassInfo object is returned, otherwise Null.

Information: When using multiple devices, the current thread's device setting (as set with BASS_SetDevice) determines which device this function call applies to.

PluginLoad

Function PluginLoad:Int(file:String, flags:Int)

Description: Plugs an "add-on" into the standard stream and sample creation functions.

TBassDeviceInfo[edit | edit source]

Used with TBass.GetDeviceInfo or TBassRecord.GetDeviceInfo to retrieve information on a device.

When a device is disabled/disconnected, it is still retained in the device list, but the BASS_DEVICE_ENABLED flag is removed from it. If the device is subsequently re-enabled, it may become available again with the same device number, or the system may add a new entry for it.

When a new device is connected, it can affect the other devices and result in the system moving them to new device entries. If an affected device is initialized, it will stop working and will need to be reinitialized using its new device number.

OSX notes: driver is not used.

Methods
  • GetName
  • GetDriver
  • GetFlags

TBassDeviceInfo: Methods[edit | edit source]

GetName

Method GetName:String()

Description: Description of the device.

GetDriver

Method GetDriver:String()

Description: The filename of the driver... NULL = no driver ("no sound" device).

Information: On systems that can use both VxD and WDM drivers (Windows Me/98SE), this will reveal which type of driver is being used. Further information can be obtained from the file using the GetFileVersionInfo Win32 API function.

GetFlags

Method GetFlags:Int()

Description: The device's current status... a combination of these flags.

TBassRecord[edit | edit source]

Bass recording type.

Methods
  • Start
Functions
  • RecordStart
  • Free
  • GetRecordDevice
  • Init
  • SetDevice
  • SetInput
  • GetInput
  • GetInputName
  • GetRecordInfo

TBassRecord: Methods[edit | edit source]

Start

Method Start:TBassRecord(freq:Int, chans:Int, flags:Int, proc:Int(handle:TBassRecord, buffer:Byte Ptr, length:Int, user:Object), user:Object)

Description: Starts a new recording.

TBassRecord: Functions[edit | edit source]

RecordStart

Function RecordStart:TBassRecord(freq:Int, chans:Int, flags:Int, proc:Int(handle:TBassRecord, buffer:Byte Ptr, length:Int, user:Object), user:Object)

Description: Starts a new recording.

Free

Function Free:Int()

Description: Frees a recording's resources.

GetRecordDevice

Function GetRecordDevice:Int()

Description: Get the current recording device.

Init

Function Init:Int(device:Int)

Description: Initializes a recording device.

SetDevice

Function SetDevice:Int(device:Int)

Description: Sets the recording device to use for subsequent calls in the current thread.

SetInput

Function SetInput:Int(inp:Int, flags:Int, volume:Float)

Description: Sets the settings for a recording input source.

GetInput

Function GetInput:Int(inp:Int, volume:Float Var)

Description: Retrieves the current settings of a recording input source.

GetInputName

Function GetInputName:String(inp:Int)

Description: Retrieves the text description of a recording input source.

GetRecordInfo

Function GetRecordInfo:TBassRecordInfo()

Description: Gets the current recording information.

TBassRecordInfo[edit | edit source]

Bass recording information type.

The formats member does not represent all the formats supported by the device, just the "standard" ones.

If there is no DirectSound driver for the device (i.e. it's being emulated), then the driver member will contain something like "WaveIn" instead of a filename.

OSX notes: The flags and formats members are not used. singlein is always TRUE.

Methods
  • GetFlags
  • GetFormats
  • GetInputs
  • IsSingleIn
  • GetFreq

TBassRecordInfo: Methods[edit | edit source]

GetFlags

Method GetFlags:Int()

Description: The device's capabilities... a combination of these flags.

Information:

ConstantDescription
DSCCAPS_EMULDRIVERThe device's drivers do NOT have DirectSound recording support, so it is being emulated.
DSCCAPS_CERTIFIEDThe device driver has been certified by Microsoft.
GetFormats

Method GetFormats:Int()

Description: The standard formats supported by the device... a combination of these flags.

Information:

ConstantDescription
WAVE_FORMAT_1M0811025Hz, Mono, 8-bit
WAVE_FORMAT_1S0811025Hz, Stereo, 8-bit
WAVE_FORMAT_1M1611025Hz, Mono, 16-bit
WAVE_FORMAT_1S1611025Hz, Stereo, 16-bit
WAVE_FORMAT_2M0822050Hz, Mono, 8-bit
WAVE_FORMAT_2S0822050Hz, Stereo, 8-bit
WAVE_FORMAT_2M1622050Hz, Mono, 16-bit
WAVE_FORMAT_2S1622050Hz, Stereo, 16-bit
WAVE_FORMAT_4M0844100Hz, Mono, 8-bit
WAVE_FORMAT_4S0844100Hz, Stereo, 8-bit
WAVE_FORMAT_4M1644100Hz, Mono, 16-bit
WAVE_FORMAT_4S1644100Hz, Stereo, 16-bit
GetInputs

Method GetInputs:Int()

Description: The number of input sources available to the device.

IsSingleIn

Method IsSingleIn:Int()

Description: TRUE = only one input may be active at a time.

GetFreq

Method GetFreq:Int()

Description: The device's current input sample rate (available only on Windows Vista and OSX).

Information: Recording at this rate will give the best quality and performance, as no resampling is required.

TBass3DVector[edit | edit source]

Type used by the 3D functions to describe positions, velocities, and orientations.

Functions
  • CreateVector
Methods
  • Create
  • GetX
  • GetY
  • GetZ
  • SetX
  • SetY
  • SetZ
  • GetXYZ
  • SetXYZ

TBass3DVector: Functions[edit | edit source]

CreateVector

Function CreateVector:TBass3DVector(x:Float = 0, y:Float = 0, z:Float = 0)

Description: Creates a new 3D Vector object.

TBass3DVector: Methods[edit | edit source]

Create

Method Create:TBass3DVector(x:Float = 0, y:Float = 0, z:Float = 0)

Description: Creates a new 3D Vector object.

GetX

Method GetX:Float()

Description: Returns the X vector.

GetY

Method GetY:Float()

Description: Returns the Y vector.

GetZ

Method GetZ:Float()

Description: Returns the Z vector.

SetX

Method SetX(value:Float)

Description: Sets the X vector.

SetY

Method SetY(value:Float)

Description: Sets the Y vector.

SetZ

Method SetZ(value:Float)

Description: Sets the Y vector.

GetXYZ

Method GetXYZ(x:Float Var, y:Float Var, z:Float Var)

Description: Returns X, Y and Z.

SetXYZ

Method SetXYZ(x:Float, y:Float, z:Float)

Description: Sets X, Y and Z.