Ada计算机图形DirectX之X3DAudio

----------------------------------------
-- File : X3DAudio.ads                --
-- Translator:Dongfeng.Gu,2018/10/30  --
-- Mail: [email protected]                --
-- Progress:100%                      --
----------------------------------------

with win32;                       use win32;
with win32.windef;                use win32.windef;
with Interfaces.C;                use Interfaces.C;

with d3d9types;                   use d3d9types;

package X3DAudio is

   subtype UINT32 is win32.UINT;
   
   type LPFLOAT32 is access all float;

   SPEAKER_FRONT_LEFT : constant := 16#00000001#;

   SPEAKER_FRONT_RIGHT : constant := 16#00000002#;

   SPEAKER_FRONT_CENTER : constant := 16#00000004#;

   SPEAKER_LOW_FREQUENCY : constant := 16#00000008#;

   SPEAKER_BACK_LEFT : constant := 16#00000010#;

   SPEAKER_BACK_RIGHT : constant := 16#00000020#;

   SPEAKER_FRONT_LEFT_OF_CENTER : constant := 16#00000040#;

   SPEAKER_FRONT_RIGHT_OF_CENTER : constant := 16#00000080#;

   SPEAKER_BACK_CENTER : constant := 16#00000100#;

   SPEAKER_SIDE_LEFT : constant := 16#00000200#;

   SPEAKER_SIDE_RIGHT : constant := 16#00000400#;

   SPEAKER_TOP_CENTER : constant := 16#00000800#;

   SPEAKER_TOP_FRONT_LEFT : constant := 16#00001000#;

   SPEAKER_TOP_FRONT_CENTER : constant := 16#00002000#;

   SPEAKER_TOP_FRONT_RIGHT : constant := 16#00004000#;

   SPEAKER_TOP_BACK_LEFT : constant := 16#00008000#;

   SPEAKER_TOP_BACK_CENTER : constant := 16#00010000#;

   SPEAKER_TOP_BACK_RIGHT : constant := 16#00020000#;

   SPEAKER_RESERVED : constant := 16#7FFC0000#;  -- bit mask locations reserved for future use;

   SPEAKER_ALL : constant := 16#80000000#;  -- used to specify that any possible permutation of speaker configurations;

   SPEAKER_MONO : constant dword:= SPEAKER_FRONT_CENTER;

   SPEAKER_STEREO : constant dword:= (SPEAKER_FRONT_LEFT or SPEAKER_FRONT_RIGHT);

   SPEAKER_2POINT1 : constant dword:= (SPEAKER_FRONT_LEFT or SPEAKER_FRONT_RIGHT or SPEAKER_LOW_FREQUENCY);

   SPEAKER_SURROUND : constant dword:= (SPEAKER_FRONT_LEFT or SPEAKER_FRONT_RIGHT or SPEAKER_FRONT_CENTER or SPEAKER_BACK_CENTER);

   SPEAKER_QUAD : constant dword:= (SPEAKER_FRONT_LEFT or SPEAKER_FRONT_RIGHT or SPEAKER_BACK_LEFT or SPEAKER_BACK_RIGHT);

   SPEAKER_4POINT1 : constant dword:= (SPEAKER_FRONT_LEFT or SPEAKER_FRONT_RIGHT or SPEAKER_LOW_FREQUENCY or SPEAKER_BACK_LEFT or SPEAKER_BACK_RIGHT);

   SPEAKER_5POINT1 : constant dword:= (SPEAKER_FRONT_LEFT or SPEAKER_FRONT_RIGHT or SPEAKER_FRONT_CENTER or SPEAKER_LOW_FREQUENCY or SPEAKER_BACK_LEFT or SPEAKER_BACK_RIGHT);

   SPEAKER_7POINT1 : constant dword:= (SPEAKER_FRONT_LEFT or SPEAKER_FRONT_RIGHT or SPEAKER_FRONT_CENTER or SPEAKER_LOW_FREQUENCY or SPEAKER_BACK_LEFT or SPEAKER_BACK_RIGHT or SPEAKER_FRONT_LEFT_OF_CENTER or SPEAKER_FRONT_RIGHT_OF_CENTER);

   SPEAKER_5POINT1_SURROUND : constant dword:= (SPEAKER_FRONT_LEFT or SPEAKER_FRONT_RIGHT or SPEAKER_FRONT_CENTER or SPEAKER_LOW_FREQUENCY or SPEAKER_SIDE_LEFT  or SPEAKER_SIDE_RIGHT);

   SPEAKER_7POINT1_SURROUND : constant dword:= (SPEAKER_FRONT_LEFT or SPEAKER_FRONT_RIGHT or SPEAKER_FRONT_CENTER or SPEAKER_LOW_FREQUENCY or SPEAKER_BACK_LEFT or SPEAKER_BACK_RIGHT or SPEAKER_SIDE_LEFT  or SPEAKER_SIDE_RIGHT);

   SPEAKER_XBOX : constant := SPEAKER_5POINT1;

   X3DAUDIO_HANDLE_BYTESIZE : constant := 20;

   X3DAUDIO_PI : constant := 3.141592654;

   X3DAUDIO_2PI : constant := 6.283185307;

   X3DAUDIO_SPEED_OF_SOUND : constant := 343.5;

   X3DAUDIO_CALCULATE_MATRIX : constant := 16#00000001#;  -- enable matrix coefficient table calculation;

   X3DAUDIO_CALCULATE_DELAY : constant := 16#00000002#;  -- enable delay time array calculation (stereo final mix only);

   X3DAUDIO_CALCULATE_LPF_DIRECT : constant := 16#00000004#;  -- enable LPF direct-path coefficient calculation;

   X3DAUDIO_CALCULATE_LPF_REVERB : constant := 16#00000008#;  -- enable LPF reverb-path coefficient calculation;

   X3DAUDIO_CALCULATE_REVERB : constant := 16#00000010#;  -- enable reverb send level calculation;

   X3DAUDIO_CALCULATE_DOPPLER : constant := 16#00000020#;  -- enable doppler shift factor calculation;

   X3DAUDIO_CALCULATE_EMITTER_ANGLE : constant := 16#00000040#;  -- enable emitter-to-listener interior angle calculation;

   X3DAUDIO_CALCULATE_ZEROCENTER : constant := 16#00010000#;  -- do not position to front center speaker, signal positioned to remaining speakers instead, front center destination channel will be zero in returned matrix coefficient table, valid only for matrix calculations with final mix formats that have a front center channel;

   X3DAUDIO_CALCULATE_REDIRECT_TO_LFE : constant := 16#00020000#;  -- apply equal mix of all source channels to LFE destination channel, valid only for matrix calculations with sources that have no LFE channel and final mix formats that have an LFE channel;

   subtype FLOAT32 is float;

   subtype X3DAUDIO_VECTOR is D3DVECTOR;

   type X3DAUDIO_HANDLE is Array(0..X3DAUDIO_HANDLE_BYTESIZE-1) of BYTE;

   

   

   type X3DAUDIO_DISTANCE_CURVE_POINT is record
      Distance: FLOAT32;
      DSPSetting: FLOAT32;
   end record;

   type LPX3DAUDIO_DISTANCE_CURVE_POINT is access all X3DAUDIO_DISTANCE_CURVE_POINT;

   type X3DAUDIO_DISTANCE_CURVE is record
      pPoints:LPX3DAUDIO_DISTANCE_CURVE_POINT;
      PointCount: UINT32;
   end record;

   type LPX3DAUDIO_DISTANCE_CURVE is access all X3DAUDIO_DISTANCE_CURVE;

   X3DAudioDefault_LinearCurvePoints:constant Array(0..1) of X3DAUDIO_DISTANCE_CURVE_POINT:=((0.0,1.0),(1.0,0.0));
   X3DAudioDefault_LinearCurve:constant X3DAUDIO_DISTANCE_CURVE:=(X3DAudioDefault_LinearCurvePoints(0)'unrestricted_Access,2);



   type X3DAUDIO_CONE is record
      InnerAngle: FLOAT32;
      OuterAngle: FLOAT32;
      InnerVolume: FLOAT32;
      OuterVolume: FLOAT32;
      InnerLPF: FLOAT32;
      OuterLPF: FLOAT32;
      InnerReverb: FLOAT32;
      OuterReverb: FLOAT32;
   end record;

   type LPX3DAUDIO_CONE is access all X3DAUDIO_CONE;

   X3DAudioDefault_DirectionalCone : constant X3DAUDIO_CONE := ( X3DAUDIO_PI/2.0, X3DAUDIO_PI, 1.0, 0.708, 0.0, 0.25, 0.708, 1.0);

   type X3DAUDIO_LISTENER is record
      OrientFront: X3DAUDIO_VECTOR;
      OrientTop: X3DAUDIO_VECTOR;
      Position: X3DAUDIO_VECTOR;
      Velocity: X3DAUDIO_VECTOR;
      pCone:LPX3DAUDIO_CONE;
   end record;

   type LPX3DAUDIO_LISTENER is access all X3DAUDIO_LISTENER;

   type X3DAUDIO_EMITTER is record
      pCone:LPX3DAUDIO_CONE;
      OrientFront: X3DAUDIO_VECTOR;
      OrientTop: X3DAUDIO_VECTOR;
      Position: X3DAUDIO_VECTOR;
      Velocity: X3DAUDIO_VECTOR;
      InnerRadius: FLOAT32;
      InnerRadiusAngle: FLOAT32;
      ChannelCount: UINT32;
      ChannelRadius: FLOAT32;
      pChannelAzimuths:LPFLOAT32;
      pVolumeCurve:LPX3DAUDIO_DISTANCE_CURVE;
      pLFECurve:LPX3DAUDIO_DISTANCE_CURVE;
      pLPFDirectCurve:LPX3DAUDIO_DISTANCE_CURVE;
      pLPFReverbCurve:LPX3DAUDIO_DISTANCE_CURVE;
      pReverbCurve:LPX3DAUDIO_DISTANCE_CURVE;
      CurveDistanceScaler: FLOAT32;
      DopplerScaler: FLOAT32;
   end record;

   type LPX3DAUDIO_EMITTER is access all X3DAUDIO_EMITTER;

   type X3DAUDIO_DSP_SETTINGS is record
      pMatrixCoefficients:LPFLOAT32;
      pDelayTimes:LPFLOAT32;
      SrcChannelCount: UINT32;
      DstChannelCount: UINT32;
      LPFDirectCoefficient: FLOAT32;
      LPFReverbCoefficient: FLOAT32;
      ReverbLevel: FLOAT32;
      DopplerFactor: FLOAT32;
      EmitterToListenerAngle: FLOAT32;
      EmitterToListenerDistance: FLOAT32;
      EmitterVelocityComponent: FLOAT32;
      ListenerVelocityComponent: FLOAT32;
   end record;

   type LPX3DAUDIO_DSP_SETTINGS is access all X3DAUDIO_DSP_SETTINGS;



   procedure X3DAudioInitialize(SpeakerChannelMask:UINT32;SpeedOfSound:FLOAT32;Instance:X3DAUDIO_HANDLE) with Import,Convention=>stdcall,external_name=>"X3DAudioInitialize";

   procedure X3DAudioCalculate(Instance:X3DAUDIO_HANDLE;pListener:access constant X3DAUDIO_LISTENER;pEmitter:access constant X3DAUDIO_EMITTER;Flags:UINT32;pDSPSettings:access X3DAUDIO_DSP_SETTINGS) with Import,Convention=>stdcall,external_name=>"X3DAudioCalculate";

   --
   -- THE END.
   --

end X3DAudio;















猜你喜欢

转载自blog.csdn.net/adacore/article/details/83540307