Пример #1
0
        public static int Connect(string name)
        {
            wetMidiKeyboard = Melanchall.DryWetMidi.Devices.InputDevice.GetByName(name);
            {
                try
                {
                    wetMidiKeyboard.EventReceived += MidiKeyboard_EventReceived;
                    wetMidiKeyboard.StartEventsListening();
                    cts = new CancellationTokenSource();


                    Task.Run(() =>
                    {
                        //var keyPlayLists = mtk.ArrangeKeyPlays(mtk.Index);
                        NoteProcess(cts.Token);
                    }, cts.Token);
                }
                catch (Exception e)
                {
                    MessageBox.Show($"连接错误 \r\n {e.Message}", "错误", MessageBoxButtons.OK, MessageBoxIcon.Error);
                }
            }

            return(0);
        }
Пример #2
0
        public MainViewModel()
        {
            VersionString = _programVersion.ToString();

            HttpWebRequest request = (HttpWebRequest)WebRequest.Create("https://api.github.com/repos/ianespana/ShawzinBot/releases/latest");

            request.UserAgent = "request";
            try
            {
                using (HttpWebResponse response = (HttpWebResponse)request.GetResponse())
                    using (StreamReader sr = new StreamReader(response.GetResponseStream()))
                        using (JsonReader reader = new JsonTextReader(sr))
                        {
                            JsonSerializer serializer = new JsonSerializer();
                            GitVersion     p          = serializer.Deserialize <GitVersion>(reader);
                            if (!(p.draft || p.prerelease) && p.tag_name != _programVersion.ToString())
                            {
                                VersionString = _programVersion.ToString() + " - Update available!";
                            }
                        }
            }
            catch (WebException ex)
            {
                Console.WriteLine(ex);
            }

            MidiInputs.Add(new MidiInputModel("None"));

            foreach (var device in InputDevice.GetAll())
            {
                MidiInputs.Add(new MidiInputModel(device.Name));
            }

            SelectedMidiInput = MidiInputs[0];

            MidiSpeeds.Add(new MidiSpeedModel("0.25", 0.25));
            MidiSpeeds.Add(new MidiSpeedModel("0.5", 0.5));
            MidiSpeeds.Add(new MidiSpeedModel("0.75", 0.75));
            MidiSpeeds.Add(new MidiSpeedModel("Normal", 1));
            MidiSpeeds.Add(new MidiSpeedModel("1.25", 1.25));
            MidiSpeeds.Add(new MidiSpeedModel("1.5", 1.5));
            MidiSpeeds.Add(new MidiSpeedModel("1.75", 1.75));
            MidiSpeeds.Add(new MidiSpeedModel("2", 2));

            SelectedMidiSpeed = MidiSpeeds[3];

            EnableVibrato       = Properties.Settings.Default.EnableVibrato;
            TransposeNotes      = Properties.Settings.Default.TransposeNotes;
            PlayThroughSpeakers = Properties.Settings.Default.PlayThroughSpeakers;
            PlaybackCurrentTimeWatcher.Instance.PollingInterval = TimeSpan.FromSeconds(1);
        }
Пример #3
0
        public MainViewModel()
        {
            MidiInputs.Add(new MidiInputModel("None"));

            foreach (var device in InputDevice.GetAll())
            {
                MidiInputs.Add(new MidiInputModel(device.Name));
            }

            SelectedMidiInput = MidiInputs[0];

            EnableVibrato       = Properties.Settings.Default.EnableVibrato;
            TransposeNotes      = Properties.Settings.Default.TransposeNotes;
            PlayThroughSpeakers = Properties.Settings.Default.PlayThroughSpeakers;
        }
Пример #4
0
        public MainViewModel()
        {
            MidiInputs.Add(new MidiInputModel("None"));

            foreach (var device in InputDevice.GetAll())
            {
                MidiInputs.Add(new MidiInputModel(device.Name));
            }

            SelectedMidiInput = MidiInputs[0];

            EnableVibrato       = Properties.Settings.Default.EnableVibrato;
            TransposeNotes      = Properties.Settings.Default.TransposeNotes;
            PlayThroughSpeakers = Properties.Settings.Default.PlayThroughSpeakers;
            PlaybackCurrentTimeWatcher.Instance.PollingInterval = TimeSpan.FromSeconds(1);
        }