private void btnNewPreset_ButtonPressed(QButton Button) { QInputBox ib = new QInputBox(this, Localization.Get(UI_Key.Dialog_Equalizer_New_Preset), Localization.Get(UI_Key.Dialog_Equalizer_New_Preset_Title), String.Empty, 24, 1); if (ib.DialogResult == DialogResult.OK) { if (equalizers.ContainsKey(ib.Value)) { QMessageBox.Show(this, Localization.Get(UI_Key.Dialog_Equalizer_Duplicate_Preset, ib.Value), Localization.Get(UI_Key.Dialog_Equalizer_Duplicate_Preset_Title), QMessageBoxIcon.Error); } else { float[] d = new float[MAX_NUM_BANDS]; Array.Copy(CurrentEqualizer.Values, d, MAX_NUM_BANDS); EqualizerSetting es = new EqualizerSetting(ib.Value, d, false); equalizers.Add(ib.Value, es); populateEqualizerList(); CurrentEqualizer = es; } } }
public void Update(Track Template) { if ((this.ChangeType & ChangeType.WriteTags) != ChangeType.WriteTags) { this.filePath = Template.filePath; this.fileName = Template.fileName; this.type = Template.type; this.title = Template.title; this.album = Template.album; this.artist = Template.artist; this.albumArtist = Template.albumArtist; this.composer = Template.composer; this.grouping = Template.grouping; this.genre = Template.genre; this.duration = Template.duration; this.trackNum = Template.trackNum; this.diskNum = Template.diskNum; this.year = Template.year; this.bitrate = Template.bitrate; this.compilation = Template.compilation; this.fileDate = Template.fileDate; this.encoder = Template.encoder; this.numChannels = Template.numChannels; this.sampleRate = Template.sampleRate; this.equalizer = Template.equalizer; this.ChangeType = Template.ChangeType; this.replayGainAlbum = Template.replayGainAlbum; this.replayGainTrack = Template.replayGainTrack; UpdateMainGroup(); this.toStringDirty = true; this.searchStringDirty = true; } }
public static string GetString(EqualizerSetting ES) { if (ES == null) { return(DontChange); } else if (ES.IsOff) { return(TurnOff); } else { return(ES.ToString()); } }
public Track(int ID, string FilePath, FileType Type, string Title, string Album, string Artist, string AlbumArtist, string Composer, string Grouping, string Genre, int Length, int TrackNum, int DiskNum, int Year, int PlayCount, int Rating, int Bitrate, long FileSize, bool Compilation, DateTime FileDate, DateTime LastPlayedDate, DateTime AddDate, string Encoder, int NumChannels, int SampleRate, ChangeType ChangeType, EqualizerSetting Eq, float ReplayGainAlbum, float ReplayGainTrack) { this.id = ID; this.type = Type; this.filePath = FilePath; this.fileName = Path.GetFileName(FilePath); this.title = Title; this.album = Album; this.artist = Artist; this.albumArtist = AlbumArtist; this.composer = Composer; this.grouping = Grouping; this.genre = Genre; this.duration = Length; this.trackNum = TrackNum; this.diskNum = DiskNum; this.year = Year; this.playCount = PlayCount; this.rating = Rating; this.bitrate = Bitrate; this.fileSize = FileSize; this.compilation = Compilation; this.fileDate = FileDate; this.lastPlayedDate = LastPlayedDate; this.addDate = AddDate; this.encoder = Encoder; this.numChannels = NumChannels; this.sampleRate = SampleRate; this.ChangeType = ChangeType; this.equalizer = Eq; this.replayGainAlbum = ReplayGainAlbum; this.replayGainTrack = ReplayGainTrack; this.Exists = null; UpdateMainGroup(); this.toStringDirty = true; this.searchStringDirty = true; }
private void reset(QButton Sender) { EqualizerSetting es = DefaultEqualizerSettings.FirstOrDefault(s => s.Name == CurrentEqualizer.Name); if (es == null) { for (int i = 0; i < numBands; i++) { scrollBars[i].Value = 0; CurrentEqualizer.Values[i] = 0; } } else { float[] f = (numBands == 10) ? compressBands(es.Values) : es.Values; for (int i = 0; i < numBands; i++) { scrollBars[i].Value = (int)f[i]; CurrentEqualizer.Values[i] = f[i]; } } EqChanged.Invoke(); }
public void SetEqualizer(string EqName) { this.Equalizer = EqualizerSetting.GetSetting(EqName, QuuxPlayer.Equalizer.GetEqualizerSettings()); }
private void textbox_BeforeShowIntellisense(object sender, QuuxControls.BeforeShowIntellisenseEventArgs e) { if (textbox.IsCommentedOrQuoted(textbox.CaretLocation)) { e.Cancel = true; return; } string w = textbox.CaretIsAfterWhiteSpaceOrParen ? textbox.LastWord : textbox.WordBeforeCurrent; List <string> ww = textbox.WordsBeforeCursor; bool modifierSection = ww.Contains("SortBy", StringComparer.InvariantCultureIgnoreCase) || ww.Contains("SelectBy", StringComparer.InvariantCultureIgnoreCase) || ww.Contains("LimitTo", StringComparer.InvariantCultureIgnoreCase); if (modifierSection) { switch (w.ToLower()) { case "sortby": case "selectby": case "thenby": e.Values = orderableFieldsComplete; break; case "tracks": case "kilobytes": case "megabytes": case "gigabytes": case "days": case "hours": case "minutes": case "seconds": case "ascending": case "descending": e.Values = modifierStarts.ToList(); adjustModifierSection(e, ww); break; case "limitto": e.Cancel = true; break; default: if (w == "ascending" || w == "descending" || orderableFieldsComplete.Contains(w, StringComparer.InvariantCultureIgnoreCase)) { e.Values = modifierStarts.ToList(); // copy since the list will be changed adjustModifierSection(e, ww); string wbwbc = textbox.WordBeforeWordBeforeCurrent.ToLower(); if (wbwbc == "selectby" || wbwbc == "sortby" || wbwbc == "thenby") { e.Values = e.Values.Union(modifierEnds).ToList(); } } else { string wbwbc = textbox.WordBeforeWordBeforeCurrent.ToLower(); if (wbwbc == "limitto") { e.Values = limitTypes; } else { e.Cancel = true; } } break; } } else { if (w.Length > 0) { if (numericFields.Contains(w, StringComparer.InvariantCultureIgnoreCase)) { e.Values = numericComparitors; } else if (stringFields.Contains(w, StringComparer.InvariantCultureIgnoreCase)) { switch (w.ToLower()) { case "track": e.Values = new List <string>() { "ContainedIn", "NotContainedIn" }; break; default: e.Values = stringComparitors; break; } } else if (numericFields.Contains(w, StringComparer.InvariantCultureIgnoreCase)) { e.Values = numericComparitors; } else if (binaryFields.Contains(w, StringComparer.InvariantCultureIgnoreCase)) { e.Values = new List <string>() { "Is" }; } else if (operatorsComplete.Contains(w, StringComparer.InvariantCultureIgnoreCase)) { e.Values = allFieldsAndModifierStarts; } else if (comparitorsComplete.Contains(w, StringComparer.InvariantCultureIgnoreCase)) { e.ValueNeedsQuoting = true; switch (textbox.WordBeforeWordBeforeCurrent.ToLower()) { case "artist": e.Values = Database.GetArtists(); e.Values.Insert(0, BLANK_KEY); e.QuoteException = BLANK_KEY; break; case "albumartist": e.Values = Database.GetAlbumArtists(); e.Values.Insert(0, BLANK_KEY); e.QuoteException = BLANK_KEY; break; case "album": e.Values = Database.GetAlbums(); e.Values.Insert(0, BLANK_KEY); e.QuoteException = BLANK_KEY; break; case "genre": e.Values = Database.GetGenres(); e.Values.Insert(0, BLANK_KEY); e.QuoteException = BLANK_KEY; break; case "grouping": e.Values = Database.GetGroupings(); e.Values.Insert(0, BLANK_KEY); e.QuoteException = BLANK_KEY; break; case "composer": e.Values = Database.GetComposers(); e.Values.Insert(0, BLANK_KEY); e.QuoteException = BLANK_KEY; break; case "track": e.Values = Database.GetPlaylists(); break; case "compilation": e.Values = trueOrFalse; e.ValueNeedsQuoting = false; break; case "mono": e.Values = trueOrFalse; e.ValueNeedsQuoting = false; break; case "encoder": e.Values = Database.GetEncoders(); e.Values.Insert(0, BLANK_KEY); e.QuoteException = BLANK_KEY; break; case "equalizer": e.Values = EqualizerSetting.GetAllSettingStrings(Equalizer.GetEqualizerSettings()); break; case "filetype": e.Values = Database.GetFileTypes(); break; case "title": e.Values = Database.GetTitles(); e.Values.Insert(0, BLANK_KEY); e.QuoteException = BLANK_KEY; break; case "year": e.Values = Database.GetYears(); break; case "rating": e.Values = new List <string>() { "0", "1", "2", "3", "4", "5" }; break; default: e.Cancel = true; break; } } else if (w == "byalbum" || w == "bytrack") { e.Values = allFieldsAndModifierStarts; } else if (w.Length > 0) { e.Values = operatorsAndModifiers; } else { e.Values = allFieldsAndModifierStarts; } } else { e.Values = allStarts; } } }
public Equalizer() { instance = this; this.DoubleBuffered = true; _currentEqualizer = EqualizerSetting.Off; scrollBars = new QScrollBar[MAX_NUM_BANDS]; for (int i = 0; i < MAX_NUM_BANDS; i++) { QScrollBar qsb = new QScrollBar(false); qsb.Max = SCALE; qsb.Min = -SCALE; qsb.LargeChange = LARGE_CHANGE; qsb.Value = 0; qsb.Brightness = QScrollBar.SBBrightness.Dim; qsb.UserScroll += new QScrollBar.ScrollDelegate(scroll); this.Controls.Add(qsb); qsb.Tag = i; scrollBars[i] = qsb; } btnOn = new QButton(Localization.Get(UI_Key.Equalizer_Eq_Off), true, false); btnOn.BackColor = Color.Black; cboName = new QComboBox(true); cboName.Location = new Point(HORIZ_MARGIN, BUTTON_TOPS + btnOn.Height / 2 - cboName.Height / 2); cboName.DropDownStyle = ComboBoxStyle.DropDownList; cboName.SelectedValueChanged += new EventHandler(cboName_SelectedValueChanged); this.Controls.Add(cboName); btnOn.ButtonPressed += new QButton.ButtonDelegate(turnOn); this.Controls.Add(btnOn); btnLockPreset = new QButton(Localization.Get(UI_Key.Equalizer_Lock), true, false); btnLockPreset.BackColor = Color.Black; btnLockPreset.ButtonPressed += new QButton.ButtonDelegate(btnLockPreset_ButtonPressed); this.Controls.Add(btnLockPreset); btnFineControl = new QButton(Localization.Get(UI_Key.Equalizer_Fine_Control), true, false); btnFineControl.BackColor = Color.Black; btnFineControl.Value = false; btnFineControl.ButtonPressed += (s) => { if (btnFineControl.Value) { btnAllTogether.Value = false; } }; this.Controls.Add(btnFineControl); btnAllTogether = new QButton(Localization.Get(UI_Key.Equalizer_All_Together), true, false); btnAllTogether.BackColor = Color.Black; btnAllTogether.Value = false; btnAllTogether.ButtonPressed += (s) => { if (btnAllTogether.Value) { btnFineControl.Value = false; } }; this.Controls.Add(btnAllTogether); btnExpand = new QButton(Localization.Get(UI_Key.Equalizer_Expand), false, false); btnExpand.BackColor = Color.Black; btnExpand.ButtonPressed += new QButton.ButtonDelegate(expand); this.Controls.Add(btnExpand); btnCompress = new QButton(Localization.Get(UI_Key.Equalizer_Compress), false, false); btnCompress.BackColor = Color.Black; btnCompress.ButtonPressed += new QButton.ButtonDelegate(compress); this.Controls.Add(btnCompress); btnReset = new QButton(Localization.Get(UI_Key.Equalizer_Reset), false, false); btnReset.BackColor = Color.Black; btnReset.ButtonPressed += new QButton.ButtonDelegate(reset); this.Controls.Add(btnReset); btnRemovePreset = new QButton(Localization.Get(UI_Key.Equalizer_Remove), false, false); btnRemovePreset.BackColor = Color.Black; btnRemovePreset.ButtonPressed += new QButton.ButtonDelegate(btnRemovePreset_ButtonPressed); this.Controls.Add(btnRemovePreset); btnNewPreset = new QButton(Localization.Get(UI_Key.Equalizer_New), false, false); btnNewPreset.BackColor = Color.Black; btnNewPreset.ButtonPressed += new QButton.ButtonDelegate(btnNewPreset_ButtonPressed); this.Controls.Add(btnNewPreset); btnNumBands = new QButton(Localization.Get(UI_Key.Equalizer_Bands, "10"), false, false); btnNumBands.BackColor = Color.Black; btnNumBands.ButtonPressed += new QButton.ButtonDelegate(btnNumBands_ButtonPressed); this.Controls.Add(btnNumBands); fullButtonsWidth = getButtonsWidth(); }
static EqualizerSetting() { Off = new EqualizerSetting(); }
protected override void OnPaint(PaintEventArgs e) { base.OnPaint(e); maxWidth = art.Left - MARGIN; int ypos = MARGIN; secondColPosn = TextRenderer.MeasureText(Localization.Get(UI_Key.File_Info_Num_Channels_Sample_Rate), Styles.Font).Width + 15; int w = this.ClientRectangle.Width - MARGIN - MARGIN; ypos = renderLine(e, ypos, Localization.Get(UI_Key.File_Info_Title), track.Title); ypos += SECTION_SPACING; ypos = renderLine(e, ypos, Localization.Get(UI_Key.File_Info_Artist), track.Artist); ypos = renderLine(e, ypos, Localization.Get(UI_Key.File_Info_Album), track.Album); if (track.AlbumArtist.Length > 0) { ypos = renderLine(e, ypos, Localization.Get(UI_Key.File_Info_Album_Artist), track.AlbumArtist); } if (track.Compilation) { ypos = renderLine(e, ypos, Localization.Get(UI_Key.File_Info_Compilation), Localization.Get(UI_Key.File_Info_Yes)); } if (track.MainGroup != track.Artist) { ypos = renderLine(e, ypos, Localization.Get(UI_Key.File_Info_Referenced_As), track.MainGroup); } ypos += SECTION_SPACING; ypos = renderLine(e, ypos, Localization.Get(UI_Key.File_Info_Length), track.DurationInfoLong); ypos += SECTION_SPACING; if (track.TrackNum > 0) { ypos = renderLine(e, ypos, Localization.Get(UI_Key.File_Info_Track_Number), track.TrackNumString); } if (track.DiskNum > 0) { ypos = renderLine(e, ypos, Localization.Get(UI_Key.File_Info_Disk_Number), track.DiskNumString); } if (track.TrackNum > 0 || track.DiskNum > 0) { ypos += SECTION_SPACING; } if (track.Genre.Length > 0) { ypos = renderLine(e, ypos, Localization.Get(UI_Key.File_Info_Genre), track.Genre); } if (track.Grouping.Length > 0) { ypos = renderLine(e, ypos, Localization.Get(UI_Key.File_Info_Grouping), track.Grouping); } if (track.Composer.Length > 0) { ypos = renderLine(e, ypos, Localization.Get(UI_Key.File_Info_Composer), track.Composer); } if (track.YearString.Length > 0) { ypos = renderLine(e, ypos, Localization.Get(UI_Key.File_Info_Year), track.YearString); } if (track.RatingString.Length > 0) { ypos = renderLine(e, ypos, Localization.Get(UI_Key.File_Info_Rating), track.RatingString); } ypos = renderLine(e, ypos, Localization.Get(UI_Key.File_Info_Play_Count), track.PlayCountString); ypos += SECTION_SPACING; ypos = renderLine(e, ypos, Localization.Get(UI_Key.File_Info_File_Type_File_Size), track.TypeString + " / " + track.FileSizeString); ypos = renderLine(e, ypos, Localization.Get(UI_Key.File_Info_Bit_Rate_Encoder), (track.BitrateString + " / ") + ((track.Encoder.Length > 0) ? track.Encoder : "Unknown")); ypos = renderLine(e, ypos, Localization.Get(UI_Key.File_Info_Num_Channels_Sample_Rate), track.NumChannelsString + " / " + track.SampleRateString + " Hz"); float trg = track.ReplayGainTrack; //AudioStreamFile.GetReplayGain(track, ReplayGain.Track, false); float arg = track.ReplayGainAlbum; //AudioStreamFile.GetReplayGain(track, ReplayGain.Album, false); if (trg != 0.0f || arg != 0.0f) { ypos = renderLine(e, ypos, Localization.Get(UI_Key.File_Info_Replay_Gain), "Track: " + trg.ToString("0.0") + "dB / Album: " + arg.ToString("0.0") + "dB"); } ypos += SECTION_SPACING; ypos = renderLine(e, ypos, Localization.Get(UI_Key.File_Info_Last_Played), track.LastPlayedDate.Year > 1980 ? track.LastPlayedDate.ToString() + " (" + (DateTime.Now - track.LastPlayedDate).TotalDays.ToString("0.00") + " Days Ago)" : "Never"); ypos = renderLine(e, ypos, Localization.Get(UI_Key.File_Info_Date_Modified), track.FileDate.ToString()); ypos = renderLine(e, ypos, Localization.Get(UI_Key.File_Info_Date_Added), track.AddDate.ToString()); if (track.Equalizer != null) { ypos += SECTION_SPACING; ypos = renderLine(e, ypos, Localization.Get(UI_Key.File_Info_Equalizer), EqualizerSetting.GetString(track.Equalizer)); } ypos += SECTION_SPACING; ypos = renderLine(e, ypos, Localization.Get(UI_Key.File_Info_File_Path), track.FilePath); if (!track.ConfirmExists) { ypos = renderLine(e, ypos, Localization.Get(UI_Key.File_Info_Ghost), Localization.YES); } this.Height = this.SizeFromClientSize(new Size(this.ClientRectangle.Width, ypos + btnOK.Height + MARGIN + MARGIN)).Height; if (btnEdit == null) { PlaceButtons(this.ClientRectangle.Width, this.ClientRectangle.Height - MARGIN - btnOK.Height); } else { PlaceButtons(this.ClientRectangle.Width, this.ClientRectangle.Height - MARGIN - btnOK.Height, btnOK, btnEdit); } }