/// <summary> /// Direct sound constructor. This prepares the simulation to run. /// </summary> /// <param name="Src_in">The sound source</param> /// <param name="Rec_in">The collection of receivers</param> /// <param name="Room_in">The acoustical scene to render</param> /// <param name="RayCount">The number of rays which will be used </param> public Direct_Sound(Source Src_in, Receiver_Bank Rec_in, Scene Room_in, int[] Octaves) { type = Src_in.Type(); Validity = new bool[Rec_in.Count];//[Rec_in.Count]; Io = new double[Rec_in.Count][][];//[Rec_in.Count][t,8]; Time_Pt = new double[Rec_in.Count];//[Rec_in.Count]; Dir_Rec_Pos = new float[Rec_in.Count][][][]; Dir_Rec_Neg = new float[Rec_in.Count][][][]; Room = Room_in; C_Sound = Room_in.Sound_speed(0); SampleFreq = Rec_in.SampleRate; Src = Src_in; this.CO_Time = Rec_in.CO_Time; Receiver = new List<Point>(); Rho_C = new double[Rec_in.Count]; for(int i = 0; i < Rec_in.Count; i++) { Rho_C[i] = Room.Rho_C(Rec_in.H_Origin(i)); Receiver.Add(Rec_in.H_Origin(i)); } SWL = new double[8] { Src_in.SWL(0), Src_in.SWL(1), Src_in.SWL(2), Src_in.SWL(3), Src_in.SWL(4), Src_in.SWL(5), Src_in.SWL(6), Src_in.SWL(7) }; Delay_ms = Src.Delay; Oct_choice = Octaves; }
/// <summary> /// Constructor prepares image source calculation to run. /// </summary> /// <param name="Source"></param> /// <param name="Receiver"></param> /// <param name="Direct"></param> /// <param name="Rm"></param> /// <param name="MaxOrder_in">The maximum order to be calculated for.</param> public ImageSourceData(Source Source, Receiver_Bank Receiver, Direct_Sound Direct, Polygon_Scene Rm, int[] Octaves, int MaxOrder_in, bool Edge_Diffraction, int SourceID_in) { IncludeEdges = Edge_Diffraction; Diffraction = Edge_Diffraction; Oct_choice = new int[Octaves[1] - Octaves[0] + 1]; for (int i = 0; i < Octaves.Length; i++) Oct_choice[i] = i + Octaves[0]; SrcNo = SourceID_in; ValidPaths = new List<Deterministic_Reflection>[Receiver.Count]; Speed_of_Sound = Rm.Sound_speed(0); MaxOrder = MaxOrder_in; Src = Source; Rec = new Hare.Geometry.Point[Receiver.Count]; SampleCT = Receiver.SampleCT; SampleRate = Receiver.SampleRate; for(int i = 0; i < Receiver.Count; i++) { Rec[i] = Receiver.H_Origin(i); } Room = Rm; Direct_Time = new double[Receiver.Count]; for (int q = 0; q < Receiver.Count; q++) { Direct_Time[q] = Direct.Min_Time(q); } }