public HomeController(IFloorData floordata, IClinicsData clinicdata, IDoctorsData doctordata, IHttpContextAccessor httpContextAccessor) { _httpContextAccessor = httpContextAccessor; _Floors = floordata; _Clinics = clinicdata; _Doctors = doctordata; }
public void Apply(IFloorData floorData, int blockSize, float[] residue) { if (!(floorData is Data data)) { throw new ArgumentException("Incorrect packet data!", "packetData"); } var n = blockSize / 2; if (data.PostCount > 0) { var stepFlags = UnwrapPosts(data); var lx = 0; var ly = data.Posts[0] * _multiplier; for (int i = 1; i < data.PostCount; i++) { var idx = _sortIdx[i]; if (stepFlags[idx]) { var hx = _xList[idx]; var hy = data.Posts[idx] * _multiplier; if (lx < n) { RenderLineMulti(lx, ly, Math.Min(hx, n), hy, residue); } lx = hx; ly = hy; } if (lx >= n) { break; } } if (lx < n) { RenderLineMulti(lx, ly, n, ly, residue); } } else { Array.Clear(residue, 0, n); } }
public void Apply(IFloorData floorData, int blockSize, float[] residue) { if (!(floorData is Data data)) { throw new ArgumentException("Incorrect packet data type.", nameof(floorData)); } int n = blockSize / 2; if (data.Amp <= 0f) { Array.Clear(residue, 0, n); return; } // this is pretty well stolen directly from libvorbis... BSD license var barkMap = _barkMaps[blockSize]; var wMap = _wMap[blockSize]; int i; for (i = 0; i < _order; i++) { data.Coeff[i] = 2f * MathF.Cos(data.Coeff[i]); } i = 0; while (i < n) { int j; var k = barkMap[i]; var p = .5f; var q = .5f; var w = wMap[k]; for (j = 1; j < _order; j += 2) { q *= w - data.Coeff[j - 1]; p *= w - data.Coeff[j]; } if (j == _order) { // odd order filter; slightly assymetric q *= w - data.Coeff[j - 1]; p *= p * (4f - w * w); q *= q; } else { // even order filter; still symetric p *= p * (2f - w); q *= q * (2f + w); } // calc the dB of this bark section q = data.Amp / MathF.Sqrt(p + q) - _ampOfs; // now convert to a linear sample multiplier q = MathF.Exp(q * 0.11512925f); residue[i] *= q; while (barkMap[++i] == k) { residue[i] *= q; } } }
public void DecodePacket(IPacket packet, int blockSize, int channels, float[][] buffer) { var halfBlockSize = blockSize >> 1; // read the noise floor data var floorData = new IFloorData[_channelFloor.Length]; var noExecuteChannel = new bool[_channelFloor.Length]; for (var i = 0; i < _channelFloor.Length; i++) { floorData[i] = _channelFloor[i].Unpack(packet, blockSize, i); noExecuteChannel[i] = !floorData[i].ExecuteChannel; // pre-clear the residue buffers Array.Clear(buffer[i], 0, halfBlockSize); } // make sure we handle no-energy channels correctly given the couplings.. for (var i = 0; i < _couplingAngle.Length; i++) { if (floorData[_couplingAngle[i]].ExecuteChannel || floorData[_couplingMangitude[i]].ExecuteChannel) { floorData[_couplingAngle[i]].ForceEnergy = true; floorData[_couplingMangitude[i]].ForceEnergy = true; } } // decode the submaps into the residue buffer for (var i = 0; i < _submapFloor.Length; i++) { for (var j = 0; j < _channelFloor.Length; j++) { if (_submapFloor[i] != _channelFloor[j] || _submapResidue[i] != _channelResidue[j]) { // the submap doesn't match, so this floor doesn't contribute floorData[j].ForceNoEnergy = true; } } _submapResidue[i].Decode(packet, noExecuteChannel, blockSize, buffer); } // inverse coupling for (var i = _couplingAngle.Length - 1; i >= 0; i--) { if (floorData[_couplingAngle[i]].ExecuteChannel || floorData[_couplingMangitude[i]].ExecuteChannel) { var magnitude = buffer[_couplingMangitude[i]]; var angle = buffer[_couplingAngle[i]]; // we only have to do the first half; MDCT ignores the last half for (var j = 0; j < halfBlockSize; j++) { float newM, newA; var oldM = magnitude[j]; var oldA = angle[j]; if (oldM > 0) { if (oldA > 0) { newM = oldM; newA = oldM - oldA; } else { newA = oldM; newM = oldM + oldA; } } else { if (oldA > 0) { newM = oldM; newA = oldM + oldA; } else { newA = oldM; newM = oldM - oldA; } } magnitude[j] = newM; angle[j] = newA; } } } // apply floor / dot product / MDCT (only run if we have sound energy in that channel) for (var c = 0; c < _channelFloor.Length; c++) { if (floorData[c].ExecuteChannel) { _channelFloor[c].Apply(floorData[c], blockSize, buffer[c]); _mdct.Reverse(buffer[c], blockSize); } else { // since we aren't doing the IMDCT, we have to explicitly clear the back half of the block Array.Clear(buffer[c], halfBlockSize, halfBlockSize); } } }