Răsfoiți Sursa

Formatting Fix

gingerBill 4 luni în urmă
părinte
comite
0ce8373528

+ 20 - 20
core/odin/parser/parser.odin

@@ -1276,28 +1276,28 @@ parse_unrolled_for_loop :: proc(p: ^Parser, inline_tok: tokenizer.Token) -> ^ast
 			args = make([dynamic]^ast.Expr)
 			for p.curr_tok.kind != .Close_Paren &&
 			    p.curr_tok.kind != .EOF {
-			    	arg := parse_value(p)
-
-			    	if p.curr_tok.kind == .Eq {
-			    		eq := expect_token(p, .Eq)
-			    		if arg != nil {
-			    			if _, ok := arg.derived.(^ast.Ident); !ok {
-			    				error(p, arg.pos, "expected an identifier for 'key=value'")
-			    			}
-			    		}
-			    		value := parse_value(p)
-			    		fv := ast.new(ast.Field_Value, arg.pos, value)
-			    		fv.field = arg
-			    		fv.sep   = eq.pos
-			    		fv.value = value
-
-			    		arg = fv
-			    	}
-
-			    	append(&args, arg)
+				arg := parse_value(p)
+
+				if p.curr_tok.kind == .Eq {
+					eq := expect_token(p, .Eq)
+					if arg != nil {
+						if _, ok := arg.derived.(^ast.Ident); !ok {
+							error(p, arg.pos, "expected an identifier for 'key=value'")
+						}
+					}
+					value := parse_value(p)
+					fv := ast.new(ast.Field_Value, arg.pos, value)
+					fv.field = arg
+					fv.sep   = eq.pos
+					fv.value = value
+
+					arg = fv
+				}
+
+				append(&args, arg)
 
 				allow_token(p, .Comma) or_break
-			    }
+			}
 		}
 
 		p.expr_level -= 1

+ 2 - 0
examples/all/all_vendor_windows.odin

@@ -3,8 +3,10 @@ package all
 import wgpu "vendor:wgpu"
 import b2 "vendor:box2d"
 import game_input "vendor:windows/GameInput"
+import XAudio2 "vendor:windows/XAudio2"
 
 _ :: wgpu
 _ :: b2
 _ :: game_input
+_ :: XAudio2
 

+ 24 - 24
vendor/windows/XAudio2/x3daudio.odin

@@ -1,7 +1,7 @@
 #+build windows
 
 /* NOTES:
-    1.  Definition of terms:
+	1.  Definition of terms:
 	    LFE: Low Frequency Effect -- always omnidirectional.
 	    LPF: Low Pass Filter, divided into two classifications:
 		 Direct -- Applied to the direct signal path,
@@ -9,7 +9,7 @@
 		 Reverb -- Applied to the reverb signal path,
 			   used for occlusion effects only.
 
-    2.  Volume level is expressed as a linear amplitude scaler:
+	2.  Volume level is expressed as a linear amplitude scaler:
 	1.0f represents no attenuation applied to the original signal,
 	0.5f denotes an attenuation of 6dB, and 0.0f results in silence.
 	Amplification (volume > 1.0f) is also allowed, and is not clamped.
@@ -17,7 +17,7 @@
 	LPF values range from 1.0f representing all frequencies pass through,
 	to 0.0f which results in silence as all frequencies are filtered out.
 
-    3.  X3DAudio uses a left-handed Cartesian coordinate system with values
+	3.  X3DAudio uses a left-handed Cartesian coordinate system with values
 	on the x-axis increasing from left to right, on the y-axis from
 	bottom to top, and on the z-axis from near to far.
 	Azimuths are measured clockwise from a given reference direction.
@@ -29,7 +29,7 @@
 	Metric constants are supplied only as a convenience.
 	Distance is calculated using the Euclidean norm formula.
 
-    4.  Only real values are permissible with functions using 32-bit
+	4.  Only real values are permissible with functions using 32-bit
 	float parameters -- NAN and infinite values are not accepted.
 	All computation occurs in 32-bit precision mode.                    */
 
@@ -100,7 +100,7 @@ CALCULATE_FLAG :: enum u32 {
 }
 
 //--------------<D-A-T-A---T-Y-P-E-S>---------------------------------------//
