Results 1 to 1 of 1

Thread: Help file: TBASS_SampleGetChannel

  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_SampleGetChannel

    Hi,

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

    I would propose:

    Description
    Creates/initializes a playback channel for a sample.


    Syntax
    hChannel = TBASS_SampleGetChannel( hSample, onlyNew )

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

    Parameters
    hSample;Number;Handle of the sample to play
    onlyNew;Number;Set to %TBASS_TRUE to not recycle/override one of the sample's existing channels. Use %TBASS_FALSE for opposite.

    Remarks
    If a sample has a maximum number of simultaneous playbacks of 1 (the max parameter was 1 when calling TBASS_SampleLoad), then the hChannel returned will be identical to the hSample. That means you can use the hSample with functions that usually require a hChannel, but you must still call this function first to initialize the channel.

    A sample channel is automatically freed when it's overridden by a new channel, or when stopped by TBASS_ChannelStop. If you wish to stop a channel and re-use it, it should be paused (TBASS_ChannelPause) instead of stopped. Determining whether a channel still exists can be done by trying to use the handle in a function call, eg. TBASS_ChannelGetAttributes.


    All of a sample's channels share the same sample data, and just have their own individual playback state information (volume/position/etc).

    Restrictions

    See also
    TBASS_SampleLoad

    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

Members who have read this thread: 0

There are no members to list at the moment.

Tags for this Thread

Posting Permissions

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