Example #1
0
        private void load(KaraokeRulesetConfigManager config, IBindable <IReadOnlyList <Mod> > mods, IBindable <WorkingBeatmap> beatmap, EditorBeatmap editorBeatmap)
        {
            if (editorBeatmap != null)
            {
                return;
            }

            this.beatmap = beatmap.Value.Beatmap;

            var disableMicrophoneDeviceByMod = mods.Value.OfType <IApplicableToMicrophone>().Any(x => !x.MicrophoneEnabled);

            if (disableMicrophoneDeviceByMod)
            {
                return;
            }

            var beatmapSaitenable = beatmap.Value.Beatmap.IsScorable();

            if (!beatmapSaitenable)
            {
                return;
            }

            var selectedDevice = config.GetBindable <string>(KaraokeRulesetSetting.MicrophoneDevice).Value;
            var microphoneList = new MicrophoneManager().MicrophoneDeviceNames.ToList();

            // Find index by selection id
            var deviceIndex = microphoneList.IndexOf(selectedDevice);

            AddHandler(new OsuTKMicrophoneHandler(deviceIndex));
        }
        private void load(KaraokeRulesetConfigManager config, IBindable <IReadOnlyList <Mod> > mods, IBindable <WorkingBeatmap> beatmap, KaraokeSessionStatics session, EditorBeatmap editorBeatmap)
        {
            if (editorBeatmap != null)
            {
                session.Set(KaraokeRulesetSession.SaitenStatus, SaitenStatusMode.Edit);
                return;
            }

            this.beatmap = beatmap.Value.Beatmap;

            var disableMicrophoneDeviceByMod = mods.Value.OfType <IApplicableToMicrophone>().Any(x => !x.MicrophoneEnabled);

            if (disableMicrophoneDeviceByMod)
            {
                session.Set(KaraokeRulesetSession.SaitenStatus, SaitenStatusMode.AutoPlay);
                return;
            }

            var beatmapSaitenable = beatmap.Value.Beatmap.IsScorable();

            if (!beatmapSaitenable)
            {
                session.Set(KaraokeRulesetSession.SaitenStatus, SaitenStatusMode.NotSaitening);
                return;
            }

            try
            {
                var selectedDevice = config.GetBindable <string>(KaraokeRulesetSetting.MicrophoneDevice).Value;
                var microphoneList = new MicrophoneManager().MicrophoneDeviceNames.ToList();

                // Find index by selection id
                var deviceIndex = microphoneList.IndexOf(selectedDevice);
                AddHandler(new OsuTKMicrophoneHandler(deviceIndex));

                session.Set(KaraokeRulesetSession.SaitenStatus, SaitenStatusMode.Saitening);
            }
            catch (Exception ex)
            {
                Logger.Error(ex, "Microphone initialize error.");
                // todo : set real error by exception
                session.Set(KaraokeRulesetSession.SaitenStatus, SaitenStatusMode.WindowsMicrophonePermissionDeclined);
            }
        }
Example #3
0
 private void load(KaraokeRulesetConfigManager config, KaraokeSessionStatics session)
 {
     preemptTimeSliderBar.Current = config.GetBindable <double>(KaraokeRulesetSetting.PracticePreemptTime);
     session.BindWith(KaraokeRulesetSession.NowLyric, lyricPreview.SelectedLyric);
 }
Example #4
0
 private void load(KaraokeRulesetConfigManager config)
 {
     preemptTimeSliderBar.Bindable = config.GetBindable <double>(KaraokeRulesetSetting.PracticePreemptTime);
 }