public MainViewModel( IAudioService audioService, ICalibrationService calibrationService, IDictionaryService dictionaryService, IKeyStateService keyStateService, ISuggestionStateService suggestionService, ICapturingStateManager capturingStateManager, ILastMouseActionStateManager lastMouseActionStateManager, IInputService inputService, IKeyboardOutputService keyboardOutputService, IMouseOutputService mouseOutputService, IWindowManipulationService mainWindowManipulationService, List<INotifyErrors> errorNotifyingServices) { this.audioService = audioService; this.calibrationService = calibrationService; this.dictionaryService = dictionaryService; this.keyStateService = keyStateService; this.suggestionService = suggestionService; this.capturingStateManager = capturingStateManager; this.lastMouseActionStateManager = lastMouseActionStateManager; this.inputService = inputService; this.keyboardOutputService = keyboardOutputService; this.mouseOutputService = mouseOutputService; this.mainWindowManipulationService = mainWindowManipulationService; this.errorNotifyingServices = errorNotifyingServices; calibrateRequest = new InteractionRequest<NotificationWithCalibrationResult>(); SelectionMode = SelectionModes.Key; InitialiseKeyboard(mainWindowManipulationService); AttachScratchpadEnabledListener(); AttachKeyboardSupportsCollapsedDockListener(mainWindowManipulationService); AttachKeyboardSupportsSimulateKeyStrokesListener(); }
public MetronomeActionBuilder() { this.ticks = new List<MetronomeTick>(); this.audioService = new AudioServiceMock(MockBehavior.Loose); this.delayService = new DelayServiceMock(MockBehavior.Loose); this.loggerService = new LoggerServiceMock(MockBehavior.Loose); }
public QuestionViewModel(IQuestionService questionService, INavigationService navigationService, IBadgeService badgeService, ISettingsService settingsService, ILocalizationService localizationService, IAudioService audioService) { _questionService = questionService; _navigationService = navigationService; _badgeService = badgeService; _settingsService = settingsService; _localizationService = localizationService; _audioService = audioService; Messenger.Default.Register<Set>(this, Load); Messenger.Default.Register<CleanUp>(this, CallCleanUp); #if DEBUG if (IsInDesignMode) { SelectedQuestion = new Question(); BindQuestion(SelectedQuestion); ProgresLabel = "1/10"; CorrectAnswers = 0; IncorrectAnswers = 0; } #endif }
/// <summary> /// Get track samples /// </summary> /// <param name = "track">Track from which to gather samples</param> /// <param name = "proxy">Proxy used in gathering samples</param> /// <param name = "sampleRate">Sample rate used in gathering samples</param> /// <param name = "milliseconds">Milliseconds to gather</param> /// <param name = "startmilliseconds">Starting millisecond</param> /// <returns></returns> public static float[] GetTrackSamples(Track track, IAudioService proxy, int sampleRate, int milliseconds, int startmilliseconds) { if (track == null || track.Path == null) return null; //read 5512 Hz, Mono, PCM, with a specific audioService return proxy.ReadMonoFromFile(track.Path, sampleRate, milliseconds, startmilliseconds); }
public Pong() { graphics = new GraphicsDeviceManager(this); Content.RootDirectory = "Content"; audioService = new AudioService(); Services.AddService(typeof(IAudioService), audioService); }
public static Parser<DoNotAwaitAction> GetParser( int indentLevel, IAudioService audioService, IDelayService delayService, ILoggerService loggerService, ISpeechService speechService) { if (indentLevel < 0) { throw new ArgumentException("indentLevel must be greater than or equal to 0.", "indentLevel"); } audioService.AssertNotNull(nameof(audioService)); delayService.AssertNotNull(nameof(delayService)); loggerService.AssertNotNull(nameof(loggerService)); speechService.AssertNotNull(nameof(speechService)); return from _ in Parse.IgnoreCase("don't") from __ in HorizontalWhitespaceParser.Parser.AtLeastOnce() from ___ in Parse.IgnoreCase("wait:") from ____ in VerticalSeparationParser.Parser.AtLeastOnce() from actions in ActionListParser.GetParser(indentLevel + 1, audioService, delayService, loggerService, speechService) let child = new SequenceAction(actions) select new DoNotAwaitAction( loggerService, child); }
public void connect(String url, IAudioServiceCallBack callback, EventHandler openedEvt = null, EventHandler faultEvt = null) //url = "net.tcp://localhost:8080/AudioService" { try { duplex = new DuplexChannelFactory<IAudioService>(callback, new NetTcpBinding(), new EndpointAddress(url)); service = duplex.CreateChannel(); channel = (ICommunicationObject)service; IClientChannel c = (IClientChannel)channel; c.OperationTimeout = TimeSpan.FromSeconds(5); channel.Opened += new EventHandler(delegate(object o, EventArgs e) { Console.WriteLine("Connection ok!"); }); if(openedEvt != null) channel.Opened += openedEvt; if(faultEvt != null) channel.Faulted += faultEvt; channel.Faulted += new EventHandler(delegate(object o, EventArgs e) { Console.WriteLine("Connection lost"); }); } catch (Exception e) { Console.WriteLine("Connection error: " + e.Message); } }
public GameController( Game game, ICollisionDetectionService collisionDetectionService, IPlayerService playerService, IEnemyService enemyService, IInputService inputService, IHeadUpDisplayService headUpDisplayService, ITerrainService terrainService, IAudioService audioService) : base(game) { this.game = game; this.collisionDetectionService = collisionDetectionService; this.playerService = playerService; this.enemyService = enemyService; this.inputService = inputService; this.headUpDisplayService = headUpDisplayService; this.terrainService = terrainService; this.audioService = audioService; this.inputService.AnalogPauseChanged += delegate { this.isGamePaused = !this.isGamePaused; }; this.inputService.PauseChanged += delegate { this.isGamePaused = !this.isGamePaused; }; this.fadeEffect = "FadeIn"; }
public MainWindow( IAudioService audioService, IDictionaryService dictionaryService, IInputService inputService) { InitializeComponent(); this.audioService = audioService; this.dictionaryService = dictionaryService; this.inputService = inputService; managementWindowRequest = new InteractionRequest<NotificationWithServices>(); //Setup key binding (Alt-C and Shift-Alt-C) to open settings InputBindings.Add(new KeyBinding { Command = new DelegateCommand(RequestManagementWindow), Modifiers = ModifierKeys.Alt, Key = Key.M }); InputBindings.Add(new KeyBinding { Command = new DelegateCommand(RequestManagementWindow), Modifiers = ModifierKeys.Shift | ModifierKeys.Alt, Key = Key.M }); Title = string.Format(Properties.Resources.WINDOW_TITLE, DiagnosticInfo.AssemblyVersion); }
public DuplicatesDetectorService(IModelService modelService, IAudioService audioService, IFingerprintCommandBuilder fingerprintCommandBuilder, IQueryFingerprintService queryFingerprintService) { this.modelService = modelService; this.audioService = audioService; this.fingerprintCommandBuilder = fingerprintCommandBuilder; this.queryFingerprintService = queryFingerprintService; }
public EventSettingItem(EventSettingsViewModel eventSettingsViewModel, EventSetting eventSetting, IAudioService audioService, ISettingsService settingsService) { this.eventSettingsViewModel = eventSettingsViewModel; EventSetting = eventSetting; this.audioService = audioService; this.settingsService = settingsService; }
public static Parser<IAction> GetParser( int indentLevel, IAudioService audioService, IDelayService delayService, ILoggerService loggerService, ISpeechService speechService) { if (indentLevel < 0) { throw new ArgumentException("indentLevel must be greater than or equal to 0.", "indentLevel"); } audioService.AssertNotNull(nameof(audioService)); delayService.AssertNotNull(nameof(delayService)); loggerService.AssertNotNull(nameof(loggerService)); speechService.AssertNotNull(nameof(speechService)); return BreakActionParser.GetParser(delayService, speechService) .Or<IAction>(MetronomeActionParser.GetParser(audioService, delayService, loggerService)) .Or<IAction>(PrepareActionParser.GetParser(delayService, speechService)) .Or<IAction>(SayActionParser.GetParser(speechService)) .Or<IAction>(WaitActionParser.GetParser(delayService)) .Or<IAction>(DoNotAwaitActionParser.GetParser(indentLevel, audioService, delayService, loggerService, speechService)) .Or<IAction>(ParallelActionParser.GetParser(indentLevel, audioService, delayService, loggerService, speechService)) .Or<IAction>(SequenceActionParser.GetParser(indentLevel, audioService, delayService, loggerService, speechService)); }
public IQueryCommand UsingServices(IModelService modelService, IAudioService audioService) { this.modelService = modelService; createFingerprintMethod = () => fingerprintingMethodFromSelector() .WithFingerprintConfig(FingerprintConfiguration) .UsingServices(audioService); return this; }
public WinMisc(IFingerprintCommandBuilder fingerprintCommandBuilder, IAudioService audioService) { this.fingerprintCommandBuilder = fingerprintCommandBuilder; this.audioService = audioService; InitializeComponent(); Icon = Resources.Sound; }
public PlayerService(Game game, IInputService inputService, IAudioService audioService, IPlayerFactory playerFactory, ITerrainService terrainService) : base(game) { this.inputService = inputService; this.audioService = audioService; this.playerFactory = playerFactory; this.terrainService = terrainService; }
public AudioAction(IAudioService audioService, string audioName) { audioService.AssertNotNull(nameof(audioService)); audioName.AssertNotNull(nameof(audioName)); this.audioService = audioService; this.audioName = audioName; }
public TrackDaoTest() { trackDao = new TrackDao(); subFingerprintDao = new SubFingerprintDao(); hashBinDao = new HashBinDao(); fingerprintCommandBuilder = new FingerprintCommandBuilder(); audioService = new NAudioService(); }
public AudioAction(IAudioService audioService, string audioName) { Ensure.ArgumentNotNull(audioService, nameof(audioService)); Ensure.ArgumentNotNull(audioName, nameof(audioName)); this.audioService = audioService; this.audioName = audioName; }
public void SetUp() { proxy = new Mock<IBassServiceProxy>(MockBehavior.Strict); streamFactory = new Mock<IBassStreamFactory>(MockBehavior.Strict); resampler = new Mock<IBassResampler>(MockBehavior.Strict); audioService = new BassAudioService(proxy.Object, streamFactory.Object, resampler.Object); }
public MKVMergeDefaultSettingsService(EAC3ToConfiguration eac3toConfiguration, ApplicationSettings applicationSettings, BluRaySummaryInfo bluRaySummaryInfo, IMKVMergeLanguageService languageService, IAudioService audioService) { _eac3toConfiguration = eac3toConfiguration; _applicationSettings = applicationSettings; _bluRaySummaryInfo = bluRaySummaryInfo; _languageService = languageService; _audioService = audioService; }
public FingerprintService( IAudioService audioService, IFingerprintDescriptor fingerprintDescriptor, IWaveletDecomposition waveletDecomposition) { this.waveletDecomposition = waveletDecomposition; this.fingerprintDescriptor = fingerprintDescriptor; this.audioService = audioService; }
/// <summary> /// Get track samples /// </summary> /// <param name = "track">Track from which to gather samples</param> /// <param name = "proxy">Proxy used in gathering samples</param> /// <param name = "sampleRate">Sample rate used in gathering samples</param> /// <param name = "secondsToRead">Milliseconds to gather</param> /// <param name = "startAtSecond">Starting millisecond</param> /// <returns>Music samples</returns> public static float[] GetTrackSamples(Track track, IAudioService proxy, int sampleRate, int secondsToRead, int startAtSecond) { if (track == null || track.Path == null) { return null; } return proxy.ReadMonoFromFile(track.Path, sampleRate, secondsToRead, startAtSecond); }
public EAC3ToBatchFileWriteService(EAC3ToConfiguration eac3toConfiguration, IDirectorySystemService directorySystemService, List<BluRayDiscInfo> bluRayDiscInfo, IAudioService audioService, AbstractEAC3ToOutputNamingService eac3ToOutputNamingService, IEAC3ToCommonRulesValidatorService eac3ToCommonRulesValidatorService) { _bluRayDiscInfoList = bluRayDiscInfo; _eac3toConfiguration = eac3toConfiguration; _directorySystemService = directorySystemService; _audioService = audioService; _eac3ToOutputNamingService = eac3ToOutputNamingService; _eac3ToCommonRulesValidatorService = eac3ToCommonRulesValidatorService; _errors = new ErrorCollection(); }
public MetronomeAction(IAudioService audioService, IDelayService delayService, ILoggerService loggerService, IEnumerable<MetronomeTick> ticks) { audioService.AssertNotNull(nameof(audioService)); delayService.AssertNotNull(nameof(delayService)); loggerService.AssertNotNull(nameof(loggerService)); ticks.AssertNotNull(nameof(ticks)); this.ticks = ticks.ToImmutableList(); this.innerAction = new SequenceAction(GetInnerActions(audioService, delayService, loggerService, this.ticks)); }
public ManagementWindow( IAudioService audioService, IDictionaryService dictionaryService) { InitializeComponent(); //Instantiate ManagementViewModel and set as DataContext of ManagementView var managementViewModel = new ManagementViewModel(audioService, dictionaryService); this.ManagementView.DataContext = managementViewModel; }
public MKVMergeBatchFileWriteForEncodeService(BatchGuyEAC3ToSettings batchGuyEAC3ToSettings, IDirectorySystemService directorySystemService, IAudioService audioService, AbstractEAC3ToOutputNamingService eac3ToOutputNamingService, IEAC3ToCommonRulesValidatorService eac3ToCommonRulesValidatorService) { _batchGuyEAC3ToSettings = batchGuyEAC3ToSettings; _bluRayDiscInfoList = _batchGuyEAC3ToSettings.BluRayDiscs; _eac3toConfiguration = _batchGuyEAC3ToSettings.EAC3ToSettings; _directorySystemService = directorySystemService; _audioService = audioService; _eac3ToOutputNamingService = eac3ToOutputNamingService; _eac3ToCommonRulesValidatorService = eac3ToCommonRulesValidatorService; _errors = new ErrorCollection(); }
public FingerprintService( IAudioService audioService, FingerprintDescriptor fingerprintDescriptor, SpectrumService spectrumService, IWaveletService waveletService) { this.SpectrumService = spectrumService; this.WaveletService = waveletService; this.FingerprintDescriptor = fingerprintDescriptor; this.AudioService = audioService; }
public static Dictionary<Int32, QueryStats> QueryOneSongMinHashFast( string pathToSong, IStride queryStride, IAudioService proxy, DaoGateway dalManager, int seconds, int lshHashTables, int lshGroupsPerKey, int thresholdTables, int topWavelets, ref long queryTime) { ///*Fingerprint service*/ //fingerprintService service = new fingerprintService {TopWavelets = topWavelets}; //Stopwatch stopWatch = new Stopwatch(); //stopWatch.Start(); //int startIndex = -1; //Dictionary<Int32, QueryStats> stats = new Dictionary<Int32, QueryStats>(); //int lenOfQuery = service.SampleRate*seconds; //double[] samples = service.GetSamplesFromSong(proxy, pathToSong); //int startOfQuery = Random.Next(0, samples.Length - lenOfQuery); //double[] querySamples = new double[lenOfQuery]; //Array.Copy(samples, startOfQuery, querySamples, 0, lenOfQuery); //startIndex = startOfQuery/service.SampleRate; //MinHash minHash = new MinHash(dalManager); //IStride stride = queryStride; //int index = stride.FirstStrideSize(); //while (index + service.SamplesPerFingerprint < querySamples.Length) //{ // Fingerprint f = service.CreateFingerprintFromSamplesArray(querySamples, index); // if (f == null) continue; // index += service.SamplesPerFingerprint + stride.StrideSize(); // int[] bin = minHash.ComputeMinHashSignature(f); /*Compute Min Hash on randomly selected fingerprints*/ // Dictionary<int, long> hashes = minHash.GroupMinHashToLSHBuckets(bin, lshHashTables, lshGroupsPerKey); /*Find all candidates by querying the database*/ // long[] hashbuckets = hashes.Values.ToArray(); // var candidates = dalManager.ReadFingerprintsByHashBucketLSH(hashbuckets, thresholdTables); // if (candidates != null && candidates.Count > 0) // { // var query = (from candidate in candidates // select candidate.Value.Item1).Distinct(); // foreach (var item in query) // { // stats.Add(item, new QueryStats(0, 0, 0, startIndex, startIndex + seconds, 0)); // } // break; // } //} //stopWatch.Stop(); //queryTime = stopWatch.ElapsedMilliseconds; /*Set the query Time parameter*/ return null; }
public WinDrawningTool(IFingerprintService fingerprintService, IAudioService audioService, ITagService tagService, IWorkUnitBuilder workUnitBuilder, IFingerprintingConfiguration fingerprintingConfiguration) { this.fingerprintService = fingerprintService; this.audioService = audioService; this.tagService = tagService; this.workUnitBuilder = workUnitBuilder; this.fingerprintingConfiguration = fingerprintingConfiguration; InitializeComponent(); Icon = Resources.Sound; _lbImageTypes.Items.Add("Single file"); _lbImageTypes.Items.Add("Separated images"); }
public WinMain() { InitializeComponent(); Icon = Resources.Sound; audioService = new NAudioService(); modelService = new SqlModelService(); playAudioFileService = new NAudioPlayAudioFileService(); fingerprintCommandBuilder = new FingerprintCommandBuilder(); queryCommandBuilder = new QueryCommandBuilder(); tagService = new BassTagService(); permutationGeneratorService = new PermutationGeneratorService(); spectrumService = new SpectrumService(); imageService = new ImageService(); }
private void Start() { _audioService = MixedRealityToolkit.Instance.GetService <IAudioService>(); StartRoot(); }
/// <summary> /// Если трек не найден возвращает пустой класс Song /// </summary> public async Task <QueryResult> SeekSongAsync(IAudioService audioReader, string filePath) { return(await Task.Run(() => SeekSong(audioReader, filePath))); }
private static async Task <bool> ShowSplashScreen(IInputService inputService, IAudioService audioService, MainViewModel mainViewModel) { var taskCompletionSource = new TaskCompletionSource <bool>(); //Used to make this method awaitable on the InteractionRequest callback if (Settings.Default.ShowSplashScreen) { Log.Info("Showing splash screen."); var message = new StringBuilder(); message.AppendLine(string.Format(OptiKey.Properties.Resources.VERSION_DESCRIPTION, DiagnosticInfo.AssemblyVersion)); message.AppendLine(string.Format(OptiKey.Properties.Resources.KEYBOARD_AND_DICTIONARY_LANGUAGE_DESCRIPTION, Settings.Default.KeyboardAndDictionaryLanguage.ToDescription())); message.AppendLine(string.Format(OptiKey.Properties.Resources.UI_LANGUAGE_DESCRIPTION, Settings.Default.UiLanguage.ToDescription())); message.AppendLine(string.Format(OptiKey.Properties.Resources.POINTING_SOURCE_DESCRIPTION, Settings.Default.PointsSource.ToDescription())); var keySelectionSb = new StringBuilder(); keySelectionSb.Append(Settings.Default.KeySelectionTriggerSource.ToDescription()); switch (Settings.Default.KeySelectionTriggerSource) { case TriggerSources.Fixations: keySelectionSb.Append(string.Format(OptiKey.Properties.Resources.DURATION_FORMAT, Settings.Default.KeySelectionTriggerFixationDefaultCompleteTime.TotalMilliseconds)); break; case TriggerSources.KeyboardKeyDownsUps: keySelectionSb.Append(string.Format(" ({0})", Settings.Default.KeySelectionTriggerKeyboardKeyDownUpKey)); break; case TriggerSources.MouseButtonDownUps: keySelectionSb.Append(string.Format(" ({0})", Settings.Default.KeySelectionTriggerMouseDownUpButton)); break; } message.AppendLine(string.Format(OptiKey.Properties.Resources.KEY_SELECTION_TRIGGER_DESCRIPTION, keySelectionSb)); var pointSelectionSb = new StringBuilder(); pointSelectionSb.Append(Settings.Default.PointSelectionTriggerSource.ToDescription()); switch (Settings.Default.PointSelectionTriggerSource) { case TriggerSources.Fixations: pointSelectionSb.Append(string.Format(OptiKey.Properties.Resources.DURATION_FORMAT, Settings.Default.PointSelectionTriggerFixationCompleteTime.TotalMilliseconds)); break; case TriggerSources.KeyboardKeyDownsUps: pointSelectionSb.Append(string.Format(" ({0})", Settings.Default.PointSelectionTriggerKeyboardKeyDownUpKey)); break; case TriggerSources.MouseButtonDownUps: pointSelectionSb.Append(string.Format(" ({0})", Settings.Default.PointSelectionTriggerMouseDownUpButton)); break; } message.AppendLine(string.Format(OptiKey.Properties.Resources.POINT_SELECTION_DESCRIPTION, pointSelectionSb)); message.AppendLine(OptiKey.Properties.Resources.MANAGEMENT_CONSOLE_DESCRIPTION); message.AppendLine(OptiKey.Properties.Resources.WEBSITE_DESCRIPTION); inputService.RequestSuspend(); audioService.PlaySound(Settings.Default.InfoSoundFile, Settings.Default.InfoSoundVolume); mainViewModel.RaiseToastNotification( OptiKey.Properties.Resources.OPTIKEY_DESCRIPTION, message.ToString(), NotificationTypes.Normal, () => { inputService.RequestResume(); taskCompletionSource.SetResult(true); }); } else { taskCompletionSource.SetResult(false); } return(await taskCompletionSource.Task); }
public EnemySpawner(IAudioService audioService, Enemy enemy) { _audioService = audioService; _enemy = enemy; }
public AbstractEAC3ToOutputNamingService(IAudioService audioService) { _audioService = audioService; }
public ExerciseProgramsViewModel( IAudioService audioService, IDelayService delayService, IExerciseDocumentService exerciseDocumentService, IScheduler mainScheduler, IScheduler backgroundScheduler, ISpeechService speechService, IStateService stateService, IScreen hostScreen, ExerciseProgramViewModelFactory exerciseProgramViewModelFactory) { Ensure.ArgumentNotNull(audioService, nameof(audioService)); Ensure.ArgumentNotNull(delayService, nameof(delayService)); Ensure.ArgumentNotNull(exerciseDocumentService, nameof(exerciseDocumentService)); Ensure.ArgumentNotNull(mainScheduler, nameof(mainScheduler)); Ensure.ArgumentNotNull(backgroundScheduler, nameof(backgroundScheduler)); Ensure.ArgumentNotNull(speechService, nameof(speechService)); Ensure.ArgumentNotNull(stateService, nameof(stateService)); Ensure.ArgumentNotNull(hostScreen, nameof(hostScreen)); Ensure.ArgumentNotNull(exerciseProgramViewModelFactory, nameof(exerciseProgramViewModelFactory)); this.logger = LoggerService.GetLogger(this.GetType()); using (this.logger.Perf("Construction")) { this.activator = new ViewModelActivator(); this.exerciseDocumentService = exerciseDocumentService; this.stateService = stateService; this.hostScreen = hostScreen; this .WhenAnyValue(x => x.SelectedProgram) .Where(x => x != null) .SelectMany(x => this.hostScreen.Router.Navigate.Execute(x)) .SubscribeSafe(); var isActivated = this .GetIsActivated() .Publish() .RefCount(); var documentsFromCache = this .stateService .Get <string>(exerciseProgramsCacheKey) .Where(x => x != null) .Select(x => new DocumentSourceWith <string>(DocumentSource.Cache, x)); var documentsFromService = this .exerciseDocumentService .ExerciseDocument .Where(x => x != null) .Select(x => new DocumentSourceWith <string>(DocumentSource.Service, x)); var documents = isActivated .Select( activated => { if (activated) { return(documentsFromCache .Catch((Exception ex) => Observable <DocumentSourceWith <string> > .Empty) .Concat(documentsFromService) .Do(x => this.logger.Debug("Received document from {0}.", x.Source))); } else { return(Observable <DocumentSourceWith <string> > .Empty); } }) .Switch() .Publish(); var results = documents .ObserveOn(backgroundScheduler) .Select( x => { IResult <ExercisePrograms> parsedExercisePrograms; using (this.logger.Perf("Parsing exercise programs from {0}.", x.Source)) { parsedExercisePrograms = ExercisePrograms.TryParse(x.Item, audioService, delayService, speechService); } return(new DocumentSourceWith <IResult <ExercisePrograms> >(x.Source, parsedExercisePrograms)); }) .Publish(); var safeResults = results .Catch((Exception ex) => Observable <DocumentSourceWith <IResult <ExercisePrograms> > > .Empty); this.parseErrorMessage = safeResults .Select(x => x.Item.WasSuccessful ? null : x.Item.ToString()) .ToProperty(this, x => x.ParseErrorMessage, scheduler: mainScheduler); this.status = results .Select(x => !x.Item.WasSuccessful ? ExerciseProgramsViewModelStatus.ParseFailed : x.Source == DocumentSource.Cache ? ExerciseProgramsViewModelStatus.LoadedFromCache : ExerciseProgramsViewModelStatus.LoadedFromService) .Catch((Exception ex) => Observable.Return(ExerciseProgramsViewModelStatus.LoadFailed)) .ObserveOn(mainScheduler) .ToProperty(this, x => x.Status); this.model = safeResults .Select(x => x.Item.WasSuccessful ? x.Item.Value : null) .ToProperty(this, x => x.Model, scheduler: mainScheduler); this.programs = this .WhenAnyValue(x => x.Model) .Select(x => x == null ? null : x.Programs.Select(program => exerciseProgramViewModelFactory(program)).ToImmutableList()) .ObserveOn(mainScheduler) .ToProperty(this, x => x.Programs); var safeDocuments = documents .Catch((Exception ex) => Observable <DocumentSourceWith <string> > .Empty); safeDocuments .Where(x => x.Source == DocumentSource.Service) .SelectMany(x => this.stateService.Set(exerciseProgramsCacheKey, x.Item)) .SubscribeSafe(); results .Connect(); documents .Connect(); this .WhenActivated( disposables => { using (this.logger.Perf("Activation")) { this .hostScreen .Router .CurrentViewModel .OfType <ExerciseProgramsViewModel>() .SubscribeSafe(x => x.SelectedProgram = null) .AddTo(disposables); } }); } }
public AudioController(IAudioService audioService) { this._audioService = audioService; }
public Services(IInputService inputService, ConfigService configService, IViewService unityViewService, IEntityFactoryService entityFactoryService, IAudioService audioService) { this.inputService = inputService; this.configService = configService; this.unityViewService = unityViewService; this.entityFactoryService = entityFactoryService; this.audioService = audioService; }
public Worker(IServiceProvider serviceProvider, IConfiguration configuration, IAudioService audioService) { _applicationDbContext = serviceProvider.CreateScope().ServiceProvider.GetRequiredService <ApplicationDbContext>(); _serviceKey = configuration.GetSection("SpeechServiceKey").Value; _audioService = audioService; }
public static void KillEngine() { AudioPlayer = Xamarin.Forms.DependencyService.Get <IAudioService>(); AudioPlayer.KillEngine(); }
public static void AdjustVolume(double volume) { AudioPlayer = Xamarin.Forms.DependencyService.Get <IAudioService>(); AudioPlayer.AdjustVolume(volume); }
public HIPApi(ILoggingService logging = null, ISystemService system = null, ISwitchService switchService = null, IIOService io = null, IPhoneCallService phoneCall = null, ICameraService camera = null, IDisplayService display = null, IAudioService audio = null, IEmailService email = null) { _logging = logging; _system = system; _switch = switchService; _io = io; _phoneCall = phoneCall; _camera = camera; _display = display; _audio = audio; _email = email; }
public static IEnumerable <Song> GetSearchSongs(IAudioService service) { return(GetSearchSongs(service.AllSongs, service.IsSearchShuffle, service.SearchKey)); }
private static async Task <bool> CheckForUpdates(IInputService inputService, IAudioService audioService, MainViewModel mainViewModel) { var taskCompletionSource = new TaskCompletionSource <bool>(); //Used to make this method awaitable on the InteractionRequest callback try { if (Settings.Default.CheckForUpdates) { Log.InfoFormat("Checking GitHub for updates (repo owner:'{0}', repo name:'{1}').", GitHubRepoOwner, GitHubRepoName); var github = new GitHubClient(new ProductHeaderValue("OptiKids")); var releases = await github.Repository.Release.GetAll(GitHubRepoOwner, GitHubRepoName); var latestRelease = releases.FirstOrDefault(release => !release.Prerelease); if (latestRelease != null) { var currentVersion = new Version(DiagnosticInfo.AssemblyVersion); //Convert from string //Discard revision (4th number) as my GitHub releases are tagged with "vMAJOR.MINOR.PATCH" currentVersion = new Version(currentVersion.Major, currentVersion.Minor, currentVersion.Build); if (!string.IsNullOrEmpty(latestRelease.TagName)) { var tagNameWithoutLetters = new string(latestRelease.TagName.ToCharArray().Where(c => !char.IsLetter(c)).ToArray()); var latestAvailableVersion = new Version(tagNameWithoutLetters); if (latestAvailableVersion > currentVersion) { Log.InfoFormat( "An update is available. Current version is {0}. Latest version on GitHub repo is {1}", currentVersion, latestAvailableVersion); inputService.RequestSuspend(); audioService.PlaySound(Settings.Default.InfoSoundFile, Settings.Default.InfoSoundVolume); mainViewModel.RaiseToastNotification(OptiKids.Properties.Resources.UPDATE_AVAILABLE, string.Format(OptiKids.Properties.Resources.URL_DOWNLOAD_PROMPT, latestRelease.TagName), NotificationTypes.Normal, () => taskCompletionSource.SetResult(true)); } else { Log.Info("No update found."); taskCompletionSource.SetResult(false); } } else { Log.Info("Unable to determine if an update is available as the latest release lacks a tag."); taskCompletionSource.SetResult(false); } } else { Log.Info("No releases found."); taskCompletionSource.SetResult(false); } } else { Log.Info("Check for update is disabled - skipping check."); taskCompletionSource.SetResult(false); } } catch (Exception ex) { Log.ErrorFormat("Error when checking for updates. Exception message:{0}\nStackTrace:{1}", ex.Message, ex.StackTrace); taskCompletionSource.SetResult(false); } return(await taskCompletionSource.Task); }
/// <summary> /// Initializes a new instance of the <see cref="ClipAudio"/> class. /// </summary> /// <param name="audioService">The audio service.</param> /// <param name="folderBrowserDialogProvider">The folder browser dialog.</param> public ClipAudio(IAudioService audioService, IFolderBrowserDialogProvider folderBrowserDialogProvider) : base(audioService, folderBrowserDialogProvider) { }
public HomeController(IWebHostEnvironment appEnvironment, MusicDbContext dbContext, IAudioService audioService) { _appEnvironment = appEnvironment; _dbContext = dbContext; _audioService = audioService; }
public static IInputService CreateInputService( IKeyStateService keyStateService, IDictionaryService dictionaryService, IAudioService audioService, ICalibrationService calibrationService, ICapturingStateManager capturingStateManager, List <INotifyErrors> errorNotifyingServices) { Log.Info("Creating InputService."); //Instantiate point source IPointSource pointSource; switch (Settings.Default.PointsSource) { case PointsSources.GazeTracker: pointSource = new GazeTrackerSource( Settings.Default.PointTtl, Settings.Default.GazeTrackerUdpPort, new Regex(GazeTrackerUdpRegex)); break; case PointsSources.TheEyeTribe: var theEyeTribePointService = new TheEyeTribePointService(); errorNotifyingServices.Add(theEyeTribePointService); pointSource = new PointServiceSource( Settings.Default.PointTtl, theEyeTribePointService); break; case PointsSources.TobiiEyeX: case PointsSources.TobiiRex: case PointsSources.TobiiPcEyeGo: var tobiiEyeXPointService = new TobiiEyeXPointService(); var tobiiEyeXCalibrationService = calibrationService as TobiiEyeXCalibrationService; if (tobiiEyeXCalibrationService != null) { tobiiEyeXCalibrationService.EyeXHost = tobiiEyeXPointService.EyeXHost; } errorNotifyingServices.Add(tobiiEyeXPointService); pointSource = new PointServiceSource( Settings.Default.PointTtl, tobiiEyeXPointService); break; case PointsSources.MousePosition: pointSource = new MousePositionSource( Settings.Default.PointTtl); break; default: throw new ArgumentException("'PointsSource' settings is missing or not recognised! Please correct and restart OptiKey."); } //Instantiate key trigger source ITriggerSource keySelectionTriggerSource; switch (Settings.Default.KeySelectionTriggerSource) { case TriggerSources.Fixations: keySelectionTriggerSource = new KeyFixationSource( Settings.Default.KeySelectionTriggerFixationLockOnTime, Settings.Default.KeySelectionTriggerFixationResumeRequiresLockOn, Settings.Default.KeySelectionTriggerFixationDefaultCompleteTime, Settings.Default.KeySelectionTriggerFixationCompleteTimesByIndividualKey ? Settings.Default.KeySelectionTriggerFixationCompleteTimesByKeyValues : null, Settings.Default.KeySelectionTriggerIncompleteFixationTtl, pointSource.Sequence); break; case TriggerSources.KeyboardKeyDownsUps: keySelectionTriggerSource = new KeyboardKeyDownUpSource( Settings.Default.KeySelectionTriggerKeyboardKeyDownUpKey, pointSource.Sequence); break; case TriggerSources.MouseButtonDownUps: keySelectionTriggerSource = new MouseButtonDownUpSource( Settings.Default.KeySelectionTriggerMouseDownUpButton, pointSource.Sequence); break; default: throw new ArgumentException( "'KeySelectionTriggerSource' setting is missing or not recognised! Please correct and restart OptiKey."); } //Instantiate point trigger source ITriggerSource pointSelectionTriggerSource; switch (Settings.Default.PointSelectionTriggerSource) { case TriggerSources.Fixations: pointSelectionTriggerSource = new PointFixationSource( Settings.Default.PointSelectionTriggerFixationLockOnTime, Settings.Default.PointSelectionTriggerFixationCompleteTime, Settings.Default.PointSelectionTriggerLockOnRadiusInPixels, Settings.Default.PointSelectionTriggerFixationRadiusInPixels, pointSource.Sequence); break; case TriggerSources.KeyboardKeyDownsUps: pointSelectionTriggerSource = new KeyboardKeyDownUpSource( Settings.Default.PointSelectionTriggerKeyboardKeyDownUpKey, pointSource.Sequence); break; case TriggerSources.MouseButtonDownUps: pointSelectionTriggerSource = new MouseButtonDownUpSource( Settings.Default.PointSelectionTriggerMouseDownUpButton, pointSource.Sequence); break; default: throw new ArgumentException( "'PointSelectionTriggerSource' setting is missing or not recognised! " + "Please correct and restart OptiKey."); } var inputService = new InputService(keyStateService, dictionaryService, audioService, capturingStateManager, pointSource, keySelectionTriggerSource, pointSelectionTriggerSource); inputService.RequestSuspend(); //Pause it initially return(inputService); }
/// <summary> /// Initialize a new instance of the <see cref="InactivePlayerEventArgs"/> class. /// </summary> /// <param name="audioService">the audio service</param> /// <param name="player">the affected player</param> public InactivePlayerEventArgs(IAudioService audioService, LavalinkPlayer player) { AudioService = audioService ?? throw new ArgumentNullException(nameof(audioService)); Player = player ?? throw new ArgumentNullException(nameof(player)); }
public PopularListProviderViewModel(IAudioService audioService, IAudioController audioController) : base(audioService, audioController) { }
/// <summary> /// Initializes a new instance of the <see cref="ActionBase{TSettings}"/> class. /// </summary> /// <param name="audioService">The audio service.</param> public ActionBase(IAudioService audioService) => this.AudioService = audioService;
/// <summary> /// Добавляет треки только форматом mp3 или wav. При не соотвестивии выходит из метода без ошибок /// </summary> public async void InsertSongToDBAsync(IAudioService audioReader, string filePath) { await Task.Run(() => InsertSongToDB(audioReader, filePath)); }
/// <summary> /// Initializes a new instance of the <see cref="MonitorPowerup" /> class. /// </summary> /// <param name="variableService">The variable service.</param> /// <param name="resourceService">The resource service.</param> /// <param name="entityService">The entity service.</param> public MonitorPowerup(IVariableService variableService, IResourceService resourceService, IEntityService entityService, IAudioService audioService) : base(variableService, resourceService) { if (resourceService == null) { throw new ArgumentNullException(nameof(resourceService)); } if (variableService == null) { throw new ArgumentNullException(nameof(variableService)); } if (entityService == null) { throw new ArgumentNullException(nameof(entityService)); } if (audioService == null) { throw new ArgumentNullException(nameof(audioService)); } _audioService = audioService; _entityService = entityService; _variableService = variableService; _resourceService = resourceService; _resourceService.PreloadResource <Sprite>("mpowerup"); _resourceService.PreloadResource <Sound>("ring"); }
protected AbstractTrackDaoTest() { fingerprintCommandBuilder = new FingerprintCommandBuilder(); audioService = new NAudioService(); }
/// <summary> /// Initializes a new instance of the <see cref="SetAppAudioDevice" /> class. /// </summary> /// <param name="audioService">The audio service.</param> /// <param name="appAudioService">The application audio service.</param> public SetAppAudioDevice(IAudioService audioService, IAppAudioService appAudioService) : base(audioService) { this.AppAudioService = appAudioService; }
[Inject] // Zenject scans every monobehaviour in the scene for the // inject attribute at scene start. public void Construct(IAudioService audioService) { _audioService = audioService; }
public AudioModule(IAudioService audioService, InactivityTrackingService trackingService) { _audioService = audioService; trackingService.InactivePlayer += Disconnect; }
public InputSourceController(IAudioService audioService) { _audioService = audioService; }
/// <summary> /// Если трек не найден возвращает пустой класс Song /// </summary> public QueryResult SeekSong(IAudioService audioReader, string filePath) { float[] audio = audioReader.ReadMonoFromFile(filePath, 44100); return(AnalysAndMatching(audio)); }
public MetronomeActionBuilder WithAudioService(IAudioService audioService) { this.audioService = audioService; return(this); }
public HomeController(ILogService logService, ILedControlService ledControlService, IAudioService audioService) { this.logService = logService; this.ledControlService = ledControlService; this.audioService = audioService; }