| 1 |
{ |
| 2 |
Copyright 2009-2018 Michalis Kamburelis. |
| 3 |
|
| 4 |
This file is part of "Castle Game Engine". |
| 5 |
|
| 6 |
"Castle Game Engine" is free software; see the file COPYING.txt, |
| 7 |
included in this distribution, for details about the copyright. |
| 8 |
|
| 9 |
"Castle Game Engine" is distributed in the hope that it will be useful, |
| 10 |
but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 11 |
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. |
| 12 |
|
| 13 |
---------------------------------------------------------------------------- |
| 14 |
} |
| 15 |
|
| 16 |
{ OpenAL EFX (Effects Extension) API. |
| 17 |
|
| 18 |
Documentation is in OpenAL SDK for Windows (installable under Linux |
| 19 |
through wine). |
| 20 |
|
| 21 |
TODO: This functionality is NOT yet available through the public |
| 22 |
Castle Game Engine API in CastleSoundEngine. For now, you need to use |
| 23 |
this unit directly, see efx_demo in engine examples. } |
| 24 |
unit CastleInternalEFX; |
| 25 |
|
| 26 |
{$I castleconf.inc} |
| 27 |
|
| 28 |
interface |
| 29 |
|
| 30 |
uses CastleVectors, CastleInternalOpenAL, Math; |
| 31 |
|
| 32 |
{$ifndef PASDOC} |
| 33 |
{$I castleinternalefx_api.inc} |
| 34 |
{$I castleinternalefx_api_creative.inc} |
| 35 |
{$endif PASDOC} |
| 36 |
|
| 37 |
{ Checks is EFX extension, along with all it's entry points, present |
| 38 |
for given OpenAL device. If true, it will also initialize the entry |
| 39 |
points of all EFX functions in this unit. |
| 40 |
|
| 41 |
Note that if OpenAL is not avaiable at all (ALLibraryAvailable = @false), |
| 42 |
then this will also always return @false. } |
| 43 |
function Load_EFX(Device: PALCDevice): boolean; |
| 44 |
|
| 45 |
implementation |
| 46 |
|
| 47 |
function Load_EFX(Device: PALCDevice): boolean; |
| 48 |
begin |
| 49 |
Result := ALLibraryAvailable and alcIsExtensionPresent(Device, ALC_EXT_EFX_NAME); |
| 50 |
|
| 51 |
if Result then |
| 52 |
begin |
| 53 |
Pointer({$ifndef FPC}@{$endif} alGenEffects) := alGetProcAddress('alGenEffects'); if not Assigned(alGenEffects) then Exit(false); |
| 54 |
Pointer({$ifndef FPC}@{$endif} alDeleteEffects) := alGetProcAddress('alDeleteEffects'); if not Assigned(alDeleteEffects) then Exit(false); |
| 55 |
Pointer({$ifndef FPC}@{$endif} alIsEffect) := alGetProcAddress('alIsEffect'); if not Assigned(alIsEffect) then Exit(false); |
| 56 |
Pointer({$ifndef FPC}@{$endif} alEffecti) := alGetProcAddress('alEffecti'); if not Assigned(alEffecti) then Exit(false); |
| 57 |
Pointer({$ifndef FPC}@{$endif} alEffectiv) := alGetProcAddress('alEffectiv'); if not Assigned(alEffectiv) then Exit(false); |
| 58 |
Pointer({$ifndef FPC}@{$endif} alEffectf) := alGetProcAddress('alEffectf'); if not Assigned(alEffectf) then Exit(false); |
| 59 |
Pointer({$ifndef FPC}@{$endif} alEffectfv) := alGetProcAddress('alEffectfv'); if not Assigned(alEffectfv) then Exit(false); |
| 60 |
Pointer({$ifndef FPC}@{$endif} alGetEffecti) := alGetProcAddress('alGetEffecti'); if not Assigned(alGetEffecti) then Exit(false); |
| 61 |
Pointer({$ifndef FPC}@{$endif} alGetEffectiv) := alGetProcAddress('alGetEffectiv'); if not Assigned(alGetEffectiv) then Exit(false); |
| 62 |
Pointer({$ifndef FPC}@{$endif} alGetEffectf) := alGetProcAddress('alGetEffectf'); if not Assigned(alGetEffectf) then Exit(false); |
| 63 |
Pointer({$ifndef FPC}@{$endif} alGetEffectfv) := alGetProcAddress('alGetEffectfv'); if not Assigned(alGetEffectfv) then Exit(false); |
| 64 |
Pointer({$ifndef FPC}@{$endif} alGenFilters) := alGetProcAddress('alGenFilters'); if not Assigned(alGenFilters) then Exit(false); |
| 65 |
Pointer({$ifndef FPC}@{$endif} alDeleteFilters) := alGetProcAddress('alDeleteFilters'); if not Assigned(alDeleteFilters) then Exit(false); |
| 66 |
Pointer({$ifndef FPC}@{$endif} alIsFilter) := alGetProcAddress('alIsFilter'); if not Assigned(alIsFilter) then Exit(false); |
| 67 |
Pointer({$ifndef FPC}@{$endif} alFilteri) := alGetProcAddress('alFilteri'); if not Assigned(alFilteri) then Exit(false); |
| 68 |
Pointer({$ifndef FPC}@{$endif} alFilteriv) := alGetProcAddress('alFilteriv'); if not Assigned(alFilteriv) then Exit(false); |
| 69 |
Pointer({$ifndef FPC}@{$endif} alFilterf) := alGetProcAddress('alFilterf'); if not Assigned(alFilterf) then Exit(false); |
| 70 |
Pointer({$ifndef FPC}@{$endif} alFilterfv) := alGetProcAddress('alFilterfv'); if not Assigned(alFilterfv) then Exit(false); |
| 71 |
Pointer({$ifndef FPC}@{$endif} alGetFilteri) := alGetProcAddress('alGetFilteri'); if not Assigned(alGetFilteri) then Exit(false); |
| 72 |
Pointer({$ifndef FPC}@{$endif} alGetFilteriv) := alGetProcAddress('alGetFilteriv'); if not Assigned(alGetFilteriv) then Exit(false); |
| 73 |
Pointer({$ifndef FPC}@{$endif} alGetFilterf) := alGetProcAddress('alGetFilterf'); if not Assigned(alGetFilterf) then Exit(false); |
| 74 |
Pointer({$ifndef FPC}@{$endif} alGetFilterfv) := alGetProcAddress('alGetFilterfv'); if not Assigned(alGetFilterfv) then Exit(false); |
| 75 |
Pointer({$ifndef FPC}@{$endif} alGenAuxiliaryEffectSlots) := alGetProcAddress('alGenAuxiliaryEffectSlots'); if not Assigned(alGenAuxiliaryEffectSlots) then Exit(false); |
| 76 |
Pointer({$ifndef FPC}@{$endif} alDeleteAuxiliaryEffectSlots) := alGetProcAddress('alDeleteAuxiliaryEffectSlots'); if not Assigned(alDeleteAuxiliaryEffectSlots) then Exit(false); |
| 77 |
Pointer({$ifndef FPC}@{$endif} alIsAuxiliaryEffectSlot) := alGetProcAddress('alIsAuxiliaryEffectSlot'); if not Assigned(alIsAuxiliaryEffectSlot) then Exit(false); |
| 78 |
Pointer({$ifndef FPC}@{$endif} alAuxiliaryEffectSloti) := alGetProcAddress('alAuxiliaryEffectSloti'); if not Assigned(alAuxiliaryEffectSloti) then Exit(false); |
| 79 |
Pointer({$ifndef FPC}@{$endif} alAuxiliaryEffectSlotiv) := alGetProcAddress('alAuxiliaryEffectSlotiv'); if not Assigned(alAuxiliaryEffectSlotiv) then Exit(false); |
| 80 |
Pointer({$ifndef FPC}@{$endif} alAuxiliaryEffectSlotf) := alGetProcAddress('alAuxiliaryEffectSlotf'); if not Assigned(alAuxiliaryEffectSlotf) then Exit(false); |
| 81 |
Pointer({$ifndef FPC}@{$endif} alAuxiliaryEffectSlotfv) := alGetProcAddress('alAuxiliaryEffectSlotfv'); if not Assigned(alAuxiliaryEffectSlotfv) then Exit(false); |
| 82 |
Pointer({$ifndef FPC}@{$endif} alGetAuxiliaryEffectSloti) := alGetProcAddress('alGetAuxiliaryEffectSloti'); if not Assigned(alGetAuxiliaryEffectSloti) then Exit(false); |
| 83 |
Pointer({$ifndef FPC}@{$endif} alGetAuxiliaryEffectSlotiv) := alGetProcAddress('alGetAuxiliaryEffectSlotiv'); if not Assigned(alGetAuxiliaryEffectSlotiv) then Exit(false); |
| 84 |
Pointer({$ifndef FPC}@{$endif} alGetAuxiliaryEffectSlotf) := alGetProcAddress('alGetAuxiliaryEffectSlotf'); if not Assigned(alGetAuxiliaryEffectSlotf) then Exit(false); |
| 85 |
Pointer({$ifndef FPC}@{$endif} alGetAuxiliaryEffectSlotfv) := alGetProcAddress('alGetAuxiliaryEffectSlotfv'); if not Assigned(alGetAuxiliaryEffectSlotfv) then Exit(false); |
| 86 |
end; |
| 87 |
end; |
| 88 |
|
| 89 |
end. |