Results 1 to 1 of 1

Thread: Help file: TBASS_MusicLoad

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

    Help file: TBASS_MusicLoad

    Hi,

    the following topic is empty:
    thinBasic Modules > TBASS (Sound Module) > Music > TBASS_MusicLoad

    I would propose:

    Description
    Loads MOD music file. The supported formats are:
    MO3, IT, XM, S3M, MTM, MOD and UMX.

    Syntax
    hMusic = TBASS_MusicLoad( fromMemory, source, offset, length, flags, frequency )

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

    Parameters
    fromMemory;Number;Use %TBASS_TRUE to load music from memory, %TBASS_FALSE to load music from file.
    source;String/Pointer;In case the music is loaded from file, pass file name. Otherwise pass pointer to memory location of music.
    offset;Number;File offset, in case music is loaded from file.
    length;Number;Data length, use 0 to load all.
    flags;Number;Use one or more (combined via OR) of the following equates to define options:

    • %TBASS_SAMPLE_8BITS Use 8-bit resolution. If neither this or the %TBASS_SAMPLE_FLOAT flags are specified, then the sample data will be 16-bit.
    • %TBASS_SAMPLE_FLOAT Use 32-bit floating-point sample data. WDM drivers or the %TBASS_MUSIC_DECODE flag are required to use this flag in Windows. See Floating-point channels for more info.
    • %TBASS_SAMPLE_MONO Decode/play the MOD music in mono (uses less CPU than stereo). This flag is automatically applied if %TBASS_DEVICE_MONO was specified when calling TBASS_Init.
    • %TBASS_SAMPLE_8BITS Use 8-bit resolution. If neither this or the %TBASS_SAMPLE_FLOAT flags are specified, then the sample data will be 16-bit.
    • %TBASS_SAMPLE_FLOAT Use 32-bit floating-point sample data. WDM drivers or the %TBASS_MUSIC_DECODE flag are required to use this flag in Windows. See Floating-point channels for more info.
    • %TBASS_SAMPLE_MONO Decode/play the MOD music in mono (uses less CPU than stereo). This flag is automatically applied if %TBASS_DEVICE_MONO was specified when calling TBASS_Init.
    • %TBASS_SAMPLE_SOFTWARE Force the MOD music to not use hardware mixing.
    • %TBASS_SAMPLE_3D Enable 3D functionality. This is ignored if %TBASS_DEVICE_3D wasn't specified when calling TBASS_Init. 3D channels are mono, so %TBASS_SAMPLE_MONO is automatically applied. The SPEAKER flags can not be used together with this flag.
    • %TBASS_SAMPLE_FX requires DirectX 8 or above Enable the old implementation of DirectX 8 effects.
    • %TBASS_SAMPLE_LOOP Loop the music.
    • %TBASS_MUSIC_RAMP Use "normal" ramping (as used in FastTracker 2).
    • %TBASS_MUSIC_RAMPS Use "sensitive" ramping.
    • %TBASS_MUSIC_NONINTER Use non-interpolated mixing. This generally reduces the sound quality, but can be good for chip-tunes.
    • %TBASS_MUSIC_FT2MOD Play .MOD file as FastTracker 2 would.
    • %TBASS_MUSIC_PT1MOD Play .MOD file as ProTracker 1 would.
    • %TBASS_MUSIC_POSRESET Stop all notes when seeking (using %TBASS_ChannelSetPosition).
    • %TBASS_MUSIC_POSRESETEX Stop all notes and reset bpm/etc when seeking.
    • %TBASS_MUSIC_SURROUND Apply XMPlay's surround sound to the music (ignored in mono).
    • %TBASS_MUSIC_SURROUND2 Apply XMPlay's surround sound mode 2 to the music (ignored in mono).
    • %TBASS_MUSIC_STOPBACK Stop 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 %TBASS_SAMPLE_LOOP flag, then the music would not be stopped but any %TBASS_SYNC_END sync would be triggered.
    • %TBASS_MUSIC_PRESCAN Calculate 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 TBASS_ChannelGetLength to retrieve the length.
    • %TBASS_MUSIC_NOSAMPLE Don'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 name and length of the music without playing it.
    • %TBASS_MUSIC_AUTOFREE Automatically free the music when it ends. This allows you to play a music and forget about it, as BASS will automatically free the music's resources when it has reached the end or when %TBASS_ChannelStop (or %TBASS_Stop) is called. Note that some musics never actually end on their own (ie. without you stopping them).
    • %TBASS_MUSIC_DECODE Decode the music into sample data, without outputting it. Use %TBASS_ChannelGetData to retrieve decoded sample data. %TBASS_SAMPLE_SOFTWARE/3D/FX/AUTOFREE are ignored when using this flag, as are the SPEAKER flags.
    • %TBASS_SPEAKER_xxx Speaker assignment flags. The %TBASS_SAMPLE_MONO flag is automatically applied when using a mono speaker assignment flag.
    • %TBASS_UNICODE file is a Unicode (UTF-16) filename.

    Remarks

    Restrictions

    See also
    TBASS_MusicFree

    Examples
    ' -- Load mod music
    DIM hMusic AS DWORD

    hMusic = TBASS_MusicLoad(%TBASS_FALSE, APP_SOURCEPATH+"backgroundMusic.mod", 0, 0, %TBASS_SAMPLE_LOOP, 0 )

    ...

    ' -- Release it
    TBASS_MusicFree( hMusic )
    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.

Posting Permissions

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