home *** CD-ROM | disk | FTP | other *** search
/ PC Format (South-Africa) 2001 June / PCFJune.iso / Xenon / ModBass / Delphi / Bass.pas next >
Encoding:
Pascal/Delphi Source File  |  2000-02-23  |  52.4 KB  |  1,138 lines

  1. {
  2.   BASS 0.8 Multimedia Library
  3.   -----------------------------
  4.   (c) 1999 Ian Luck.
  5.   Please report bugs/suggestions/etc... to bass@icl.ndirect.co.uk
  6.  
  7.   Delphi API Version 0.8 by Titus Miloi
  8.   -----------------------------------------
  9.   Questions, suggestions, etc. regarding the Delphi API
  10.   can be sent to titus.a.m@t-online.de
  11.  
  12.   NOTE: This unit will only work with BASS.DLL version 0.8
  13.   Check http://www.un4seen.com/music/ for any later
  14.   versions of BASS.PAS
  15.  
  16.   History
  17.   ---------
  18.   02/18/2000 BASS.PAS 0.8
  19.              - adapted for BASS version 0.8
  20.              - indexed dll function calls replaced with
  21.                dll function calls by name
  22.              - new procedure: BASS_EAXPreset
  23.                which replaces the EAX_PRESET_xxx definitions
  24.              - some new example programs added
  25.   09/21/1999 BASS.PAS 0.7
  26.              - adapted for BASS version 0.7
  27.                (see BASS.TXT for further information)
  28.   08/20/1999 BASS.PAS 0.6.2
  29.              The following bugs were fixed:
  30.              - The STREAMPROC and SYNCPROC types were declared
  31.                incorrectly; now declared as stdcall
  32.              - BASS_StreamCreate and BASS_ChannelSetSync
  33.                have been declared incorrectly; the last
  34.                parameter must not be declared with var
  35.              The following features have been added:
  36.              - A new demo application has been added
  37.                which shows how to use the stream functions
  38.   07/31/1999 BASS.PAS 0.6
  39.              The first BASS API for Delphi
  40.              Tested with Delphi 3, but should also work
  41.              proberly under Delphi 2 and 4.
  42.  
  43.   How to install
  44.   ----------------
  45.   Copy BASS.PAS to the \LIB subdirectory of your Delphi path
  46.   e.g. to C:\Program Files\Borland\Delphi 3\Lib
  47.   Now you should be able to run the demo projects.
  48. }
  49. unit Bass;
  50.  
  51. interface
  52.  
  53. uses
  54.   Windows;
  55.  
  56. const
  57.   // Error codes returned by BASS_GetErrorCode()
  58.   BASS_OK                 = 0;    // all is OK
  59.   BASS_ERROR_MEM          = 1;    // memory error
  60.   BASS_ERROR_FILEOPEN     = 2;    // can't open the file
  61.   BASS_ERROR_DRIVER       = 3;    // can't find a free sound driver
  62.   BASS_ERROR_BUFLOST      = 4;    // the sample buffer was lost - please report this!
  63.   BASS_ERROR_HANDLE       = 5;    // invalid handle
  64.   BASS_ERROR_FORMAT       = 6;    // unsupported format
  65.   BASS_ERROR_POSITION     = 7;    // invalid playback position
  66.   BASS_ERROR_INIT         = 8;    // BASS_Init has not been successfully called
  67.   BASS_ERROR_START        = 9;    // BASS_Start has not been successfully called
  68.   BASS_ERROR_INITCD       = 10;   // can't initialize CD
  69.   BASS_ERROR_CDINIT       = 11;   // BASS_CDInit has not been successfully called
  70.   BASS_ERROR_NOCD         = 12;   // no CD in drive
  71.   BASS_ERROR_CDTRACK      = 13;   // can't play the selected CD track
  72.   BASS_ERROR_ALREADY      = 14;   // already initialized
  73.   BASS_ERROR_CDVOL        = 15;   // CD has no volume control
  74.   BASS_ERROR_NOPAUSE      = 16;   // not paused
  75.   BASS_ERROR_NOTAUDIO     = 17;   // not an audio track
  76.   BASS_ERROR_NOCHAN       = 18;   // can't get a free channel
  77.   BASS_ERROR_ILLTYPE      = 19;   // an illegal type was specified
  78.   BASS_ERROR_ILLPARAM     = 20;   // an illegal parameter was specified
  79.   BASS_ERROR_NO3D         = 21;   // no 3D support
  80.   BASS_ERROR_NOEAX        = 22;   // no EAX support
  81.   BASS_ERROR_DEVICE       = 23;   // illegal device number
  82.   BASS_ERROR_NOPLAY       = 24;   // not playing
  83.   BASS_ERROR_FREQ         = 25;   // illegal sample rate
  84.   BASS_ERROR_NOA3D        = 26;   // A3D.DLL is not installed
  85.   BASS_ERROR_NOTFILE      = 27;   // the stream is not a file stream (WAV/MP3)
  86.   BASS_ERROR_NOHW         = 29;   // no hardware voices available
  87.   BASS_ERROR_NOSYNC       = 30;   // synchronizers have been disabled
  88.   BASS_ERROR_UNKNOWN      = -1;   // some other mystery error
  89.  
  90.   // Device setup flags
  91.   BASS_DEVICE_8BITS       = 1;    // use 8 bit resolution, else 16 bit
  92.   BASS_DEVICE_MONO        = 2;    // use mono, else stereo
  93.   BASS_DEVICE_3D          = 4;    // enable 3D functionality
  94.   {
  95.     If the BASS_DEVICE_3D flag is not specified when
  96.     initilizing BASS, then the 3D flags (BASS_SAMPLE_3D
  97.     and BASS_MUSIC_3D) are ignored when loading/creating
  98.     a sample/stream/music.
  99.   }
  100.   BASS_DEVICE_A3D         = 8;    // enable A3D functionality
  101.   BASS_DEVICE_NOSYNC      = 16;   // disable synchronizers
  102.  
  103.   // DirectSound interfaces (for use with BASS_GetDSoundObject)
  104.   BASS_OBJECT_DS          = 1;   // IDirectSound
  105.   BASS_OBJECT_DS3DL       = 2;   // IDirectSound3DListener
  106.  
  107.   // BASS_INFO flags (from DSOUND.H)
  108.   DSCAPS_CONTINUOUSRATE   = $00000010;
  109.   { supports all sample rates between min/maxrate }
  110.   DSCAPS_EMULDRIVER       = $00000020;
  111.   { device does NOT have hardware DirectSound support }
  112.   DSCAPS_CERTIFIED        = $00000040;
  113.   { device driver has been certified by Microsoft }
  114.   {
  115.     The following flags tell what type of samples are
  116.     supported by HARDWARE mixing, all these formats are
  117.     supported by SOFTWARE mixing
  118.   }
  119.   DSCAPS_SECONDARYMONO    = $00000100;     // mono
  120.   DSCAPS_SECONDARYSTEREO  = $00000200;     // stereo
  121.   DSCAPS_SECONDARY8BIT    = $00000400;     // 8 bit
  122.   DSCAPS_SECONDARY16BIT   = $00000800;     // 16 bit
  123.  
  124.   // Volume sliding flags
  125.   BASS_SLIDE_DIGITAL      = 1;   // slide digital master volume
  126.   BASS_SLIDE_CD           = 2;   // slide CD volume
  127.  
  128.   // Music flags
  129.   BASS_MUSIC_RAMP         = 1;   // normal ramping
  130.   BASS_MUSIC_RAMPS        = 2;   // sensitive ramping
  131.   {
  132.     Ramping doesn't take a lot of extra processing and
  133.     improves the sound quality by removing "clicks".
  134.     Sensitive ramping will leave sharp attacked samples,
  135.     unlike normal ramping.
  136.   }
  137.   BASS_MUSIC_LOOP         = 4;   // loop music
  138.   BASS_MUSIC_FT2MOD       = 16;  // play .MOD as FastTracker 2 does
  139.   BASS_MUSIC_PT1MOD       = 32;  // play .MOD as ProTracker 1 does
  140.   BASS_MUSIC_MONO         = 64;  // force mono mixing (less CPU usage)
  141.   BASS_MUSIC_3D           = 128; // enable 3D functionality
  142.   BASS_MUSIC_POSRESET     = 256; // stop all notes when moving position
  143.  
  144.   // Sample info flags
  145.   BASS_SAMPLE_8BITS       = 1;   // 8 bit, else 16 bit
  146.   BASS_SAMPLE_MONO        = 2;   // mono, else stereo
  147.   BASS_SAMPLE_LOOP        = 4;   // looped
  148.   BASS_SAMPLE_3D          = 8;   // 3D functionality enabled
  149.   BASS_SAMPLE_SOFTWARE    = 16;  // it's NOT using hardware mixing
  150.   BASS_SAMPLE_MUTEMAX     = 32;  // muted at max distance (3D only)
  151.   BASS_SAMPLE_VAM         = 64;  // uses the DX7 voice allocation & management
  152.   BASS_SAMPLE_OVER_VOL    = $10000; // override lowest volume
  153.   BASS_SAMPLE_OVER_POS    = $20000; // override longest playing
  154.   BASS_SAMPLE_OVER_DIST   = $30000; // override furthest from listener (3D only)
  155.  
  156.   BASS_MP3_HALFRATE       = $10000; // reduced quality MP3 (half sample rate)
  157.   BASS_MP3_SETPOS         = $20000; // enable seeking on the MP3
  158.  
  159.   // DX7 voice allocation flags
  160.   BASS_VAM_HARDWARE       = 1;
  161.   {
  162.     Play the sample in hardware. If no hardware voices are available then
  163.     the "play" call will fail
  164.   }
  165.   BASS_VAM_SOFTWARE       = 2;
  166.   {
  167.     Play the sample in software (ie. non-accelerated). No other VAM flags
  168.     may be used together with this flag.
  169.   }
  170.  
  171.   // DX7 voice management flags
  172.   {
  173.     These flags enable hardware resource stealing... if the hardware has no
  174.     available voices, a currently playing buffer will be stopped to make room
  175.     for the new buffer. NOTE: only samples loaded/created with the
  176.     BASS_SAMPLE_VAM flag are considered for termination by the DX7 voice
  177.     management.
  178.   }
  179.   BASS_VAM_TERM_TIME      = 4;
  180.   {
  181.     If there are no free hardware voices, the buffer to be terminated will be
  182.     the one with the least time left to play.
  183.   }
  184.   BASS_VAM_TERM_DIST      = 8;
  185.   {
  186.     If there are no free hardware voices, the buffer to be terminated will be
  187.     one that was loaded/created with the BASS_SAMPLE_MUTEMAX flag and is
  188.     beyond
  189.     it's max distance. If there are no buffers that match this criteria, then
  190.     the "play" call will fail.
  191.   }
  192.   BASS_VAM_TERM_PRIO      = 16;
  193.   {
  194.     If there are no free hardware voices, the buffer to be terminated will be
  195.     the one with the lowest priority.
  196.   }
  197.  
  198.   // 3D channel modes
  199.   BASS_3DMODE_NORMAL      = 0;
  200.   { normal 3D processing }
  201.   BASS_3DMODE_RELATIVE    = 1;
  202.   {
  203.     The channel's 3D position (position/velocity/
  204.     orientation) are relative to the listener. When the
  205.     listener's position/velocity/orientation is changed
  206.     with BASS_Set3DPosition, the channel's position
  207.     relative to the listener does not change.
  208.   }
  209.   BASS_3DMODE_OFF         = 2;
  210.   {
  211.     Turn off 3D processing on the channel, the sound will
  212.     be played in the center.
  213.   }
  214.  
  215.   // EAX environments, use with BASS_SetEAXParameters
  216.   EAX_ENVIRONMENT_OFF               = -1;
  217.   EAX_ENVIRONMENT_GENERIC           = 0;
  218.   EAX_ENVIRONMENT_PADDEDCELL        = 1;
  219.   EAX_ENVIRONMENT_ROOM              = 2;
  220.   EAX_ENVIRONMENT_BATHROOM          = 3;
  221.   EAX_ENVIRONMENT_LIVINGROOM        = 4;
  222.   EAX_ENVIRONMENT_STONEROOM         = 5;
  223.   EAX_ENVIRONMENT_AUDITORIUM        = 6;
  224.   EAX_ENVIRONMENT_CONCERTHALL       = 7;
  225.   EAX_ENVIRONMENT_CAVE              = 8;
  226.   EAX_ENVIRONMENT_ARENA             = 9;
  227.   EAX_ENVIRONMENT_HANGAR            = 10;
  228.   EAX_ENVIRONMENT_CARPETEDHALLWAY   = 11;
  229.   EAX_ENVIRONMENT_HALLWAY           = 12;
  230.   EAX_ENVIRONMENT_STONECORRIDOR     = 13;
  231.   EAX_ENVIRONMENT_ALLEY             = 14;
  232.   EAX_ENVIRONMENT_FOREST            = 15;
  233.   EAX_ENVIRONMENT_CITY              = 16;
  234.   EAX_ENVIRONMENT_MOUNTAINS         = 17;
  235.   EAX_ENVIRONMENT_QUARRY            = 18;
  236.   EAX_ENVIRONMENT_PLAIN             = 19;
  237.   EAX_ENVIRONMENT_PARKINGLOT        = 20;
  238.   EAX_ENVIRONMENT_SEWERPIPE         = 21;
  239.   EAX_ENVIRONMENT_UNDERWATER        = 22;
  240.   EAX_ENVIRONMENT_DRUGGED           = 23;
  241.   EAX_ENVIRONMENT_DIZZY             = 24;
  242.   EAX_ENVIRONMENT_PSYCHOTIC         = 25;
  243.   // total number of environments
  244.   EAX_ENVIRONMENT_COUNT             = 26;
  245.  
  246.   // A3D resource manager modes
  247.   A3D_RESMODE_OFF                   = 0;    // off
  248.   A3D_RESMODE_NOTIFY                = 1;    // notify when there are no free hardware channels
  249.   A3D_RESMODE_DYNAMIC               = 2;    // non-looping channels are managed
  250.   A3D_RESMODE_DYNAMIC_LOOPERS       = 3;    // all (inc. looping) channels are managed (req A3D 1.2)
  251.  
  252.   // software 3D mixing algorithm modes (used with BASS_Set3DAlgorithm)
  253.   BASS_3DALG_DEFAULT                = 0;
  254.   {
  255.     default algorithm (currently translates to BASS_3DALG_OFF)
  256.   }
  257.   BASS_3DALG_OFF                    = 1;
  258.   {
  259.     Uses normal left and right panning. The vertical axis is ignored except
  260.     for scaling of volume due to distance. Doppler shift and volume scaling
  261.     are still applied, but the 3D filtering is not performed. This is the
  262.     most CPU efficient software implementation, but provides no virtual 3D
  263.     audio effect. Head Related Transfer Function processing will not be done.
  264.     Since only normal stereo panning is used, a channel using this algorithm
  265.     may be accelerated by a 2D hardware voice if no free 3D hardware voices
  266.     are available.
  267.   }
  268.   BASS_3DALG_FULL                   = 2;
  269.   {
  270.     This algorithm gives the highest quality 3D audio effect, but uses more
  271.     CPU. Requires Windows 98 2nd Edition or Windows 2000 that uses WDM
  272.     drivers, if this mode is not available then BASS_3DALG_OFF will be used
  273.     instead.
  274.   }
  275.   BASS_3DALG_LIGHT                  = 3;
  276.   {
  277.     This algorithm gives a good 3D audio effect, and uses less CPU than the
  278.     FULL mode. Requires Windows 98 2nd Edition or Windows 2000 that uses WDM
  279.     drivers, if this mode is not available then BASS_3DALG_OFF will be used
  280.     instead.
  281.   }
  282.  
  283.   {
  284.     Sync types (with BASS_ChannelSetSync() "param" and
  285.     SYNCPROC "data" definitions) & flags.
  286.   }
  287.   BASS_SYNC_MUSICPOS                = 0;
  288.   {
  289.     Sync when a music reaches a position.
  290.     param: LOWORD=order (0=first, -1=all) HIWORD=row (0=first, -1=all)
  291.     data : LOWORD=order HIWORD=row
  292.   }
  293.   BASS_SYNC_MUSICINST               = 1;
  294.   {
  295.     Sync when an instrument (sample for the non-instrument
  296.     based formats) is played in a music (not including
  297.     retrigs).
  298.     param: LOWORD=instrument (1=first) HIWORD=note (0=c0...119=b9, -1=all)
  299.     data : LOWORD=note HIWORD=volume (0-64)
  300.   }
  301.   BASS_SYNC_END                     = 2;
  302.   {
  303.     Sync when a music or file stream reaches the end.
  304.     param: not used
  305.     data : not used
  306.   }
  307.   BASS_SYNC_MUSICFX                 = 3;
  308.   {
  309.     Sync when the "sync" effect (XM/MTM/MOD: E8x, IT/S3M: S0x) is used.
  310.     param: 0:data=pos, 1:data="x" value
  311.     data : param=0: LOWORD=order HIWORD=row, param=1: "x" value
  312.   }
  313.   BASS_SYNC_MIXTIME                 = $40000000;
  314.   { FLAG: sync at mixtime, else at playtime }
  315.   BASS_SYNC_ONETIME                 = $80000000;
  316.   { FLAG: sync only once, else continuously }
  317.  
  318.   CDCHANNEL                         = 0; // CD channel, for use with BASS_Channel functions
  319.  
  320. type
  321.   DWORD = cardinal;
  322.   BOOL = LongBool;
  323.   FLOAT = Single;
  324.  
  325.   HMUSIC = DWORD;               // MOD music handle
  326.   HSAMPLE = DWORD;              // sample handle
  327.   HCHANNEL = DWORD;             // playing sample's channel handle
  328.   HSTREAM = DWORD;              // sample stream handle
  329.   HSYNC = DWORD;                // synchronizer handle
  330.   HDSP = DWORD;                 // DSP handle
  331.  
  332.   BASS_INFO = record
  333.     size: DWORD;               // size of this struct (set this before calling the function)
  334.     flags: DWORD;              // device capabilities (DSCAPS_xxx flags)
  335.     {
  336.       The following values are irrelevant if the device
  337.       doesn't have hardware support
  338.       (DSCAPS_EMULDRIVER is specified in flags)
  339.     }
  340.     hwsize: DWORD;             // size of total device hardware memory
  341.     hwfree: DWORD;             // size of free device hardware memory
  342.     freesam: DWORD;            // number of free sample slots in the hardware
  343.     free3d: DWORD;             // number of free 3D sample slots in the hardware
  344.     minrate: DWORD;            // min sample rate supported by the hardware
  345.     maxrate: DWORD;            // max sample rate supported by the hardware
  346.     eax: BOOL;                 // device supports EAX? (always FALSE if BASS_DEVICE_3D was not used)
  347.     a3d: DWORD;                // A3D version (0=unsupported or BASS_DEVICE_A3D was not used)
  348.     dsver: DWORD;              // DirectSound version (use to check for DX5/7 functions)
  349.   end;
  350.  
  351.   // Sample info structure
  352.   BASS_SAMPLE = record
  353.     freq: DWORD;               // default playback rate
  354.     volume: DWORD;             // default volume (0-100)
  355.     pan: Integer;              // default pan (-100=left, 0=middle, 100=right)
  356.     flags: DWORD;              // BASS_SAMPLE_xxx flags
  357.     length: DWORD;             // length (in samples, not bytes)
  358.     max: DWORD;                // maximum simultaneous playbacks
  359.     {
  360.       The following are the sample's default 3D attributes
  361.       (if the sample is 3D, BASS_SAMPLE_3D is in flags)
  362.       see BASS_ChannelSet3DAttributes
  363.     }
  364.     mode3d: DWORD;             // BASS_3DMODE_xxx mode
  365.     mindist: FLOAT;            // minimum distance
  366.     maxdist: FLOAT;            // maximum distance
  367.     iangle: DWORD;             // angle of inside projection cone
  368.     oangle: DWORD;             // angle of outside projection cone
  369.     outvol: DWORD;             // delta-volume outside the projection cone
  370.     {
  371.       The following are the defaults used if the sample uses the DirectX 7
  372.       voice allocation/management features.
  373.     }
  374.     vam: DWORD;                // voice allocation/management flags (BASS_VAM_xxx)
  375.     priority: DWORD;           // priority (0=lowest, 0xffffffff=highest)
  376.   end;
  377.  
  378.   // 3D vector (for 3D positions/velocities/orientations)
  379.   BASS_3DVECTOR = record
  380.     x: FLOAT;                  // +=right, -=left
  381.     y: FLOAT;                  // +=up, -=down
  382.     z: FLOAT;                  // +=front, -=behind
  383.   end;
  384.  
  385.   // callback function types
  386.   STREAMPROC = function(handle: HSTREAM; buffer: Pointer; length: DWORD; user: DWORD): DWORD; stdcall;
  387.   {
  388.     Stream callback function. NOTE: A stream function should obviously be as
  389.     quick as possible, other streams (and MOD musics) can't be mixed until
  390.     it's finished.
  391.     handle : The stream that needs writing
  392.     buffer : Buffer to write the samples in
  393.     length : Number of bytes to write
  394.     user   : The 'user' parameter value given when calling BASS_StreamCreate
  395.     RETURN : Number of bytes written. If less than "length" then the
  396.              stream is assumed to be at the end, and is stopped.
  397.   }
  398.   SYNCPROC = procedure(handle: HSYNC; channel, data: DWORD; user: DWORD); stdcall;
  399.   {
  400.     Sync callback function. NOTE: a sync callback function should be very
  401.     quick (eg. just posting a message) as other syncs cannot be processed
  402.     until it has finished. If the sync is a "mixtime" sync, then other streams
  403.     and MOD musics can not be mixed until it's finished either.
  404.     handle : The sync that has occured
  405.     channel: Channel that the sync occured in
  406.     data   : Additional data associated with the sync's occurance
  407.     user   : The 'user' parameter given when calling BASS_ChannelSetSync
  408.   }
  409.  
  410.   DSPPROC = procedure(handle: HSYNC; channel: DWORD; buffer: Pointer; length: DWORD; user: DWORD); stdcall;
  411.   {
  412.     DSP callback function. NOTE: A DSP function should obviously be as quick
  413.     as possible... other DSP functions, streams and MOD musics can not be
  414.     processed until it's finished.
  415.     handle : The DSP handle
  416.     channel: Channel that the DSP is being applied to
  417.     buffer : Buffer to apply the DSP to
  418.     length : Number of bytes in the buffer
  419.     user   : The 'user' parameter given when calling BASS_ChannelSetDSP
  420.   }
  421.  
  422.  
  423. // Functions
  424. function BASS_GetVersion: DWORD; stdcall; external 'bass.dll' name 'BASS_GetVersion';
  425. {
  426.   Retrieve the version number of BASS that is loaded.
  427.   RETURN : The BASS version (LOWORD.HIWORD)
  428. }
  429. function BASS_GetDeviceDescription(devnum: Integer; var desc: PChar): BOOL; stdcall; external 'bass.dll' name 'BASS_GetDeviceDescription';
  430. {
  431.   Get the text description of a device. This function can
  432.   be used to enumerate the available devices.
  433.   devnum : The device (0=first)
  434.   desc   : Pointer to store pointer to text description at
  435. }
  436. procedure BASS_SetBufferLength(length: FLOAT); stdcall; external 'bass.dll' name 'BASS_SetBufferLength';
  437. {
  438.   Set the amount that BASS mixes ahead new musics/streams.
  439.   Changing this setting does not affect musics/streams
  440.   that have already been loaded/created. Increasing the
  441.   buffer length, decreases the chance of the sound
  442.   possibly breaking-up on slower computers, but also
  443.   requires more memory. The default length is 0.5 secs.
  444.   length : The buffer length in seconds (limited to 0.3-2.0s)
  445.  
  446.   NOTE: This setting does not represent the latency
  447.   (delay between playing and hearing the sound). The
  448.   latency depends on the drivers, the power of the CPU,
  449.   and the complexity of what's being mixed (eg. an IT
  450.   using filters requires more processing than a plain
  451.   4 channel MOD). So the buffer length actually has no
  452.   effect on the latency.
  453. }
  454. procedure BASS_SetGlobalVolumes(musvol, samvol, strvol: Integer); stdcall; external 'bass.dll' name 'BASS_SetGlobalVolumes'
  455. {
  456.   Set the global music/sample/stream volume levels.
  457.   musvol : MOD music global volume level (0-100, -1=leave current)
  458.   samvol : Sample global volume level (0-100, -1=leave current)
  459.   strvol : Stream global volume level (0-100, -1=leave current)
  460. }
  461. procedure BASS_GetGlobalVolumes(var musvol, samvol, strvol: DWORD); stdcall; external 'bass.dll' name 'BASS_GetGlobalVolumes';
  462. {
  463.   Retrive the global music/sample/stream volume levels.
  464.   musvol : MOD music global volume level (NULL=don't retrieve it)
  465.   samvol : Sample global volume level (NULL=don't retrieve it)
  466.   strvol : Stream global volume level (NULL=don't retrieve it)
  467. }
  468. procedure BASS_SetLogCurves(volume, pan: BOOL); stdcall; external 'bass.dll' name 'BASS_SetLogCurves';
  469. {
  470.   Make the volume/panning values translate to a logarithmic curve,
  471.   or a linear "curve" (the default).
  472.   volume : volume curve (FALSE=linear, TRUE=log)
  473.   pan    : panning curve (FALSE=linear, TRUE=log)
  474. }
  475. procedure BASS_Set3DAlgorithm(algo: DWORD); stdcall; external 'bass.dll' name 'BASS_Set3DAlgorithm';
  476. {
  477.   Set the 3D algorithm for software mixed 3D channels (does not affect
  478.   hardware mixed channels). Changing the mode only affects subsequently
  479.   created or loaded samples/streams/musics, not those that already exist.
  480.   Requires DirectX 7 or above.
  481.   algo   : algorithm flag (BASS_3DALG_xxx)
  482. }
  483. function BASS_ErrorGetCode: DWORD; stdcall; external 'bass.dll' name 'BASS_ErrorGetCode';
  484. {
  485.   Get the BASS_ERROR_xxx error code. Use this function to
  486.   get the reason for an error.
  487. }
  488. function BASS_Init(device: Integer; freq, flags: DWORD; win: HWND): BOOL; stdcall; external 'bass.dll' name 'BASS_Init';
  489. {
  490.   Initialize the digital output. This must be called
  491.   before all following BASS functions (except CD functions).
  492.   The volume is initially set to 100 (the maximum),
  493.   use BASS_SetVolume() to adjust it.
  494.   device : Device to use (0=first, -1=default, -2=no sound)
  495.   freq   : Output sample rate
  496.   flags  : BASS_DEVICE_xxx flags
  497.   win    : Owner window
  498.  
  499.   NOTE: The "no sound" device (device=-2), allows loading
  500.   and "playing" of MOD musics only (all sample/stream
  501.   functions and most other functions fail). This is so
  502.   that you can still use the MOD musics as synchronizers
  503.   when there is no soundcard present. When using device -2,
  504.   you should still set the other arguments as you would do
  505.   normally.
  506. }
  507. procedure BASS_Free; stdcall; external 'bass.dll' name 'BASS_Free';
  508. {
  509.   Free all resources used by the digital output, including
  510.   all musics and samples.
  511. }
  512. function BASS_GetDSoundObject(obj: DWORD): Pointer; stdcall; external 'bass.dll' name 'BASS_GetDSoundObject';
  513. {
  514.   Retrieve a pointer to a DirectSound interface. This can be used by
  515.   advanced users to "plugin" external functionality.
  516.   object : The interface to retrieve (BASS_OBJECT_xxx)
  517.   RETURN : A pointer to the requested interface (NULL=error)
  518. }
  519. procedure BASS_GetInfo(var info: BASS_INFO); stdcall; external 'bass.dll' name 'BASS_GetInfo';
  520. {
  521.   Retrieve some information on the device being used.
  522.   info   : Pointer to store info at
  523. }
  524. function BASS_GetCPU: FLOAT; stdcall; external 'bass.dll' name 'BASS_GetCPU';
  525. {
  526.   Get the current CPU usage of BASS. This includes the
  527.   time taken to mix the MOD musics and sample streams.
  528.   It does not include plain sample mixing which is done
  529.   by the output device (hardware accelerated) or
  530.   DirectSound (emulated). Audio CD playback requires no
  531.   CPU usage.
  532.   RETURN : The CPU usage percentage
  533. }
  534. function BASS_Start: BOOL; stdcall; external 'bass.dll' name 'BASS_Start';
  535. {
  536.   Start the digital output.
  537. }
  538. function BASS_Stop: BOOL; stdcall; external 'bass.dll' name 'BASS_Stop';
  539. {
  540.   Stop the digital output, stopping all musics/samples/
  541.   streams.
  542. }
  543. function BASS_Pause: BOOL; stdcall; external 'bass.dll' name 'BASS_Pause';
  544. {
  545.   Stop the digital output, pausing all musics/samples/
  546.   streams. Use BASS_Start to resume the digital output.
  547. }
  548. function BASS_SetVolume(volume: DWORD): BOOL; stdcall; external 'bass.dll' name 'BASS_SetVolume';
  549. {
  550.   Set the digital output master volume.
  551.   volume : Desired volume level (0-100)
  552. }
  553. function BASS_GetVolume: Integer; stdcall; external 'bass.dll' name 'BASS_GetVolume';
  554. {
  555.   Get the digital output master volume.
  556.   RETURN : The volume level (0-100, -1=error)
  557. }
  558. function BASS_Set3DFactors(distf, rollf, doppf: FLOAT): BOOL; stdcall; external 'bass.dll' name 'BASS_Set3DFactors';
  559. {
  560.   Set the factors that affect the calculations of 3D sound.
  561.   distf  : Distance factor (0.0-10.0, 1.0=use meters, 0.3=use feet, <0.0=leave current)
  562.            By default BASS measures distances in meters, you can change this
  563.            setting if you are using a different unit of measurement.
  564.   roolf  : Rolloff factor, how fast the sound quietens with distance
  565.            (0.0=no rolloff, 1.0=real world, 2.0=2x real... 10.0=max, <0.0=leave current)
  566.   doppf  : Doppler factor (0.0=no doppler, 1.0=real world, 2.0=2x real... 10.0=max, <0.0=leave current)
  567.            The doppler effect is the way a sound appears to change frequency when it is
  568.            moving towards or away from you. The listener and sound velocity settings are
  569.            used to calculate this effect, this "doppf" value can be used to lessen or
  570.            exaggerate the effect.
  571. }
  572. function BASS_Get3DFactors(var distf, rollf, doppf: FLOAT): BOOL; stdcall; external 'bass.dll' name 'BASS_Get3DFactors';
  573. {
  574.   Get the factors that affect the calculations of 3D sound.
  575.   distf  : Distance factor (NULL=don't get it)
  576.   roolf  : Rolloff factor (NULL=don't get it)
  577.   doppf  : Doppler factor (NULL=don't get it)
  578. }
  579. function BASS_Set3DPosition(var pos, vel, front, top: BASS_3DVECTOR): BOOL; stdcall; external 'bass.dll' name 'BASS_Set3DPosition';
  580. {
  581.   Set the position/velocity/orientation of the listener (ie. the player/viewer).
  582.   pos    : Position of the listener (NULL=leave current)
  583.   vel    : Listener's velocity, used to calculate doppler effect (NULL=leave current)
  584.   front  : Direction that listener's front is pointing (NULL=leave current)
  585.   top    : Direction that listener's top is pointing (NULL=leave current)
  586.          NOTE: front & top must both be set in a single call
  587. }
  588. function BASS_Get3DPosition(var pos, vel, front, top: BASS_3DVECTOR): BOOL; stdcall; external 'bass.dll' name 'BASS_Get3DPosition';
  589. {
  590.   Get the position/velocity/orientation of the listener.
  591.   pos    : Position of the listener (NULL=don't get it)
  592.   vel    : Listener's velocity (NULL=don't get it)
  593.   front  : Direction that listener's front is pointing (NULL=don't get it)
  594.   top    : Direction that listener's top is pointing (NULL=don't get it)
  595.          NOTE: front & top must both be retrieved in a single call
  596. }
  597. function BASS_Apply3D: BOOL; stdcall; external 'bass.dll' name 'BASS_Apply3D';
  598. {
  599.   Apply changes made to the 3D system. This must be called to apply any changes
  600.   made with BASS_Set3DFactors, BASS_Set3DPosition, BASS_ChannelSet3DAttributes or
  601.   BASS_ChannelSet3DPosition. It improves performance to have DirectSound do all the
  602.   required recalculating at the same time like this, rather than recalculating after
  603.   every little change is made. NOTE: This is automatically called when starting a 3D
  604.   sample with BASS_SamplePlay3D/Ex.
  605. }
  606. function BASS_SetEAXParameters(env: Integer; vol, decay, damp: FLOAT): BOOL; stdcall; external 'bass.dll' name 'BASS_SetEAXParameters';
  607. {
  608.   Set the type of EAX environment and it's parameters. Obviously, EAX functions
  609.   have no effect if no EAX supporting device (ie. SB Live) is used.
  610.   env    : Reverb environment (EAX_ENVIRONMENT_xxx, -1=leave current)
  611.   vol    : Volume of the reverb (0.0=off, 1.0=max, <0.0=leave current)
  612.   decay  : Time in seconds it takes the reverb to diminish by 60dB (0.1-20.0, <0.0=leave current)
  613.   damp   : The damping, high or low frequencies decay faster (0.0=high decays quickest,
  614.            1.0=low/high decay equally, 2.0=low decays quickest, <0.0=leave current)
  615. }
  616. function BASS_GetEAXParameters(var env: DWORD; var vol, decay, damp: FLOAT): BOOL; stdcall; external 'bass.dll' name 'BASS_GetEAXParameters';
  617. {
  618.   Get the current EAX parameters.
  619.   env    : Reverb environment (NULL=don't get it)
  620.   vol    : Reverb volume (NULL=don't get it)
  621.   decay  : Decay duration (NULL=don't get it)
  622.   damp   : The damping (NULL=don't get it)
  623. }
  624. function BASS_SetA3DResManager(mode: DWORD): BOOL; stdcall; external 'bass.dll' name 'BASS_SetA3DResManager';
  625. {
  626.   Set the A3D resource management mode.
  627.   mode   : The mode (A3D_RESMODE_OFF=disable resource management,
  628.            A3D_RESMODE_DYNAMIC=enable resource manager but looping channels are not managed,
  629.            A3D_RESMODE_DYNAMIC_LOOPERS=enable resource manager including looping channels,
  630.            A3D_RESMODE_NOTIFY=plays will fail when there are no available resources)
  631. }
  632. function BASS_GetA3DResManager: DWORD; stdcall; external 'bass.dll' name 'BASS_GetA3DResManager';
  633. {
  634.   Get the A3D resource management mode.
  635.   RETURN : The mode (0xffffffff=error)
  636. }
  637. function BASS_SetA3DHFAbsorbtion(factor: FLOAT): BOOL; stdcall; external 'bass.dll' name 'BASS_SetA3DHFAbsorbtion';
  638. {
  639.   Set the A3D high frequency absorbtion factor.
  640.   factor  : Absorbtion factor (0.0=disabled, <1.0=diminished, 1.0=default,
  641.             >1.0=exaggerated)
  642. }
  643. function BASS_GetA3DHFAbsorbtion(var factor: FLOAT): BOOL; stdcall; external 'bass.dll' name 'BASS_GetA3DHFAbsorbtion';
  644. {
  645.   Retrieve the current A3D high frequency absorbtion factor.
  646.   factor  : The absorbtion factor
  647. }
  648. function BASS_MusicLoad(mem: BOOL; f: Pointer; offset, length, flags: DWORD): HMUSIC; stdcall; external 'bass.dll' name 'BASS_MusicLoad';
  649. {
  650.   Load a music (XM/MOD/S3M/IT/MTM). The amplification and pan
  651.   seperation are initially set to 50, use BASS_MusicSetAmplify()
  652.   and BASS_MusicSetPanSep() to adjust them.
  653.   mem    : TRUE = Load music from memory
  654.   f      : Filename (mem=FALSE) or memory location (mem=TRUE)
  655.   offset : File offset to load the music from (only used if mem=FALSE)
  656.   length : Data length (only used if mem=FALSE, 0=use to end of file)
  657.   flags  : BASS_MUSIC_xxx flags
  658.   RETURN : The loaded music's handle (NULL=error)
  659. }
  660. procedure BASS_MusicFree(handle: HMUSIC); stdcall; external 'bass.dll' name 'BASS_MusicFree';
  661. {
  662.   Free a music's resources.
  663.   handle : Music handle
  664. }
  665. function BASS_MusicGetName(handle: HMUSIC): PChar; stdcall; external 'bass.dll' name 'BASS_MusicGetName';
  666. {
  667.   Retrieves a music's name.
  668.   handle : Music handle
  669.   RETURN : The music's name (NULL=error)
  670. }
  671. function BASS_MusicGetLength(handle: HMUSIC): DWORD; stdcall; external 'bass.dll' name 'BASS_MusicGetLength';
  672. {
  673.   Retrieves the length of a music in patterns (ie. how many "orders"
  674.   there are).
  675.   handle : Music handle
  676.   RETURN : The length of the music (0xFFFFFFFF=error)
  677. }
  678. function BASS_MusicPlay(handle: HMUSIC): BOOL; stdcall; external 'bass.dll' name 'BASS_MusicPlay';
  679. {
  680.   Play a music. Playback continues from where it was last stopped/paused.
  681.   Multiple musics may be played simultaneously.
  682.   handle : Handle of music to play
  683. }
  684. function BASS_MusicPlayEx(handle: HMUSIC; pos: DWORD; flags: Integer; reset: BOOL): BOOL; stdcall; external 'bass.dll' name 'BASS_MusicPlayEx';
  685. {
  686.   Play a music, specifying start position and playback flags.
  687.   handle : Handle of music to play
  688.   pos    : Position to start playback from, LOWORD=order HIWORD=row
  689.   flags  : BASS_MUSIC_xxx flags. These flags overwrite the defaults
  690.            specified when the music was loaded. (-1=use current flags)
  691.   reset  : TRUE = Stop all current playing notes and reset bpm/etc... */
  692. }
  693. function BASS_MusicSetAmplify(handle: HMUSIC; amp: DWORD): BOOL; stdcall; external 'bass.dll' name 'BASS_MusicSetAmplify';
  694. {
  695.   Set a music's amplification level.
  696.   handle : Music handle
  697.   amp    : Amplification level (0-100)
  698. }
  699. function BASS_MusicSetPanSep(handle: HMUSIC; pan: DWORD): BOOL; stdcall; external 'bass.dll' name 'BASS_MusicSetPanSep';
  700. {
  701.   Set a music's pan seperation.
  702.   handle : Music handle
  703.   pan    : Pan seperation (0-100, 50=linear)
  704. }
  705. function BASS_MusicSetPositionScaler(handle: HMUSIC; scale: DWORD): BOOL; stdcall; external 'bass.dll' name 'BASS_MusicSetPositionScaler';
  706. {
  707.   Set a music's "GetPosition" scaler
  708.   When you call BASS_ChannelGetPosition, the "row" (HIWORD) will be
  709.   scaled by this value. By using a higher scaler, you can get a more
  710.   precise position indication.
  711.   handle : Music handle
  712.   scale  : The scaler (1-256)
  713. }
  714. function BASS_SampleLoad(mem: BOOL; f: Pointer; offset, length, max, flags: DWORD): HSAMPLE; stdcall; external 'bass.dll' name 'BASS_SampleLoad';
  715. {
  716.   Load a WAV sample. If you're loading a sample with 3D functionality,
  717.   then you should use BASS_GetInfo and BASS_SetInfo to set the default 3D
  718.   parameters. You can also use these two functions to set the sample's
  719.   default frequency/volume/pan/looping.
  720.   mem    : TRUE = Load sample from memory
  721.   f      : Filename (mem=FALSE) or memory location (mem=TRUE)
  722.   offset : File offset to load the sample from (only used if mem=FALSE)
  723.   length : Data length (only used if mem=FALSE, 0=use to end of file)
  724.   max    : Maximum number of simultaneous playbacks (1-65535)
  725.   flags  : BASS_SAMPLE_xxx flags (only the LOOP/3D/SOFTWARE/OVER_xxx flags are used)
  726.   RETURN : The loaded sample's handle (NULL=error)
  727. }
  728. function BASS_SampleCreate(length, freq, max, flags: DWORD): Pointer; stdcall; external 'bass.dll' name 'BASS_SampleCreate';
  729. {
  730.   Create a sample. This function allows you to generate custom samples, or
  731.   load samples that are not in the WAV format. A pointer is returned to the
  732.   memory location at which you should write the sample's data. After writing
  733.   the data, call BASS_SampleCreateDone to get the new sample's handle.
  734.   length : The sample's length (in samples, NOT bytes)
  735.   freq   : default sample rate
  736.   max    : Maximum number of simultaneous playbacks (1-65535)
  737.   flags  : BASS_SAMPLE_xxx flags
  738.   RETURN : Memory location to write the sample's data (NULL=error)
  739. }
  740. function BASS_SampleCreateDone: HSAMPLE; stdcall; external 'bass.dll' name 'BASS_SampleCreateDone';
  741. {
  742.   Finished creating a new sample.
  743.   RETURN : The new sample's handle (NULL=error)
  744. }
  745. procedure BASS_SampleFree(handle: HSAMPLE); stdcall; external 'bass.dll' name 'BASS_SampleFree';
  746. {
  747.   Free a sample's resources.
  748.   handle : Sample handle
  749. }
  750. function BASS_SampleGetInfo(handle: HSAMPLE; var info: BASS_SAMPLE): BOOL; stdcall; external 'bass.dll' name 'BASS_SampleGetInfo';
  751. {
  752.   Retrieve a sample's current default attributes.
  753.   handle : Sample handle
  754.   info   : Pointer to store sample info
  755. }
  756. function BASS_SampleSetInfo(handle: HSAMPLE; var info: BASS_SAMPLE): BOOL; stdcall; external 'bass.dll' name 'BASS_SampleSetInfo';
  757. {
  758.   Set a sample's default attributes.
  759.   handle : Sample handle
  760.   info   : Sample info, only the freq/volume/pan/3D attributes and
  761.            looping/override method flags are used
  762. }
  763. function BASS_SamplePlay(handle: HSAMPLE): HCHANNEL; stdcall; external 'bass.dll' name 'BASS_SamplePlay';
  764. {
  765.   Play a sample, using the sample's default attributes.
  766.   handle : Handle of sample to play
  767.   RETURN : Handle of channel used to play the sample (NULL=error)
  768. }
  769. function BASS_SamplePlayEx(handle: HSAMPLE; start: DWORD; freq, volume, pan: Integer; loop: BOOL): HCHANNEL; stdcall; external 'bass.dll' name 'BASS_SamplePlayEx';
  770. {
  771.   Play a sample, using specified attributes.
  772.   handle : Handle of sample to play
  773.   start  : Playback start position (in samples, not bytes)
  774.   freq   : Playback rate (-1=default)
  775.   volume : Volume (-1=default, 0=silent, 100=max)
  776.   pan    : Pan position (-101=default, -100=left, 0=middle, 100=right)
  777.   loop   : TRUE = Loop sample (-1=default)
  778.   RETURN : Handle of channel used to play the sample (NULL=error)
  779. }
  780. function BASS_SamplePlay3D(handle: HSAMPLE; var pos, orient, vel: BASS_3DVECTOR): HCHANNEL; stdcall; external 'bass.dll' name 'BASS_SamplePlay3D';
  781. {
  782.   Play a 3D sample, setting it's 3D position, orientation and velocity.
  783.   handle : Handle of sample to play
  784.   pos    : position of the sound (NULL = x/y/z=0.0)
  785.   orient : orientation of the sound, this is irrelevant if it's an
  786.            omnidirectional sound source (NULL = x/y/z=0.0)
  787.   vel    : velocity of the sound (NULL = x/y/z=0.0)
  788.   RETURN : Handle of channel used to play the sample (NULL=error)
  789. }
  790. function BASS_SamplePlay3DEx(handle: HSAMPLE; var pos, orient, vel: BASS_3DVECTOR; start: DWORD; freq, volume: Integer; loop: BOOL): HCHANNEL; stdcall; external 'bass.dll' name 'BASS_SamplePlay3DEx';
  791. {
  792.   Play a 3D sample, using specified attributes.
  793.   handle : Handle of sample to play
  794.   pos    : position of the sound (NULL = x/y/z=0.0)
  795.   orient : orientation of the sound, this is irrelevant if it's an
  796.            omnidirectional sound source (NULL = x/y/z=0.0)
  797.   vel    : velocity of the sound (NULL = x/y/z=0.0)
  798.   start  : Playback start position (in samples, not bytes)
  799.   freq   : Playback rate (-1=default)
  800.   volume : Volume (-1=default, 0=silent, 100=max)
  801.   loop   : TRUE = Loop sample (-1=default)
  802.   RETURN : Handle of channel used to play the sample (NULL=error)
  803. }
  804. function BASS_SampleStop(handle: HSAMPLE): BOOL; stdcall; external 'bass.dll' name 'BASS_SampleStop';
  805. {
  806.   Stops all instances of a sample. For example, if a sample is playing
  807.   simultaneously 3 times, calling this function will stop all 3 of them,
  808.   which is obviously simpler than calling BASS_ChannelStop() 3 times.
  809.   handle : Handle of sample to stop
  810. }
  811. function BASS_StreamCreate(freq, flags: DWORD; proc: STREAMPROC; user: DWORD): HSTREAM; stdcall; external 'bass.dll' name 'BASS_StreamCreate';
  812. {
  813.   Create a user sample stream.
  814.   freq   : Stream playback rate
  815.   flags  : BASS_SAMPLE_xxx flags (only the 8BITS/MONO/3D flags are used)
  816.   proc   : User defined stream writing function
  817.   user   : The 'user' value passed to the callback function
  818.   RETURN : The created stream's handle (NULL=error)
  819. }
  820. function BASS_StreamCreateFile(mem: BOOL; f: Pointer; offset, length, flags: DWORD): HSTREAM; stdcall; external 'bass.dll' name 'BASS_StreamCreateFile';
  821. {
  822.   Create a sample stream from an MP3 or WAV file.
  823.   mem    : TRUE = Stream file from memory
  824.   f      : Filename (mem=FALSE) or memory location (mem=TRUE)
  825.   offset : File offset of the stream data
  826.   length : File length (0=use whole file if mem=FALSE)
  827.   flags  : BASS_SAMPLE_3D and/or BASS_MP3_LOWQ flags
  828.   RETURN : The created stream's handle (NULL=error)
  829. }
  830. procedure BASS_StreamFree(handle: HSTREAM); stdcall; external 'bass.dll' name 'BASS_StreamFree';
  831. {
  832.   Free a sample stream's resources.
  833.   stream : Stream handle
  834. }
  835. function BASS_StreamGetLength(handle: HSTREAM): DWORD; stdcall; external 'bass.dll' name 'BASS_StreamGetLength';
  836. {
  837.   Retrieves the playback length (in bytes) of a file stream. It's not
  838.   always possible to 100% accurately guess the length of a stream, so
  839.   the length returned may be only an approximation when using some WAV
  840.   codecs.
  841.   handle : Stream handle
  842.   RETURN : The length (0xffffffff=error)
  843. }
  844. function BASS_StreamGetBlockLength(handle: HSTREAM): DWORD; stdcall; external 'bass.dll' name 'BASS_StreamGetBlockLength';
  845. {
  846.   Retrieves the playback length (in bytes) of a block in a file stream.
  847.   handle : Stream handle
  848.   RETURN : The block length (0xffffffff=error)
  849. }
  850. function BASS_StreamPlay(handle: HSTREAM; flush: BOOL; flags: DWORD): BOOL; stdcall; external 'bass.dll' name 'BASS_StreamPlay';
  851. {
  852.   Play a sample stream, optionally flushing the buffer first.
  853.   handle : Handle of stream to play
  854.   flush  : Flush buffer contents. If you stop a stream and then want to
  855.            continue it from where it stopped, don't flush it. Flushing
  856.            a file stream causes it to restart from the beginning.
  857.   flags  : BASS_SAMPLE_xxx flags (only affects file streams, and only the
  858.           LOOP flag is used)
  859. }
  860. function BASS_CDInit(drive: PChar): BOOL; stdcall; external 'bass.dll' name 'BASS_CDInit';
  861. {
  862.   Initialize the CD functions, must be called before any other CD
  863.   functions. The volume is initially set to 100 (the maximum), use
  864.   BASS_ChannelSetAttributes() to adjust it.
  865.   drive  : The CD drive, for example: "d:" (NULL=use default drive)
  866. }
  867. procedure BASS_CDFree; stdcall; external 'bass.dll' name 'BASS_CDFree';
  868. {
  869.   Free resources used by the CD
  870. }
  871. function BASS_CDInDrive: BOOL; stdcall; external 'bass.dll' name 'BASS_CDInDrive';
  872. {
  873.   Check if there is a CD in the drive.
  874. }
  875. function BASS_CDPlay(track: DWORD; loop: BOOL; wait: BOOL): BOOL; stdcall; external 'bass.dll' name 'BASS_CDPlay';
  876. {
  877.   Play a CD track.
  878.   track  : Track number to play (1=first)
  879.   loop   : TRUE = Loop the track
  880.   wait   : TRUE = don't return until playback has started (some drives
  881.            will always wait anyway)
  882. }
  883.  
  884. {
  885.   A "channel" can be a playing sample (HCHANNEL), a MOD music (HMUSIC),
  886.   a sample stream (HSTREAM), or the CD (CDCHANNEL). The following
  887.   functions can be used with one or more of these channel types.
  888. }
  889. function BASS_ChannelIsActive(handle: DWORD): BOOL; stdcall; external 'bass.dll' name 'BASS_ChannelIsActive';
  890. {
  891.   Check if a channel is active (playing).
  892.   handle : Channel handle (HCHANNEL/HMUSIC/HSTREAM, or CDCHANNEL)
  893. }
  894. function BASS_ChannelGetFlags(handle: DWORD): DWORD; stdcall; external 'bass.dll' name 'BASS_ChannelGetFlags';
  895. {
  896.   Get some info about a channel.
  897.   handle : Channel handle (HCHANNEL/HMUSIC/HSTREAM)
  898.   RETURN : BASS_SAMPLE_xxx flags (0xffffffff=error)
  899. }
  900. function BASS_ChannelStop(handle: DWORD): BOOL; stdcall; external 'bass.dll' name 'BASS_ChannelStop';
  901. {
  902.   Stop a channel.
  903.   handle : Channel handle (HCHANNEL/HMUSIC/HSTREAM, or CDCHANNEL)
  904. }
  905. function BASS_ChannelPause(handle: DWORD): BOOL; stdcall; external 'bass.dll' name 'BASS_ChannelPause';
  906. {
  907.   Pause a channel.
  908.   handle : Channel handle (HCHANNEL/HMUSIC/HSTREAM, or CDCHANNEL)
  909. }
  910. function BASS_ChannelResume(handle: DWORD): BOOL; stdcall; external 'bass.dll' name 'BASS_ChannelResume';
  911. {
  912.   Resume a paused channel.
  913.   handle : Channel handle (HCHANNEL/HMUSIC/HSTREAM, or CDCHANNEL)
  914. }
  915. function BASS_ChannelSetAttributes(handle: DWORD; freq, volume, pan: Integer): BOOL; stdcall; external 'bass.dll' name 'BASS_ChannelSetAttributes';
  916. {
  917.   Update a channel's attributes. The actual setting may not be exactly
  918.   as specified, depending on the accuracy of the device and drivers.
  919.   NOTE: Only the volume can be adjusted for the CD "channel", but not all
  920.   soundcards allow controlling of the CD volume level.
  921.   handle : Channel handle (HCHANNEL/HMUSIC/HSTREAM, or CDCHANNEL)
  922.   freq   : Playback rate (-1=leave current)
  923.   volume : Volume (-1=leave current, 0=silent, 100=max)
  924.   pan    : Pan position (-101=current, -100=left, 0=middle, 100=right)
  925.            panning has no effect on 3D channels
  926. }
  927. function BASS_ChannelGetAttributes(handle: DWORD; var freq, volume: DWORD; var pan: Integer): BOOL; stdcall; external 'bass.dll' name 'BASS_ChannelGetAttributes';
  928. {
  929.   Retrieve a channel's attributes. Only the volume is available for
  930.   the CD "channel" (if allowed by the soundcard/drivers).
  931.   handle : Channel handle (HCHANNEL/HMUSIC/HSTREAM, or CDCHANNEL)
  932.   freq   : Pointer to store playback rate (NULL=don't retrieve it)
  933.   volume : Pointer to store volume (NULL=don't retrieve it)
  934.   pan    : Pointer to store pan position (NULL=don't retrieve it)
  935. }
  936. function BASS_ChannelSet3DAttributes(handle: DWORD; mode: Integer; min, max: FLOAT; iangle, oangle, outvol: Integer): BOOL; stdcall; external 'bass.dll' name 'BASS_ChannelSet3DAttributes';
  937. {
  938.   Set a channel's 3D attributes.
  939.   handle : Channel handle (HCHANNEL/HSTREAM/HMUSIC)
  940.   mode   : BASS_3DMODE_xxx mode (-1=leave current setting)
  941.   min    : minimum distance, volume stops increasing within this distance (<0.0=leave current)
  942.   max    : maximum distance, volume stops decreasing past this distance (<0.0=leave current)
  943.   iangle : angle of inside projection cone in degrees (360=omnidirectional, -1=leave current)
  944.   oangle : angle of outside projection cone in degrees (-1=leave current)
  945.            NOTE: iangle & oangle must both be set in a single call
  946.   outvol : delta-volume outside the projection cone (0=silent, 100=same as inside)
  947.   The iangle/oangle angles decide how wide the sound is projected around the
  948.   orientation angle. Within the inside angle the volume level is the channel
  949.   level as set with BASS_ChannelSetAttributes, from the inside to the outside
  950.   angles the volume gradually changes by the "outvol" setting.
  951. }
  952. function BASS_ChannelGet3DAttributes(handle: DWORD; var mode: DWORD; var min, max: FLOAT; var iangle, oangle, outvol: DWORD): BOOL; stdcall; external 'bass.dll' name 'BASS_ChannelGet3DAttributes';
  953. {
  954.   Retrieve a channel's 3D attributes.
  955.   handle : Channel handle (HCHANNEL/HSTREAM/HMUSIC)
  956.   mode   : BASS_3DMODE_xxx mode (NULL=don't retrieve it)
  957.   min    : minumum distance (NULL=don't retrieve it)
  958.   max    : maximum distance (NULL=don't retrieve it)
  959.   iangle : angle of inside projection cone (NULL=don't retrieve it)
  960.   oangle : angle of outside projection cone (NULL=don't retrieve it)
  961.            NOTE: iangle & oangle must both be retrieved in a single call
  962.   outvol : delta-volume outside the projection cone (NULL=don't retrieve it)
  963. }
  964. function BASS_ChannelSet3DPosition(handle: DWORD; var pos, orient, vel: BASS_3DVECTOR): BOOL; stdcall; external 'bass.dll' name 'BASS_ChannelSet3DPosition';
  965. {
  966.   Update a channel's 3D position, orientation and velocity. The velocity
  967.   is only used to calculate the doppler effect.
  968.   handle : Channel handle (HCHANNEL/HSTREAM/HMUSIC)
  969.   pos    : position of the sound (NULL=leave current)
  970.   orient : orientation of the sound, this is irrelevant if it's an
  971.            omnidirectional sound source (NULL=leave current)
  972.   vel    : velocity of the sound (NULL=leave current)
  973. }
  974. function BASS_ChannelGet3DPosition(handle: DWORD; var pos, orient, vel: BASS_3DVECTOR): BOOL; stdcall; external 'bass.dll' name 'BASS_ChannelGet3DPosition';
  975. {
  976.   Retrieve a channel's current 3D position, orientation and velocity.
  977.   handle : Channel handle (HCHANNEL/HSTREAM/HMUSIC)
  978.   pos    : position of the sound (NULL=don't retrieve it)
  979.   orient : orientation of the sound, this is irrelevant if it's an
  980.            omnidirectional sound source (NULL=don't retrieve it)
  981.   vel    : velocity of the sound (NULL=don't retrieve it)
  982. }
  983. function BASS_ChannelSetPosition(handle: DWORD; pos: DWORD): BOOL; stdcall; external 'bass.dll' name 'BASS_ChannelSetPosition';
  984. {
  985.   Set the current playback position of a channel.
  986.   handle : Channel handle (HCHANNEL/HMUSIC, or CDCHANNEL)
  987.   pos    : the position
  988.            if HCHANNEL: position in bytes
  989.            if HMUSIC: LOWORD=order HIWORD=row ... use MAKELONG(order,row)
  990.            if CDCHANNEL: position in milliseconds from start of track
  991. }
  992. function BASS_ChannelGetPosition(handle: DWORD): DWORD; stdcall; external 'bass.dll' name 'BASS_ChannelGetPosition';
  993. {
  994.   Get the current playback position of a channel.
  995.   handle : Channel handle (HCHANNEL/HMUSIC/HSTREAM, or CDCHANNEL)
  996.   RETURN : the position (0xffffffff=error)
  997.            if HCHANNEL: position in bytes
  998.            if HMUSIC: LOWORD=order HIWORD=row (see BASS_MusicSetPositionScaler)
  999.            if HSTREAM: total bytes played since the stream was last flushed
  1000.            if CDCHANNEL: position in milliseconds from start of track
  1001. }
  1002. function BASS_ChannelGetLevel(handle: DWORD): DWORD; stdcall; external 'bass.dll' name 'BASS_ChannelGetLevel';
  1003. {
  1004.   Calculate a channel's current output level.
  1005.   handle : Channel handle (HMUSIC/HSTREAM)
  1006.   RETURN : LOWORD=left level (0-128) HIWORD=right level (0-128) (0xffffffff=error)
  1007. }
  1008. function BASS_ChannelGetData(handle: DWORD; buffer: Pointer; length: DWORD): DWORD; stdcall; external 'bass.dll' name 'BASS_ChannelGetData';
  1009. {
  1010.   Retrieves upto "length" bytes of the channel's current sample data.
  1011.   This is useful if you wish to "visualize" the sound.
  1012.   handle : Channel handle (HMUSIC/HSTREAM)
  1013.   buffer : Location to write the sample data
  1014.   length : Number of bytes wanted
  1015.   RETURN : Number of bytes actually written to the buffer (0xffffffff=error)
  1016. }
  1017. function BASS_ChannelSetSync(handle: DWORD; atype, param: DWORD; proc: SYNCPROC; user: DWORD): HSYNC; stdcall; external 'bass.dll' name 'BASS_ChannelSetSync';
  1018. {
  1019.   Setup a sync on a channel. Multiple syncs may be used per channel.
  1020.   handle : Channel handle (currently there are only HMUSIC syncs)
  1021.   atype  : Sync type (BASS_SYNC_xxx type & flags)
  1022.   param  : Sync parameters (see the BASS_SYNC_xxx type description)
  1023.   proc   : User defined callback function
  1024.   user   : The 'user' value passed to the callback function
  1025.   RETURN : Sync handle (NULL=error)
  1026. }
  1027. function BASS_ChannelRemoveSync(handle: DWORD; sync: HSYNC): BOOL; stdcall; external 'bass.dll' name 'BASS_ChannelRemoveSync';
  1028. {
  1029.   Remove a sync from a channel
  1030.   handle : Channel handle (HMUSIC)
  1031.   sync   : Handle of sync to remove
  1032. }
  1033. function BASS_ChannelSetDSP(handle: DWORD; proc: DSPPROC; user: DWORD): HDSP; stdcall; external 'bass.dll' name 'BASS_ChannelSetDSP';
  1034. {
  1035.   Setup a user DSP function on a channel. When multiple DSP functions
  1036.   are used on a channel, they are called in the order that they were added.
  1037.   handle : Channel handle (HMUSIC/HSTREAM)
  1038.   proc   : User defined callback function
  1039.   user   : The 'user' value passed to the callback function
  1040.   RETURN : DSP handle (NULL=error)
  1041. }
  1042. function BASS_ChannelRemoveDSP(handle: DWORD; dsp: HDSP): BOOL; stdcall; external 'bass.dll' name 'BASS_ChannelRemoveDSP';
  1043. {
  1044.   Remove a DSP function from a channel
  1045.   handle : Channel handle (HMUSIC/HSTREAM)
  1046.   dsp    : Handle of DSP to remove
  1047. }
  1048. function BASS_ChannelSetEAXMix(handle: DWORD; mix: FLOAT): BOOL; stdcall; external 'bass.dll' name 'BASS_ChannelSetEAXMix';
  1049. {
  1050.   Set the wet(reverb)/dry(no reverb) mix ratio on the channel. By default
  1051.   the distance of the sound from the listener is used to calculate the mix.
  1052.   NOTE: The channel must have 3D functionality enabled for the EAX environment
  1053.   to have any affect on it.
  1054.   handle : Channel handle (HCHANNEL/HSTREAM/HMUSIC)
  1055.   mix    : The ratio (0.0=reverb off, 1.0=max reverb, -1.0=let EAX calculate
  1056.            the reverb mix based on the distance)
  1057. }
  1058. function BASS_ChannelGetEAXMix(handle: DWORD; var mix: FLOAT): BOOL; stdcall; external 'bass.dll' name 'BASS_ChannelGetEAXMix';
  1059. {
  1060.   Get the wet(reverb)/dry(no reverb) mix ratio on the channel.
  1061.   handle : Channel handle (HCHANNEL/HSTREAM/HMUSIC)
  1062.   mix    : Pointer to store the ratio at
  1063. }
  1064.  
  1065. procedure BASS_EAXPreset(env: Integer);
  1066. {
  1067.   This function is defined in the implementation part of this unit.
  1068.   It is not part of BASS.DLL but an extra function which makes it easier
  1069.   to set the predefined EAX environments.
  1070.   env    : a EAX_ENVIRONMENT_xxx constant
  1071. }
  1072.  
  1073. implementation
  1074.  
  1075. procedure BASS_EAXPreset(env: Integer);
  1076. begin
  1077.   case (env) of
  1078.     EAX_ENVIRONMENT_GENERIC:
  1079.       BASS_SetEAXParameters(EAX_ENVIRONMENT_GENERIC, 0.5, 1.493, 0.5);
  1080.     EAX_ENVIRONMENT_PADDEDCELL:
  1081.       BASS_SetEAXParameters(EAX_ENVIRONMENT_PADDEDCELL, 0.25, 0.1, 0);
  1082.     EAX_ENVIRONMENT_ROOM:
  1083.       BASS_SetEAXParameters(EAX_ENVIRONMENT_ROOM, 0.417, 0.4, 0.666);
  1084.     EAX_ENVIRONMENT_BATHROOM:
  1085.       BASS_SetEAXParameters(EAX_ENVIRONMENT_BATHROOM, 0.653, 1.499, 0.166);
  1086.     EAX_ENVIRONMENT_LIVINGROOM:
  1087.       BASS_SetEAXParameters(EAX_ENVIRONMENT_LIVINGROOM, 0.208, 0.478, 0);
  1088.     EAX_ENVIRONMENT_STONEROOM:
  1089.       BASS_SetEAXParameters(EAX_ENVIRONMENT_STONEROOM, 0.5, 2.309, 0.888);
  1090.     EAX_ENVIRONMENT_AUDITORIUM:
  1091.       BASS_SetEAXParameters(EAX_ENVIRONMENT_AUDITORIUM, 0.403, 4.279, 0.5);
  1092.     EAX_ENVIRONMENT_CONCERTHALL:
  1093.       BASS_SetEAXParameters(EAX_ENVIRONMENT_CONCERTHALL, 0.5, 3.961, 0.5);
  1094.     EAX_ENVIRONMENT_CAVE:
  1095.       BASS_SetEAXParameters(EAX_ENVIRONMENT_CAVE, 0.5, 2.886, 1.304);
  1096.     EAX_ENVIRONMENT_ARENA:
  1097.       BASS_SetEAXParameters(EAX_ENVIRONMENT_ARENA, 0.361, 7.284, 0.332);
  1098.     EAX_ENVIRONMENT_HANGAR:
  1099.       BASS_SetEAXParameters(EAX_ENVIRONMENT_HANGAR, 0.5, 10.0, 0.3);
  1100.     EAX_ENVIRONMENT_CARPETEDHALLWAY:
  1101.       BASS_SetEAXParameters(EAX_ENVIRONMENT_CARPETEDHALLWAY, 0.153, 0.259, 2.0);
  1102.     EAX_ENVIRONMENT_HALLWAY:
  1103.       BASS_SetEAXParameters(EAX_ENVIRONMENT_HALLWAY, 0.361, 1.493, 0);
  1104.     EAX_ENVIRONMENT_STONECORRIDOR:
  1105.       BASS_SetEAXParameters(EAX_ENVIRONMENT_STONECORRIDOR, 0.444, 2.697, 0.638);
  1106.     EAX_ENVIRONMENT_ALLEY:
  1107.       BASS_SetEAXParameters(EAX_ENVIRONMENT_ALLEY, 0.25, 1.752, 0.776);
  1108.     EAX_ENVIRONMENT_FOREST:
  1109.       BASS_SetEAXParameters(EAX_ENVIRONMENT_FOREST, 0.111, 3.145, 0.472);
  1110.     EAX_ENVIRONMENT_CITY:
  1111.       BASS_SetEAXParameters(EAX_ENVIRONMENT_CITY, 0.111, 2.767, 0.224);
  1112.     EAX_ENVIRONMENT_MOUNTAINS:
  1113.       BASS_SetEAXParameters(EAX_ENVIRONMENT_MOUNTAINS, 0.194, 7.841, 0.472);
  1114.     EAX_ENVIRONMENT_QUARRY:
  1115.       BASS_SetEAXParameters(EAX_ENVIRONMENT_QUARRY, 1, 1.499, 0.5);
  1116.     EAX_ENVIRONMENT_PLAIN:
  1117.       BASS_SetEAXParameters(EAX_ENVIRONMENT_PLAIN, 0.097, 2.767, 0.224);
  1118.     EAX_ENVIRONMENT_PARKINGLOT:
  1119.       BASS_SetEAXParameters(EAX_ENVIRONMENT_PARKINGLOT, 0.208, 1.652, 1.5);
  1120.     EAX_ENVIRONMENT_SEWERPIPE:
  1121.       BASS_SetEAXParameters(EAX_ENVIRONMENT_SEWERPIPE, 0.652, 2.886, 0.25);
  1122.     EAX_ENVIRONMENT_UNDERWATER:
  1123.       BASS_SetEAXParameters(EAX_ENVIRONMENT_UNDERWATER, 1, 1.499, 0);
  1124.     EAX_ENVIRONMENT_DRUGGED:
  1125.       BASS_SetEAXParameters(EAX_ENVIRONMENT_DRUGGED, 0.875, 8.392, 1.388);
  1126.     EAX_ENVIRONMENT_DIZZY:
  1127.       BASS_SetEAXParameters(EAX_ENVIRONMENT_DIZZY, 0.139, 17.234, 0.666);
  1128.     EAX_ENVIRONMENT_PSYCHOTIC:
  1129.       BASS_SetEAXParameters(EAX_ENVIRONMENT_PSYCHOTIC, 0.486, 7.563, 0.806);
  1130.     else
  1131.       BASS_SetEAXParameters(-1, 0, -1, -1);
  1132.   end;
  1133. end;
  1134.  
  1135. end.
  1136. // END OF FILE /////////////////////////////////////////////////////////////////
  1137.  
  1138.