-VECTOR :: distinct [3]f32 // float 3D vector
+VECTOR :: [3]f32 // float 3D vector
 
 // instance handle of precalculated constants
 HANDLE :: distinct [HANDLE_BYTESIZE]byte
@@ -123,22 +123,22 @@ DISTANCE_CURVE_POINT :: struct #packed {
 //      pPoints[k-1].DSPSetting + ((pPoints[k].DSPSetting-pPoints[k-1].DSPSetting) / (pPoints[k].Distance-pPoints[k-1].Distance)) * (pPoints[k].Distance-pPoints[k-1].Distance) != NAN or infinite values
 // For all points in the distance curve where 1 <= k < PointCount.
 DISTANCE_CURVE :: struct #packed {
-	pPoints:    [^]DISTANCE_CURVE_POINT,    // distance curve point array, must have at least PointCount elements with no duplicates and be sorted in ascending order with respect to Distance
-	PointCount: u32,                        // number of distance curve points, must be >= 2 as all distance curves must have at least two endpoints, defining DSP settings at 0.0f and 1.0f normalized distance
+	pPoints:    [^]DISTANCE_CURVE_POINT `fmt:"v,PointCount"`, // distance curve point array, must have at least PointCount elements with no duplicates and be sorted in ascending order with respect to Distance
+	PointCount: u32,                                          // number of distance curve points, must be >= 2 as all distance curves must have at least two endpoints, defining DSP settings at 0.0f and 1.0f normalized distance
 }
 Default_LinearCurvePoints := [2]DISTANCE_CURVE_POINT{{0.0, 1.0}, {1.0, 0.0}}
 Default_LinearCurve       := DISTANCE_CURVE{&Default_LinearCurvePoints[0], 2}
 
 CONE :: struct #packed {
-	InnerAngle:  f32,   // inner cone angle in radians, must be within [0.0f, TAU]
-	OuterAngle:  f32,   // outer cone angle in radians, must be within [InnerAngle, TAU]
-
-	InnerVolume: f32,   // volume level scaler on/within inner cone, used only for matrix calculations, must be within [0.0f, 2.0f] when used
-	OuterVolume: f32,   // volume level scaler on/beyond outer cone, used only for matrix calculations, must be within [0.0f, 2.0f] when used
-	InnerLPF:    f32,   // LPF (both direct and reverb paths) coefficient subtrahend on/within inner cone, used only for LPF (both direct and reverb paths) calculations, must be within [0.0f, 1.0f] when used
-	OuterLPF:    f32,   // LPF (both direct and reverb paths) coefficient subtrahend on/beyond outer cone, used only for LPF (both direct and reverb paths) calculations, must be within [0.0f, 1.0f] when used
-	InnerReverb: f32,   // reverb send level scaler on/within inner cone, used only for reverb calculations, must be within [0.0f, 2.0f] when used
-	OuterReverb: f32,   // reverb send level scaler on/beyond outer cone, used only for reverb calculations, must be within [0.0f, 2.0f] when used
+	InnerAngle:  f32, // inner cone angle in radians, must be within [0.0f, TAU]
+	OuterAngle:  f32, // outer cone angle in radians, must be within [InnerAngle, TAU]
+
+	InnerVolume: f32, // volume level scaler on/within inner cone, used only for matrix calculations, must be within [0.0f, 2.0f] when used
+	OuterVolume: f32, // volume level scaler on/beyond outer cone, used only for matrix calculations, must be within [0.0f, 2.0f] when used
+	InnerLPF:    f32, // LPF (both direct and reverb paths) coefficient subtrahend on/within inner cone, used only for LPF (both direct and reverb paths) calculations, must be within [0.0f, 1.0f] when used
+	OuterLPF:    f32, // LPF (both direct and reverb paths) coefficient subtrahend on/beyond outer cone, used only for LPF (both direct and reverb paths) calculations, must be within [0.0f, 1.0f] when used
+	InnerReverb: f32, // reverb send level scaler on/within inner cone, used only for reverb calculations, must be within [0.0f, 2.0f] when used
+	OuterReverb: f32, // reverb send level scaler on/beyond outer cone, used only for reverb calculations, must be within [0.0f, 2.0f] when used
 }
 Default_DirectionalCone := CONE{math.PI / 2, math.PI, 1.0, 0.708, 0.0, 0.25, 0.708, 1.0}
 
