private void SetAudio(VixenModules.Media.Audio.Audio value) { if (this.InvokeRequired) { this.Invoke(new SetAudioDelegate(SetAudio), value); } else { //Clean up any existing audio. if (audio != null) { audio.Dispose(); } audio = value; if (audio != null) { if (bw != null && bw.IsBusy) { bw.CancelAsync(); } CreateWorker(); bw.RunWorkerAsync(); Visible = true; // Make us visible if we have audio to display. } else { Visible = false; } this.Invalidate(); } }
public AutomaticMusicDetection(Audio audio) { InitializeComponent(); _audio = audio; _audio.FrequencyDetected += _audio_FrequencyDetected; freqTimer = new Timer(); freqTimer.Interval = 10; freqTimer.Tick += freqTimer_Tick; freqTimer.Enabled = true; this.numericUpDown1.Value = Accuracy; }
public BeatsAndBarsDialog(Audio audio) { InitializeComponent(); ForeColor = ThemeColorTable.ForeColor; BackColor = ThemeColorTable.BackgroundColor; var excludes = new List<Control>(); excludes.Add(BarsColorPanel); excludes.Add(BeatCountsColorPanel); excludes.Add(AllColorPanel); excludes.Add(BeatSplitsColorPanel); ThemeUpdateControls.UpdateControls(this, excludes); m_allowUpdates = false; m_toolTip = new ToolTip(); m_toolTip.AutoPopDelay = 5000; m_toolTip.InitialDelay = 500; m_toolTip.ReshowDelay = 500; m_toolTip.ShowAlways = true; m_toolTip.Active = true; m_toolTip.SetToolTip(AllFeaturesCB, "Single Collection containing all features"); m_toolTip.SetToolTip(BarsCB, "Single Collection containing starting location of each measure/bar"); m_toolTip.SetToolTip(BeatCountsCB, "Generates a beat collection for each beat count"); m_toolTip.SetToolTip(BeatSplitsCB, "Generates a beat collection for each beat count and each beat count split"); m_toolTip.SetToolTip(BeatsNameTB, "Base name of each collection"); m_toolTip.SetToolTip(AllColorPanel, "Color of All Features Collection"); m_toolTip.SetToolTip(BarsColorPanel, "Color of Bars Collection"); m_toolTip.SetToolTip(BeatCountsColorPanel, "Color of Beat Counts Collection"); m_toolTip.SetToolTip(BeatSplitsColorPanel, "Color of Beat Splits Collection"); m_settingsData = m_settingsData ?? new BeatBarSettingsData("Beats"); BarsCB.Checked = true; AllFeaturesCB.Checked = true; BeatCountsCB.Checked = true; BeatSplitsCB.Checked = false; m_allowUpdates = true; SetBeatBarOutputSettings(); m_previewWaveForm = new PreviewWaveform(audio); m_previewWaveForm.Width = musicStaff1.Width; m_previewWaveForm.Height = 75; m_previewWaveForm.Location = new Point(musicStaff1.Location.X, 25); musicStaff1.SettingChanged += MusicStaffSettingsChanged; PreviewGroupBox.Controls.Add(m_previewWaveForm); }
public PreviewWaveform(Audio audio) { InitializeComponent(); m_info = new TimeInfo(); m_info.TotalTime = new TimeSpan(0, 0, 0, 1); m_waveform = new Waveform(m_info); m_waveform.BorderStyle = BorderStyle.FixedSingle; m_waveform.Audio = audio; m_waveform.BackColor = Color.LightGray; m_waveform.Paint += PreviewWaveform_Paint; Controls.Add(m_waveform); }
public AutomaticMusicDetection(Audio audio) { InitializeComponent(); ForeColor = ThemeColorTable.ForeColor; BackColor = ThemeColorTable.BackgroundColor; ThemeUpdateControls.UpdateControls(this); _audio = audio; _audio.FrequencyDetected += _audio_FrequencyDetected; freqTimer = new Timer(); freqTimer.Interval = 10; freqTimer.Tick += freqTimer_Tick; freqTimer.Enabled = true; this.numericUpDown1.Value = Accuracy; }
private void numLowPass_ValueChanged(object sender, EventArgs e) { var media = _timedSequenceEditorForm.Sequence.GetAllMedia().First(); // IMediaModuleInstance media = _sequence.GetAllMedia().First(); _audio = media as Audio; _audio.FrequencyDetected += _audio_FrequencyDetected; _audio.LowPassFilterValue = (float) this.numLowPass.Value; }
private void chkHighPass_CheckedChanged(object sender, EventArgs e) { var media = _timedSequenceEditorForm.Sequence.GetAllMedia().First(); // IMediaModuleInstance media = _sequence.GetAllMedia().First(); _audio = media as Audio; _audio.FrequencyDetected += _audio_FrequencyDetected; _audio.HighPassFilterEnabled = this.chkHighPass.Checked; _audio.HighPassFilterValue = (float) this.numHighPass.Value; }
private void ChkAutoTapper_CheckedChanged(object sender, EventArgs e) { var media = _timedSequenceEditorForm.Sequence.GetAllMedia().First(); // IMediaModuleInstance media = _sequence.GetAllMedia().First(); _audio = media as Audio; _audio.FrequencyDetected += _audio_FrequencyDetected; _audio.DetectFrequeniesEnabled = ChkAutoTapper.Checked; }
private void btnAutoDetectionSettings_Click(object sender, EventArgs e) { if (_audio == null) { var media = _timedSequenceEditorForm.Sequence.GetAllMedia().First(); // IMediaModuleInstance media = _sequence.GetAllMedia().First(); _audio = media as Audio; } if (audioDetectionSettings == null) audioDetectionSettings = new AutomaticMusicDetection(_audio); audioDetectionSettings.Indexes = detectionIndexes; var result = audioDetectionSettings.ShowDialog(); if (result == System.Windows.Forms.DialogResult.OK) { detectionIndexes = audioDetectionSettings.Indexes; } }
private void updateControlsforPlaying() { groupBoxSelectedMarkCollection.Enabled = false; buttonPlay.Enabled = false; buttonStop.Enabled = true; groupBoxMode.Enabled = false; textBoxCurrentMark.Text = ""; groupBoxMarkCollections.Enabled = false; try { if (_audio != null) _audio.FrequencyDetected -= _audio_FrequencyDetected; var media = _timedSequenceEditorForm.Sequence.GetAllMedia().First(); // IMediaModuleInstance media = _sequence.GetAllMedia().First(); _audio = media as Audio; _audio.FrequencyDetected += _audio_FrequencyDetected; } catch (Exception) { } }
private void updateControlsforPlaying() { checkBoxEnabled.AutoCheck = false; radioButtonTapper.AutoCheck = false; radioButtonPlayback.AutoCheck = false; radioButtonTapper.ForeColor = radioButtonTapper.AutoCheck ? ThemeColorTable.ForeColor : ThemeColorTable.ForeColorDisabled; radioButtonPlayback.ForeColor = radioButtonTapper.AutoCheck ? ThemeColorTable.ForeColor : ThemeColorTable.ForeColorDisabled; textBoxCollectionName.Enabled = false; numericUpDownWeight.Enabled = false; panelColor.Enabled = false; groupBoxOperations.Enabled = false; buttonSelectAllMarks.Enabled = false; buttonAddOrUpdateMark.Enabled = false; textBoxTime.Enabled = false; buttonPlay.Enabled = false; buttonStop.Enabled = true; buttonRestartPlay.Enabled = false; textBoxCurrentMark.Text = ""; panelMarkCollectionsButtons.Enabled = false; try { if (_audio != null) _audio.FrequencyDetected -= _audio_FrequencyDetected; var media = _timedSequenceEditorForm.Sequence.GetAllMedia().First(); // IMediaModuleInstance media = _sequence.GetAllMedia().First(); _audio = media as Audio; _audio.FrequencyDetected += _audio_FrequencyDetected; } catch (Exception) { } }
public BeatsAndBars(Audio module) { m_audioModule = module; m_featureSet = null; }
/// <summary> /// Find the audio module and load the audio as a mono channel into memory /// </summary> public bool ReloadAudio(Audio audio) { if (audio == null) { throw new ArgumentNullException("audio"); } if (audio.Channels == 0) return false; _audioModule = audio; _audioSampleRate = _audioModule.Frequency; LoadAudioIntoMemory(); return true; }