private void EQ_coef_apply_Click(object sender, EventArgs e) { equalizer_temp.filter_selection[0] = (effect_EQ.Filter_type)Enum.Parse(typeof(effect_EQ.Filter_type), filter_selection1.SelectedIndex.ToString()); equalizer_temp.filter_selection[1] = (effect_EQ.Filter_type)Enum.Parse(typeof(effect_EQ.Filter_type), filter_selection2.SelectedIndex.ToString()); equalizer_temp.filter_selection[2] = (effect_EQ.Filter_type)Enum.Parse(typeof(effect_EQ.Filter_type), filter_selection3.SelectedIndex.ToString()); equalizer_temp.filter_selection[3] = (effect_EQ.Filter_type)Enum.Parse(typeof(effect_EQ.Filter_type), filter_selection4.SelectedIndex.ToString()); equalizer_temp.filter_selection[4] = (effect_EQ.Filter_type)Enum.Parse(typeof(effect_EQ.Filter_type), filter_selection5.SelectedIndex.ToString()); equalizer_temp.filter_selection[5] = (effect_EQ.Filter_type)Enum.Parse(typeof(effect_EQ.Filter_type), filter_selection6.SelectedIndex.ToString()); equalizer_temp.filter_selection[6] = (effect_EQ.Filter_type)Enum.Parse(typeof(effect_EQ.Filter_type), filter_selection7.SelectedIndex.ToString()); equalizer_temp.filter_selection[7] = (effect_EQ.Filter_type)Enum.Parse(typeof(effect_EQ.Filter_type), filter_selection8.SelectedIndex.ToString()); equalizer_temp.filter_selection[8] = (effect_EQ.Filter_type)Enum.Parse(typeof(effect_EQ.Filter_type), filter_selection9.SelectedIndex.ToString()); equalizer_temp.filter_selection[9] = (effect_EQ.Filter_type)Enum.Parse(typeof(effect_EQ.Filter_type), filter_selection10.SelectedIndex.ToString()); equalizer_temp.gain[0] = double.Parse(gain1.Text); equalizer_temp.gain[1] = double.Parse(gain2.Text); equalizer_temp.gain[2] = double.Parse(gain3.Text); equalizer_temp.gain[3] = double.Parse(gain4.Text); equalizer_temp.gain[4] = double.Parse(gain5.Text); equalizer_temp.gain[5] = double.Parse(gain6.Text); equalizer_temp.gain[6] = double.Parse(gain7.Text); equalizer_temp.gain[7] = double.Parse(gain8.Text); equalizer_temp.gain[8] = double.Parse(gain9.Text); equalizer_temp.gain[9] = double.Parse(gain10.Text); equalizer_temp.fc[0] = int.Parse(fc1.Text); equalizer_temp.fc[1] = int.Parse(fc2.Text); equalizer_temp.fc[2] = int.Parse(fc3.Text); equalizer_temp.fc[3] = int.Parse(fc4.Text); equalizer_temp.fc[4] = int.Parse(fc5.Text); equalizer_temp.fc[5] = int.Parse(fc6.Text); equalizer_temp.fc[6] = int.Parse(fc7.Text); equalizer_temp.fc[7] = int.Parse(fc8.Text); equalizer_temp.fc[8] = int.Parse(fc9.Text); equalizer_temp.fc[9] = int.Parse(fc10.Text); equalizer_temp.Q_factor[0] = double.Parse(Q_factor1.Text); equalizer_temp.Q_factor[1] = double.Parse(Q_factor2.Text); equalizer_temp.Q_factor[2] = double.Parse(Q_factor3.Text); equalizer_temp.Q_factor[3] = double.Parse(Q_factor4.Text); equalizer_temp.Q_factor[4] = double.Parse(Q_factor5.Text); equalizer_temp.Q_factor[5] = double.Parse(Q_factor6.Text); equalizer_temp.Q_factor[6] = double.Parse(Q_factor7.Text); equalizer_temp.Q_factor[7] = double.Parse(Q_factor8.Text); equalizer_temp.Q_factor[8] = double.Parse(Q_factor9.Text); equalizer_temp.Q_factor[9] = double.Parse(Q_factor10.Text); //gen_UI_EQ_coef(); equalizer_temp.update_coef(); }
public void openAudioFileToolStripMenuItem_Click(object sender, EventArgs e) { //for second load music OpenFileDialog open = new OpenFileDialog(); open_temp = open; open.Filter = "(*.wav;*.mp3)| *.wav; *.mp3"; if (open.ShowDialog() != DialogResult.OK) { return; } if (audio_player != null && audio_player.stop_flag == false) { audio_player.StopPlaying(); } Get_audio_file_information_and_refresh_reader(); sampling_rate = Audio_reader.WaveFormat.SampleRate; int bits_per_sample = Audio_reader.WaveFormat.BitsPerSample; audio_channel = Audio_reader.WaveFormat.Channels; int buflen = (int)(Math.Floor((double)Audio_reader.Length)); //refresh effect parameter equalizer.sampling_rate = sampling_rate; equalizer.samples_per_frame = Samples_per_frame; equalizer.audio_channels = audio_channel; equalizer.update_coef(); equalizer.init_memory(); three_band_drc.update_music_information(sampling_rate, Samples_per_frame, audio_channel); real_time_fft.ini_parameter(sampling_rate, Samples_per_frame, audio_channel); // bgw_play = new BackgroundWorker(); audio_player = new audio_player_with_effect_class(real_time_fft, three_band_drc, equalizer, bgw_play, Audio_reader, buflen, In_total_byte_per_frame, Samples_per_frame); bgw_play.DoWork += new DoWorkEventHandler(bgw_start_playing); bgw_play.ProgressChanged += new ProgressChangedEventHandler(bgw_get_current_time); bgw_play.RunWorkerCompleted += new RunWorkerCompletedEventHandler(bgw_run_worker_complete); bgw_play.WorkerReportsProgress = true; bgw_play.WorkerSupportsCancellation = true; Label_current_time.Text = (string)"00:00"; trackbar_playing_time.Value = 0; start_playing_button.Enabled = true; Pause_button.Enabled = false; stop_button.Enabled = false; volume.Enabled = true; volume_UI = volume.Value; audio_player.volume = (float)(((double)volume_UI) / 100); peak_meter.Value = 0; }