Please enable JavaScript to view this site.

thinBasic Help Manual

* * HELP & MANUAL PREMIUM PACK 4 DEMO VERSION * *

This documentation was styled with a demo skin from the Premium Pack 4 add-on for Help & Manual. The contents of the skin are encrypted and not configurable. You can only publish HM projects with this skin. You cannot edit it or change it.

This version is copyright and may only be used for local testing purposes. It may not be distributed.

Please purchase the full version of the Premium Pack to get the configurable skins and remove this notice. The package will also include the Toolbox configuration utility for Premium Pack skins.

 

Description

 

Loads sample from file or memory.

 

Syntax

 

sample = TBASS_LoadSample(mem, source, offset, length, maxPlaybacks, flags)

 

Returns

 

Number, sample handle - non-zero in case of success.

 

Parameters

 

Name

Type

Optional

Meaning

mem

Numeric

No

flag indicating if you want to load the sample from memory

source

String / Pointer

No

file name (if mem is FALSE), otherwise memory location of sample

offset



file offset to load the sample from (only used if mem is FALSE).

length



Data length... 0 = use all data up to the end of file (if mem is FALSE). If length over-runs the end of the file, it will automatically be lowered to the end of the file.

maxPlaybacks



Maximum number of simultaneous playbacks... 1 - 65535. Use one of the 

%TBASS_SAMPLE_OVER flags to choose the override decider, in the case of there being no free channel available for playback (ie. the sample is already playing maxPlaybacks times)

flags



A combination of these flags

 

Flag

Meaning

%TBASS_SAMPLE_FLOAT

Use 32-bit floating-point sample data. Not really recommended for samples as it (at least) doubles the memory usage.

 

%TBASS_SAMPLE_MONO

Convert the sample to mono, if it is not already mono. This flag is automatically applied if %TBASS_DEVICE_MONO was specified when calling TBASS_Init.

%TBASS_SAMPLE_SOFTWARE

Force the sample to not use hardware DirectSound mixing.

%TBASS_SAMPLE_3D

Enable 3D functionality. This requires that the %TBASS_DEVICE_3D flag was specified when calling TBASS_Init, and the sample must be mono.

%TBASS_SAMPLE_LOOP

Looped? Note that only complete sample loops are allowed, you cannot loop just a part of the sample. More fancy looping can be achieved by streaming the file.

%TBASS_UNICODE

file is in UTF-16 form. Otherwise it is ANSI on Windows or Windows CE, and UTF-8 on other platforms.

 

 

 

Remarks

 

Restrictions

 

See also

 

Examples

 

' Load sample from file on disk, as looping

DWord sample = TBASS_SampleLoad(%TBASS_FALSE"C:\sounds\mysound.wav", 0, 0, 1, %TBASS_SAMPLE_LOOP)

Created with Help+Manual 8 and styled with Premium Pack Version 4 © by EC Software