Beispiel #1
0
 private void getMidiDevices()
 {
     foreach (KeyValuePair <int, string> device in NAudioMidi.GetDevices())
     {
         midiDeviceComboBox.Items.Insert(device.Key, device.Value);
     }
     try { midiDeviceComboBox.SelectedIndex = SettingsReader <int> .Read("midiDeviceNo"); }
     catch { }
 }
Beispiel #2
0
        private static void midiSend()
        {
            if (currentTrack.isMidiNote == false && currentTrack.midiFile != null)
            {
                NAudioMidi.PlayFile(currentTrack.midiFile);
                return;
            }

            NAudioMidi.Send(currentTrack.midiNote);
            //NAudioMidi.playFile(@"D:\00000\ttt.midi");
        }
Beispiel #3
0
        internal static void Stop()
        {
            if (tempPlayer != null)
            {
                tempPlayer.Stop();
                tempPlayer = null;
            }

            player.Stop();
            NAudioMidi.Stop();
            status(STOP);
        }
Beispiel #4
0
        private static void getNext()
        {
            NAudioMidi.Stop();

            if (currentTrack.isPlaylistTrack)
            {
                currentKey++;
                status(TRACK_STOPPED);
            }
            switch (currentTrack.next)
            {
            case nextTrack.bgRandom:
                BgPlay();
                break;

            case nextTrack.next:
                if (currentKey >= mainPlayList.tracks.Count)
                {
                    MessageBox.Show("Данный трек последний в плейлисте, поэтому воспроизвести следующий трек невозможно.", "ПОСЛЕДНИЙ ТРЕК В ПЛЕЙЛИСТЕ", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                    Stop();
                    break;
                }
                else
                {
                    Play(mainPlayList.tracks[currentKey], currentKey);
                }
                break;

            case nextTrack.bgConcrete:
                if (bgMain != null)
                {
                    Play(bgMain, currentKey);
                }
                else
                {
                    BgPlay();
                }
                break;

            case nextTrack.cycle:
                Play(currentTrack, currentKey);
                break;

            case nextTrack.pause:
                Stop();
                break;

            default:
                Stop();
                break;
            }
        }
Beispiel #5
0
 private void sendMidiButton_Click(object sender, EventArgs e)
 {
     NAudioMidi.Send((int)midiUpDown.Value);
 }
Beispiel #6
0
        /// <summary>
        /// Инициализация устройств
        /// </summary>
        internal static void Init()
        {
            /// MIDI Выход
            int midiDevice = 0;

            midiDevice = SettingsReader <int> .Read("midiDeviceNo");

            try
            {
                NAudioMidi.Init(midiDevice);
            }
            catch
            {
                MessageBox.Show("MIDI устройство сохранённое в настройках не найдено");
                NAudioMidi.Init(0);
            }

            playerBgVolume = SettingsReader <int> .Read("bgVolume");


            /// Инициализация OSC протокола
            ip = SettingsReader <string> .Read("oscIP");

            port = SettingsReader <int> .Read("oscPORT");

            ip   = ip ?? "127.0.0.1";
            port = (port != 0) ? port : 7000;

            OSC.init(ip, port);

            /// Инициализация плеера
            string setPlayer = SettingsReader <string> .Read("defaultPlayer");

            if (player == null || player.name != setPlayer)
            {
                if (setPlayer != null)
                {
                    switch (SettingsReader <string> .Read("defaultPlayer"))
                    {
                    case "naudio":
                        player = new NAudioPlayer();
                        break;

                    case "aimp":
                        player = new AIMPPlayer();
                        break;
                    }
                }
                else
                {
                    player = new AIMPPlayer();
                }
            }

            // TODO Временное решение!!!!!!
            string value = SettingsReader <string> .Read("bgPlaylistFolder");

            if (value != null)
            {
                bgPlaylist = new BgPlaylist(value);
            }
        }