unabassapi.pas

来自「Voice Commnucation Components for Delphi」· PAS 代码 · 共 1,586 行 · 第 1/5 页

PAS
1,586
字号
    //
    {21}r_getDeviceDescription: function(devnum: DWORD): pChar; stdcall;
{$IFDEF BASS_AFTER_18 }
    // removed in 2.0
{$ELSE }
    r_setBufferLength:      function(length: FLOAT): FLOAT; stdcall;
    r_setGlobalVolumes:     procedure(musvol, samvol, strvol: Integer); stdcall;
    r_getGlobalVolumes:     procedure(out musvol, samvol, strvol: Integer); stdcall;
    r_setLogCurves:         procedure(volume, pan: BOOL); stdcall;
    r_set3DAlgorithm:       procedure(algo: DWORD); stdcall;
{$ENDIF }
    {21}r_errorGetCode:         function(): DWORD; stdcall;
    //
{$IFDEF BASS_AFTER_18 }
    // fucked up in 2.0
    {21}r_init:                 function(device: Integer; freq, flags: DWORD; win: HWND; clsid: PGUID): BOOL; stdcall;
{$ELSE }
    r_init:                 function(device: Integer; freq, flags: DWORD; win: HWND): BOOL; stdcall;
{$ENDIF }    
    {21}r_free:                 function(): bool; stdcall;
    //
    {21}r_getDSoundObject:      function(obj: DWORD): pointer; stdcall;
    {21}r_getInfo:              procedure(out info: BASS_INFO); stdcall;
    {21}r_getCPU:               function(): FLOAT; stdcall;
    {21}r_start:                function(): BOOL; stdcall;
    {21}r_stop:                 function(): BOOL; stdcall;
    {21}r_pause:                function(): BOOL; stdcall;
    {21}r_setVolume:            function(volume: DWORD): BOOL; stdcall;
    {21}r_getVolume:            function(): Integer; stdcall;
    //
    {21}r_set3DFactors:         function(distf, rollf, doppf: FLOAT): BOOL; stdcall;
    {21}r_get3DFactors:         function(out distf, rollf, doppf: FLOAT): BOOL; stdcall;
    {21}r_set3DPosition:        function(const pos, vel, front, top: BASS_3DVECTOR): BOOL; stdcall;
    {21}r_get3DPosition:        function(out pos, vel, front, top: BASS_3DVECTOR): BOOL; stdcall;
    {21}r_apply3D:              procedure(); stdcall;
    {21}r_setEAXParameters:     function(env: Integer; vol, decay, damp: FLOAT): BOOL; stdcall;
    {21}r_getEAXParameters:     function(out env: Integer; out vol, decay, damp: FLOAT): BOOL; stdcall;
    //
{$IFDEF BASS_AFTER_18 }
    // fucked up by 2.0
    {21}r_musicLoad:            function(mem: BOOL; f: Pointer; offset, length, flags, freq: DWORD): HMUSIC; stdcall;
{$ELSE }
    r_musicLoad:             function(mem: BOOL; f: Pointer; offset, length, flags: DWORD): HMUSIC; stdcall;
{$ENDIF }

    {21}r_musicFree:            procedure(handle: HMUSIC); stdcall;
{$IFDEF BASS_AFTER_22 }
{$ELSE }
    // fucked in 2.3
    {21}r_musicGetName:         function(handle: HMUSIC): PChar; stdcall;
{$ENDIF }
    //
{$IFDEF BASS_BEFORE_22 }
    // removed in 2.2
    {21}r_musicGetLength:       function(handle: HMUSIC; playlen: BOOL): DWORD; stdcall;
{$ENDIF }
{$IFDEF BASS_AFTER_20 }
    // removed in 2.1
{$ELSE }
    r_musicPlay:             function(handle: HMUSIC): BOOL; stdcall;
    r_musicPlayEx:           function(handle: HMUSIC; pos: DWORD; flags: Integer; reset: BOOL): BOOL; stdcall;
    //
    r_musicSetAmplify:       function(handle: HMUSIC; amp: DWORD): BOOL; stdcall;
    r_musicSetPanSep:        function(handle: HMUSIC; pan: DWORD): BOOL; stdcall;
    r_musicSetPositionScaler: function(handle: HMUSIC; scale: DWORD): BOOL; stdcall;
{$ENDIF }
{$IFDEF BASS_AFTER_20 }
    // new in 2.1
    {21}r_musicSetAttribute:    function(handle: HMUSIC; attrib,value: DWORD): DWORD; stdcall;
    {21}r_musicGetAttribute:    function(handle: HMUSIC; attrib: DWORD): DWORD; stdcall;
{$ENDIF }

    //
    {21}r_sampleLoad:           function(mem: BOOL; f: Pointer; offset, length, max, flags: DWORD): HSAMPLE; stdcall;
  {$IFDEF BASS_AFTER_21 }
    // parameters were fucked in 2.2
    {22}r_sampleCreate:         function(length, freq, chans, max, flags: DWORD): Pointer; stdcall;
  {$ELSE }
    {21}r_sampleCreate:         function(length, freq, max, flags: DWORD): Pointer; stdcall;
  {$ENDIF }
    {21}r_sampleCreateDone:     function(): HSAMPLE; stdcall;
    {21}r_sampleFree:           procedure(handle: HSAMPLE); stdcall;
    {21}r_sampleGetInfo:        function(handle: HSAMPLE; out info: BASS_SAMPLE): BOOL;stdcall;
    {21}r_sampleSetInfo:        function(handle: HSAMPLE; const info: BASS_SAMPLE): BOOL; stdcall;
{$IFDEF BASS_AFTER_20 }
    // new in 2.1
    {21}r_sampleGetChannel:     function(handle: HSAMPLE; onlynew: BOOL): HCHANNEL; stdcall;
{$ENDIF }
{$IFDEF BASS_AFTER_20 }
    // removed in 2.1
{$ELSE}
    r_samplePlay:            function(handle: HSAMPLE): HCHANNEL; stdcall;
    r_samplePlayEx:          function(handle: HSAMPLE; start: DWORD; freq, volume, pan: Integer; loop: BOOL): HCHANNEL; stdcall;
    r_samplePlay3D:          function(handle: HSAMPLE; const pos, orient, vel: BASS_3DVECTOR): HCHANNEL; stdcall;
    r_samplePlay3DEx:        function(handle: HSAMPLE; const pos, orient, vel: BASS_3DVECTOR; start: DWORD; freq, volume: Integer; loop: BOOL): HCHANNEL; stdcall;
{$ENDIF }
    {21}r_sampleStop:           function(handle: HSAMPLE): BOOL; stdcall;
    //
    {21}r_streamCreate:         function(freq, flags: DWORD; proc: pointer; user: DWORD): HSTREAM; stdcall;
    {21}r_streamCreateFile:     function(mem: BOOL; f: Pointer; offset, length, flags: DWORD): HSTREAM; stdcall;
    {21}r_streamFree:           procedure(handle: HSTREAM); stdcall;
{$IFDEF BASS_BEFORE_22 }
    // removed in 2.2
    {21}r_streamGetLength:      function(handle: HSTREAM): QWORD; stdcall;
{$ENDIF }
{$IFDEF BASS_AFTER_20 }
    // removed in 2.1
{$ELSE}
    r_streamPlay:            function(handle: HSTREAM; flush: BOOL; flags: DWORD): BOOL; stdcall;
{$ENDIF }
    //
{$IFDEF BASS_AFTER_18 }
    // removed in 2.0
{$ELSE }
    r_CDInit:                function(drive: pChar; flags: DWORD): BOOL; stdcall;
    r_CDFree:                procedure(); stdcall;
    r_CDInDrive:             function(): BOOL; stdcall;
    r_CDPlay:                function(track: DWORD; loop: BOOL; wait: BOOL): BOOL; stdcall;
{$ENDIF }
    //
{$IFDEF BASS_AFTER_18 }
    // removed in 2.0
{$ELSE }
    r_channelGetFlags:       function(handle: DWORD): DWORD; stdcall;
{$ENDIF }
    {21}r_channelStop:          function(handle: DWORD): BOOL; stdcall;
    {21}r_channelPause:         function(handle: DWORD): BOOL; stdcall;
{$IFDEF BASS_AFTER_20 }
    // removed in 2.1
{$ELSE }
    r_channelResume:         function(handle: DWORD): BOOL; stdcall;
{$ENDIF }
    {21}r_channelSetAttributes: function(handle: DWORD; freq, volume, pan: Integer): BOOL; stdcall;
    {21}r_channelGetAttributes: function(handle: DWORD; out freq, volume, pan: Integer): BOOL; stdcall;
    {21}r_channelSet3DAttributes: function(handle: DWORD; mode: Integer; min, max: FLOAT; iangle, oangle, outvol: Integer): BOOL; stdcall;
    {21}r_channelGet3DAttributes: function(handle: DWORD; out mode: Integer; out min, max: FLOAT; out iangle, oangle, outvol: Integer): BOOL; stdcall;
    {21}r_channelSet3DPosition: function(handle: DWORD; const pos, orient, vel: BASS_3DVECTOR): BOOL; stdcall;
    {21}r_channelGet3DPosition: function(handle: DWORD; out pos, orient, vel: BASS_3DVECTOR): BOOL; stdcall;
    {21}r_channelSetPosition:   function(handle: DWORD; pos: QWORD): BOOL; stdcall;
    {21}r_channelGetPosition:   function(handle: DWORD): QWORD; stdcall;
    {21}r_channelGetLevel:      function(handle: DWORD): DWORD; stdcall;
    {21}r_channelGetData:       function(handle: DWORD; buffer: pointer; length: DWORD): DWORD; stdcall;
    {21}r_channelSetSync:       function(handle: DWORD; atype: DWORD; param: QWORD; proc: SYNCPROC; user: DWORD): HSYNC; stdcall;
    {21}r_channelRemoveSync:    function(handle: DWORD; sync: HSYNC): BOOL; stdcall;
{$IFDEF BASS_AFTER_18 }
    // fucked up by 2.0
    {21}r_channelSetDSP:        function(handle: DWORD; proc: DSPPROC; user: DWORD; priority: Integer): HDSP; stdcall;
{$ELSE }
    r_channelSetDSP:          function(handle: DWORD; proc: DSPPROC; user: DWORD): HDSP; stdcall;
{$ENDIF }
    {21}r_channelRemoveDSP:     function(handle: DWORD; dsp: HDSP): BOOL; stdcall;
    {21}r_channelSetEAXMix:     function(handle: DWORD; mix: FLOAT): BOOL; stdcall;
    {21}r_channelGetEAXMix:     function(handle: DWORD; out mix: FLOAT): BOOL; stdcall;

    // these were added/changed in v0.9
    {21}r_streamGetFilePosition: function(handle:HSTREAM; mode:DWORD): DWORD; stdcall;
{$IFDEF BASS_AFTER_18 }
    // removed in 2.0
{$ELSE }
    r_CDGetTracks:            function(): Integer; stdcall;
    r_CDGetTrackLength:       function(track:DWORD):DWORD; stdcall;
{$ENDIF }
    {21}r_channelIsActive:       function(handle: DWORD): DWORD; stdcall;

    // v1.1
{$IFDEF BASS_AFTER_18 }
    // removed in 2.0
{$ELSE }
    r_CDGetID:                function(id: DWORD):PChar; stdcall;
{$ENDIF }
{$IFDEF BASS_AFTER_20 }
    // fucked up in 2.1
    {21}r_channelSetFX:          function(handle, etype: DWORD; priority: Integer): HFX; stdcall;
{$ELSE }
    r_channelSetFX:           function(handle, etype: DWORD): HFX; stdcall;
{$ENDIF }
    {21}r_channelRemoveFX:       function(handle: DWORD; fx: HFX): BOOL; stdcall;
    {21}r_FXSetParameters:       function(handle: HFX; par: Pointer): BOOL; stdcall;
    {21}r_FXGetParameters:       function(handle: HFX; par: Pointer): BOOL; stdcall;

    // v1.2
    {21}r_channelSetLink:        function(handle, chan: DWORD): BOOL; stdcall;
    {21}r_channelRemoveLink:     function(handle, chan: DWORD): BOOL; stdcall;
{$IFDEF BASS_AFTER_20 }
    // removed in 2.1
{$ELSE }
    r_musicPreBuf:            function(handle: HMUSIC): BOOL; stdcall;
    r_streamPreBuf:           function(handle: HMUSIC): BOOL; stdcall;
{$ENDIF }

    // v1.3
    {21}r_update:                function(): BOOL; stdcall;
{$IFDEF BASS_AFTER_22 }
    {21}r_channelGetTags:         function(handle: HSTREAM; tags : DWORD): PChar; stdcall;
{$ELSE }
    // fucked in 2.3
    {21}r_streamGetTags:         function(handle: HSTREAM; tags : DWORD): PChar; stdcall;
{$ENDIF }
    //
{$IFDEF BASS_AFTER_18 }
    // fucked up in 2.0
    {21}r_streamCreateURL:       function(URL: PChar; offset: DWORD; flags: DWORD; proc: DOWNLOADPROC; user:DWORD):HSTREAM; stdcall;
{$ELSE }
    r_streamCreateURL:        function(URL: PChar; offset: DWORD; flags: DWORD; save: PChar):HSTREAM;stdcall;
{$ENDIF }
    {21}r_channelBytes2Seconds:  function(handle: DWORD; pos: QWORD): FLOAT; stdcall;
    {21}r_channelSeconds2Bytes:  function(handle: DWORD; pos: FLOAT): QWORD; stdcall;

    // v1.4
{$IFDEF BASS_AFTER_18 }
    // removed in 2.0
{$ELSE }
    r_setCLSID:               procedure(clsid: TGUID); stdcall;
    r_musicSetChannelVol:     function(handle: HMUSIC; channel,volume: DWORD): BOOL; stdcall;
    r_musicGetChannelVol:     function(handle: HMUSIC; channel: DWORD): Integer; stdcall;
{$ENDIF }

    // v1.5
    {21}r_recordGetDeviceDescription: function(devnum: DWORD): PChar; stdcall;
    {21}r_recordInit:            function(device: Integer): BOOL; stdcall;
    {21}r_recordFree:            procedure(); stdcall;
    {21}r_recordGetInfo:         procedure(out info: BASS_RECORDINFO); stdcall;
    {21}r_recordStart:	      function(freq, flags: DWORD; proc: RECORDPROC; user: DWORD): BOOL; stdcall;

    // v1.6
{$IFDEF BASS_AFTER_18 }
    // removed in 2.0
{$ELSE }
    r_CDDoor:                 function(open:BOOL): BOOL; stdcall;
{$ENDIF }
    {21}r_recordGetInputName:    function(input: DWORD): PChar; stdcall;
    {21}r_recordSetInput:        function(input: DWORD; setting: DWORD): BOOL; stdcall;
    {21}r_recordGetInput:        function(input: DWORD): DWORD; stdcall;

    // v1.7
{$IFDEF BASS_AFTER_18 }
    // removed in 2.0
{$ELSE }
    r_setNetConfig:           function(option, value: DWORD): DWORD; stdcall;
{$ENDIF }
    {21}r_channelSlideAttributes: function(handle: DWORD; freq, volume, pan: Integer; time: DWORD): BOOL; stdcall;
    {21}r_channelIsSliding:       function(handle: DWORD): DWORD; stdcall;

    // v2.0
{$IFDEF BASS_AFTER_18 }
    {21}r_setConfig:	      function(option, value: DWORD): DWORD; stdcall;
    {21}r_getConfig:	      function(option: DWORD): DWORD; stdcall;
    {21}r_setDevice:          function(device: DWORD): BOOL; stdcall;
    {21}r_getDevice:	      function(): DWORD; stdcall;
{$IFDEF BASS_AFTER_20 }
    // removed in 2.1
{$ELSE }
    r_musicSetVolume:	      function(handle: HMUSIC; chanins,volume: DWORD): BOOL; stdcall;
    r_musicGetVolume:	      function(handle: HMUSIC; chanins: DWORD): Integer; stdcall;
{$ENDIF }
    {21}r_streamCreateFileUser:   function(buffered: BOOL; flags: DWORD; proc: STREAMFILEPROC; user: DWORD): HSTREAM; stdcall;
    {21}r_recordSetDevice:        function(device: DWORD): BOOL; stdcall;
    {21}r_recordGetDevice:        function(): DWORD; stdcall;
    {21}r_channelGetDevice:       function(handle: DWORD): DWORD; stdcall;
    {21}r_channelGetInfo:         function(handle: DWORD; out info: BASS_CHANNELINFO): BOOL; stdcall;
{$ENDIF }
    //
{$IFDEF BASS_AFTER_20 }
    // new in 2.1
    {21}r_channelSetFlags:	      function(handle, flags: DWORD): BOOL; stdcall;
  {$IFDEF BASS_AFTER_21 }
    // parameters were fucked in 2.2
    {22}r_channelPreBuf:	      function(handle, length: DWORD): BOOL; stdcall;
  {$ELSE}
    {21}r_channelPreBuf:	      function(handle: DWORD): BOOL; stdcall;
  {$ENDIF }
    {21}r_channelPlay:	              function(handle: DWORD; restart: BOOL): BOOL; stdcall;
{$ENDIF }
{$IFDEF BASS_AFTER_21 }
    // new in 2.2
    {22}r_channelGetLength:	 function(handle: DWORD): QWORD; stdcall;
    {22}r_musicGetOrders: 	 function(handle: HMUSIC): DWORD; stdcall;
    {22}r_musicGetOrderPosition: function(handle: HMUSIC): DWORD; stdcall;
{$ENDIF }
{$IFDEF BASS_AFTER_22 }
    {23}r_pluginLoad: 		function(filename: PChar; flags: DWORD): HPLUGIN; stdcall;
    {23}r_pluginFree: 	 	function(handle: HPLUGIN): BOOL; stdcall;
    {23}r_pluginGetInfo: 	function(handle: HPLUGIN): PBASS_PLUGININFO; stdcall;
{$ENDIF }
  end;


{DP:METHOD
  This function is defined in the implementation part of this unit.
  It is not part of BASS.DLL but an extra function which makes it easier
  to set the predefined EAX environments.
  env    : a EAX_ENVIRONMENT_xxx constant
}
function BASS_EAXPreset(const bassProc: tBassProc; env: Integer): BOOL;

// MACROS

// --  --
function MAKEMUSICPOS(order, row: DWORD): DWORD;
function BASS_SPEAKER_N(n: DWORD): DWORD;

// -- DLL specific --

const
  c_bassLibrary	= 'bass.dll';


{DP:METHOD
  Loads the BASS Library.
  NOTE: load and unload functions are not multi-thread safe.
}
function load_BASS(var bassProc: tBassProc; const dllFile: string = c_bassLibrary): BOOL;

{DP:METHOD
  Unloads BASS Library.
  NOTE: load and unload functions are not multi-thread safe.
}
procedure unload_BASS(var bassProc: tBassProc);

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?