@@ -147,13 +147,13 @@ Default_DirectionalCone := CONE{math.PI / 2, math.PI, 1.0, 0.708, 0.0, 0.25, 0.7
 //
 // The cone is directed by the listener's front orientation.
 LISTENER :: struct #packed {
-	OrientFront: VECTOR,   // orientation of front direction, used only for matrix and delay calculations or listeners with cones for matrix, LPF (both direct and reverb paths), and reverb calculations, must be normalized when used
-	OrientTop:   VECTOR,   // orientation of top direction, used only for matrix and delay calculations, must be orthonormal with OrientFront when used
+	OrientFront: VECTOR, // orientation of front direction, used only for matrix and delay calculations or listeners with cones for matrix, LPF (both direct and reverb paths), and reverb calculations, must be normalized when used
+	OrientTop:   VECTOR, // orientation of top direction, used only for matrix and delay calculations, must be orthonormal with OrientFront when used
 
-	Position: VECTOR,      // position in user-defined world units, does not affect Velocity
-	Velocity: VECTOR,      // velocity vector in user-defined world units/second, used only for doppler calculations, does not affect Position
+	Position:    VECTOR, // position in user-defined world units, does not affect Velocity
+	Velocity:    VECTOR, // velocity vector in user-defined world units/second, used only for doppler calculations, does not affect Position
 
-	pCone: ^CONE,                     // sound cone, used only for matrix, LPF (both direct and reverb paths), and reverb calculations, NULL specifies omnidirectionality
+	pCone:       ^CONE,  // sound cone, used only for matrix, LPF (both direct and reverb paths), and reverb calculations, NULL specifies omnidirectionality
 }
 
 // Emitter:
@@ -187,9 +187,9 @@ EMITTER :: struct #packed {
 	InnerRadius:      f32,    // inner radius, must be within [0.0f, max(f32)]
 	InnerRadiusAngle: f32,    // inner radius angle, must be within [0.0f, PI/4.0)
 
-	ChannelCount:     u32,       // number of sound channels, must be > 0
-	ChannelRadius:    f32,       // channel radius, used only with multi-channel emitters for matrix calculations, must be >= 0.0f when used
-	pChannelAzimuths: [^]f32,    // channel azimuth array, used only with multi-channel emitters for matrix calculations, contains positions of each channel expressed in radians along the channel radius with respect to the front orientation vector in the plane orthogonal to the top orientation vector, or TAU to specify an LFE channel, must have at least ChannelCount elements, all within [0.0f, TAU] when used
+	ChannelCount:     u32,                           // number of sound channels, must be > 0
+	ChannelRadius:    f32,                           // channel radius, used only with multi-channel emitters for matrix calculations, must be >= 0.0f when used
+	pChannelAzimuths: [^]f32 `fmt:"v,ChannelCount"`, // channel azimuth array, used only with multi-channel emitters for matrix calculations, contains positions of each channel expressed in radians along the channel radius with respect to the front orientation vector in the plane orthogonal to the top orientation vector, or TAU to specify an LFE channel, must have at least ChannelCount elements, all within [0.0f, TAU] when used
 
 	pVolumeCurve:    ^DISTANCE_CURVE,    // volume level distance curve, used only for matrix calculations, NULL specifies a default curve that conforms to the inverse square law, calculated in user-defined world units with distances <= CurveDistanceScaler clamped to no attenuation
 	pLFECurve:       ^DISTANCE_CURVE,    // LFE level distance curve, used only for matrix calculations, NULL specifies a default curve that conforms to the inverse square law, calculated in user-defined world units with distances <= CurveDistanceScaler clamped to no attenuation

+ 7 - 7
vendor/windows/XAudio2/xapo.odin

