⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 unabassapi.pas

📁 Voice Commnucation Components for Delphi
💻 PAS
📖 第 1 页 / 共 5 页
字号:



implementation


// -- --
function BASS_SPEAKER_N(n: DWORD): DWORD;
begin
  result := (n shl 24);
end;

// -- --
function MAKEMUSICPOS(order, row: DWORD): DWORD;
begin
  result := ($80000000 or DWORD(MAKELONG(order, row)));
end;


// --  --
function load_BASS(var bassProc: tBassProc; const dllFile: string): BOOL;
var
  libFile: string;
begin
  with bassProc do begin
    //
    if (0 <> r_module) then begin
      //
      if (0 < r_refCount) then
	inc(r_refCount);
    end
    else begin
      //
      libFile := dllFile;
      if ('' = libFile) then
	libFile := c_bassLibrary;
      //
      fillChar(bassProc, sizeOf(bassProc), #0);
      //
      r_module := LoadLibrary(pChar(libFile));
      if (0 <> r_module) then begin
	//
	@r_getVersion           := GetProcAddress(r_module, 'BASS_GetVersion');
	@r_getDeviceDescription := GetProcAddress(r_module, 'BASS_GetDeviceDescription');
{$IFDEF BASS_AFTER_18 }
	// removed in 2.0
{$ELSE }
	@r_setBufferLength      := GetProcAddress(r_module, 'BASS_SetBufferLength');
	@r_setGlobalVolumes     := GetProcAddress(r_module, 'BASS_SetGlobalVolumes');
	@r_getGlobalVolumes     := GetProcAddress(r_module, 'BASS_GetGlobalVolumes');
	@r_setLogCurves         := GetProcAddress(r_module, 'BASS_SetLogCurves');
	@r_set3DAlgorithm       := GetProcAddress(r_module, 'BASS_Set3DAlgorithm');
{$ENDIF }
	@r_errorGetCode         := GetProcAddress(r_module, 'BASS_ErrorGetCode');
	//
	@r_init                 := GetProcAddress(r_module, 'BASS_Init');
	@r_free                 := GetProcAddress(r_module, 'BASS_Free');
	//
	@r_getDSoundObject      := GetProcAddress(r_module, 'BASS_GetDSoundObject');
	@r_getInfo              := GetProcAddress(r_module, 'BASS_GetInfo');
	@r_getCPU               := GetProcAddress(r_module, 'BASS_GetCPU');
	@r_start                := GetProcAddress(r_module, 'BASS_Start');
	@r_stop                 := GetProcAddress(r_module, 'BASS_Stop');
	@r_pause                := GetProcAddress(r_module, 'BASS_Pause');
	@r_setVolume            := GetProcAddress(r_module, 'BASS_SetVolume');
	@r_getVolume            := GetProcAddress(r_module, 'BASS_GetVolume');
	@r_set3DFactors         := GetProcAddress(r_module, 'BASS_Set3DFactors');
	@r_get3DFactors         := GetProcAddress(r_module, 'BASS_Get3DFactors');
	@r_set3DPosition        := GetProcAddress(r_module, 'BASS_Set3DPosition');
	@r_get3DPosition        := GetProcAddress(r_module, 'BASS_Get3DPosition');
	@r_apply3D              := GetProcAddress(r_module, 'BASS_Apply3D');
	@r_setEAXParameters     := GetProcAddress(r_module, 'BASS_SetEAXParameters');
	@r_getEAXParameters     := GetProcAddress(r_module, 'BASS_GetEAXParameters');
	//
	@r_musicLoad            := GetProcAddress(r_module, 'BASS_MusicLoad');
	@r_musicFree            := GetProcAddress(r_module, 'BASS_MusicFree');
{$IFDEF BASS_AFTER_22 }
{$ELSE }
        // fucked in 2.3
	@r_musicGetName         := GetProcAddress(r_module, 'BASS_MusicGetName');
{$ENDIF }	
{$IFDEF BASS_BEFORE_22 }
	// removed in 2.2
	@r_musicGetLength       := GetProcAddress(r_module, 'BASS_MusicGetLength');
{$ELSE }
	// new in 2.2
	@r_channelGetLength	:= GetProcAddress(r_module, 'BASS_ChannelGetLength');
	@r_musicGetOrders 	:= GetProcAddress(r_module, 'BASS_MusicGetOrders');
	@r_musicGetOrderPosition:= GetProcAddress(r_module, 'BASS_MusicGetOrderPosition');
{$ENDIF }
	//
{$IFDEF BASS_AFTER_20 }
        // removed in 2.1
{$ELSE }
	@r_musicPlay            := GetProcAddress(r_module, 'BASS_MusicPlay');
	@r_musicPlayEx          := GetProcAddress(r_module, 'BASS_MusicPlayEx');
	@r_musicSetAmplify      := GetProcAddress(r_module, 'BASS_MusicSetAmplify');
	@r_musicSetPanSep       := GetProcAddress(r_module, 'BASS_MusicSetPanSep');
	@r_musicSetPositionScaler := GetProcAddress(r_module, 'BASS_MusicSetPositionScaler');
{$ENDIF }
{$IFDEF BASS_AFTER_20 }
	// new in 2.1
	@r_musicSetAttribute    := GetProcAddress(r_module, 'BASS_MusicSetAttribute');
	@r_musicGetAttribute    := GetProcAddress(r_module, 'BASS_MusicGetAttribute');
{$ENDIF }
	//
	@r_sampleLoad           := GetProcAddress(r_module, 'BASS_SampleLoad');
	@r_sampleCreate         := GetProcAddress(r_module, 'BASS_SampleCreate');
	@r_sampleCreateDone     := GetProcAddress(r_module, 'BASS_SampleCreateDone');
	@r_sampleFree           := GetProcAddress(r_module, 'BASS_SampleFree');
	@r_sampleGetInfo        := GetProcAddress(r_module, 'BASS_SampleGetInfo');
	@r_sampleSetInfo        := GetProcAddress(r_module, 'BASS_SampleSetInfo');
{$IFDEF BASS_AFTER_20 }
	// new in 2.1
	@r_sampleGetChannel     := GetProcAddress(r_module, 'BASS_SampleGetChannel');
{$ENDIF }
{$IFDEF BASS_AFTER_20 }
    // removed in 2.1
{$ELSE}
	@r_samplePlay           := GetProcAddress(r_module, 'BASS_SamplePlay');
	@r_samplePlayEx         := GetProcAddress(r_module, 'BASS_SamplePlayEx');
	@r_samplePlay3D         := GetProcAddress(r_module, 'BASS_SamplePlay3D');
	@r_samplePlay3DEx       := GetProcAddress(r_module, 'BASS_SamplePlay3DEx');
{$ENDIF }
	@r_sampleStop           := GetProcAddress(r_module, 'BASS_SampleStop');
	//
	@r_streamCreate         := GetProcAddress(r_module, 'BASS_StreamCreate');
	@r_streamCreateFile     := GetProcAddress(r_module, 'BASS_StreamCreateFile');
	@r_streamFree           := GetProcAddress(r_module, 'BASS_StreamFree');
{$IFDEF BASS_BEFORE_22 }
	// removed in 2.2
	@r_streamGetLength      := GetProcAddress(r_module, 'BASS_StreamGetLength');
{$ENDIF }
{$IFDEF BASS_AFTER_20 }
	// removed in 2.1
{$ELSE }
	@r_streamPlay           := GetProcAddress(r_module, 'BASS_StreamPlay');
{$ENDIF }
{$IFDEF BASS_AFTER_18 }
	// removed in 2.0
{$ELSE }
	@r_CDInit               := GetProcAddress(r_module, 'BASS_CDInit');
	@r_CDFree               := GetProcAddress(r_module, 'BASS_CDFree');
	@r_CDInDrive            := GetProcAddress(r_module, 'BASS_CDInDrive');
	@r_CDPlay               := GetProcAddress(r_module, 'BASS_CDPlay');
	//
	@r_channelGetFlags      := GetProcAddress(r_module, 'BASS_ChannelGetFlags');
{$ENDIF }
	@r_channelStop          := GetProcAddress(r_module, 'BASS_ChannelStop');
	@r_channelPause         := GetProcAddress(r_module, 'BASS_ChannelPause');
{$IFDEF BASS_AFTER_20 }
	// removed up in 2.1
{$ELSE }
	@r_channelResume        := GetProcAddress(r_module, 'BASS_ChannelResume');
{$ENDIF }
	//
	@r_channelSetAttributes := GetProcAddress(r_module, 'BASS_ChannelSetAttributes');
	@r_channelGetAttributes := GetProcAddress(r_module, 'BASS_ChannelGetAttributes');
	@r_channelSet3DAttributes := GetProcAddress(r_module, 'BASS_ChannelSet3DAttributes');
	@r_channelGet3DAttributes := GetProcAddress(r_module, 'BASS_ChannelGet3DAttributes');
	@r_channelSet3DPosition := GetProcAddress(r_module, 'BASS_ChannelSet3DPosition');
	@r_channelGet3DPosition := GetProcAddress(r_module, 'BASS_ChannelGet3DPosition');
	@r_channelSetPosition   := GetProcAddress(r_module, 'BASS_ChannelSetPosition');
	@r_channelGetPosition   := GetProcAddress(r_module, 'BASS_ChannelGetPosition');
	@r_channelGetLevel      := GetProcAddress(r_module, 'BASS_ChannelGetLevel');
	@r_channelGetData       := GetProcAddress(r_module, 'BASS_ChannelGetData');
	@r_channelSetSync       := GetProcAddress(r_module, 'BASS_ChannelSetSync');
	@r_channelRemoveSync    := GetProcAddress(r_module, 'BASS_ChannelRemoveSync');
	//
	@r_channelSetDSP        := GetProcAddress(r_module, 'BASS_ChannelSetDSP');
	@r_channelRemoveDSP     := GetProcAddress(r_module, 'BASS_ChannelRemoveDSP');
	@r_channelSetEAXMix     := GetProcAddress(r_module, 'BASS_ChannelSetEAXMix');
	@r_channelGetEAXMix     := GetProcAddress(r_module, 'BASS_ChannelGetEAXMix');

	// new in v0.9
	@r_streamGetFilePosition := GetProcAddress(r_module, 'BASS_StreamGetFilePosition');

{$IFDEF BASS_AFTER_18 }
	// removed in 2.0
{$ELSE }
	@r_CDGetTracks           := GetProcAddress(r_module, 'BASS_CDGetTracks');
	@r_CDGetTrackLength      := GetProcAddress(r_module, 'BASS_CDGetTrackLength');
{$ENDIF }
	@r_channelIsActive       := GetProcAddress(r_module, 'BASS_ChannelIsActive');

	// v1.1
{$IFDEF BASS_AFTER_18 }
	// removed in 2.0
{$ELSE }
	@r_CDGetID              := GetProcAddress(r_module, 'BASS_CDGetID');
{$ENDIF }
	@r_channelSetFX         := GetProcAddress(r_module, 'BASS_ChannelSetFX');
	@r_channelRemoveFX      := GetProcAddress(r_module, 'BASS_ChannelRemoveFX');
	@r_FXSetParameters      := GetProcAddress(r_module, 'BASS_FXSetParameters');
	@r_FXGetParameters      := GetProcAddress(r_module, 'BASS_FXGetParameters');

	// v1.2
	@r_channelSetLink       := GetProcAddress(r_module, 'BASS_ChannelSetLink');
	@r_channelRemoveLink    := GetProcAddress(r_module, 'BASS_ChannelRemoveLink');
{$IFDEF BASS_AFTER_20 }
	// removed up in 2.1
{$ELSE }
	@r_musicPreBuf          := GetProcAddress(r_module, 'BASS_MusicPreBuf');
	@r_streamPreBuf         := GetProcAddress(r_module, 'BASS_StreamPreBuf');
{$ENDIF }

	// v1.3
	@r_update               := GetProcAddress(r_module, 'BASS_Update');
{$IFDEF BASS_AFTER_22 }
	@r_channelGetTags        := GetProcAddress(r_module, 'BASS_ChannelGetTags');
{$ELSE }
	// fucked in 2.3
	@r_streamGetTags        := GetProcAddress(r_module, 'BASS_StreamGetTags');
{$ENDIF }
	@r_streamCreateURL      := GetProcAddress(r_module, 'BASS_StreamCreateURL');
	//
	@r_channelBytes2Seconds := GetProcAddress(r_module, 'BASS_ChannelBytes2Seconds');
	@r_channelSeconds2Bytes := GetProcAddress(r_module, 'BASS_ChannelSeconds2Bytes');

	// v1.4
{$IFDEF BASS_AFTER_18 }
	// removed in 2.0
{$ELSE }
	@r_setCLSID             := GetProcAddress(r_module, 'BASS_SetCLSID');
	@r_musicSetChannelVol   := GetProcAddress(r_module, 'BASS_MusicSetChannelVol');
	@r_musicGetChannelVol   := GetProcAddress(r_module, 'BASS_MusicGetChannelVol');
{$ENDIF }

	// v1.5
	@r_recordGetDeviceDescription := GetProcAddress(r_module, 'BASS_RecordGetDeviceDescription');
	@r_recordInit           := GetProcAddress(r_module, 'BASS_RecordInit');
	@r_recordFree           := GetProcAddress(r_module, 'BASS_RecordFree');
	@r_recordGetInfo        := GetProcAddress(r_module, 'BASS_RecordGetInfo');
	@r_recordStart          := GetProcAddress(r_module, 'BASS_RecordStart');

	// v1.6
{$IFDEF BASS_AFTER_18 }
	// removed in 2.0
{$ELSE }
	@r_CDDoor               := GetProcAddress(r_module, 'BASS_CDDoor');
{$ENDIF }
	@r_recordGetInputName   := GetProcAddress(r_module, 'BASS_RecordGetInputName');
	@r_recordSetInput       := GetProcAddress(r_module, 'BASS_RecordSetInput');
	@r_recordGetInput       := GetProcAddress(r_module, 'BASS_RecordGetInput');

	// v1.7
{$IFDEF BASS_AFTER_18 }
	// removed in 2.0
{$ELSE }
	@r_setNetConfig           := GetProcAddress(r_module, 'BASS_SetNetConfig');
{$ENDIF }
	@r_channelSlideAttributes := GetProcAddress(r_module, 'BASS_ChannelSlideAttributes');
	@r_channelIsSliding       := GetProcAddress(r_module, 'BASS_ChannelIsSliding');

{$IFDEF BASS_AFTER_18 }
	// new in 2.0
	@r_setConfig	      	:= GetProcAddress(r_module, 'BASS_SetConfig');
	@r_getConfig	      	:= GetProcAddress(r_module, 'BASS_GetConfig');
	@r_setDevice          	:= GetProcAddress(r_module, 'BASS_SetDevice');
	@r_getDevice	      	:= GetProcAddress(r_module, 'BASS_GetDevice');
{$IFDEF BASS_AFTER_20 }
	// removed in 2.1
{$ELSE }
	@r_musicSetVolume	:= GetProcAddress(r_module, 'BASS_MusicSetVolume');
	@r_musicGetVolume	:= GetProcAddress(r_module, 'BASS_MusicGetVolume');
{$ENDIF }
	@r_streamCreateFileUser	:= GetProcAddress(r_module, 'BASS_StreamCreateFileUser');
	@r_recordSetDevice	:= GetProcAddress(r_module, 'BASS_RecordSetDevice');
	@r_recordGetDevice	:= GetProcAddress(r_module, 'BASS_RecordGetDevice');
	@r_channelGetDevice	:= GetProcAddress(r_module, 'BASS_ChannelGetDevice');
	@r_channelGetInfo	:= GetProcAddress(r_module, 'BASS_ChannelGetInfo');
{$ENDIF } // 2.0
	//
{$IFDEF BASS_AFTER_20 }
	// new in 2.1
	@r_channelSetFlags	:= GetProcAddress(r_module, 'BASS_ChannelSetFlags');
	@r_channelPreBuf	:= GetProcAddress(r_module, 'BASS_ChannelPreBuf');
	@r_channelPlay	        := GetProcAddress(r_module, 'BASS_ChannelPlay');
{$ENDIF } // 2.1
{$IFDEF BASS_AFTER_22 }
	@r_pluginLoad 		:= GetProcAddress(r_module, 'BASS_PluginLoad');
	@r_pluginFree 	 	:= GetProcAddress(r_module, 'BASS_PluginFree');
	@r_pluginGetInfo 	:= GetProcAddress(r_module, 'BASS_PluginGetInfo');
{$ENDIF } // 2.3
	//
	//
	if (
	    assigned(r_getVersion) and
	    assigned(r_getDeviceDescription) and
{$IFDEF BASS_AFTER_18 }
	    // removed in 2.0
{$ELSE }
	    assigned(r_setBufferLength) and
	    assigned(r_setGlobalVolumes) and
	    assigned(r_getGlobalVolumes) and
	    assigned(r_setLogCurves) and
	    assigned(r_set3DAlgorithm) and
{$ENDIF }
	    assigned(r_errorGetCode) and
	    assigned(r_init) and
	    assigned(r_free) and
	    assigned(r_getDSoundObject) and
	    assigned(r_getInfo) and
	    assigned(r_getCPU) and
	    assigned(r_start) and
	    assigned(r_stop) and
	    assigned(r_pause) and
	    assigned(r_setVolume) and
	    assigned(r_getVolume) and
	    assigned(r_set3DFactors) and
	    assigned(r_get3DFactors) and
	    assigned(r_set3DPosition) and
	    assigned(r_get3DPosition) and
	    assig

⌨️ 快捷键说明

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