Пример #1
0
        /// <summary>
        /// Вопроизведение
        /// </summary>
        /// <param name="num">Номер блока, с которого начинать</param>
        public static void Play(int num)
        {
            block = num;
            if (num >= Project.TAP.Count)
            {
                return;
            }
            if (Plaing)
            {
                Stop();
            }

            //Подготовка данных
            WAVmaker.BlockToWav(Project.TAP[num]);
            Player.s = 0;
            Player.c = WAVmaker.wav.Count();

            //Инициализация звуковой системы
            try
            {
                player = new Player();
                player.SetWaveFormat(SampleRate, 1);
                waveOut = new WaveOut();
                waveOut.DeviceNumber   = Properties.Settings.Default.AudioPlay;
                waveOut.DesiredLatency = 200; // длина буфера /2=50 миллисекунд
                waveOut.Init(player);
                waveOut.Play();
                Plaing = true;
                Program.mainform.PlayerIndication(num);
            }
            catch
            {
                Program.Error(Lang.msgAudioDeviceError);
            }
        }
Пример #2
0
        /// <summary>
        /// Сохранение "тапа" в "вавку"
        /// </summary>
        private void SaveToWAV(object sender, EventArgs e)
        {
            SaveFileDialog dialog = new SaveFileDialog()
            {
                Filter = Lang.FilterWAV
            };

            if (dialog.ShowDialog() != DialogResult.OK)
            {
                return;
            }
            WAVmaker.Save(dialog.FileName);
        }