@@ -1,7 +1,7 @@
 #+build windows
 
 /* NOTES:
-    1.  Definition of terms:
+	1.  Definition of terms:
 	    DSP: Digital Signal Processing.
 
 	    CBR: Constant BitRate -- DSP that consumes a constant number of
@@ -27,7 +27,7 @@
 		      However, an XAPO may not perform format conversion
 		      when processing in-place.
 
-    2.  XAPO member variables are divided into three classifications:
+	2.  XAPO member variables are divided into three classifications:
 	    Immutable: Set once via IXAPO.Initialize and remain
 		       constant during the lifespan of the XAPO.
 
@@ -48,27 +48,27 @@
 	That is, one should strive to minimize XAPO state changes for
 	best performance, maintainability, and ease of use.
 
-    3.  To minimize glitches, the realtime audio processing thread must
+	3.  To minimize glitches, the realtime audio processing thread must
 	not block.  XAPO methods called by the realtime thread are commented
 	as non-blocking and therefore should not use blocking synchronization,
 	allocate memory, access the disk, etc.  The XAPO interfaces were
 	designed to allow an effect implementer to move such operations
 	into other methods called on an application controlled thread.
 
-    4.  Extending functionality is accomplished through the addition of new
+	4.  Extending functionality is accomplished through the addition of new
 	COM interfaces.  For example, if a new member is added to a parameter
 	structure, a new interface using the new structure should be added,
 	leaving the original interface unchanged.
 	This ensures consistent communication between future versions of
 	XAudio2 and various versions of XAPOs that may exist in an application.
 
-    5.  All audio data is interleaved in XAudio2.
+	5.  All audio data is interleaved in XAudio2.
 	The default audio format for an effect chain is WAVE_FORMAT_IEEE_FLOAT.
 
-    6.  User-defined XAPOs should assume all input and output buffers are
+	6.  User-defined XAPOs should assume all input and output buffers are
 	16-byte aligned.
 
-    7.  See XAPOBase.odin for an XAPO base class which provides a default
+	7.  See XAPOBase.odin for an XAPO base class which provides a default
 	implementation for most of the interface methods defined below.     */
 
 package windows_xaudio2

+ 1 - 1
vendor/windows/XAudio2/xapofx.odin

@@ -110,7 +110,7 @@ FXMASTERINGLIMITER_PARAMETERS :: struct #packed {
 FXREVERB_PARAMETERS :: struct #packed {
 	Diffusion: f32,  // diffusion
 	RoomSize:  f32,  // room size
-};
+}
 
 
 // Echo initialization data, used with CreateFX:

+ 3 - 5
vendor/windows/XAudio2/xaudio2.odin

@@ -11,12 +11,10 @@ package windows_xaudio2
 import win "core:sys/windows"
 import "core:math"
 
-foreign import xa2 "system:xaudio2.lib"
-
-HRESULT :: win.HRESULT
-IUnknown :: win.IUnknown
+HRESULT         :: win.HRESULT
+IUnknown        :: win.IUnknown
 IUnknown_VTable :: win.IUnknown_VTable
-WAVEFORMATEX :: win.WAVEFORMATEX
+WAVEFORMATEX    :: win.WAVEFORMATEX
 
 /**************************************************************************
  *

+ 3 - 3
vendor/windows/XAudio2/xaudio2fx.odin

@@ -32,9 +32,9 @@ foreign xa2 {
 // The user is responsible for allocating pPeakLevels, pRMSLevels, and initializing ChannelCount accordingly.
 // The volume meter does not support SetEffectParameters().
 VOLUMEMETER_LEVELS :: struct #packed {
-	pPeakLevels:  [^]f32,   // Peak levels table: receives maximum absolute level for each channel over a processing pass, may be NULL if pRMSLevls != NULL, otherwise must have at least ChannelCount elements.
-	pRMSLevels:   [^]f32,   // Root mean square levels table: receives RMS level for each channel over a processing pass, may be NULL if pPeakLevels != NULL, otherwise must have at least ChannelCount elements.
-	ChannelCount: u32, 	    // Number of channels being processed by the volume meter APO
+	pPeakLevels:  [^]f32 `fmt:"v,ChannelCount"`, // Peak levels table: receives maximum absolute level for each channel over a processing pass, may be NULL if pRMSLevls != NULL, otherwise must have at least ChannelCount elements.
+	pRMSLevels:   [^]f32 `fmt:"v,ChannelCount"`, // Root mean square levels table: receives RMS level for each channel over a processing pass, may be NULL if pPeakLevels != NULL, otherwise must have at least ChannelCount elements.
+	ChannelCount: u32,                           // Number of channels being processed by the volume meter APO
 }
 
 /**************************************************************************