コード例 #1
0
ファイル: Cue.cs プロジェクト: matrix4x4/Space
        // Minimum and maximum distances aren't really an XACT term any more because you can have
        // arbitrary distance curves. However, it's still useful to be able to know the minimum
        // distance (distance up to which volume does not attenuate) and maximum distance (distance
        // at which volume is silent) for things like culling, and volume tweaking. NOTE - after the
        // last point on the volume curve, XACT no longer attenuates the volume, so it's possible to
        // have a sound heard infinitely far away. This deals with that quite happily - the maximum
        // distance is where the volume is silent, not merely the last point on the graph.
        public void GetMinMaxDistances(ref float minDist, ref float maxDist)
        {
            minDist = float.MaxValue;
            maxDist = float.MinValue;
            bool distSet = false;

            foreach (SoundEntry soundEntry in m_soundEntries)
            {
                Sound sound = soundEntry.FindSound(m_ownerSoundBank);

                foreach (RpcEntry rpcEntry in sound.m_rpcEntries)
                {
                    Rpc rpc = rpcEntry.FindRpc();

                    if (rpc != null)
                    {
                        foreach (Variable variable in rpc.m_variables)
                        {
                            if (variable.m_name == "Distance")
                            {
                                foreach (RpcCurve curve in rpc.m_rpcCurves)
                                {
                                    if (curve.m_property == 0)                                          // 0 => volume, 1 => pitch according to the docs
                                    {
                                        foreach (RpcPoint point in curve.m_rpcPoints)
                                        {
                                            if (point.m_y >= 0.0f && point.m_x < minDist)
                                            {
                                                minDist = point.m_x;
                                            }

                                            // The graph goes down to -96.0f but there's no point in counting something
                                            // only -93dB as not silent... -64dB is close enough
                                            if (point.m_y < -64.0f && point.m_x > maxDist)
                                            {
                                                maxDist = point.m_x;
                                            }

                                            distSet = true;
                                        }
                                    }
                                }
                            }
                        }
                    }
                }
            }

            if (!distSet)
            {
                minDist = maxDist = float.MaxValue;
            }
        }
コード例 #2
0
ファイル: GlobalSettings.cs プロジェクト: GlennSandoval/JSIL
		public override bool SetProperty( string propertyName, string value, string[] source, ref int line )
		{
			switch ( propertyName )
			{
				case "Xbox File":
					m_xboxFile = value;
					break;

				case "Windows File":
					m_windowsFile = value;
					break;

				case "Header File":
					m_headerFile = value;
					break;

				case "Shared Settings File":
					m_sharedSettingsFile = value;
					break;

				case "Exclude Category Names":
					m_excludeCategoryNames = Parser.ParseInt( value, line );
					break;

				case "Exclude Variable Names":
					m_excludeVariableNames = Parser.ParseInt( value, line );
					break;

				case "Last Modified Low":
					m_lastModifiedLow = Parser.ParseUint( value, line );
					break;

				case "Last Modified High":
					m_lastModifiedHigh = Parser.ParseUint( value, line );
					break;

				case "Category":
					Category category = new Category();
					category.Parse( source, ref line, OwnerProject );
					m_categories.Add( category );
					break;

				case "Variable":
					Variable variable = new Variable();
					variable.Parse( source, ref line, OwnerProject );
					m_variables.Add( variable );
					break;

				case "Effect":
					Effect effect = new Effect();
					effect.Parse( source, ref line, OwnerProject );
					m_effects.Add( effect );
					break;

				case "Codec Preset":		// So says the docs
				case "Compression Preset":	// So say XACT files!
					CompressionPreset preset = new CompressionPreset();
					preset.Parse( source, ref line, OwnerProject );
					m_compressionPresets.Add( preset );
					break;

				case "RPC":
					Rpc rpc = new Rpc();
					rpc.Parse( source, ref line, OwnerProject );
					m_rpcs.Add( rpc );
					break;

				default:
					return false;
			}

			return true;
		}		
コード例 #3
0
ファイル: GlobalSettings.cs プロジェクト: destenson/sq--JSIL
        public override bool SetProperty(string propertyName, string value, string[] source, ref int line)
        {
            switch (propertyName)
            {
            case "Xbox File":
                m_xboxFile = value;
                break;

            case "Windows File":
                m_windowsFile = value;
                break;

            case "Header File":
                m_headerFile = value;
                break;

            case "Shared Settings File":
                m_sharedSettingsFile = value;
                break;

            case "Exclude Category Names":
                m_excludeCategoryNames = Parser.ParseInt(value, line);
                break;

            case "Exclude Variable Names":
                m_excludeVariableNames = Parser.ParseInt(value, line);
                break;

            case "Last Modified Low":
                m_lastModifiedLow = Parser.ParseUint(value, line);
                break;

            case "Last Modified High":
                m_lastModifiedHigh = Parser.ParseUint(value, line);
                break;

            case "Category":
                Category category = new Category();
                category.Parse(source, ref line, OwnerProject);
                m_categories.Add(category);
                break;

            case "Variable":
                Variable variable = new Variable();
                variable.Parse(source, ref line, OwnerProject);
                m_variables.Add(variable);
                break;

            case "Effect":
                Effect effect = new Effect();
                effect.Parse(source, ref line, OwnerProject);
                m_effects.Add(effect);
                break;

            case "Codec Preset":                                // So says the docs
            case "Compression Preset":                          // So say XACT files!
                CompressionPreset preset = new CompressionPreset();
                preset.Parse(source, ref line, OwnerProject);
                m_compressionPresets.Add(preset);
                break;

            case "RPC":
                Rpc rpc = new Rpc();
                rpc.Parse(source, ref line, OwnerProject);
                m_rpcs.Add(rpc);
                break;

            default:
                return(false);
            }

            return(true);
        }