Пример #1
0
            private void RenderParticles(ParticleRays[] Rays, double total_Frames, Pachyderm_Acoustic.Visualization.Phonon P)
            {
                List <Guid> Particle_IDS = new List <Guid>();
                double      Increment    = CutOffLength() / (double)(Frame_Rate.Value * Seconds.Value);
                Point3d     Point        = default(Point3d);
                double      PMin         = (double)this.Param_Min.Value;
                double      PMax         = (double)this.Param_Max.Value;
                double      PRange       = PMax - PMin;

                int h = Rhino.RhinoDoc.ActiveDoc.Views.ActiveView.ActiveViewport.Bounds.Height;
                int w = Rhino.RhinoDoc.ActiveDoc.Views.ActiveView.ActiveViewport.Bounds.Width;

                for (int q = 0; q < (int)total_Frames; q++)
                {
                    for (int i = 0; i < Rays.Length; i++)
                    {
                        for (int p = 0; p < Rays[i].Count(); p++)
                        {
                            Point3d N;
                            double  energy;
                            if (Rays[i].RayPt(p, Increment * q, 4, out energy, out N, out Point))
                            {
                                Vector3d V = new Vector3d(N - Point);
                                V.Unitize();
                                double SPL             = AcousticalMath.SPL_Intensity(energy);
                                System.Drawing.Color C = scale.GetValue(SPL, PMin, PMax);
                                Mesh M = P.Generate(Point, V);
                                M.Scale((SPL - PMin) / PRange);
                                System.Guid PG = Rhino.RhinoDoc.ActiveDoc.Objects.AddMesh(M);
                                Rhino.RhinoDoc.ActiveDoc.Objects.Find(PG).Attributes.ObjectColor = C;
                                Particle_IDS.Add(PG);
                            }
                        }
                    }

                    string number;
                    if (q < 100)
                    {
                        if (q < 10)
                        {
                            number = "00" + q.ToString();
                        }
                        else
                        {
                            number = "0" + q.ToString();
                        }
                    }
                    else
                    {
                        number = q.ToString();
                    }
                    Rhino.RhinoApp.RunScript("-ViewCaptureToFile " + Folder_Status.Text + "\\"[0] + "frame" + number + string.Format(".jpg Width={0} Height={1} DrawGrid=No Enter", 2 * w, 2 * h), true);

                    //Clean Up Model
                    Rhino.RhinoDoc.ActiveDoc.Objects.Delete(Particle_IDS, true);
                    Particle_IDS.Clear();
                }
            }
            public static double[] Expand_Response(Direct_Sound[] DirectIn, ImageSourceData[] SpecularIn, Environment.Receiver_Bank[] DiffuseIn, double CutOffTime, int sample_frequency_out, int Rec_ID, List <int> SrcID)
            {
                int length = (int)Math.Pow(2, 11);
                int sample_frequency_in = DiffuseIn[0].SampleRate;

                double[]   IR         = new double[(int)Math.Floor(sample_frequency_out * CutOffTime) + 2 * (int)length];
                double[][] Octave_ETC = new double[8][];
                double     BW         = (double)sample_frequency_out / (double)sample_frequency_in;

                //Convert to Pressure & Interpolate full resolution IR
                for (int oct = 0; oct < 8; oct++)
                {
                    Octave_ETC[oct] = AcousticalMath.ETCurve(DirectIn, SpecularIn, DiffuseIn, CutOffTime, sample_frequency_in, oct, Rec_ID, SrcID, false);
                }

                return(ETCToPTC(Octave_ETC, CutOffTime, sample_frequency_in, sample_frequency_out, DirectIn[0].Rho_C[Rec_ID]));
            }
            /// <summary>
            /// Takes ETC, and extrapolates a pressure domain impulse response.
            /// </summary>
            /// <param name="DirectIn"></param>
            /// <param name="SpecularIn"></param>
            /// <param name="DiffuseIn"></param>
            /// <param name="CutOffTime"></param>
            /// <param name="sample_frequency_out">The desired sample frequency.</param>
            /// <param name="Rec_ID">The index of the receiver.</param>
            /// <returns></returns>
            public static double[] Expand_Dir_Response(Direct_Sound[] DirectIn, ImageSourceData[] SpecularIn, Environment.Receiver_Bank[] DiffuseIn, double CutOffTime, int sample_frequency_out, int Rec_ID, List <int> SrcID, double alt, double azi, bool degrees)
            {
                Random Rnd    = new Random();
                int    length = (int)Math.Pow(2, 11);
                int    sample_frequency_in = DiffuseIn[0].SampleRate;

                //fftwlib.fftw. FFT = new MathNet.Numerics.IntegralTransforms.Algorithms.DiscreteFourierTransform();
                double[]   IR         = new double[(int)Math.Floor(sample_frequency_out * CutOffTime) + 2 * (int)length];
                double[][] Octave_ETC = new double[8][];
                double     BW         = (double)sample_frequency_out / (double)sample_frequency_in;

                //Convert to Pressure & Interpolate full resolution IR
                for (int oct = 0; oct < 8; oct++)
                {
                    Octave_ETC[oct] = AcousticalMath.ETCurve_Directional(DirectIn, SpecularIn, DiffuseIn, CutOffTime, sample_frequency_in, oct, Rec_ID, SrcID, false, alt, azi, degrees);
                }

                return(ETCToPTC(Octave_ETC, CutOffTime, sample_frequency_in, sample_frequency_out, DirectIn[0].Rho_C[Rec_ID]));
            }
            public void Plot_PTB_Results()
            {
                if (Direct_Data == null && IS_Data == null && Receiver == null && Parameter_Choice.Text != "Sabine RT" && Parameter_Choice.Text != "Eyring RT")
                {
                    return;
                }
                double[] Schroeder;
                string[] paramtype    = new string [] { "T30/s", "EDT/s", "D/%", "C/dB", "TS/ms", "G/dB", "LF%", "LFC%", "IACC" };//LF/% LFC/% IACC
                string   ReceiverLine = "Receiver{0};";

                double[, , ,] ParamValues = new double[SourceList.Items.Count, Recs.Length, 8, paramtype.Length];

                for (int s = 0; s < Direct_Data.Length; s++)
                {
                    for (int r = 0; r < Recs.Length; r++)
                    {
                        ReceiverLine += r.ToString() + ";";
                        for (int oct = 0; oct < 8; oct++)
                        {
                            double[] ETC = AcousticalMath.ETCurve(Direct_Data, IS_Data, Receiver, (int)(CO_TIME.Value / 1000), SampleRate, oct, r, s, false);
                            Schroeder = AcousticalMath.Schroeder_Integral(ETC);
                            ParamValues[s, r, oct, 0] = AcousticalMath.T_X(Schroeder, 30, SampleRate);
                            ParamValues[s, r, oct, 1] = AcousticalMath.EarlyDecayTime(Schroeder, SampleRate);
                            ParamValues[s, r, oct, 2] = AcousticalMath.Definition(ETC, SampleRate, 0.05, Direct_Data[s].Min_Time(r), false);
                            ParamValues[s, r, oct, 3] = AcousticalMath.Clarity(ETC, SampleRate, 0.08, Direct_Data[s].Min_Time(r), false);
                            ParamValues[s, r, oct, 4] = AcousticalMath.Center_Time(ETC, SampleRate, Direct_Data[s].Min_Time(r)) * 1000;
                            ParamValues[s, r, oct, 5] = AcousticalMath.Strength(ETC, Direct_Data[s].SWL[oct], false);
                            double azi, alt;
                            PachTools.World_Angles(Direct_Data[s].Src.Origin(), Utilities.PachTools.HPttoRPt(Recs[r]), true, out alt, out azi);
                            double[][] Lateral_ETC = AcousticalMath.ETCurve_1d(Direct_Data, IS_Data, Receiver, CutoffTime, SampleRate, oct, r, new System.Collections.Generic.List <int> {
                                s
                            }, false, alt, azi, true);
                            ParamValues[s, r, oct, 6] = AcousticalMath.Lateral_Fraction(ETC, Lateral_ETC, SampleRate, Direct_Data[s].Min_Time(r), false);
                        }
                    }
                }

                System.Windows.Forms.SaveFileDialog sf = new System.Windows.Forms.SaveFileDialog();
                sf.DefaultExt   = ".txt";
                sf.AddExtension = true;
                sf.Filter       = "Text File (*.txt)|*.txt|" + "All Files|";

                if (sf.ShowDialog() == System.Windows.Forms.DialogResult.OK)
                {
                    try
                    {
                        System.IO.StreamWriter SW = new System.IO.StreamWriter(System.IO.File.Open(sf.FileName, System.IO.FileMode.Create));
                        SW.WriteLine("Pachyderm Acoustic Simulation Results");
                        SW.WriteLine("Saved {0}", System.DateTime.Now.ToString());
                        SW.WriteLine("Filename:{0}", Rhino.RhinoDoc.ActiveDoc.Name);

                        for (int oct = 0; oct < 8; oct++)
                        {
                            SW.WriteLine(string.Format(ReceiverLine, oct));
                            for (int param = 0; param < paramtype.Length; param++)
                            {
                                SW.Write(paramtype[param] + ";");
                                for (int i = 0; i < Direct_Data.Length; i++)
                                {
                                    for (int q = 0; q < Recs.Length; q++)
                                    {
                                        SW.Write(ParamValues[i, q, oct, param].ToString() + ";");
                                    }
                                }
                                SW.WriteLine("");
                            }
                        }
                        SW.Close();
                    }
                    catch (System.Exception)
                    {
                        Rhino.RhinoApp.WriteLine("File is open, and cannot be written over.");
                        return;
                    }
                }
            }
            public void Plot_Results()
            {
                if (Direct_Data == null && IS_Data == null && Receiver == null && Parameter_Choice.Text != "Sabine RT" && Parameter_Choice.Text != "Eyring RT")
                {
                    return;
                }
                double[] Schroeder;

                double[,,] EDT  = new double[this.SourceList.Items.Count, Recs.Length, 8];
                double[, ,] T10 = new double[this.SourceList.Items.Count, Recs.Length, 8];
                double[, ,] T15 = new double[this.SourceList.Items.Count, Recs.Length, 8];
                double[, ,] T20 = new double[this.SourceList.Items.Count, Recs.Length, 8];
                double[, ,] T30 = new double[this.SourceList.Items.Count, Recs.Length, 8];
                double[, ,] G   = new double[this.SourceList.Items.Count, Recs.Length, 8];
                double[, ,] C80 = new double[this.SourceList.Items.Count, Recs.Length, 8];
                double[, ,] C50 = new double[this.SourceList.Items.Count, Recs.Length, 8];
                double[, ,] D50 = new double[this.SourceList.Items.Count, Recs.Length, 8];
                double[, ,] TS  = new double[this.SourceList.Items.Count, Recs.Length, 8];
                double[, ,] LF  = new double[this.SourceList.Items.Count, Recs.Length, 8];
                double[, ,] LE  = new double[this.SourceList.Items.Count, Recs.Length, 8];

                for (int s = 0; s < SourceList.Items.Count; s++)
                {
                    for (int r = 0; r < Recs.Length; r++)
                    {
                        for (int oct = 0; oct < 8; oct++)
                        {
                            double[] ETC = AcousticalMath.ETCurve(Direct_Data, IS_Data, Receiver, (int)(CO_TIME.Value / 1000), SampleRate, oct, r, s, false);
                            Schroeder      = AcousticalMath.Schroeder_Integral(ETC);
                            EDT[s, r, oct] = AcousticalMath.EarlyDecayTime(Schroeder, SampleRate);
                            T10[s, r, oct] = AcousticalMath.T_X(Schroeder, 10, SampleRate);
                            T15[s, r, oct] = AcousticalMath.T_X(Schroeder, 15, SampleRate);
                            T20[s, r, oct] = AcousticalMath.T_X(Schroeder, 20, SampleRate);
                            T30[s, r, oct] = AcousticalMath.T_X(Schroeder, 30, SampleRate);
                            G[s, r, oct]   = AcousticalMath.Strength(ETC, Direct_Data[s].SWL[oct], false);
                            C50[s, r, oct] = AcousticalMath.Clarity(ETC, SampleRate, 0.05, Direct_Data[s].Min_Time(r), false);
                            C80[s, r, oct] = AcousticalMath.Clarity(ETC, SampleRate, 0.08, Direct_Data[s].Min_Time(r), false);
                            D50[s, r, oct] = AcousticalMath.Definition(ETC, SampleRate, 0.05, Direct_Data[s].Min_Time(r), false);
                            TS[s, r, oct]  = AcousticalMath.Center_Time(ETC, SampleRate, Direct_Data[s].Min_Time(r)) * 1000;
                            double[] L_ETC = AcousticalMath.ETCurve_1d(Direct_Data, IS_Data, Receiver, (int)(CO_TIME.Value), SampleRate, oct, r, new System.Collections.Generic.List <int>()
                            {
                                s
                            }, false, (double)this.Alt_Choice.Value, (double)this.Azi_Choice.Value, true)[1];
                            LF[s, r, oct] = AcousticalMath.Lateral_Fraction(ETC, L_ETC, SampleRate, Direct_Data[s].Min_Time(r), false) * 1000;
                            LE[s, r, oct] = AcousticalMath.Lateral_Efficiency(ETC, L_ETC, SampleRate, Direct_Data[s].Min_Time(r), false) * 1000;
                        }
                    }
                }
                System.Windows.Forms.SaveFileDialog sf = new System.Windows.Forms.SaveFileDialog();
                sf.DefaultExt   = ".txt";
                sf.AddExtension = true;
                sf.Filter       = "Text File (*.txt)|*.txt|" + "All Files|";

                if (sf.ShowDialog() == System.Windows.Forms.DialogResult.OK)
                {
                    System.IO.StreamWriter SW = new System.IO.StreamWriter(System.IO.File.Open(sf.FileName, System.IO.FileMode.Create));
                    SW.WriteLine("Pachyderm Acoustic Simulation Results");
                    SW.WriteLine("Saved {0}", System.DateTime.Now.ToString());
                    SW.WriteLine("Filename:{0}", Rhino.RhinoDoc.ActiveDoc.Name);
                    for (int s = 0; s < SourceList.Items.Count; s++)
                    {
                        SW.WriteLine("Source {0};", s);
                        for (int r = 0; r < Recs.Length; r++)
                        {
                            SW.WriteLine("Receiver {0};63 Hz.;125 Hz.;250 Hz.;500 Hz.;1000 Hz.; 2000 Hz.;4000 Hz.; 8000 Hz.", r);
                            SW.WriteLine("Early Decay Time (EDT);{0};{1};{2};{3};{4};{5};{6};{7}", EDT[s, r, 0], EDT[s, r, 1], EDT[s, r, 2], EDT[s, r, 3], EDT[s, r, 4], EDT[s, r, 5], EDT[s, r, 6], EDT[s, r, 7]);
                            SW.WriteLine("Reverberation Time (T-10);{0};{1};{2};{3};{4};{5};{6};{7}", T10[s, r, 0], T10[s, r, 1], T10[s, r, 2], T10[s, r, 3], T10[s, r, 4], T10[s, r, 5], T10[s, r, 6], T10[s, r, 7]);
                            SW.WriteLine("Reverberation Time (T-15);{0};{1};{2};{3};{4};{5};{6};{7}", T15[s, r, 0], T15[s, r, 1], T15[s, r, 2], T15[s, r, 3], T15[s, r, 4], T15[s, r, 5], T15[s, r, 6], T15[s, r, 7]);
                            SW.WriteLine("Reverberation Time (T-20);{0};{1};{2};{3};{4};{5};{6};{7}", T20[s, r, 0], T20[s, r, 1], T20[s, r, 2], T20[s, r, 3], T20[s, r, 4], T20[s, r, 5], T20[s, r, 6], T20[s, r, 7]);
                            SW.WriteLine("Reverberation Time (T-30);{0};{1};{2};{3};{4};{5};{6};{7}", T30[s, r, 0], T30[s, r, 1], T30[s, r, 2], T30[s, r, 3], T30[s, r, 4], T30[s, r, 5], T30[s, r, 6], T30[s, r, 7]);
                            SW.WriteLine("Clarity - 50 ms (C-50);{0};{1};{2};{3};{4};{5};{6};{7}", C50[s, r, 0], C50[s, r, 1], C50[s, r, 2], C50[s, r, 3], C50[s, r, 4], C50[s, r, 5], C50[s, r, 6], C50[s, r, 7]);
                            SW.WriteLine("Definition/Deutlichkeit (D);{0};{1};{2};{3};{4};{5};{6};{7}", D50[s, r, 0], D50[s, r, 1], D50[s, r, 2], D50[s, r, 3], D50[s, r, 4], D50[s, r, 5], D50[s, r, 6], D50[s, r, 7]);
                            SW.WriteLine("Clarity - 80 ms (C-80);{0};{1};{2};{3};{4};{5};{6};{7}", C80[s, r, 0], C80[s, r, 1], C80[s, r, 2], C80[s, r, 3], C80[s, r, 4], C80[s, r, 5], C80[s, r, 6], C80[s, r, 7]);
                            SW.WriteLine("Center Time (TS);{0};{1};{2};{3};{4};{5};{6};{7}", TS[s, r, 0], TS[s, r, 1], TS[s, r, 2], TS[s, r, 3], TS[s, r, 4], TS[s, r, 5], TS[s, r, 6], TS[s, r, 7]);
                            SW.WriteLine("Strength(G);{0};{1};{2};{3};{4};{5};{6};{7}", G[s, r, 0], G[s, r, 1], G[s, r, 2], G[s, r, 3], G[s, r, 4], G[s, r, 5], G[s, r, 6], G[s, r, 7]);
                            SW.WriteLine("Lateral Fraction(LF);{0};{1};{2};{3};{4};{5};{6};{7}", LF[s, r, 0], LF[s, r, 1], LF[s, r, 2], LF[s, r, 3], LF[s, r, 4], LF[s, r, 5], LF[s, r, 6], LF[s, r, 7]);
                            SW.WriteLine("Lateral Efficiency(LE);{0};{1};{2};{3};{4};{5};{6};{7}", LE[s, r, 0], LE[s, r, 1], LE[s, r, 2], LE[s, r, 3], LE[s, r, 4], LE[s, r, 5], LE[s, r, 6], LE[s, r, 7]);
                        }
                    }
                    SW.Close();
                }
            }
 private double C_Sound()
 {
     return(AcousticalMath.SoundSpeed((double)Air_Temp.Value));
 }
