home *** CD-ROM | disk | FTP | other *** search
/ Chip 2005 November / CDVD1105.ISO / Software / Freeware / programare / bass / Delphi / Bass.pas
Encoding:
Pascal/Delphi Source File  |  2005-09-27  |  41.6 KB  |  921 lines

  1. {
  2.   BASS 2.2 Audio Library, (c) 1999-2005 Ian Luck.
  3.   Please report bugs/suggestions/etc... to bass@un4seen.com
  4.  
  5.   See the BASS.CHM file for more complete documentation
  6.  
  7.  
  8.   How to install
  9.   ----------------
  10.   Copy BASS.PAS to the \LIB subdirectory of your Delphi path or your project dir
  11. }
  12. unit Bass;
  13.  
  14. interface
  15.  
  16. uses
  17.   Windows;
  18.  
  19. const
  20.   // Use these to test for error from functions that return a DWORD or QWORD
  21.   DW_ERROR = Cardinal(-1); // -1 (DWORD)
  22.   QW_ERROR = Int64(-1);    // -1 (QWORD)
  23.  
  24.   // Error codes returned by BASS_GetErrorCode()
  25.   BASS_OK                 = 0;    // all is OK
  26.   BASS_ERROR_MEM          = 1;    // memory error
  27.   BASS_ERROR_FILEOPEN     = 2;    // can't open the file
  28.   BASS_ERROR_DRIVER       = 3;    // can't find a free sound driver
  29.   BASS_ERROR_BUFLOST      = 4;    // the sample buffer was lost - please report this!
  30.   BASS_ERROR_HANDLE       = 5;    // invalid handle
  31.   BASS_ERROR_FORMAT       = 6;    // unsupported sample format
  32.   BASS_ERROR_POSITION     = 7;    // invalid playback position
  33.   BASS_ERROR_INIT         = 8;    // BASS_Init has not been successfully called
  34.   BASS_ERROR_START        = 9;    // BASS_Start has not been successfully called
  35.   BASS_ERROR_ALREADY      = 14;   // already initialized/paused/whatever
  36.   BASS_ERROR_NOPAUSE      = 16;   // not paused
  37.   BASS_ERROR_NOCHAN       = 18;   // can't get a free channel
  38.   BASS_ERROR_ILLTYPE      = 19;   // an illegal type was specified
  39.   BASS_ERROR_ILLPARAM     = 20;   // an illegal parameter was specified
  40.   BASS_ERROR_NO3D         = 21;   // no 3D support
  41.   BASS_ERROR_NOEAX        = 22;   // no EAX support
  42.   BASS_ERROR_DEVICE       = 23;   // illegal device number
  43.   BASS_ERROR_NOPLAY       = 24;   // not playing
  44.   BASS_ERROR_FREQ         = 25;   // illegal sample rate
  45.   BASS_ERROR_NOTFILE      = 27;   // the stream is not a file stream
  46.   BASS_ERROR_NOHW         = 29;   // no hardware voices available
  47.   BASS_ERROR_EMPTY        = 31;   // the MOD music has no sequence data
  48.   BASS_ERROR_NONET        = 32;   // no internet connection could be opened
  49.   BASS_ERROR_CREATE       = 33;   // couldn't create the file
  50.   BASS_ERROR_NOFX         = 34;   // effects are not enabled
  51.   BASS_ERROR_PLAYING      = 35;   // the channel is playing
  52.   BASS_ERROR_NOTAVAIL     = 37;   // requested data is not available
  53.   BASS_ERROR_DECODE       = 38;   // the channel is a "decoding channel"
  54.   BASS_ERROR_DX           = 39;   // a sufficient DirectX version is not installed
  55.   BASS_ERROR_TIMEOUT      = 40;   // connection timedout
  56.   BASS_ERROR_FILEFORM     = 41;   // unsupported file format
  57.   BASS_ERROR_SPEAKER      = 42;   // unavailable speaker
  58.   BASS_ERROR_UNKNOWN      = -1;   // some other mystery error
  59.  
  60.   // Initialization flags
  61.   BASS_DEVICE_8BITS       = 1;    // use 8 bit resolution, else 16 bit
  62.   BASS_DEVICE_MONO        = 2;    // use mono, else stereo
  63.   BASS_DEVICE_3D          = 4;    // enable 3D functionality
  64.   {
  65.     If the BASS_DEVICE_3D flag is not specified when
  66.     initilizing BASS, then the 3D flags (BASS_SAMPLE_3D
  67.     and BASS_MUSIC_3D) are ignored when loading/creating
  68.     a sample/stream/music.
  69.   }
  70.   BASS_DEVICE_LATENCY     = 256;  // calculate device latency (BASS_INFO struct)
  71.   BASS_DEVICE_SPEAKERS    = 2048; // force enabling of speaker assignment
  72.  
  73.   // DirectSound interfaces (for use with BASS_GetDSoundObject)
  74.   BASS_OBJECT_DS          = 1;   // IDirectSound
  75.   BASS_OBJECT_DS3DL       = 2;   // IDirectSound3DListener
  76.  
  77.   // BASS_INFO flags (from DSOUND.H)
  78.   DSCAPS_CONTINUOUSRATE   = $00000010;
  79.   { supports all sample rates between min/maxrate }
  80.   DSCAPS_EMULDRIVER       = $00000020;
  81.   { device does NOT have hardware DirectSound support }
  82.   DSCAPS_CERTIFIED        = $00000040;
  83.   { device driver has been certified by Microsoft }
  84.   {
  85.     The following flags tell what type of samples are
  86.     supported by HARDWARE mixing, all these formats are
  87.     supported by SOFTWARE mixing
  88.   }
  89.   DSCAPS_SECONDARYMONO    = $00000100;     // mono
  90.   DSCAPS_SECONDARYSTEREO  = $00000200;     // stereo
  91.   DSCAPS_SECONDARY8BIT    = $00000400;     // 8 bit
  92.   DSCAPS_SECONDARY16BIT   = $00000800;     // 16 bit
  93.  
  94.   // BASS_RECORDINFO flags (from DSOUND.H)
  95.   DSCCAPS_EMULDRIVER = DSCAPS_EMULDRIVER;
  96.   { device does NOT have hardware DirectSound recording support }
  97.   DSCCAPS_CERTIFIED = DSCAPS_CERTIFIED;
  98.   { device driver has been certified by Microsoft }
  99.  
  100.   // defines for formats field of BASS_RECORDINFO (from MMSYSTEM.H)
  101.   WAVE_FORMAT_1M08       = $00000001;      // 11.025 kHz, Mono,   8-bit
  102.   WAVE_FORMAT_1S08       = $00000002;      // 11.025 kHz, Stereo, 8-bit
  103.   WAVE_FORMAT_1M16       = $00000004;      // 11.025 kHz, Mono,   16-bit
  104.   WAVE_FORMAT_1S16       = $00000008;      // 11.025 kHz, Stereo, 16-bit
  105.   WAVE_FORMAT_2M08       = $00000010;      // 22.05  kHz, Mono,   8-bit
  106.   WAVE_FORMAT_2S08       = $00000020;      // 22.05  kHz, Stereo, 8-bit
  107.   WAVE_FORMAT_2M16       = $00000040;      // 22.05  kHz, Mono,   16-bit
  108.   WAVE_FORMAT_2S16       = $00000080;      // 22.05  kHz, Stereo, 16-bit
  109.   WAVE_FORMAT_4M08       = $00000100;      // 44.1   kHz, Mono,   8-bit
  110.   WAVE_FORMAT_4S08       = $00000200;      // 44.1   kHz, Stereo, 8-bit
  111.   WAVE_FORMAT_4M16       = $00000400;      // 44.1   kHz, Mono,   16-bit
  112.   WAVE_FORMAT_4S16       = $00000800;      // 44.1   kHz, Stereo, 16-bit
  113.  
  114.   // Sample info flags
  115.   BASS_SAMPLE_8BITS       = 1;   // 8 bit
  116.   BASS_SAMPLE_FLOAT       = 256; // 32-bit floating-point
  117.   BASS_SAMPLE_MONO        = 2;   // mono, else stereo
  118.   BASS_SAMPLE_LOOP        = 4;   // looped
  119.   BASS_SAMPLE_3D          = 8;   // 3D functionality enabled
  120.   BASS_SAMPLE_SOFTWARE    = 16;  // it's NOT using hardware mixing
  121.   BASS_SAMPLE_MUTEMAX     = 32;  // muted at max distance (3D only)
  122.   BASS_SAMPLE_VAM         = 64;  // uses the DX7 voice allocation & management
  123.   BASS_SAMPLE_FX          = 128; // old implementation of DX8 effects are enabled
  124.   BASS_SAMPLE_OVER_VOL    = $10000; // override lowest volume
  125.   BASS_SAMPLE_OVER_POS    = $20000; // override longest playing
  126.   BASS_SAMPLE_OVER_DIST   = $30000; // override furthest from listener (3D only)
  127.  
  128.   BASS_STREAM_PRESCAN     = $20000; // enable pin-point seeking (MP3/MP2/MP1)
  129.   BASS_MP3_SETPOS         = BASS_STREAM_PRESCAN;
  130.   BASS_STREAM_AUTOFREE      = $40000; // automatically free the stream when it stop/ends
  131.   BASS_STREAM_RESTRATE      = $80000; // restrict the download rate of internet file streams
  132.   BASS_STREAM_BLOCK       = $100000;// download/play internet file stream in small blocks
  133.   BASS_STREAM_DECODE      = $200000;// don't play the stream, only decode (BASS_ChannelGetData)
  134.   BASS_STREAM_STATUS      = $800000;// give server status info (HTTP/ICY tags) in DOWNLOADPROC
  135.  
  136.   BASS_MUSIC_FLOAT        = BASS_SAMPLE_FLOAT; // 32-bit floating-point
  137.   BASS_MUSIC_MONO         = BASS_SAMPLE_MONO; // force mono mixing (less CPU usage)
  138.   BASS_MUSIC_LOOP         = BASS_SAMPLE_LOOP; // loop music
  139.   BASS_MUSIC_3D           = BASS_SAMPLE_3D; // enable 3D functionality
  140.   BASS_MUSIC_FX           = BASS_SAMPLE_FX; // enable old implementation of DX8 effects
  141.   BASS_MUSIC_AUTOFREE     = BASS_STREAM_AUTOFREE; // automatically free the music when it stop/ends
  142.   BASS_MUSIC_DECODE       = BASS_STREAM_DECODE; // don't play the music, only decode (BASS_ChannelGetData)
  143.   BASS_MUSIC_PRESCAN      = BASS_STREAM_PRESCAN; // calculate playback length
  144.   BASS_MUSIC_CALCLEN      = BASS_MUSIC_PRESCAN;
  145.   BASS_MUSIC_RAMP         = $200;  // normal ramping
  146.   BASS_MUSIC_RAMPS        = $400;  // sensitive ramping
  147.   BASS_MUSIC_SURROUND     = $800;  // surround sound
  148.   BASS_MUSIC_SURROUND2    = $1000; // surround sound (mode 2)
  149.   BASS_MUSIC_FT2MOD       = $2000; // play .MOD as FastTracker 2 does
  150.   BASS_MUSIC_PT1MOD       = $4000; // play .MOD as ProTracker 1 does
  151.   BASS_MUSIC_NONINTER     = $10000; // non-interpolated mixing
  152.   BASS_MUSIC_POSRESET     = $8000; // stop all notes when moving position
  153.   BASS_MUSIC_POSRESETEX   = $400000; // stop all notes and reset bmp/etc when moving position
  154.   BASS_MUSIC_STOPBACK     = $80000; // stop the music on a backwards jump effect
  155.   BASS_MUSIC_NOSAMPLE     = $100000; // don't load the samples
  156.  
  157.   // Speaker assignment flags
  158.   BASS_SPEAKER_FRONT      = $1000000;  // front speakers
  159.   BASS_SPEAKER_REAR       = $2000000;  // rear/side speakers
  160.   BASS_SPEAKER_CENLFE     = $3000000;  // center & LFE speakers (5.1)
  161.   BASS_SPEAKER_REAR2      = $4000000;  // rear center speakers (7.1)
  162.   BASS_SPEAKER_LEFT       = $10000000; // modifier: left
  163.   BASS_SPEAKER_RIGHT      = $20000000; // modifier: right
  164.   BASS_SPEAKER_FRONTLEFT  = BASS_SPEAKER_FRONT or BASS_SPEAKER_LEFT;
  165.   BASS_SPEAKER_FRONTRIGHT = BASS_SPEAKER_FRONT or BASS_SPEAKER_RIGHT;
  166.   BASS_SPEAKER_REARLEFT   = BASS_SPEAKER_REAR or BASS_SPEAKER_LEFT;
  167.   BASS_SPEAKER_REARRIGHT  = BASS_SPEAKER_REAR or BASS_SPEAKER_RIGHT;
  168.   BASS_SPEAKER_CENTER     = BASS_SPEAKER_CENLFE or BASS_SPEAKER_LEFT;
  169.   BASS_SPEAKER_LFE        = BASS_SPEAKER_CENLFE or BASS_SPEAKER_RIGHT;
  170.   BASS_SPEAKER_REAR2LEFT  = BASS_SPEAKER_REAR2 or BASS_SPEAKER_LEFT;
  171.   BASS_SPEAKER_REAR2RIGHT = BASS_SPEAKER_REAR2 or BASS_SPEAKER_RIGHT;
  172.  
  173.   BASS_UNICODE            = $80000000;
  174.  
  175.   BASS_RECORD_PAUSE       = $8000; // start recording paused
  176.  
  177.   // DX7 voice allocation flags
  178.   BASS_VAM_HARDWARE       = 1;
  179.   {
  180.     Play the sample in hardware. If no hardware voices are available then
  181.     the "play" call will fail
  182.   }
  183.   BASS_VAM_SOFTWARE       = 2;
  184.   {
  185.     Play the sample in software (ie. non-accelerated). No other VAM flags
  186.     may be used together with this flag.
  187.   }
  188.  
  189.   // DX7 voice management flags
  190.   {
  191.     These flags enable hardware resource stealing... if the hardware has no
  192.     available voices, a currently playing buffer will be stopped to make room
  193.     for the new buffer. NOTE: only samples loaded/created with the
  194.     BASS_SAMPLE_VAM flag are considered for termination by the DX7 voice
  195.     management.
  196.   }
  197.   BASS_VAM_TERM_TIME      = 4;
  198.   {
  199.     If there are no free hardware voices, the buffer to be terminated will be
  200.     the one with the least time left to play.
  201.   }
  202.   BASS_VAM_TERM_DIST      = 8;
  203.   {
  204.     If there are no free hardware voices, the buffer to be terminated will be
  205.     one that was loaded/created with the BASS_SAMPLE_MUTEMAX flag and is
  206.     beyond
  207.     it's max distance. If there are no buffers that match this criteria, then
  208.     the "play" call will fail.
  209.   }
  210.   BASS_VAM_TERM_PRIO      = 16;
  211.   {
  212.     If there are no free hardware voices, the buffer to be terminated will be
  213.     the one with the lowest priority.
  214.   }
  215.  
  216.   // BASS_CHANNELINFO types
  217.   BASS_CTYPE_SAMPLE       = 1;
  218.   BASS_CTYPE_RECORD       = 2;
  219.   BASS_CTYPE_STREAM       = $10000;
  220.   BASS_CTYPE_STREAM_WAV   = $10001;
  221.   BASS_CTYPE_STREAM_OGG   = $10002;
  222.   BASS_CTYPE_STREAM_MP1   = $10003;
  223.   BASS_CTYPE_STREAM_MP2   = $10004;
  224.   BASS_CTYPE_STREAM_MP3   = $10005;
  225.   BASS_CTYPE_STREAM_AIFF  = $10006;
  226.   BASS_CTYPE_MUSIC_MOD    = $20000;
  227.   BASS_CTYPE_MUSIC_MTM    = $20001;
  228.   BASS_CTYPE_MUSIC_S3M    = $20002;
  229.   BASS_CTYPE_MUSIC_XM     = $20003;
  230.   BASS_CTYPE_MUSIC_IT     = $20004;
  231.   BASS_CTYPE_MUSIC_MO3    = $00100; // mo3 flag
  232.  
  233.   // 3D channel modes
  234.   BASS_3DMODE_NORMAL      = 0;
  235.   { normal 3D processing }
  236.   BASS_3DMODE_RELATIVE    = 1;
  237.   {
  238.     The channel's 3D position (position/velocity/
  239.     orientation) are relative to the listener. When the
  240.     listener's position/velocity/orientation is changed
  241.     with BASS_Set3DPosition, the channel's position
  242.     relative to the listener does not change.
  243.   }
  244.   BASS_3DMODE_OFF         = 2;
  245.   {
  246.     Turn off 3D processing on the channel, the sound will
  247.     be played in the center.
  248.   }
  249.  
  250.   // EAX environments, use with BASS_SetEAXParameters
  251.   EAX_ENVIRONMENT_OFF               = -1;
  252.   EAX_ENVIRONMENT_GENERIC           = 0;
  253.   EAX_ENVIRONMENT_PADDEDCELL        = 1;
  254.   EAX_ENVIRONMENT_ROOM              = 2;
  255.   EAX_ENVIRONMENT_BATHROOM          = 3;
  256.   EAX_ENVIRONMENT_LIVINGROOM        = 4;
  257.   EAX_ENVIRONMENT_STONEROOM         = 5;
  258.   EAX_ENVIRONMENT_AUDITORIUM        = 6;
  259.   EAX_ENVIRONMENT_CONCERTHALL       = 7;
  260.   EAX_ENVIRONMENT_CAVE              = 8;
  261.   EAX_ENVIRONMENT_ARENA             = 9;
  262.   EAX_ENVIRONMENT_HANGAR            = 10;
  263.   EAX_ENVIRONMENT_CARPETEDHALLWAY   = 11;
  264.   EAX_ENVIRONMENT_HALLWAY           = 12;
  265.   EAX_ENVIRONMENT_STONECORRIDOR     = 13;
  266.   EAX_ENVIRONMENT_ALLEY             = 14;
  267.   EAX_ENVIRONMENT_FOREST            = 15;
  268.   EAX_ENVIRONMENT_CITY              = 16;
  269.   EAX_ENVIRONMENT_MOUNTAINS         = 17;
  270.   EAX_ENVIRONMENT_QUARRY            = 18;
  271.   EAX_ENVIRONMENT_PLAIN             = 19;
  272.   EAX_ENVIRONMENT_PARKINGLOT        = 20;
  273.   EAX_ENVIRONMENT_SEWERPIPE         = 21;
  274.   EAX_ENVIRONMENT_UNDERWATER        = 22;
  275.   EAX_ENVIRONMENT_DRUGGED           = 23;
  276.   EAX_ENVIRONMENT_DIZZY             = 24;
  277.   EAX_ENVIRONMENT_PSYCHOTIC         = 25;
  278.   // total number of environments
  279.   EAX_ENVIRONMENT_COUNT             = 26;
  280.  
  281.   // software 3D mixing algorithm modes (used with BASS_Set3DAlgorithm)
  282.   BASS_3DALG_DEFAULT                = 0;
  283.   {
  284.     default algorithm (currently translates to BASS_3DALG_OFF)
  285.   }
  286.   BASS_3DALG_OFF                    = 1;
  287.   {
  288.     Uses normal left and right panning. The vertical axis is ignored except
  289.     for scaling of volume due to distance. Doppler shift and volume scaling
  290.     are still applied, but the 3D filtering is not performed. This is the
  291.     most CPU efficient software implementation, but provides no virtual 3D
  292.     audio effect. Head Related Transfer Function processing will not be done.
  293.     Since only normal stereo panning is used, a channel using this algorithm
  294.     may be accelerated by a 2D hardware voice if no free 3D hardware voices
  295.     are available.
  296.   }
  297.   BASS_3DALG_FULL                   = 2;
  298.   {
  299.     This algorithm gives the highest quality 3D audio effect, but uses more
  300.     CPU. Requires Windows 98 2nd Edition or Windows 2000 that uses WDM
  301.     drivers, if this mode is not available then BASS_3DALG_OFF will be used
  302.     instead.
  303.   }
  304.   BASS_3DALG_LIGHT                  = 3;
  305.   {
  306.     This algorithm gives a good 3D audio effect, and uses less CPU than the
  307.     FULL mode. Requires Windows 98 2nd Edition or Windows 2000 that uses WDM
  308.     drivers, if this mode is not available then BASS_3DALG_OFF will be used
  309.     instead.
  310.   }
  311.  
  312.   {
  313.     Sync types (with BASS_ChannelSetSync() "param" and
  314.     SYNCPROC "data" definitions) & flags.
  315.   }
  316.   BASS_SYNC_POS                     = 0;
  317.   {
  318.     Sync when a channel reaches a position.
  319.     param: position in bytes
  320.     data : not used
  321.   }
  322.   BASS_SYNC_END                     = 2;
  323.   {
  324.     Sync when a channel reaches the end.
  325.     param: not used
  326.     data : not used
  327.   }
  328.   BASS_SYNC_META                    = 4;
  329.   {
  330.     Sync when metadata is received in a stream.
  331.     param: not used
  332.     data : pointer to the metadata
  333.   }
  334.   BASS_SYNC_SLIDE                   = 5;
  335.   {
  336.     Sync when an attribute slide is completed.
  337.     param: not used
  338.     data : the type of slide completed (one of the BASS_SLIDE_xxx values)
  339.   }
  340.   BASS_SYNC_STALL                   = 6;
  341.   {
  342.     Sync when playback has stalled.
  343.     param: not used
  344.     data : 0=stalled, 1=resumed
  345.   }
  346.   BASS_SYNC_DOWNLOAD                = 7;
  347.   {
  348.     Sync when downloading of an internet (or "buffered" user file) stream has ended.
  349.     param: not used
  350.     data : not used
  351.   }
  352.   BASS_SYNC_FREE                    = 8;
  353.   {
  354.     Sync when a channel is freed.
  355.     param: not used
  356.     data : not used
  357.   }
  358.   BASS_SYNC_MUSICPOS                = 10;
  359.   {
  360.     Sync when a MOD music reaches an order:row position.
  361.     param: LOWORD=order (0=first, -1=all) HIWORD=row (0=first, -1=all)
  362.     data : LOWORD=order HIWORD=row
  363.   }
  364.   BASS_SYNC_MUSICINST               = 1;
  365.   {
  366.     Sync when an instrument (sample for the non-instrument based formats)
  367.     is played in a MOD music (not including retrigs).
  368.     param: LOWORD=instrument (1=first) HIWORD=note (0=c0...119=b9, -1=all)
  369.     data : LOWORD=note HIWORD=volume (0-64)
  370.   }
  371.   BASS_SYNC_MUSICFX                 = 3;
  372.   {
  373.     Sync when the "sync" effect (XM/MTM/MOD: E8x/Wxx, IT/S3M: S2x) is used.
  374.     param: 0:data=pos, 1:data="x" value
  375.     data : param=0: LOWORD=order HIWORD=row, param=1: "x" value
  376.   }
  377.   BASS_SYNC_MESSAGE                 = $20000000;
  378.   { FLAG: post a Windows message (instead of callback)
  379.     When using a window message "callback", the message to post is given in the "proc"
  380.     parameter of BASS_ChannelSetSync, and is posted to the window specified in the BASS_Init
  381.     call. The message parameters are: WPARAM = data, LPARAM = user.
  382.   }
  383.   BASS_SYNC_MIXTIME                 = $40000000;
  384.   { FLAG: sync at mixtime, else at playtime }
  385.   BASS_SYNC_ONETIME                 = $80000000;
  386.   { FLAG: sync only once, else continuously }
  387.  
  388.   // BASS_ChannelIsActive return values
  389.   BASS_ACTIVE_STOPPED = 0;
  390.   BASS_ACTIVE_PLAYING = 1;
  391.   BASS_ACTIVE_STALLED = 2;
  392.   BASS_ACTIVE_PAUSED  = 3;
  393.  
  394.   // BASS_ChannelIsSliding return flags
  395.   BASS_SLIDE_FREQ     = 1;
  396.   BASS_SLIDE_VOL      = 2;
  397.   BASS_SLIDE_PAN      = 4;
  398.  
  399.   // BASS_ChannelGetData flags
  400.   BASS_DATA_AVAILABLE = 0;        // query how much data is buffered
  401.   BASS_DATA_FLOAT    = $40000000; // flag: return floating-point sample data
  402.   BASS_DATA_FFT512   = $80000000; // 512 sample FFT
  403.   BASS_DATA_FFT1024  = $80000001; // 1024 FFT
  404.   BASS_DATA_FFT2048  = $80000002; // 2048 FFT
  405.   BASS_DATA_FFT4096  = $80000003; // 4096 FFT
  406.   BASS_DATA_FFT_INDIVIDUAL = $10; // FFT flag: FFT for each channel, else all combined
  407.   BASS_DATA_FFT_NOWINDOW = $20;   // FFT flag: no Hanning window
  408.  
  409.   // BASS_StreamGetTags flags : what's returned
  410.   BASS_TAG_ID3   = 0; // ID3v1 tags : 128 byte block
  411.   BASS_TAG_ID3V2 = 1; // ID3v2 tags : variable length block
  412.   BASS_TAG_OGG   = 2; // OGG comments : array of null-terminated strings
  413.   BASS_TAG_HTTP  = 3; // HTTP headers : array of null-terminated strings
  414.   BASS_TAG_ICY   = 4; // ICY headers : array of null-terminated strings
  415.   BASS_TAG_META  = 5; // ICY metadata : null-terminated string
  416.  
  417.   BASS_FX_CHORUS      = 0;      // GUID_DSFX_STANDARD_CHORUS
  418.   BASS_FX_COMPRESSOR  = 1;      // GUID_DSFX_STANDARD_COMPRESSOR
  419.   BASS_FX_DISTORTION  = 2;      // GUID_DSFX_STANDARD_DISTORTION
  420.   BASS_FX_ECHO        = 3;      // GUID_DSFX_STANDARD_ECHO
  421.   BASS_FX_FLANGER     = 4;      // GUID_DSFX_STANDARD_FLANGER
  422.   BASS_FX_GARGLE      = 5;      // GUID_DSFX_STANDARD_GARGLE
  423.   BASS_FX_I3DL2REVERB = 6;      // GUID_DSFX_STANDARD_I3DL2REVERB
  424.   BASS_FX_PARAMEQ     = 7;      // GUID_DSFX_STANDARD_PARAMEQ
  425.   BASS_FX_REVERB      = 8;      // GUID_DSFX_WAVES_REVERB
  426.  
  427.   BASS_FX_PHASE_NEG_180 = 0;
  428.   BASS_FX_PHASE_NEG_90  = 1;
  429.   BASS_FX_PHASE_ZERO    = 2;
  430.   BASS_FX_PHASE_90      = 3;
  431.   BASS_FX_PHASE_180     = 4;
  432.  
  433.   // BASS_RecordSetInput flags
  434.   BASS_INPUT_OFF    = $10000;
  435.   BASS_INPUT_ON     = $20000;
  436.   BASS_INPUT_LEVEL  = $40000;
  437.  
  438.   BASS_INPUT_TYPE_MASK    = $ff000000;
  439.   BASS_INPUT_TYPE_UNDEF   = $00000000;
  440.   BASS_INPUT_TYPE_DIGITAL = $01000000;
  441.   BASS_INPUT_TYPE_LINE    = $02000000;
  442.   BASS_INPUT_TYPE_MIC     = $03000000;
  443.   BASS_INPUT_TYPE_SYNTH   = $04000000;
  444.   BASS_INPUT_TYPE_CD      = $05000000;
  445.   BASS_INPUT_TYPE_PHONE   = $06000000;
  446.   BASS_INPUT_TYPE_SPEAKER = $07000000;
  447.   BASS_INPUT_TYPE_WAVE    = $08000000;
  448.   BASS_INPUT_TYPE_AUX     = $09000000;
  449.   BASS_INPUT_TYPE_ANALOG  = $0a000000;
  450.  
  451.   // BASS_SetNetConfig flags
  452.   BASS_NET_TIMEOUT  = 0;
  453.   BASS_NET_BUFFER   = 1;
  454.  
  455.   // BASS_StreamGetFilePosition modes
  456.   BASS_FILEPOS_CURRENT    = 0;
  457.   BASS_FILEPOS_DECODE     = BASS_FILEPOS_CURRENT;
  458.   BASS_FILEPOS_DOWNLOAD   = 1;
  459.   BASS_FILEPOS_END        = 2;
  460.   BASS_FILEPOS_START      = 3;
  461.  
  462.   // STREAMFILEPROC actions
  463.   BASS_FILE_CLOSE   = 0;
  464.   BASS_FILE_READ    = 1;
  465.   BASS_FILE_LEN     = 3;
  466.   BASS_FILE_SEEK    = 4;
  467.  
  468.   BASS_STREAMPROC_END = $80000000; // end of user stream flag
  469.  
  470.   // BASS_MusicSet/GetAttribute options
  471.   BASS_MUSIC_ATTRIB_AMPLIFY    = 0;
  472.   BASS_MUSIC_ATTRIB_PANSEP     = 1;
  473.   BASS_MUSIC_ATTRIB_PSCALER    = 2;
  474.   BASS_MUSIC_ATTRIB_BPM        = 3;
  475.   BASS_MUSIC_ATTRIB_SPEED      = 4;
  476.   BASS_MUSIC_ATTRIB_VOL_GLOBAL = 5;
  477.   BASS_MUSIC_ATTRIB_VOL_CHAN   = $100; // + channel #
  478.   BASS_MUSIC_ATTRIB_VOL_INST   = $200; // + instrument #
  479.  
  480.   // BASS_Set/GetConfig options
  481.   BASS_CONFIG_BUFFER        = 0;
  482.   BASS_CONFIG_UPDATEPERIOD  = 1;
  483.   BASS_CONFIG_MAXVOL        = 3;
  484.   BASS_CONFIG_GVOL_SAMPLE   = 4;
  485.   BASS_CONFIG_GVOL_STREAM   = 5;
  486.   BASS_CONFIG_GVOL_MUSIC    = 6;
  487.   BASS_CONFIG_CURVE_VOL     = 7;
  488.   BASS_CONFIG_CURVE_PAN     = 8;
  489.   BASS_CONFIG_FLOATDSP      = 9;
  490.   BASS_CONFIG_3DALGORITHM   = 10;
  491.   BASS_CONFIG_NET_TIMEOUT   = 11;
  492.   BASS_CONFIG_NET_BUFFER    = 12;
  493.   BASS_CONFIG_PAUSE_NOPLAY  = 13;
  494.   BASS_CONFIG_NET_NOPROXY   = 14;
  495.   BASS_CONFIG_NET_PREBUF    = 15;
  496.  
  497. type
  498.   DWORD = cardinal;
  499.   BOOL = LongBool;
  500.   FLOAT = Single;
  501.   QWORD = int64;        // 64-bit (replace "int64" with "comp" if using Delphi 3)
  502.  
  503.   HMUSIC = DWORD;       // MOD music handle
  504.   HSAMPLE = DWORD;      // sample handle
  505.   HCHANNEL = DWORD;     // playing sample's channel handle
  506.   HSTREAM = DWORD;      // sample stream handle
  507.   HRECORD = DWORD;      // recording handle
  508.   HSYNC = DWORD;        // synchronizer handle
  509.   HDSP = DWORD;         // DSP handle
  510.   HFX = DWORD;          // DX8 effect handle
  511.   HPLUGIN = DWORD;      // Plugin handle
  512.  
  513.   BASS_INFO = record
  514.     flags: DWORD;       // device capabilities (DSCAPS_xxx flags)
  515.     hwsize: DWORD;      // size of total device hardware memory
  516.     hwfree: DWORD;      // size of free device hardware memory
  517.     freesam: DWORD;     // number of free sample slots in the hardware
  518.     free3d: DWORD;      // number of free 3D sample slots in the hardware
  519.     minrate: DWORD;     // min sample rate supported by the hardware
  520.     maxrate: DWORD;     // max sample rate supported by the hardware
  521.     eax: BOOL;          // device supports EAX? (always FALSE if BASS_DEVICE_3D was not used)
  522.     minbuf: DWORD;      // recommended minimum buffer length in ms (requires BASS_DEVICE_LATENCY)
  523.     dsver: DWORD;       // DirectSound version
  524.     latency: DWORD;     // delay (in ms) before start of playback (requires BASS_DEVICE_LATENCY)
  525.     initflags: DWORD;   // "flags" parameter of BASS_Init call
  526.     speakers: DWORD;    // number of speakers available
  527.     driver: PChar;      // driver
  528.   end;
  529.  
  530.   BASS_RECORDINFO = record
  531.     flags: DWORD;       // device capabilities (DSCCAPS_xxx flags)
  532.     formats: DWORD;     // supported standard formats (WAVE_FORMAT_xxx flags)
  533.     inputs: DWORD;      // number of inputs
  534.     singlein: BOOL;     // only 1 input can be set at a time
  535.     driver: PChar;      // driver
  536.   end;
  537.  
  538.   BASS_CHANNELINFO = record
  539.     freq: DWORD;        // default playback rate
  540.     chans: DWORD;       // channels
  541.     flags: DWORD;       // BASS_SAMPLE/STREAM/MUSIC/SPEAKER flags
  542.     ctype: DWORD;       // type of channel
  543.     origres: DWORD;     // original resolution
  544.   end;
  545.  
  546.   // Sample info structure
  547.   BASS_SAMPLE = record
  548.     freq: DWORD;        // default playback rate
  549.     volume: DWORD;      // default volume (0-100)
  550.     pan: Integer;       // default pan (-100=left, 0=middle, 100=right)
  551.     flags: DWORD;       // BASS_SAMPLE_xxx flags
  552.     length: DWORD;      // length (in samples, not bytes)
  553.     max: DWORD;         // maximum simultaneous playbacks
  554.     origres: DWORD;     // original resolution
  555.     chans: DWORD;       // number of channels
  556.     {
  557.       The following are the sample's default 3D attributes
  558.       (if the sample is 3D, BASS_SAMPLE_3D is in flags)
  559.       see BASS_ChannelSet3DAttributes
  560.     }
  561.     mode3d: DWORD;      // BASS_3DMODE_xxx mode
  562.     mindist: FLOAT;     // minimum distance
  563.     maxdist: FLOAT;     // maximum distance
  564.     iangle: DWORD;      // angle of inside projection cone
  565.     oangle: DWORD;      // angle of outside projection cone
  566.     outvol: DWORD;      // delta-volume outside the projection cone
  567.     {
  568.       The following are the defaults used if the sample uses the DirectX 7
  569.       voice allocation/management features.
  570.     }
  571.     vam: DWORD;         // voice allocation/management flags (BASS_VAM_xxx)
  572.     priority: DWORD;    // priority (0=lowest, $ffffffff=highest)
  573.   end;
  574.  
  575.   // 3D vector (for 3D positions/velocities/orientations)
  576.   BASS_3DVECTOR = record
  577.     x: FLOAT;           // +=right, -=left
  578.     y: FLOAT;           // +=up, -=down
  579.     z: FLOAT;           // +=front, -=behind
  580.   end;
  581.  
  582.   BASS_FXCHORUS = record
  583.     fWetDryMix: FLOAT;
  584.     fDepth: FLOAT;
  585.     fFeedback: FLOAT;
  586.     fFrequency: FLOAT;
  587.     lWaveform: DWORD;   // 0=triangle, 1=sine
  588.     fDelay: FLOAT;
  589.     lPhase: DWORD;      // BASS_FX_PHASE_xxx
  590.   end;
  591.  
  592.   BASS_FXCOMPRESSOR = record
  593.     fGain: FLOAT;
  594.     fAttack: FLOAT;
  595.     fRelease: FLOAT;
  596.     fThreshold: FLOAT;
  597.     fRatio: FLOAT;
  598.     fPredelay: FLOAT;
  599.   end;
  600.  
  601.   BASS_FXDISTORTION = record
  602.     fGain: FLOAT;
  603.     fEdge: FLOAT;
  604.     fPostEQCenterFrequency: FLOAT;
  605.     fPostEQBandwidth: FLOAT;
  606.     fPreLowpassCutoff: FLOAT;
  607.   end;
  608.  
  609.   BASS_FXECHO = record
  610.     fWetDryMix: FLOAT;
  611.     fFeedback: FLOAT;
  612.     fLeftDelay: FLOAT;
  613.     fRightDelay: FLOAT;
  614.     lPanDelay: BOOL;
  615.   end;
  616.  
  617.   BASS_FXFLANGER = record
  618.     fWetDryMix: FLOAT;
  619.     fDepth: FLOAT;
  620.     fFeedback: FLOAT;
  621.     fFrequency: FLOAT;
  622.     lWaveform: DWORD;   // 0=triangle, 1=sine
  623.     fDelay: FLOAT;
  624.     lPhase: DWORD;      // BASS_FX_PHASE_xxx
  625.   end;
  626.  
  627.   BASS_FXGARGLE = record
  628.     dwRateHz: DWORD;               // Rate of modulation in hz
  629.     dwWaveShape: DWORD;            // 0=triangle, 1=square
  630.   end;
  631.  
  632.   BASS_FXI3DL2REVERB = record
  633.     lRoom: Longint;                // [-10000, 0]      default: -1000 mB
  634.     lRoomHF: Longint;              // [-10000, 0]      default: 0 mB
  635.     flRoomRolloffFactor: FLOAT;    // [0.0, 10.0]      default: 0.0
  636.     flDecayTime: FLOAT;            // [0.1, 20.0]      default: 1.49s
  637.     flDecayHFRatio: FLOAT;         // [0.1, 2.0]       default: 0.83
  638.     lReflections: Longint;         // [-10000, 1000]   default: -2602 mB
  639.     flReflectionsDelay: FLOAT;     // [0.0, 0.3]       default: 0.007 s
  640.     lReverb: Longint;              // [-10000, 2000]   default: 200 mB
  641.     flReverbDelay: FLOAT;          // [0.0, 0.1]       default: 0.011 s
  642.     flDiffusion: FLOAT;            // [0.0, 100.0]     default: 100.0 %
  643.     flDensity: FLOAT;              // [0.0, 100.0]     default: 100.0 %
  644.     flHFReference: FLOAT;          // [20.0, 20000.0]  default: 5000.0 Hz
  645.   end;
  646.  
  647.   BASS_FXPARAMEQ = record
  648.     fCenter: FLOAT;
  649.     fBandwidth: FLOAT;
  650.     fGain: FLOAT;
  651.   end;
  652.  
  653.   BASS_FXREVERB = record
  654.     fInGain: FLOAT;                // [-96.0,0.0]            default: 0.0 dB
  655.     fReverbMix: FLOAT;             // [-96.0,0.0]            default: 0.0 db
  656.     fReverbTime: FLOAT;            // [0.001,3000.0]         default: 1000.0 ms
  657.     fHighFreqRTRatio: FLOAT;       // [0.001,0.999]          default: 0.001
  658.   end;
  659.  
  660.   // callback function types
  661.   STREAMPROC = function(handle: HSTREAM; buffer: Pointer; length: DWORD; user: DWORD): DWORD; stdcall;
  662.   {
  663.     User stream callback function. NOTE: A stream function should obviously be as
  664.     quick as possible, other streams (and MOD musics) can't be mixed until
  665.     it's finished.
  666.     handle : The stream that needs writing
  667.     buffer : Buffer to write the samples in
  668.     length : Number of bytes to write
  669.     user   : The 'user' parameter value given when calling BASS_StreamCreate
  670.     RETURN : Number of bytes written. Set the BASS_STREAMPROC_END flag to end
  671.              the stream.
  672.   }
  673.  
  674.   STREAMFILEPROC = function(action, param1, param2, user: DWORD): DWORD; stdcall;
  675.   {  
  676.     User file stream callback function.
  677.     action : The action to perform, one of BASS_FILE_xxx values.
  678.     param1 : Depends on "action"
  679.     param2 : Depends on "action"
  680.     user   : The 'user' parameter value given when calling BASS_StreamCreate
  681.     RETURN : Depends on "action"
  682.   }
  683.  
  684.   DOWNLOADPROC = procedure(buffer: Pointer; length: DWORD; user: DWORD); stdcall;
  685.   {
  686.     Internet stream download callback function.
  687.     buffer : Buffer containing the downloaded data... NULL=end of download
  688.     length : Number of bytes in the buffer
  689.     user   : The 'user' parameter value given when calling BASS_StreamCreateURL
  690.   }
  691.  
  692.   SYNCPROC = procedure(handle: HSYNC; channel, data: DWORD; user: DWORD); stdcall;
  693.   {
  694.     Sync callback function. NOTE: a sync callback function should be very
  695.     quick as other syncs cannot be processed until it has finished. If the
  696.     sync is a "mixtime" sync, then other streams and MOD musics can not be
  697.     mixed until it's finished either.
  698.     handle : The sync that has occured
  699.     channel: Channel that the sync occured in
  700.     data   : Additional data associated with the sync's occurance
  701.     user   : The 'user' parameter given when calling BASS_ChannelSetSync
  702.   }
  703.  
  704.   DSPPROC = procedure(handle: HDSP; channel: DWORD; buffer: Pointer; length: DWORD; user: DWORD); stdcall;
  705.   {
  706.     DSP callback function. NOTE: A DSP function should obviously be as quick
  707.     as possible... other DSP functions, streams and MOD musics can not be
  708.     processed until it's finished.
  709.     handle : The DSP handle
  710.     channel: Channel that the DSP is being applied to
  711.     buffer : Buffer to apply the DSP to
  712.     length : Number of bytes in the buffer
  713.     user   : The 'user' parameter given when calling BASS_ChannelSetDSP
  714.   }
  715.  
  716.   RECORDPROC = function(handle: HRECORD; buffer: Pointer; length: DWORD; user: DWORD): BOOL; stdcall;
  717.   {
  718.     Recording callback function.
  719.     handle : The recording handle
  720.     buffer : Buffer containing the recorded sample data
  721.     length : Number of bytes
  722.     user   : The 'user' parameter value given when calling BASS_RecordStart
  723.     RETURN : TRUE = continue recording, FALSE = stop
  724.   }
  725.  
  726.  
  727. // Functions
  728. const
  729.   bassdll = 'bass.dll';
  730.  
  731. function BASS_SetConfig(option, value: DWORD): DWORD; stdcall; external bassdll;
  732. function BASS_GetConfig(option: DWORD): DWORD; stdcall; external bassdll;
  733. function BASS_GetVersion: DWORD; stdcall; external bassdll;
  734. function BASS_GetDeviceDescription(device: DWORD): PChar; stdcall; external bassdll;
  735. function BASS_ErrorGetCode: Integer; stdcall; external bassdll;
  736. function BASS_Init(device: Integer; freq, flags: DWORD; win: HWND; clsid: PGUID): BOOL; stdcall; external bassdll;
  737. function BASS_SetDevice(device: DWORD): BOOL; stdcall; external bassdll;
  738. function BASS_GetDevice: DWORD; stdcall; external bassdll;
  739. function BASS_Free: BOOL; stdcall; external bassdll;
  740. function BASS_GetDSoundObject(obj: DWORD): Pointer; stdcall; external bassdll;
  741. function BASS_GetInfo(var info: BASS_INFO): BOOL; stdcall; external bassdll;
  742. function BASS_Update: BOOL; stdcall; external bassdll;
  743. function BASS_GetCPU: FLOAT; stdcall; external bassdll;
  744. function BASS_Start: BOOL; stdcall; external bassdll;
  745. function BASS_Stop: BOOL; stdcall; external bassdll;
  746. function BASS_Pause: BOOL; stdcall; external bassdll;
  747. function BASS_SetVolume(volume: DWORD): BOOL; stdcall; external bassdll;
  748. function BASS_GetVolume: Integer; stdcall; external bassdll;
  749.  
  750. function BASS_PluginLoad(f: PChar): HPLUGIN; stdcall; external bassdll;
  751. function BASS_PluginFree(handle: HPLUGIN): BOOL; stdcall; external bassdll;
  752.  
  753. function BASS_Set3DFactors(distf, rollf, doppf: FLOAT): BOOL; stdcall; external bassdll;
  754. function BASS_Get3DFactors(var distf, rollf, doppf: FLOAT): BOOL; stdcall; external bassdll;
  755. function BASS_Set3DPosition(var pos, vel, front, top: BASS_3DVECTOR): BOOL; stdcall; external bassdll;
  756. function BASS_Get3DPosition(var pos, vel, front, top: BASS_3DVECTOR): BOOL; stdcall; external bassdll;
  757. procedure BASS_Apply3D; stdcall; external bassdll;
  758. function BASS_SetEAXParameters(env: Integer; vol, decay, damp: FLOAT): BOOL; stdcall; external bassdll;
  759. function BASS_GetEAXParameters(var env: DWORD; var vol, decay, damp: FLOAT): BOOL; stdcall; external bassdll;
  760.  
  761. function BASS_MusicLoad(mem: BOOL; f: Pointer; offset, length, flags, freq: DWORD): HMUSIC; stdcall; external bassdll;
  762. function BASS_MusicFree(handle: HMUSIC): BOOL; stdcall; external bassdll;
  763. function BASS_MusicSetAttribute(handle: HMUSIC; attrib,value: DWORD): DWORD; stdcall; external bassdll;
  764. function BASS_MusicGetAttribute(handle: HMUSIC; attrib: DWORD): DWORD; stdcall; external bassdll;
  765. function BASS_MusicGetName(handle: HMUSIC): PChar; stdcall; external bassdll;
  766. function BASS_MusicGetOrders(handle: HMUSIC): DWORD; stdcall; external bassdll;
  767. function BASS_MusicGetOrderPosition(handle: HMUSIC): DWORD; stdcall; external bassdll;
  768.  
  769. function BASS_SampleLoad(mem: BOOL; f: Pointer; offset, length, max, flags: DWORD): HSAMPLE; stdcall; external bassdll;
  770. function BASS_SampleCreate(length, freq, chans, max, flags: DWORD): Pointer; stdcall; external bassdll;
  771. function BASS_SampleCreateDone: HSAMPLE; stdcall; external bassdll;
  772. function BASS_SampleFree(handle: HSAMPLE): BOOL; stdcall; external bassdll;
  773. function BASS_SampleGetInfo(handle: HSAMPLE; var info: BASS_SAMPLE): BOOL; stdcall; external bassdll;
  774. function BASS_SampleSetInfo(handle: HSAMPLE; var info: BASS_SAMPLE): BOOL; stdcall; external bassdll;
  775. function BASS_SampleGetChannel(handle: HSAMPLE; onlynew: BOOL): HCHANNEL; stdcall; external bassdll;
  776. function BASS_SampleStop(handle: HSAMPLE): BOOL; stdcall; external bassdll;
  777.  
  778. function BASS_StreamCreate(freq, chans, flags: DWORD; proc: Pointer; user: DWORD): HSTREAM; stdcall; external bassdll;
  779. function BASS_StreamCreateFile(mem: BOOL; f: Pointer; offset, length, flags: DWORD): HSTREAM; stdcall; external bassdll;
  780. function BASS_StreamCreateURL(URL: PChar; offset: DWORD; flags: DWORD; proc: DOWNLOADPROC; user: DWORD):HSTREAM; stdcall; external bassdll;
  781. function BASS_StreamCreateFileUser(buffered: BOOL; flags: DWORD; proc: STREAMFILEPROC; user: DWORD): HSTREAM; stdcall; external bassdll;
  782. function BASS_StreamFree(handle: HSTREAM): BOOL; stdcall; external bassdll;
  783. function BASS_StreamGetTags(handle: HSTREAM; tags : DWORD): PChar; stdcall; external bassdll;
  784. function BASS_StreamGetFilePosition(handle:HSTREAM; mode:DWORD) : DWORD;stdcall;external bassdll;
  785.  
  786. function BASS_RecordGetDeviceDescription(devnum: DWORD):PChar;stdcall;external bassdll;
  787. function BASS_RecordInit(device: Integer):BOOL;stdcall;external bassdll;
  788. function BASS_RecordSetDevice(device: DWORD): BOOL; stdcall; external bassdll;
  789. function BASS_RecordGetDevice: DWORD; stdcall; external bassdll;
  790. function BASS_RecordFree:BOOL;stdcall;external bassdll;
  791. function BASS_RecordGetInfo(var info:BASS_RECORDINFO):BOOL;stdcall;external bassdll;
  792. function BASS_RecordGetInputName(input:Integer):PChar;stdcall;external bassdll;
  793. function BASS_RecordSetInput(input:Integer; setting:DWORD):BOOL;stdcall;external bassdll;
  794. function BASS_RecordGetInput(input:Integer):DWORD;stdcall;external bassdll;
  795. function BASS_RecordStart(freq,chans,flags:DWORD; proc:RECORDPROC; user:DWORD):HRECORD;stdcall;external bassdll;
  796.  
  797. function BASS_ChannelBytes2Seconds(handle: DWORD; pos: QWORD): FLOAT; stdcall;external bassdll;
  798. function BASS_ChannelSeconds2Bytes(handle: DWORD; pos: FLOAT): QWORD; stdcall;external bassdll;
  799. function BASS_ChannelGetDevice(handle: DWORD): DWORD; stdcall; external bassdll;
  800. function BASS_ChannelIsActive(handle: DWORD): DWORD; stdcall;external bassdll;
  801. function BASS_ChannelGetInfo(handle: DWORD; var info:BASS_CHANNELINFO):BOOL;stdcall;external bassdll;
  802. function BASS_ChannelSetFlags(handle, flags: DWORD): BOOL; stdcall; external bassdll;
  803. function BASS_ChannelPreBuf(handle, length: DWORD): BOOL; stdcall; external bassdll;
  804. function BASS_ChannelPlay(handle: DWORD; restart: BOOL): BOOL; stdcall; external bassdll;
  805. function BASS_ChannelStop(handle: DWORD): BOOL; stdcall; external bassdll;
  806. function BASS_ChannelPause(handle: DWORD): BOOL; stdcall; external bassdll;
  807. function BASS_ChannelSetAttributes(handle: DWORD; freq, volume, pan: Integer): BOOL; stdcall; external bassdll;
  808. function BASS_ChannelGetAttributes(handle: DWORD; var freq, volume: DWORD; var pan: Integer): BOOL; stdcall; external bassdll;
  809. function BASS_ChannelSlideAttributes(handle: DWORD; freq, volume, pan: Integer; time: DWORD): BOOL; stdcall; external bassdll;
  810. function BASS_ChannelIsSliding(handle: DWORD): DWORD; stdcall;external bassdll;
  811. function BASS_ChannelSet3DAttributes(handle: DWORD; mode: Integer; min, max: FLOAT; iangle, oangle, outvol: Integer): BOOL; stdcall; external bassdll;
  812. function BASS_ChannelGet3DAttributes(handle: DWORD; var mode: DWORD; var min, max: FLOAT; var iangle, oangle, outvol: DWORD): BOOL; stdcall; external bassdll;
  813. function BASS_ChannelSet3DPosition(handle: DWORD; var pos, orient, vel: BASS_3DVECTOR): BOOL; stdcall; external bassdll;
  814. function BASS_ChannelGet3DPosition(handle: DWORD; var pos, orient, vel: BASS_3DVECTOR): BOOL; stdcall; external bassdll;
  815. function BASS_ChannelGetLength(handle: DWORD): QWORD; stdcall; external bassdll;
  816. function BASS_ChannelSetPosition(handle: DWORD; pos: QWORD): BOOL; stdcall; external bassdll;
  817. function BASS_ChannelGetPosition(handle: DWORD): QWORD; stdcall; external bassdll;
  818. function BASS_ChannelGetLevel(handle: DWORD): DWORD; stdcall; external bassdll;
  819. function BASS_ChannelGetData(handle: DWORD; buffer: Pointer; length: DWORD): DWORD; stdcall; external bassdll;
  820. function BASS_ChannelSetSync(handle: DWORD; stype: DWORD; param: QWORD; proc: SYNCPROC; user: DWORD): HSYNC; stdcall; external bassdll;
  821. function BASS_ChannelRemoveSync(handle: DWORD; sync: HSYNC): BOOL; stdcall; external bassdll;
  822. function BASS_ChannelSetDSP(handle: DWORD; proc: DSPPROC; user: DWORD; priority: Integer): HDSP; stdcall; external bassdll;
  823. function BASS_ChannelRemoveDSP(handle: DWORD; dsp: HDSP): BOOL; stdcall; external bassdll;
  824. function BASS_ChannelSetEAXMix(handle: DWORD; mix: FLOAT): BOOL; stdcall; external bassdll;
  825. function BASS_ChannelGetEAXMix(handle: DWORD; var mix: FLOAT): BOOL; stdcall; external bassdll;
  826. function BASS_ChannelSetLink(handle, chan: DWORD): BOOL; stdcall; external bassdll;
  827. function BASS_ChannelRemoveLink(handle, chan: DWORD): BOOL; stdcall; external bassdll;
  828. function BASS_ChannelSetFX(handle, etype: DWORD; priority: Integer): HFX; stdcall; external bassdll;
  829. function BASS_ChannelRemoveFX(handle: DWORD; fx: HFX): BOOL; stdcall; external bassdll;
  830.  
  831. function BASS_FXSetParameters(handle: HFX; par: Pointer): BOOL; stdcall; external bassdll;
  832. function BASS_FXGetParameters(handle: HFX; par: Pointer): BOOL; stdcall; external bassdll;
  833.  
  834.  
  835. function BASS_SPEAKER_N(n: DWORD): DWORD;
  836. function MAKEMUSICPOS(order,row: DWORD): DWORD;
  837. function BASS_SetEAXPreset(env: Integer): BOOL;
  838. {
  839.   This function is defined in the implementation part of this unit.
  840.   It is not part of BASS.DLL but an extra function which makes it easier
  841.   to set the predefined EAX environments.
  842.   env    : a EAX_ENVIRONMENT_xxx constant
  843. }
  844.  
  845.  
  846. implementation
  847.  
  848. function BASS_SPEAKER_N(n: DWORD): DWORD;
  849. begin
  850.   Result := n shl 24;
  851. end;
  852.  
  853. function MAKEMUSICPOS(order,row: DWORD): DWORD;
  854. begin
  855.   Result := $80000000 or DWORD(MAKELONG(order,row));
  856. end;
  857.  
  858. function BASS_SetEAXPreset(env: Integer): BOOL;
  859. begin
  860.   case (env) of
  861.     EAX_ENVIRONMENT_GENERIC:
  862.       Result := BASS_SetEAXParameters(EAX_ENVIRONMENT_GENERIC, 0.5, 1.493, 0.5);
  863.     EAX_ENVIRONMENT_PADDEDCELL:
  864.       Result := BASS_SetEAXParameters(EAX_ENVIRONMENT_PADDEDCELL, 0.25, 0.1, 0);
  865.     EAX_ENVIRONMENT_ROOM:
  866.       Result := BASS_SetEAXParameters(EAX_ENVIRONMENT_ROOM, 0.417, 0.4, 0.666);
  867.     EAX_ENVIRONMENT_BATHROOM:
  868.       Result := BASS_SetEAXParameters(EAX_ENVIRONMENT_BATHROOM, 0.653, 1.499, 0.166);
  869.     EAX_ENVIRONMENT_LIVINGROOM:
  870.       Result := BASS_SetEAXParameters(EAX_ENVIRONMENT_LIVINGROOM, 0.208, 0.478, 0);
  871.     EAX_ENVIRONMENT_STONEROOM:
  872.       Result := BASS_SetEAXParameters(EAX_ENVIRONMENT_STONEROOM, 0.5, 2.309, 0.888);
  873.     EAX_ENVIRONMENT_AUDITORIUM:
  874.       Result := BASS_SetEAXParameters(EAX_ENVIRONMENT_AUDITORIUM, 0.403, 4.279, 0.5);
  875.     EAX_ENVIRONMENT_CONCERTHALL:
  876.       Result := BASS_SetEAXParameters(EAX_ENVIRONMENT_CONCERTHALL, 0.5, 3.961, 0.5);
  877.     EAX_ENVIRONMENT_CAVE:
  878.       Result := BASS_SetEAXParameters(EAX_ENVIRONMENT_CAVE, 0.5, 2.886, 1.304);
  879.     EAX_ENVIRONMENT_ARENA:
  880.       Result := BASS_SetEAXParameters(EAX_ENVIRONMENT_ARENA, 0.361, 7.284, 0.332);
  881.     EAX_ENVIRONMENT_HANGAR:
  882.       Result := BASS_SetEAXParameters(EAX_ENVIRONMENT_HANGAR, 0.5, 10.0, 0.3);
  883.     EAX_ENVIRONMENT_CARPETEDHALLWAY:
  884.       Result := BASS_SetEAXParameters(EAX_ENVIRONMENT_CARPETEDHALLWAY, 0.153, 0.259, 2.0);
  885.     EAX_ENVIRONMENT_HALLWAY:
  886.       Result := BASS_SetEAXParameters(EAX_ENVIRONMENT_HALLWAY, 0.361, 1.493, 0);
  887.     EAX_ENVIRONMENT_STONECORRIDOR:
  888.       Result := BASS_SetEAXParameters(EAX_ENVIRONMENT_STONECORRIDOR, 0.444, 2.697, 0.638);
  889.     EAX_ENVIRONMENT_ALLEY:
  890.       Result := BASS_SetEAXParameters(EAX_ENVIRONMENT_ALLEY, 0.25, 1.752, 0.776);
  891.     EAX_ENVIRONMENT_FOREST:
  892.       Result := BASS_SetEAXParameters(EAX_ENVIRONMENT_FOREST, 0.111, 3.145, 0.472);
  893.     EAX_ENVIRONMENT_CITY:
  894.       Result := BASS_SetEAXParameters(EAX_ENVIRONMENT_CITY, 0.111, 2.767, 0.224);
  895.     EAX_ENVIRONMENT_MOUNTAINS:
  896.       Result := BASS_SetEAXParameters(EAX_ENVIRONMENT_MOUNTAINS, 0.194, 7.841, 0.472);
  897.     EAX_ENVIRONMENT_QUARRY:
  898.       Result := BASS_SetEAXParameters(EAX_ENVIRONMENT_QUARRY, 1, 1.499, 0.5);
  899.     EAX_ENVIRONMENT_PLAIN:
  900.       Result := BASS_SetEAXParameters(EAX_ENVIRONMENT_PLAIN, 0.097, 2.767, 0.224);
  901.     EAX_ENVIRONMENT_PARKINGLOT:
  902.       Result := BASS_SetEAXParameters(EAX_ENVIRONMENT_PARKINGLOT, 0.208, 1.652, 1.5);
  903.     EAX_ENVIRONMENT_SEWERPIPE:
  904.       Result := BASS_SetEAXParameters(EAX_ENVIRONMENT_SEWERPIPE, 0.652, 2.886, 0.25);
  905.     EAX_ENVIRONMENT_UNDERWATER:
  906.       Result := BASS_SetEAXParameters(EAX_ENVIRONMENT_UNDERWATER, 1, 1.499, 0);
  907.     EAX_ENVIRONMENT_DRUGGED:
  908.       Result := BASS_SetEAXParameters(EAX_ENVIRONMENT_DRUGGED, 0.875, 8.392, 1.388);
  909.     EAX_ENVIRONMENT_DIZZY:
  910.       Result := BASS_SetEAXParameters(EAX_ENVIRONMENT_DIZZY, 0.139, 17.234, 0.666);
  911.     EAX_ENVIRONMENT_PSYCHOTIC:
  912.       Result := BASS_SetEAXParameters(EAX_ENVIRONMENT_PSYCHOTIC, 0.486, 7.563, 0.806);
  913.     else
  914.       Result := FALSE;
  915.   end;
  916. end;
  917.  
  918. end.
  919. // END OF FILE /////////////////////////////////////////////////////////////////
  920.  
  921.