private HttpWebRequest CreateServicePostRequest(ReverbCommand command, string endpoint, string content) { this.AllowInvalidCertificate(); this.InitSecurityProtocol(); var uri = new Uri(string.Concat(this._host, command.Command, endpoint)); var request = (HttpWebRequest)WebRequest.Create(uri); request.Method = WebRequestMethods.Http.Post; request.UserAgent = "SkuVault"; request.ContentType = "application/json"; if (!String.IsNullOrEmpty(this.GetLogin()) && !String.IsNullOrEmpty(this.GetPassword())) { request.Credentials = new NetworkCredential(this.GetLogin(), this.GetPassword()); } if (command != ReverbCommand.GetToken) { request.Headers.Add("Authorization", this.CreateAuthenticationHeader()); } using (var writer = new StreamWriter(request.GetRequestStream())) writer.Write(content); return(request); }
public async Task PutFormatDataAsync(ReverbCommand command, string[] data, string jsonContent) { var request = this.CreateServicePutFormatRequest(command, data, jsonContent); this.LogPutInfo(this._config.Token, String.Join(",", data), jsonContent); using (var response = await request.GetResponseAsync()) this.LogUpdateInfo(this._config.Token, String.Join(",", data), ((HttpWebResponse)response).StatusCode, jsonContent); }
public async Task PutDataAsync(ReverbCommand command, string endpoint, string jsonContent) { var request = this.CreateServicePutRequest(command, endpoint, jsonContent); this.LogPutInfo(this._config.Token, endpoint, jsonContent); using (var response = await request.GetResponseAsync()) this.LogUpdateInfo(this._config.Token, endpoint, ((HttpWebResponse)response).StatusCode, jsonContent); }
public void PutData(ReverbCommand command, string endpoint, string jsonContent) { var request = this.CreateServicePutRequest(command, endpoint, jsonContent); this.LogPutInfo(this._config.Token, endpoint, jsonContent); using (var response = (HttpWebResponse)request.GetResponse()) this.LogUpdateInfo(this._config.Token, endpoint, response.StatusCode, jsonContent); }
public async Task <T> GetResponseAsync <T>(ReverbCommand command, string commandParams) { T result; var request = this.CreateGetServiceGetRequest(string.Concat(this._host, command.Command, commandParams)); using (var response = await request.GetResponseAsync()) result = ParseResponse <T>(response); return(result); }
/// <summary> /// Generate a new <see cref="ReverbCommand"/>. /// </summary> /// <param name="bufferOffset">The target buffer offset.</param> /// <param name="parameter">The reverb parameter.</param> /// <param name="state">The reverb state.</param> /// <param name="isEnabled">Set to true if the effect should be active.</param> /// <param name="workBuffer">The work buffer to use for processing.</param> /// <param name="nodeId">The node id associated to this command.</param> /// <param name="isLongSizePreDelaySupported">If set to true, the long size pre-delay is supported.</param> /// <param name="newEffectChannelMappingSupported">If set to true, the new effect channel mapping for 5.1 is supported.</param> public void GenerateReverbEffect(uint bufferOffset, ReverbParameter parameter, Memory <ReverbState> state, bool isEnabled, CpuAddress workBuffer, int nodeId, bool isLongSizePreDelaySupported, bool newEffectChannelMappingSupported) { if (parameter.IsChannelCountValid()) { ReverbCommand command = new ReverbCommand(bufferOffset, parameter, state, isEnabled, workBuffer, nodeId, isLongSizePreDelaySupported, newEffectChannelMappingSupported); command.EstimatedProcessingTime = _commandProcessingTimeEstimator.Estimate(command); AddCommand(command); } }
public uint Estimate(ReverbCommand command) { Debug.Assert(command.Parameter.IsChannelCountValid()); if (command.Enabled) { return((uint)(750 * _sampleCount * command.Parameter.ChannelCount * 1.2f)); } return(0); }
public T GetResponse <T>(ReverbCommand command, string[] commandFormatParams, string commandParams) { T result; var request = this.CreateGetServiceGetRequest(string.Concat(this._host, String.Format(command.Command, commandFormatParams), commandParams)); using (var response = request.GetResponse()) result = ParseResponse <T>(response); return(result); }
public async Task <T> GetPostDataAsync <T>(ReverbCommand command, string endpoint, string jsonContent) { var request = this.CreateServicePostRequest(command, endpoint, jsonContent); using (var response = await(Task <WebResponse>) request.GetResponseAsync()) { StreamReader reader = new StreamReader(response.GetResponseStream()); StringBuilder output = new StringBuilder(); output.Append(reader.ReadToEnd()); response.Close(); return(ParseJson <T>(output.ToString())); } }
public uint Estimate(ReverbCommand command) { Debug.Assert(_sampleCount == 160 || _sampleCount == 240); if (_sampleCount == 160) { if (command.Enabled) { switch (command.Parameter.ChannelCount) { case 1: return((uint)81475.05f); case 2: return((uint)84975.0f); case 4: return((uint)91625.15f); case 6: return((uint)95332.27f); default: throw new NotImplementedException($"{command.Parameter.ChannelCount}"); } } else { switch (command.Parameter.ChannelCount) { case 1: return((uint)536.30f); case 2: return((uint)588.70f); case 4: return((uint)643.70f); case 6: return((uint)706.0f); default: throw new NotImplementedException($"{command.Parameter.ChannelCount}"); } } } if (command.Enabled) { switch (command.Parameter.ChannelCount) { case 1: return((uint)120174.47f); case 2: return((uint)25262.22f); case 4: return((uint)135751.23f); case 6: return((uint)141129.23f); default: throw new NotImplementedException($"{command.Parameter.ChannelCount}"); } } else { switch (command.Parameter.ChannelCount) { case 1: return((uint)617.64f); case 2: return((uint)659.54f); case 4: return((uint)711.43f); case 6: return((uint)778.07f); default: throw new NotImplementedException($"{command.Parameter.ChannelCount}"); } } }
public uint Estimate(ReverbCommand command) { Debug.Assert(_sampleCount == 160 || _sampleCount == 240); if (_sampleCount == 160) { if (command.Enabled) { switch (command.Parameter.ChannelCount) { case 1: return((uint)97192.0f); case 2: return((uint)103280.0f); case 4: return((uint)109580.0f); case 6: return((uint)115070.0f); default: throw new NotImplementedException($"{command.Parameter.ChannelCount}"); } } else { switch (command.Parameter.ChannelCount) { case 1: return((uint)492.01f); case 2: return((uint)554.46f); case 4: return((uint)595.86f); case 6: return((uint)656.62f); default: throw new NotImplementedException($"{command.Parameter.ChannelCount}"); } } } if (command.Enabled) { switch (command.Parameter.ChannelCount) { case 1: return((uint)136460.0f); case 2: return((uint)145750.0f); case 4: return((uint)154800.0f); case 6: return((uint)161970.0f); default: throw new NotImplementedException($"{command.Parameter.ChannelCount}"); } } else { switch (command.Parameter.ChannelCount) { case 1: return((uint)495.79f); case 2: return((uint)527.16f); case 4: return((uint)598.75f); case 6: return((uint)666.03f); default: throw new NotImplementedException($"{command.Parameter.ChannelCount}"); } } }
public override uint Estimate(ReverbCommand command) { Debug.Assert(_sampleCount == 160 || _sampleCount == 240); if (_sampleCount == 160) { if (command.Enabled) { switch (command.Parameter.ChannelCount) { case 1: return(81475); case 2: return(84975); case 4: return(91625); case 6: return(95332); default: throw new NotImplementedException($"{command.Parameter.ChannelCount}"); } } else { switch (command.Parameter.ChannelCount) { case 1: return((uint)536.30f); case 2: return((uint)588.80f); case 4: return((uint)643.70f); case 6: return((uint)706.0f); default: throw new NotImplementedException($"{command.Parameter.ChannelCount}"); } } } if (command.Enabled) { switch (command.Parameter.ChannelCount) { case 1: return(120170); case 2: return(125260); case 4: return(135750); case 6: return(141130); default: throw new NotImplementedException($"{command.Parameter.ChannelCount}"); } } else { switch (command.Parameter.ChannelCount) { case 1: return((uint)617.64f); case 2: return((uint)659.54f); case 4: return((uint)711.44f); case 6: return((uint)778.07f); default: throw new NotImplementedException($"{command.Parameter.ChannelCount}"); } } }