Navigation:  thinBasic Modules > TBASS (Sound Module) > TBASS functions working on init, info, general, ... >

TBASS_Init

Previous pageReturn to chapter overviewNext page

 

Description

 

Initializes an output device.

 

Syntax

 

n = TBASS_Init (Device, Frequency, Flags, Win, clsID)

 

Returns

 

If the device was successfully initialized, %TBASS_TRUE is returned, else %TBASS_FALSE is returned. Use TBASS_ErrorGetCode to get the error code.

 

Parameters

 

Name

Type

Optional

Meaning

Device

Number

No

The device to use... -1 = default device, 0 = no sound, 1 = first real output device.

Frequency

Number

No

Output sample rate.

Flags

Number

No

Any combination of the following flags:

 

Flag

Meaning

%TBASS_DEVICE_8BITS

Use 8-bit resolution, else 16-bit.

%TBASS_DEVICE_MONO

Use mono, else stereo.

%TBASS_DEVICE_3D

Enable 3D functionality.

If this flag is not specified, then the %TBASS_SAMPLE_3D flag is ignored when loading/creating a sample/stream/music.

%TBASS_DEVICE_LATENCY

Calculates the latency of the device, that is the delay between requesting a sound to play and it actually being heard. A recommended minimum buffer length is also calculated. Both values are retrievable in the BASS_INFO structure (latency & minbuf members). These calculations can increase the time taken by this function by 1-3 seconds

%TBASS_DEVICE_SPEAKERS

Force the enabling of speaker assignment. With some devices/drivers, the number of speakers BASS detects may be 2, when the device in fact supports more than 2 speakers. This flag forces the enabling of assignment to 8 possible speakers. This flag has no effect with non-WDM drivers.

%TBASS_DEVICE_NOSPEAKER

Ignore speaker arrangement. This flag tells BASS not to make any special consideration for speaker arrangements when using the SPEAKER flags, eg. swapping the CENLFE and REAR speaker channels in 5/7.1 speaker output. This flag should be used with plain multi-channel (rather than 5/7.1) devices.

 

 

Win

Number

No

The application's main window... 0 = the current foreground window (use this for console applications).

clsID

Number

No

Class identifier of the object to create, that will be used to initialize DirectSound... NULL (0) = use default.

 

Remarks

 

Restrictions

 

See also

 

Examples