public void Execute() { var VONAGE_APPLICATION_ID = Environment.GetEnvironmentVariable("VONAGE_APPLICATION_ID") ?? "VONAGE_APPLICATION_ID"; var VONAGE_PRIVATE_KEY_PATH = Environment.GetEnvironmentVariable("VONAGE_PRIVATE_KEY_PATH") ?? "VONAGE_PRIVATE_KEY_PATH"; var TO_NUMBER = Environment.GetEnvironmentVariable("TO_NUMBER") ?? "TO_NUMBER"; var VONAGE_NUMBER = Environment.GetEnvironmentVariable("VONAGE_NUMBER") ?? "VONAGE_NUMBER"; var ANSWER_URL = Environment.GetEnvironmentVariable("ANSWER_URL") ?? "ANSWER_URL"; var toEndpoint = new PhoneEndpoint() { Number = TO_NUMBER }; var fromEndpoint = new PhoneEndpoint() { Number = VONAGE_NUMBER }; var creds = Credentials.FromAppIdAndPrivateKeyPath(VONAGE_APPLICATION_ID, VONAGE_PRIVATE_KEY_PATH); var client = new VonageClient(creds); var command = new CallCommand() { To = new Endpoint[] { toEndpoint }, From = fromEndpoint, AnswerUrl = new[] { ANSWER_URL } }; var response = client.VoiceClient.CreateCall(command); Console.WriteLine($"Call Created with call uuid: {response.Uuid}"); }
public Void VisitCallCommand(CallCommand ast, Frame frame) { int argsSize = ast.Actuals.Visit(this, frame); ast.Identifier.Visit(this, frame.Replace(argsSize)); return(null); }
public T invoke <T> (int timeoutInMs, string mappingUrl, params object[] paramList) { makeConnectionInCallerThread(15000); if (ioSession == null || !ioSession.Connected) { return(default(T)); } CallCommand callCmd = new CallCommand(); callCmd.procedureUri = mappingUrl; callCmd.args = paramList; callCmd.options.Add("Cookie", cookieManager.getCookieForSendToServer()); CallResultFuture asyncResult = new CallResultFuture(); metaHolder.requestPool.Add(callCmd.requestId, asyncResult); asyncResult.resultType = typeof(T); ioSession.Write(callCmd); lock (asyncResult.monitorLock) { //Monitor.Wait (asyncResult.monitorLock, timeoutInMs); commented for test Monitor.Wait(asyncResult.monitorLock); } if (!asyncResult.done) { throw new TimeoutException("{timeoutInMs:" + timeoutInMs + '}'); } if (!asyncResult.isExceptionResult) { return((T)asyncResult.result); } if (asyncResult.isExceptionResult) { throw new Exception((string)asyncResult.result); } return(default(T)); }
public IActionResult MakePhoneCall(string toNumber, string fromNumber) { var appId = _config["APPLICATION_ID"]; var privateKeyPath = _config["PRIVATE_KEY_PATH"]; var streamAction = new StreamAction { StreamUrl = new string[] { STREAM_URL } }; var ncco = new Ncco(streamAction); var toEndpoint = new PhoneEndpoint { Number = toNumber }; var fromEndpoint = new PhoneEndpoint { Number = fromNumber }; var credentials = Credentials.FromAppIdAndPrivateKeyPath(appId, privateKeyPath); var client = new VoiceClient(credentials); var callRequest = new CallCommand { To = new [] { toEndpoint }, From = fromEndpoint, Ncco = ncco }; var call = client.CreateCall(callRequest); ViewBag.Uuid = call.Uuid; return(View("Index")); }
public void Call(CallCommand command) { _file.WriteLine($"// Call {command.Arg1} ({command.Arg2})"); _file.WriteLine($"@Return{this.ReturnAddressLabel}"); _file.WriteLine($"D=A"); this.PushFromDRegister(); foreach (var segmentName in new string[] { "LCL", "ARG", "THIS", "THAT" }) { _file.WriteLine($"@{segmentName}"); _file.WriteLine($"D=M"); this.PushFromDRegister(); } _file.WriteLine($"@SP"); _file.WriteLine($"D=M"); _file.WriteLine($"@{command.Arg2}"); _file.WriteLine($"D=D-A"); _file.WriteLine($"@5"); _file.WriteLine($"D=D-A"); _file.WriteLine($"@ARG"); _file.WriteLine($"M=D"); _file.WriteLine($"@SP"); _file.WriteLine($"D=M"); _file.WriteLine($"@LCL"); _file.WriteLine($"M=D"); _file.WriteLine($"@{command.Arg1}"); _file.WriteLine($"0;JMP"); _file.WriteLine($"(Return{this.ReturnAddressLabel})"); this.ReturnAddressLabel++; }
public void PostCallsCallIdTest() { // TODO: add unit test for the method 'PostCallsCallId' string callId = null; // TODO: replace null with proper value CallCommand body = null; // TODO: replace null with proper value var response = instance.PostCallsCallId(callId, body); Assert.IsInstanceOf <Conversation> (response, "response is Conversation"); }
public void visit(CallCommand that) { // let the arguments resolve their types foreach (Expression argument in that.Arguments) { argument.visit(this); } // mangle the parameter list so as to be able to look up the mangled symbol System.Text.StringBuilder mangled = new System.Text.StringBuilder(64); that.Encode(mangled); string name = mangled.ToString(); // look up the function name Declaration declaration = _symbols.Lookup(name); if (declaration == null) { throw new CheckerError(that.Position, "Unknown function name '" + Demangler.Decode(name) + "' in call command"); } switch (declaration.Kind) { case SymbolKind.Constant: throw new CheckerError(that.Position, "Cannot call constant"); case SymbolKind.Function: break; case SymbolKind.Parameter: throw new CheckerError(that.Position, "Cannot call parameter"); case SymbolKind.Variable: throw new CheckerError(that.Position, "Cannot call variable"); default: throw new CheckerError(declaration.Position, "Unknown symbol kind: " + declaration.Kind.ToString()); } // check that the expected number of parameters is specified FunctionDeclaration function = (FunctionDeclaration)declaration; if (that.Arguments.Length != function.Parameters.Length) { throw new CheckerError(that.Position, "Incorrect number of parameters in function call"); } // check that the argument types match the parameter types for (int i = 0; i < that.Arguments.Length; i++) { if (that.Arguments[i].Type.Kind != function.Parameters[i].Type.Kind) { throw new CheckerError(that.Arguments[i].Position, "Type mismatch in argument to procedure"); } } }
protected void CallCommandHandler(CallCommand cmd) { #if PERFORMANCE_TEST var ptest = Service.Performance.PerformanceTest.Get(); ptest.Start("CallCommand"); #endif cmd.result = _service.Call(cmd.act, cmd.usingCoroutine, cmd.global); #if PERFORMANCE_TEST // now stop the watches ptest.Stop("CallCommand"); #endif }
public Void VisitCallCommand(CallCommand ast, Void arg) { var binding = ast.Identifier.Visit(this); var procedure = binding as IProcedureDeclaration; if (procedure != null) { ast.Actuals.Visit(this, procedure.Formals); } else { ReportUndeclaredOrError(binding, ast.Identifier, "\"%\" is not a procedure identifier"); } return(null); }
/// <summary> /// Khởi tạo gói thông tin với dữ liệu đã chuyển sang mảng byte /// </summary> /// <param name="Data"></param> public DataPacket(byte[] Data) { //Lấy 4 byte đầu tiên chứa thông tin Command (Dựa theo Start Index) this.Command = (CallCommand)BitConverter.ToInt32(Data, 0); //Lấy 4 byte tiếp theo chứa chiều dài của tên người nhận/gửi (Dựa theo Start Index) int nameLen = BitConverter.ToInt32(Data, 4); if (nameLen > 0) //Trường hợp tên người nhận/gửi không bị trống thì sẽ lấy tên người gửi/nhận ở 4 byte tiếp theo (Dựa theo Start Index) { this.Name = Encoding.UTF8.GetString(Data, 8, nameLen); } else { this.Name = null; } }
public Void VisitCallCommand(CallCommand ast, Void arg) { Declaration binding = ast.Identifier.Visit(this, null); if (binding is ProcDeclaration procedure) { ast.Parameters.Visit(this, procedure.Formals); } else if (binding is FuncDeclaration function) { ast.Parameters.Visit(this, function.Formals); } else { ReportUndeclaredOrError(binding, ast.Identifier, "\"%\" is not a procedure identifier"); } return(null); }
public void visit(CallCommand that) { Console.Write("{0}(", that.Identifier); foreach (Expression argument in that.Arguments) { argument.visit(this); if (argument != that.Arguments[that.Arguments.Length - 1]) { Console.Write(", "); } } Console.WriteLine(");"); #if false switch (that.Identifier) { case "getint": // To get the parameters ?? // getint( xx ) if (that.Arguments.Length != 1) { throw new CoderError(that.Position, "Incorrect number of parameters in function call"); } VariableExpression argument = that.Arguments[0] as VariableExpression; if (argument == null) { throw new CoderError("Variable expected"); } Console.WriteLine("Arg = {0}", argument.Name); break; case "putint": break; } foreach (Expression argument in that.Arguments) { argument.visit(this); } #endif }
public void Execute() { var VONAGE_APPLICATION_ID = Environment.GetEnvironmentVariable("VONAGE_APPLICATION_ID") ?? "VONAGE_APPLICATION_ID"; var VONAGE_PRIVATE_KEY_PATH = Environment.GetEnvironmentVariable("VONAGE_PRIVATE_KEY_PATH") ?? "VONAGE_PRIVATE_KEY_PATH"; var TO_NUMBER = Environment.GetEnvironmentVariable("TO_NUMBER") ?? "TO_NUMBER"; var VONAGE_NUMBER = Environment.GetEnvironmentVariable("VONAGE_NUMBER") ?? "VONAGE_NUMBER"; var EVENT_URL = new[] { Environment.GetEnvironmentVariable("EVENT_URL") ?? "https://example.com" }; var creds = Credentials.FromAppIdAndPrivateKeyPath(VONAGE_APPLICATION_ID, VONAGE_PRIVATE_KEY_PATH); var client = new VonageClient(creds); var toEndpoint = new PhoneEndpoint() { Number = TO_NUMBER }; var fromEndpoint = new PhoneEndpoint() { Number = VONAGE_NUMBER }; var extraText = ""; for (var i = 0; i < 50; i++) { extraText += $"{i} "; } var talkAction = new TalkAction() { Text = "This is a text to speech call from Vonage " + extraText }; var ncco = new Ncco(talkAction); var command = new CallCommand() { To = new Endpoint[] { toEndpoint }, From = fromEndpoint, Ncco = ncco, EventUrl = EVENT_URL }; var response = client.VoiceClient.CreateCall(command); Console.WriteLine($"Call Created with call uuid: {response.Uuid}"); }
protected void CallCommandHandler(CallCommand cmd) { //Profiler.BeginSample("CallCommandHandler"); cmd.result = _service.Call(cmd.act, cmd.usingCoroutine); //Profiler.EndSample(); }
public VenueViewModel(INavigationService navigationService, IEventAggregator eventAggregator, IStoreManager storeManager, IToast toast, IFavoriteService favoriteService, ILoggerFacade logger, ILaunchTwitter twitter, ISSOClient ssoClient, IPushNotifications pushNotifications, IReminderService reminderService, IPageDialogService pageDialogService) : base(navigationService, eventAggregator, storeManager, toast, favoriteService, logger, twitter, ssoClient, pushNotifications, reminderService, pageDialogService) { if (Device.OS == TargetPlatform.Android) { ToolBarItems.Add(new ToolbarItem { Order = ToolbarItemOrder.Secondary, Text = "Get Directions", Command = NavigateCommand }); if (CanMakePhoneCall) { ToolBarItems.Add(new ToolbarItem { Order = ToolbarItemOrder.Secondary, Text = "Call Hotel", Command = CallCommand }); } } else if (Device.OS == TargetPlatform.iOS) { ToolBarItems.Add(new ToolbarItem { Text = "More", Icon = "toolbar_overflow.png", Command = DelegateCommand <object> .FromAsyncHandler(async(o) => { string[] items = null; if (!CanMakePhoneCall) { items = new[] { "Get Directions" }; } else { items = new[] { "Get Directions", "Call +49 (341) 4859270" }; } var action = await PageDialogService.DisplayActionSheetAsync("Commundo Tagungshotel", "Cancel", null, items); if (action == items[0]) { NavigateCommand.Execute(null); } else if (items.Length > 1 && action == items[1] && CanMakePhoneCall) { CallCommand.Execute(null); } }) }); } else { ToolBarItems.Add(new ToolbarItem { Text = "Directions", Command = NavigateCommand, Icon = "toolbar_navigate.png" }); if (CanMakePhoneCall) { ToolBarItems.Add(new ToolbarItem { Text = "Call", Command = CallCommand, Icon = "toolbar_call.png" }); } } var position = new Position(Latitude, Longitude); MapSpan = new MapSpan(position, 0.02, 0.02); Pins.Add(new Pin { Type = PinType.Place, Address = LocationTitle, Label = EventTitle, Position = position }); }
public void Init() { instance = new CallCommand(); }
protected void Load(byte[] binary, EndianBinaryReader reader, int headerOffset) { _binary = binary; Header = reader.ReadObject <M4ASongHeader>(headerOffset); VoiceTable = VoiceTable.LoadTable <M4AVoiceTable>(Header.VoiceTable - ROM.Pak); Commands = new List <SongEvent> [Header.NumTracks]; for (int i = 0; i < Header.NumTracks; i++) { Commands[i] = new List <SongEvent>(); } if (Header.NumTracks > ROM.Instance.Game.Engine.TrackLimit) { throw new InvalidDataException($"La canzone ha troppe tracce ({Header.NumTracks})."); } for (int i = 0; i < NumTracks; i++) { reader.BaseStream.Position = Header.Tracks[i] - ROM.Pak; byte cmd = 0, runCmd = 0, prevNote = 0, prevVelocity = 0x7F; while (cmd != 0xB1 && cmd != 0xB6) { int off = (int)reader.BaseStream.Position; ICommand command = null; cmd = reader.ReadByte(); if (cmd >= 0xBD) // Commands that work within running status { runCmd = cmd; } #region TIE & Notes if (runCmd >= 0xCF && cmd < 0x80) // Within running status { var peek = reader.PeekBytes(2); if (peek[0] >= 0x80) { command = AddNoteEvent(cmd, prevVelocity, 0, runCmd, out prevNote, out prevVelocity); } else if (peek[1] > 3 || peek[1] < 1) { command = AddNoteEvent(cmd, reader.ReadByte(), 0, runCmd, out prevNote, out prevVelocity); } else { command = AddNoteEvent(cmd, reader.ReadByte(), reader.ReadByte(), runCmd, out prevNote, out prevVelocity); } } else if (cmd >= 0xCF) { var peek = reader.PeekBytes(3); if (peek[0] >= 0x80) { command = AddNoteEvent(prevNote, prevVelocity, 0, runCmd, out prevNote, out prevVelocity); } else if (peek[1] >= 0x80) { command = AddNoteEvent(reader.ReadByte(), prevVelocity, 0, runCmd, out prevNote, out prevVelocity); } // TIE cannot have an added duration so it needs to stop here else if (cmd == 0xCF || peek[2] > 3 || peek[2] < 1) { command = AddNoteEvent(reader.ReadByte(), reader.ReadByte(), 0, runCmd, out prevNote, out prevVelocity); } else { command = AddNoteEvent(reader.ReadByte(), reader.ReadByte(), reader.ReadByte(), runCmd, out prevNote, out prevVelocity); } } #endregion #region Rests else if (cmd >= 0x80 && cmd <= 0xB0) { command = new RestCommand { Rest = SongEvent.RestFromCMD(0x80, cmd) } } ; #endregion #region Commands else if (runCmd < 0xCF && cmd < 0x80) // Commands within running status { switch (runCmd) { case 0xBD: command = new VoiceCommand { Voice = cmd }; break; case 0xBE: command = new VolumeCommand { Volume = cmd }; break; case 0xBF: command = new PanpotCommand { Panpot = (sbyte)(cmd - 0x40) }; break; case 0xC0: command = new BendCommand { Bend = (sbyte)(cmd - 0x40) }; break; case 0xC1: command = new BendRangeCommand { Range = cmd }; break; case 0xC2: command = new LFOSpeedCommand { Speed = cmd }; break; case 0xC3: command = new LFODelayCommand { Delay = cmd }; break; case 0xC4: command = new ModDepthCommand { Depth = cmd }; break; case 0xC5: command = new ModTypeCommand { Type = cmd }; break; case 0xC8: command = new TuneCommand { Tune = (sbyte)(cmd - 0x40) }; break; case 0xCD: command = new LibraryCommand { Command = cmd, Argument = reader.ReadByte() }; break; case 0xCE: command = new EndOfTieCommand { Note = (sbyte)cmd }; prevNote = cmd; break; } } else if (cmd > 0xB0 && cmd < 0xCF) { switch (cmd) { case 0xB1: // FINE & PREV case 0xB6: command = new M4AFinishCommand { Type = cmd }; break; case 0xB2: command = new GoToCommand { Offset = reader.ReadInt32() - ROM.Pak }; break; case 0xB3: command = new CallCommand { Offset = reader.ReadInt32() - ROM.Pak }; break; case 0xB4: command = new ReturnCommand(); break; case 0xB5: command = new RepeatCommand { Times = reader.ReadByte(), Offset = reader.ReadInt32() - ROM.Pak }; break; case 0xB9: command = new MemoryAccessCommand { Arg1 = reader.ReadByte(), Arg2 = reader.ReadByte(), Arg3 = reader.ReadByte() }; break; case 0xBA: command = new PriorityCommand { Priority = reader.ReadByte() }; break; case 0xBB: command = new TempoCommand { Tempo = (short)(reader.ReadByte() * 2) }; break; case 0xBC: command = new KeyShiftCommand { Shift = reader.ReadSByte() }; break; // Commands that work within running status: case 0xBD: command = new VoiceCommand { Voice = reader.ReadByte() }; break; case 0xBE: command = new VolumeCommand { Volume = reader.ReadByte() }; break; case 0xBF: command = new PanpotCommand { Panpot = (sbyte)(reader.ReadByte() - 0x40) }; break; case 0xC0: command = new BendCommand { Bend = (sbyte)(reader.ReadByte() - 0x40) }; break; case 0xC1: command = new BendRangeCommand { Range = reader.ReadByte() }; break; case 0xC2: command = new LFOSpeedCommand { Speed = reader.ReadByte() }; break; case 0xC3: command = new LFODelayCommand { Delay = reader.ReadByte() }; break; case 0xC4: command = new ModDepthCommand { Depth = reader.ReadByte() }; break; case 0xC5: command = new ModTypeCommand { Type = reader.ReadByte() }; break; case 0xC8: command = new TuneCommand { Tune = (sbyte)(reader.ReadByte() - 0x40) }; break; case 0xCD: command = new LibraryCommand { Command = reader.ReadByte(), Argument = reader.ReadByte() }; break; case 0xCE: // EOT sbyte note; if (reader.PeekByte() < 0x80) { note = reader.ReadSByte(); prevNote = (byte)note; } else { note = -1; } command = new EndOfTieCommand { Note = note }; break; default: Console.WriteLine("Comando invalido: 0x{0:X} = {1}", off, cmd); break; } } #endregion Commands[i].Add(new SongEvent(off, command)); } } ICommand AddNoteEvent(byte note, byte velocity, byte addedDuration, byte runCmd, out byte prevNote, out byte prevVelocity) { return(new M4ANoteCommand { Note = (sbyte)(prevNote = note), Velocity = prevVelocity = velocity, Duration = (short)(runCmd == 0xCF ? -1 : (SongEvent.RestFromCMD(0xCF, runCmd) + addedDuration)) }); } }
protected void Load(byte[] binary, M4ASongHeader head) { _binary = binary; Header = head; Array.Resize(ref Header.Tracks, Header.NumTracks); // Not really necessary yet Commands = new List <SongEvent> [Header.NumTracks]; for (int i = 0; i < Header.NumTracks; i++) { Commands[i] = new List <SongEvent>(); } VoiceTable = VoiceTable.LoadTable <M4AVoiceTable>(Header.VoiceTable); if (NumTracks == 0 || NumTracks > 16) { return; } var reader = new ROMReader(); reader.InitReader(_binary); for (int i = 0; i < NumTracks; i++) { reader.SetOffset(Header.Tracks[i]); byte cmd = 0, runCmd = 0, prevNote = 0, prevVelocity = 127; while (cmd != 0xB1 && cmd != 0xB6) { uint off = reader.Position; ICommand command = null; cmd = reader.ReadByte(); if (cmd >= 0xBD) // Commands that work within running status { runCmd = cmd; } #region TIE & Notes if (runCmd >= 0xCF && cmd < 0x80) // Within running status { var o = reader.Position; byte peek1 = reader.ReadByte(), peek2 = reader.ReadByte(); reader.SetOffset(o); if (peek1 >= 128) { command = AddNoteEvent(cmd, prevVelocity, 0, runCmd, out prevNote, out prevVelocity); } else if (peek2 > 3 || peek2 < 1) { command = AddNoteEvent(cmd, reader.ReadByte(), 0, runCmd, out prevNote, out prevVelocity); } else { command = AddNoteEvent(cmd, reader.ReadByte(), reader.ReadByte(), runCmd, out prevNote, out prevVelocity); } } else if (cmd >= 0xCF) { var o = reader.Position; byte peek1 = reader.ReadByte(), peek2 = reader.ReadByte(), peek3 = reader.ReadByte(); reader.SetOffset(o); if (peek1 >= 128) { command = AddNoteEvent(prevNote, prevVelocity, 0, runCmd, out prevNote, out prevVelocity); } else if (peek2 >= 128) { command = AddNoteEvent(reader.ReadByte(), prevVelocity, 0, runCmd, out prevNote, out prevVelocity); } // TIE cannot have an added duration so it needs to stop here else if (cmd == 0xCF || peek3 > 3 || peek3 < 1) { command = AddNoteEvent(reader.ReadByte(), reader.ReadByte(), 0, runCmd, out prevNote, out prevVelocity); } else { command = AddNoteEvent(reader.ReadByte(), reader.ReadByte(), reader.ReadByte(), runCmd, out prevNote, out prevVelocity); } } #endregion #region Rests else if (cmd >= 0x80 && cmd <= 0xB0) { command = new RestCommand { Rest = SongEvent.RestFromCMD(0x80, cmd) } } ; #endregion #region Commands else if (runCmd < 0xCF && cmd < 0x80) // Commands within running status { switch (runCmd) { case 0xBD: command = new VoiceCommand { Voice = cmd }; break; case 0xBE: command = new VolumeCommand { Volume = cmd }; break; case 0xBF: command = new PanpotCommand { Panpot = (sbyte)(cmd - 0x40) }; break; case 0xC0: command = new BendCommand { Bend = (sbyte)(cmd - 0x40) }; break; case 0xC1: command = new BendRangeCommand { Range = cmd }; break; case 0xC2: command = new LFOSpeedCommand { Speed = cmd }; break; case 0xC3: command = new LFODelayCommand { Delay = cmd }; break; case 0xC4: command = new ModDepthCommand { Depth = cmd }; break; case 0xC5: command = new ModTypeCommand { Type = cmd }; break; case 0xC8: command = new TuneCommand { Tune = (sbyte)(cmd - 0x40) }; break; case 0xCD: command = new LibraryCommand { Command = cmd, Argument = reader.ReadByte() }; break; case 0xCE: command = new EndOfTieCommand { Note = (sbyte)cmd }; prevNote = cmd; break; } } else if (cmd > 0xB0 && cmd < 0xCF) { switch (cmd) { case 0xB1: // FINE & PREV case 0xB6: command = new M4AFinishCommand { Type = cmd }; break; case 0xB2: command = new GoToCommand { Offset = reader.ReadPointer() }; break; case 0xB3: command = new CallCommand { Offset = reader.ReadPointer() }; break; case 0xB4: command = new ReturnCommand(); break; case 0xB5: command = new RepeatCommand { Times = reader.ReadByte(), Offset = reader.ReadPointer() }; break; case 0xB9: command = new MemoryAccessCommand { Arg1 = reader.ReadByte(), Arg2 = reader.ReadByte(), Arg3 = reader.ReadByte() }; break; case 0xBA: command = new PriorityCommand { Priority = reader.ReadByte() }; break; case 0xBB: command = new TempoCommand { Tempo = (ushort)(reader.ReadByte() * 2) }; break; case 0xBC: command = new KeyShiftCommand { Shift = reader.ReadSByte() }; break; // Commands that work within running status: case 0xBD: command = new VoiceCommand { Voice = reader.ReadByte() }; break; case 0xBE: command = new VolumeCommand { Volume = reader.ReadByte() }; break; case 0xBF: command = new PanpotCommand { Panpot = (sbyte)(reader.ReadByte() - 0x40) }; break; case 0xC0: command = new BendCommand { Bend = (sbyte)(reader.ReadByte() - 0x40) }; break; case 0xC1: command = new BendRangeCommand { Range = reader.ReadByte() }; break; case 0xC2: command = new LFOSpeedCommand { Speed = reader.ReadByte() }; break; case 0xC3: command = new LFODelayCommand { Delay = reader.ReadByte() }; break; case 0xC4: command = new ModDepthCommand { Depth = reader.ReadByte() }; break; case 0xC5: command = new ModTypeCommand { Type = reader.ReadByte() }; break; case 0xC8: command = new TuneCommand { Tune = (sbyte)(reader.ReadByte() - 0x40) }; break; case 0xCD: command = new LibraryCommand { Command = reader.ReadByte(), Argument = reader.ReadByte() }; break; case 0xCE: // EOT sbyte note; if (reader.PeekByte() < 128) { note = reader.ReadSByte(); prevNote = (byte)note; } else { note = -1; } command = new EndOfTieCommand { Note = note }; break; default: Console.WriteLine("Invalid command: 0x{0:X} = {1}", reader.Position, cmd); break; } } #endregion Commands[i].Add(new SongEvent(off, command)); } } ICommand AddNoteEvent(byte note, byte velocity, byte addedDuration, byte runCmd, out byte prevNote, out byte prevVelocity) { return(new M4ANoteCommand { Note = (sbyte)(prevNote = note), Velocity = prevVelocity = velocity, Duration = (short)(runCmd == 0xCF ? -1 : (SongEvent.RestFromCMD(0xCF, runCmd) + addedDuration)) }); } }
public void Execute(Action <IRuntimeContext> action) { var command = new CallCommand(_root, action); _root.Add(command); }
/// <summary> /// Khởi tạo gói thông tin rỗng /// </summary> public DataPacket() { this.Name = null; this.Command = CallCommand.Null; }
/// <summary> /// POST /v1/calls - create an outbound SIP or PSTN Call /// </summary> /// <param name="cmd"></param> /// <param name="creds">(Optional) Overridden credentials for only this request</param> /// <returns></returns> public CallResponse Do(CallCommand cmd, Credentials creds = null) { return(Do(cmd, creds ?? Credentials)); }
public static CallRequestResponse Call(CallCommand cmd) { var jsonstring = ApiRequest.DoPostRequest(ApiRequest.GetBaseUriFor(typeof(Voice), "/call/json"), cmd); return(JsonConvert.DeserializeObject <CallRequestResponse>(jsonstring)); }
/// <summary> /// POST /v1/calls - create an outbound SIP or PSTN Call /// </summary> /// <param name="cmd"></param> /// <param name="creds">(Optional) Overridden credentials for only this request</param> /// <returns></returns> public static CallResponse Do(CallCommand cmd, Credentials creds = null) { var response = VersionedApiRequest.DoRequest("POST", ApiRequests.GetBaseUriFor(typeof(Call), "/v1/calls"), cmd, creds); return(JsonConvert.DeserializeObject <CallResponse>(response.JsonResponse)); }