Пример #7
0
            private void Update_Graph(object sender, EventArgs e)
            {
                Analysis_View.GraphPane.CurveList.Clear();

                int REC_ID = 0;

                try
                {
                    REC_ID = int.Parse(Receiver_Choice.Text);

                    int OCT_ID = PachTools.OctaveStr2Int(Graph_Octave.Text);
                    Analysis_View.GraphPane.Title.Text       = "Logarithmic Energy Time Curve";
                    Analysis_View.GraphPane.XAxis.Title.Text = "Time (seconds)";
                    Analysis_View.GraphPane.YAxis.Title.Text = "Sound Pressure Level (dB)";

                    List <int> SrcIDs = new List <int>();
                    foreach (int i in SourceList.CheckedIndices)
                    {
                        SrcIDs.Add(i);
                    }

                    //List<double[]> Filter = new List<double[]>();
                    List <System.Drawing.Color> C = new List <System.Drawing.Color> {
                        System.Drawing.Color.Red, System.Drawing.Color.OrangeRed, System.Drawing.Color.Orange, System.Drawing.Color.DarkGoldenrod, System.Drawing.Color.Olive, System.Drawing.Color.Green, System.Drawing.Color.Aquamarine, System.Drawing.Color.Azure, System.Drawing.Color.Blue, System.Drawing.Color.Indigo, System.Drawing.Color.Violet
                    };

                    double[][] Temp;

                    switch (DistributionType.Text)
                    {
                    case "Monaural":
                        Response    = new double[1][];
                        Response[0] = (AcousticalMath.PTCurve(Direct_Data, IS_Data, Receiver, CutoffTime, SampleRate, REC_ID, SrcIDs, false));
                        break;

                    case "First Order Ambisonics":
                        Response    = new double[4][];
                        Temp        = AcousticalMath.PTCurve_Fig8_3Axis(Direct_Data, IS_Data, Receiver, CutoffTime, SampleRate, Receiver_Choice.SelectedIndex, SelectedSources(), false, (double)Alt_Choice.Value, (double)Azi_Choice.Value, true);
                        Response[0] = AcousticalMath.PTCurve(Direct_Data, IS_Data, Receiver, CutoffTime, SampleRate, REC_ID, SrcIDs, false);
                        Response[1] = Temp[0];
                        Response[2] = Temp[1];
                        Response[3] = Temp[2];
                        break;

                    case "Second Order Ambisonics":
                        Response    = new double[9][];
                        Temp        = AcousticalMath.PTCurve_Fig8_3Axis(Direct_Data, IS_Data, Receiver, CutoffTime, SampleRate, Receiver_Choice.SelectedIndex, SelectedSources(), false, (double)Alt_Choice.Value, (double)Azi_Choice.Value, true);
                        Response[0] = AcousticalMath.PTCurve(Direct_Data, IS_Data, Receiver, CutoffTime, SampleRate, REC_ID, SrcIDs, false);
                        Response[1] = Temp[0];
                        Response[2] = Temp[1];
                        Response[3] = Temp[2];
                        Temp        = AcousticalMath.PTCurve_Ambisonics2(Direct_Data, IS_Data, Receiver, CutoffTime, SampleRate, Receiver_Choice.SelectedIndex, SelectedSources(), false, (double)Alt_Choice.Value, (double)Azi_Choice.Value, true);
                        Response[4] = Temp[0];
                        Response[5] = Temp[1];
                        Response[6] = Temp[2];
                        Response[7] = Temp[3];
                        Response[8] = Temp[4];
                        break;

                    case "Third Order Ambisonics":
                        Response     = new double[16][];
                        Temp         = AcousticalMath.PTCurve_Fig8_3Axis(Direct_Data, IS_Data, Receiver, CutoffTime, SampleRate, Receiver_Choice.SelectedIndex, SelectedSources(), false, (double)Alt_Choice.Value, (double)Azi_Choice.Value, true);
                        Response[0]  = AcousticalMath.PTCurve(Direct_Data, IS_Data, Receiver, CutoffTime, SampleRate, REC_ID, SrcIDs, false);
                        Response[1]  = Temp[0];
                        Response[2]  = Temp[1];
                        Response[3]  = Temp[2];
                        Temp         = AcousticalMath.PTCurve_Ambisonics2(Direct_Data, IS_Data, Receiver, CutoffTime, SampleRate, Receiver_Choice.SelectedIndex, SelectedSources(), false, (double)Alt_Choice.Value, (double)Azi_Choice.Value, true);
                        Response[4]  = Temp[0];
                        Response[5]  = Temp[1];
                        Response[6]  = Temp[2];
                        Response[7]  = Temp[3];
                        Response[8]  = Temp[4];
                        Temp         = AcousticalMath.PTCurve_Ambisonics3(Direct_Data, IS_Data, Receiver, CutoffTime, SampleRate, Receiver_Choice.SelectedIndex, SelectedSources(), false, (double)Alt_Choice.Value, (double)Azi_Choice.Value, true);
                        Response[9]  = Temp[0];
                        Response[10] = Temp[1];
                        Response[11] = Temp[2];
                        Response[12] = Temp[3];
                        Response[13] = Temp[4];
                        Response[14] = Temp[5];
                        Response[15] = Temp[6];
                        break;

                    default:
                        Response = new double[Channel_View.Items.Count][];
                        for (int i = 0; i < Channel_View.Items.Count; i++)
                        {
                            double alt = -(double)Alt_Choice.Value + 180 * Math.Asin((Channel_View.Items[i] as channel).V.z) / Math.PI;
                            double azi = (double)Azi_Choice.Value + 180 * Math.Atan2((Channel_View.Items[i] as channel).V.y, (Channel_View.Items[i] as channel).V.x) / Math.PI;
                            if (alt > 90)
                            {
                                alt -= 180;
                            }
                            if (alt < -90)
                            {
                                alt += 180;
                            }
                            if (azi > 360)
                            {
                                azi -= 360;
                            }
                            if (azi < 0)
                            {
                                azi += 360;
                            }
                            Response[i] = AcousticalMath.PTCurve_Directional(Direct_Data, IS_Data, Receiver, CutoffTime, SampleRate, PachTools.OctaveStr2Int(Graph_Octave.Text), REC_ID, SrcIDs, false, alt, azi, true);
                        }
                        break;
                    }

                    //Get the maximum value of the Direct Sound
                    double DirectMagnitude = 0;
                    foreach (int i in SourceList.CheckedIndices)
                    {
                        double[] E = Direct_Data[i].EnergyValue(OCT_ID, REC_ID);
                        for (int j = 0; j < E.Length; j++)
                        {
                            double D = AcousticalMath.SPL_Intensity(E[j]);
                            if (D > DirectMagnitude)
                            {
                                DirectMagnitude = D;
                            }
                        }
                    }

                    double[] time = new double[Response[0].Length];
                    for (int i = 0; i < Response[0].Length; i++)
                    {
                        time[i] = (double)i / SampleRate - 1024f / SampleRate;
                    }

                    for (int i = 0; i < Response.Length; i++)
                    {
                        double[] filter = Audio.Pach_SP.FIR_Bandpass(Response[i], OCT_ID, SampleRate, 0);
                        Analysis_View.GraphPane.AddCurve(String.Format("Channel {0}", i), time, AcousticalMath.SPL_Pressure_Signal(filter), C[i % 10], ZedGraph.SymbolType.None);
                    }
                    Analysis_View.GraphPane.XAxis.Scale.Max = time[time.Length - 1];
                    Analysis_View.GraphPane.XAxis.Scale.Min = time[0];
                    Analysis_View.GraphPane.YAxis.Scale.Max = DirectMagnitude + 15;
                    Analysis_View.GraphPane.YAxis.Scale.Min = 0;

                    //AuralisationConduit.Instance.set_direction(Receiver[0].Origin(Receiver_Choice.SelectedIndex), new Rhino.Geometry.Vector3d(Math.Cos((float)Azi_Choice.Value * Math.PI / 180.0f) * Math.Cos((float)Alt_Choice.Value * Math.PI / 180.0f), Math.Sin((float)Azi_Choice.Value * Math.PI / 180.0f) * Math.Cos((float)Alt_Choice.Value * Math.PI / 180.0f), Math.Sin((float)Alt_Choice.Value * Math.PI / 180.0f)));
                    Rhino.RhinoDoc.ActiveDoc.Views.Redraw();
                }
                catch { return; }
                Analysis_View.AxisChange();
                Analysis_View.Invalidate();
                Draw_Feedback();
            }
Пример #8
0
 private double CutOffLength()
 {
     return(((double)CO_TIME.Value / 1000) * AcousticalMath.SoundSpeed((double)Air_Temp.Value));;
 }