Results 1 to 2 of 2

Thread: Help file: TBASS_SampleLoad

  1. #1
    Super Moderator Petr Schreiber's Avatar
    Join Date
    Aug 2005
    Location
    Brno - Czech Republic
    Posts
    7,153
    Rep Power
    736

    Help file: TBASS_SampleLoad

    Hi,

    the following topic is empty:
    thinBasic Modules > TBASS (Sound Module) > Samples > TBASS_SampleLoad

    I would propose:

    Description
    Loads a WAV, AIFF, MP3, MP2, MP1, OGG files.


    Syntax
    hSample = TBASS_SampleLoad( fromMemory, source, offset, length, flags, maxPlaybacks, flags )

    Returns
    If successful, returned value is sample handle.
    Otherwise 0 is returned, use TBASS_ErrorGetCode to find reason of failure.

    Parameters
    fromMemory;Number;Use %TBASS_TRUE to load sample from memory, %TBASS_FALSE to load sample from file.
    source;String/Pointer;In case the sample is loaded from file, pass file name. Otherwise pass pointer to memory location of sample.
    offset;Number;File offset, in case sample is loaded from file.
    length;Number;Data length, use 0 to load all.
    maxPlaybacks;Number;Maximum number of simultaneous playbacks in range 1 to 65535. Use one of the %BASS_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 max times).

    flags;Number;Use one or more (combined via OR) of the following equates to define options:

    • %TBASS_SAMPLE_FLOAT Use 32-bit floating-point sample data (not really recommended for samples). WDM drivers are required to use this flag in Windows. See Floating-point channels for more info.
    • %TBASS_SAMPLE_LOOP Looped? Note that only complete sample loops are allowed, you can't loop just a part of the sample. More fancy looping can be achieved by streaming the file.
    • %TBASS_SAMPLE_MONO Convert the sample (MP3/MP2/MP1 only) to mono, if it's not already. 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 mixing.
    • %TBASS_SAMPLE_VAM requires DirectX 7 or above. Enables the DX7 voice allocation and management features on the sample, which allows the sample to be played in software or hardware. This flag is ignored if the %TBASS_SAMPLE_SOFTWARE flag is also specified.
    • %TBASS_SAMPLE_3D Use 3D functionality. This is ignored if %TBASS_DEVICE_3D wasn't specified when calling TBASS_Init. 3D samples must be mono.
    • %TBASS_SAMPLE_MUTEMAX Mute the sample when it is at (or beyond) it's max distance (3D samples only).
    • %TBASS_SAMPLE_OVER_VOL Override: the channel with the lowest volume is overriden.
    • %TBASS_SAMPLE_OVER_POS Override: the longest playing channel is overriden.
    • %TBASS_SAMPLE_OVER_DIST Override: the channel furthest away from the listener is overriden. Valid for 3D samples only.
    • %TBASS_UNICODE file is a Unicode (UTF-16) filename.

    Remarks
    To play a sample, first a channel must be obtained using TBASS_SampleGetChannel, which can then be played using TBASS_ChannelPlay.

    Restrictions

    See also
    TBASS_SampleGetChannel

    Examples
    ' -- Load sample
    hSample = TBASS_SampleLoad(%TBASS_FALSE, APP_SOURCEPATH+"monster.wav", 0, 0, 1, %TBASS_SAMPLE_LOOP )

    ' -- Retrieve channel
    hChannel = TBASS_SampleGetChannel(hSample , %TBASS_FALSE)
    Last edited by Petr Schreiber; 15-05-2011 at 12:10.
    Learn 3D graphics with ThinBASIC, learn TBGL!
    Windows 10 64bit - Intel Core i5-3350P @ 3.1GHz - 16 GB RAM - NVIDIA GeForce GTX 1050 Ti 4GB

  2. #2
    Super Moderator Petr Schreiber's Avatar
    Join Date
    Aug 2005
    Location
    Brno - Czech Republic
    Posts
    7,153
    Rep Power
    736
    Hello Petr from the past, Petr from the future fixed it for 1.11.7.0 release.
    Learn 3D graphics with ThinBASIC, learn TBGL!
    Windows 10 64bit - Intel Core i5-3350P @ 3.1GHz - 16 GB RAM - NVIDIA GeForce GTX 1050 Ti 4GB

Members who have read this thread: 0

There are no members to list at the moment.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •