public Recorder(RecorderOptions options) { _options = options; _startTrigger = new Trigger(options.TriggerVolume, options.TriggerDuration, true); _endTrigger = new Trigger(options.EndTriggerVolume, options.EndTriggerDuration, false); _buffer = new FrameInfoBuffer(options.MinClipSeparation); }
static RecorderOptions OptionsFromArgs() { var args = GetCommandLineArgs(); var options = new RecorderOptions(); for (int i = 0; i < args.Length; i++) { var command = args[i].ToLower(); if(command == "--outdir") { options.OutputDirectory = args[++i]; } else if (command == "--triggerduration") { options.TriggerDuration = TimeSpan.FromMilliseconds(double.Parse(args[++i])); } else if (command == "--triggervolume") { options.TriggerVolume = double.Parse(args[++i]); } else if(command =="--endtriggerduration") { options.EndTriggerDuration = TimeSpan.FromMilliseconds(double.Parse(args[++i])); } else if(command == "--endtriggervolume") { options.EndTriggerVolume = double.Parse(args[++i]); } else if(command == "--minclipseparation") { options.MinClipSeparation = TimeSpan.FromMilliseconds(double.Parse(args[++i])); } else if(command == "--url") { options.Url = args[++i]; } else if(command == "--debug") { options.Debug = true; } else { if(!string.IsNullOrEmpty(command)) Console.WriteLine($"Unrecognized command: {command}"); } } return options; }