2010-04-07 18:26:04 +02:00
|
|
|
/* This file is part of Clementine.
|
2010-11-20 14:27:10 +01:00
|
|
|
Copyright 2010, David Sansome <me@davidsansome.com>
|
2010-04-07 18:26:04 +02:00
|
|
|
|
|
|
|
Clementine is free software: you can redistribute it and/or modify
|
|
|
|
it under the terms of the GNU General Public License as published by
|
|
|
|
the Free Software Foundation, either version 3 of the License, or
|
|
|
|
(at your option) any later version.
|
|
|
|
|
|
|
|
Clementine is distributed in the hope that it will be useful,
|
|
|
|
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
GNU General Public License for more details.
|
|
|
|
|
|
|
|
You should have received a copy of the GNU General Public License
|
|
|
|
along with Clementine. If not, see <http://www.gnu.org/licenses/>.
|
|
|
|
*/
|
|
|
|
|
|
|
|
#include "equalizer.h"
|
2010-05-10 23:50:31 +02:00
|
|
|
#include "ui_equalizer.h"
|
2010-04-07 18:26:04 +02:00
|
|
|
|
2010-04-07 19:39:07 +02:00
|
|
|
#include <QInputDialog>
|
|
|
|
#include <QMessageBox>
|
2010-12-14 18:55:08 +01:00
|
|
|
#include <QSettings>
|
|
|
|
#include <QShortcut>
|
|
|
|
#include <QtDebug>
|
2010-04-07 18:26:04 +02:00
|
|
|
|
2013-04-27 05:05:42 +02:00
|
|
|
#include "ui/iconloader.h"
|
|
|
|
#include "widgets/equalizerslider.h"
|
|
|
|
|
2010-04-07 18:26:04 +02:00
|
|
|
// We probably don't need to translate these, right?
|
2014-02-07 16:34:20 +01:00
|
|
|
const char* Equalizer::kGainText[] = {"60", "170", "310", "600", "1k",
|
|
|
|
"3k", "6k", "12k", "14k", "16k"};
|
2010-04-07 18:26:04 +02:00
|
|
|
|
|
|
|
const char* Equalizer::kSettingsGroup = "Equalizer";
|
|
|
|
|
2014-02-07 16:34:20 +01:00
|
|
|
Equalizer::Equalizer(QWidget* parent)
|
|
|
|
: QDialog(parent), ui_(new Ui_Equalizer), loading_(false) {
|
2010-05-10 23:50:31 +02:00
|
|
|
ui_->setupUi(this);
|
2010-04-07 18:26:04 +02:00
|
|
|
|
2010-05-19 17:45:29 +02:00
|
|
|
// Icons
|
|
|
|
ui_->preset_del->setIcon(IconLoader::Load("list-remove"));
|
|
|
|
ui_->preset_save->setIcon(IconLoader::Load("document-save"));
|
|
|
|
|
2010-04-07 18:26:04 +02:00
|
|
|
preamp_ = AddSlider(tr("Pre-amp"));
|
|
|
|
|
2010-05-10 23:50:31 +02:00
|
|
|
QFrame* line = new QFrame(ui_->slider_container);
|
2010-04-07 18:26:04 +02:00
|
|
|
line->setFrameShape(QFrame::VLine);
|
|
|
|
line->setFrameShadow(QFrame::Sunken);
|
2010-05-10 23:50:31 +02:00
|
|
|
ui_->slider_container->layout()->addWidget(line);
|
2010-04-07 18:26:04 +02:00
|
|
|
|
2014-02-07 16:34:20 +01:00
|
|
|
for (int i = 0; i < kBands; ++i) gain_[i] = AddSlider(kGainText[i]);
|
2010-04-08 17:13:34 +02:00
|
|
|
|
|
|
|
// Must be done before the signals are connected
|
|
|
|
ReloadSettings();
|
|
|
|
|
2010-05-10 23:50:31 +02:00
|
|
|
connect(ui_->enable, SIGNAL(toggled(bool)), SIGNAL(EnabledChanged(bool)));
|
2014-02-07 16:34:20 +01:00
|
|
|
connect(ui_->enable, SIGNAL(toggled(bool)), ui_->slider_container,
|
|
|
|
SLOT(setEnabled(bool)));
|
2010-05-10 23:50:31 +02:00
|
|
|
connect(ui_->enable, SIGNAL(toggled(bool)), SLOT(Save()));
|
2014-02-07 16:34:20 +01:00
|
|
|
connect(ui_->preset, SIGNAL(currentIndexChanged(int)),
|
|
|
|
SLOT(PresetChanged(int)));
|
2010-05-10 23:50:31 +02:00
|
|
|
connect(ui_->preset_save, SIGNAL(clicked()), SLOT(SavePreset()));
|
|
|
|
connect(ui_->preset_del, SIGNAL(clicked()), SLOT(DelPreset()));
|
2014-02-07 16:34:20 +01:00
|
|
|
connect(ui_->balance_slider, SIGNAL(valueChanged(int)),
|
|
|
|
SLOT(StereoSliderChanged(int)));
|
2010-12-14 18:55:08 +01:00
|
|
|
|
|
|
|
QShortcut* close = new QShortcut(QKeySequence::Close, this);
|
|
|
|
connect(close, SIGNAL(activated()), SLOT(close()));
|
2010-05-10 23:50:31 +02:00
|
|
|
}
|
|
|
|
|
2014-02-07 16:34:20 +01:00
|
|
|
Equalizer::~Equalizer() { delete ui_; }
|
2010-04-07 18:26:04 +02:00
|
|
|
|
|
|
|
void Equalizer::ReloadSettings() {
|
|
|
|
QSettings s;
|
|
|
|
s.beginGroup(kSettingsGroup);
|
|
|
|
|
2010-04-07 19:39:07 +02:00
|
|
|
presets_.clear();
|
2010-05-10 23:50:31 +02:00
|
|
|
ui_->preset->clear();
|
2010-04-07 18:26:04 +02:00
|
|
|
|
2010-04-07 19:39:07 +02:00
|
|
|
// Load presets
|
|
|
|
int count = s.beginReadArray("presets");
|
2014-02-07 16:34:20 +01:00
|
|
|
for (int i = 0; i < count; ++i) {
|
2010-04-07 19:39:07 +02:00
|
|
|
s.setArrayIndex(i);
|
|
|
|
AddPreset(s.value("name").toString(),
|
|
|
|
s.value("params").value<Equalizer::Params>());
|
2010-04-07 18:26:04 +02:00
|
|
|
}
|
2010-04-07 19:39:07 +02:00
|
|
|
s.endArray();
|
|
|
|
|
2014-02-07 16:34:20 +01:00
|
|
|
if (count == 0) LoadDefaultPresets();
|
2010-04-07 19:39:07 +02:00
|
|
|
|
|
|
|
// Selected preset
|
|
|
|
QString selected_preset = s.value("selected_preset", "Custom").toString();
|
2014-02-07 16:34:20 +01:00
|
|
|
QString selected_preset_display_name =
|
|
|
|
QString(tr(qPrintable(selected_preset)));
|
2011-03-23 01:42:35 +01:00
|
|
|
int selected_index = ui_->preset->findText(selected_preset_display_name);
|
2014-02-07 16:34:20 +01:00
|
|
|
if (selected_index != -1) ui_->preset->setCurrentIndex(selected_index);
|
2010-04-07 19:39:07 +02:00
|
|
|
|
|
|
|
// Enabled?
|
2010-05-10 23:50:31 +02:00
|
|
|
ui_->enable->setChecked(s.value("enabled", false).toBool());
|
|
|
|
ui_->slider_container->setEnabled(ui_->enable->isChecked());
|
2010-04-07 18:26:04 +02:00
|
|
|
|
2013-04-27 05:05:42 +02:00
|
|
|
int stereo_balance = s.value("stereo_balance", 0).toInt();
|
|
|
|
ui_->balance_slider->setValue(stereo_balance);
|
|
|
|
StereoSliderChanged(stereo_balance);
|
|
|
|
|
2010-04-08 17:13:34 +02:00
|
|
|
PresetChanged(selected_preset);
|
2010-04-07 19:39:07 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
void Equalizer::LoadDefaultPresets() {
|
2014-02-07 16:34:20 +01:00
|
|
|
AddPreset(QT_TRANSLATE_NOOP("Equalizer", "Custom"),
|
|
|
|
Params(0, 0, 0, 0, 0, 0, 0, 0, 0, 0));
|
|
|
|
AddPreset(QT_TRANSLATE_NOOP("Equalizer", "Classical"),
|
|
|
|
Params(0, 0, 0, 0, 0, 0, -40, -40, -40, -50));
|
|
|
|
AddPreset(QT_TRANSLATE_NOOP("Equalizer", "Club"),
|
|
|
|
Params(0, 0, 20, 30, 30, 30, 20, 0, 0, 0));
|
|
|
|
AddPreset(QT_TRANSLATE_NOOP("Equalizer", "Dance"),
|
|
|
|
Params(50, 35, 10, 0, 0, -30, -40, -40, 0, 0));
|
2014-01-05 08:19:39 +01:00
|
|
|
// Dubstep equalizer created by Devyn Collier Johnson
|
2014-02-07 16:34:20 +01:00
|
|
|
AddPreset(QT_TRANSLATE_NOOP("Equalizer", "Dubstep"),
|
|
|
|
Params(0, 36, 85, 58, 30, 0, 36, 60, 96, 62, 0));
|
|
|
|
AddPreset(QT_TRANSLATE_NOOP("Equalizer", "Full Bass"),
|
|
|
|
Params(70, 70, 70, 40, 20, -45, -50, -55, -55, -55));
|
|
|
|
AddPreset(QT_TRANSLATE_NOOP("Equalizer", "Full Treble"),
|
|
|
|
Params(-50, -50, -50, -25, 15, 55, 80, 80, 80, 85));
|
|
|
|
AddPreset(QT_TRANSLATE_NOOP("Equalizer", "Full Bass + Treble"),
|
|
|
|
Params(35, 30, 0, -40, -25, 10, 45, 55, 60, 60));
|
|
|
|
AddPreset(QT_TRANSLATE_NOOP("Equalizer", "Laptop/Headphones"),
|
|
|
|
Params(25, 50, 25, -20, 0, -30, -40, -40, 0, 0));
|
|
|
|
AddPreset(QT_TRANSLATE_NOOP("Equalizer", "Large Hall"),
|
|
|
|
Params(50, 50, 30, 30, 0, -25, -25, -25, 0, 0));
|
|
|
|
AddPreset(QT_TRANSLATE_NOOP("Equalizer", "Live"),
|
|
|
|
Params(-25, 0, 20, 25, 30, 30, 20, 15, 15, 10));
|
|
|
|
AddPreset(QT_TRANSLATE_NOOP("Equalizer", "Party"),
|
|
|
|
Params(35, 35, 0, 0, 0, 0, 0, 0, 35, 35));
|
|
|
|
AddPreset(QT_TRANSLATE_NOOP("Equalizer", "Pop"),
|
|
|
|
Params(-10, 25, 35, 40, 25, -5, -15, -15, -10, -10));
|
2014-01-07 21:02:40 +01:00
|
|
|
// Psychedelic equalizer created by Devyn Collier Johnson
|
2014-02-07 16:34:20 +01:00
|
|
|
AddPreset(QT_TRANSLATE_NOOP("Equalizer", "Psychedelic"),
|
|
|
|
Params(100, 100, 0, 40, 0, 67, 79, 0, 30, -100, 37));
|
|
|
|
AddPreset(QT_TRANSLATE_NOOP("Equalizer", "Reggae"),
|
|
|
|
Params(0, 0, -5, -30, 0, -35, -35, 0, 0, 0));
|
|
|
|
AddPreset(QT_TRANSLATE_NOOP("Equalizer", "Rock"),
|
|
|
|
Params(40, 25, -30, -40, -20, 20, 45, 55, 55, 55));
|
|
|
|
AddPreset(QT_TRANSLATE_NOOP("Equalizer", "Soft"),
|
|
|
|
Params(25, 10, -5, -15, -5, 20, 45, 50, 55, 60));
|
|
|
|
AddPreset(QT_TRANSLATE_NOOP("Equalizer", "Ska"),
|
|
|
|
Params(-15, -25, -25, -5, 20, 30, 45, 50, 55, 50));
|
|
|
|
AddPreset(QT_TRANSLATE_NOOP("Equalizer", "Soft Rock"),
|
|
|
|
Params(20, 20, 10, -5, -25, -30, -20, -5, 15, 45));
|
|
|
|
AddPreset(QT_TRANSLATE_NOOP("Equalizer", "Techno"),
|
|
|
|
Params(40, 30, 0, -30, -25, 0, 40, 50, 50, 45));
|
|
|
|
AddPreset(QT_TRANSLATE_NOOP("Equalizer", "Zero"),
|
|
|
|
Params(0, 0, 0, 0, 0, 0, 0, 0, 0, 0));
|
2010-04-07 19:39:07 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
void Equalizer::AddPreset(const QString& name, const Params& params) {
|
2011-06-22 22:41:48 +02:00
|
|
|
QString name_displayed = tr(qPrintable(name));
|
2010-04-07 19:39:07 +02:00
|
|
|
presets_[name] = params;
|
2011-03-23 01:42:35 +01:00
|
|
|
if (ui_->preset->findText(name_displayed) == -1) {
|
2014-02-07 16:34:20 +01:00
|
|
|
ui_->preset->addItem(name_displayed, // name to display (translated)
|
|
|
|
QVariant(name) // original name
|
|
|
|
);
|
2011-03-23 01:42:35 +01:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
void Equalizer::PresetChanged(int index) {
|
|
|
|
PresetChanged(ui_->preset->itemData(index).toString());
|
2010-04-07 19:39:07 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
void Equalizer::PresetChanged(const QString& name) {
|
2010-04-09 02:23:17 +02:00
|
|
|
if (presets_.contains(last_preset_)) {
|
|
|
|
if (presets_[last_preset_] != current_params()) {
|
|
|
|
SaveCurrentPreset();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
last_preset_ = name;
|
|
|
|
|
2010-04-07 19:39:07 +02:00
|
|
|
Params& p = presets_[name];
|
|
|
|
|
|
|
|
loading_ = true;
|
|
|
|
preamp_->set_value(p.preamp);
|
2014-02-07 16:34:20 +01:00
|
|
|
for (int i = 0; i < kBands; ++i) gain_[i]->set_value(p.gain[i]);
|
2010-04-07 19:39:07 +02:00
|
|
|
loading_ = false;
|
|
|
|
|
|
|
|
ParametersChanged();
|
2010-04-09 02:23:17 +02:00
|
|
|
Save();
|
2010-04-07 19:39:07 +02:00
|
|
|
}
|
|
|
|
|
2010-04-09 02:23:17 +02:00
|
|
|
void Equalizer::SavePreset() {
|
|
|
|
QString name = SaveCurrentPreset();
|
|
|
|
if (!name.isEmpty()) {
|
|
|
|
last_preset_ = name;
|
2011-06-22 22:41:48 +02:00
|
|
|
ui_->preset->setCurrentIndex(ui_->preset->findText(tr(qPrintable(name))));
|
2010-04-07 19:39:07 +02:00
|
|
|
}
|
2010-04-09 02:23:17 +02:00
|
|
|
}
|
2010-04-07 19:39:07 +02:00
|
|
|
|
2010-04-09 02:23:17 +02:00
|
|
|
QString Equalizer::SaveCurrentPreset() {
|
2014-02-07 16:34:20 +01:00
|
|
|
QString name =
|
|
|
|
QInputDialog::getText(this, tr("Save preset"), tr("Name"),
|
|
|
|
QLineEdit::Normal, tr(qPrintable(last_preset_)));
|
|
|
|
;
|
|
|
|
if (name.isEmpty()) return QString();
|
2010-04-09 02:23:17 +02:00
|
|
|
|
|
|
|
AddPreset(name, current_params());
|
2010-04-07 19:39:07 +02:00
|
|
|
Save();
|
2010-04-09 02:23:17 +02:00
|
|
|
return name;
|
2010-04-07 19:39:07 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
void Equalizer::DelPreset() {
|
2011-03-23 01:42:35 +01:00
|
|
|
QString name = ui_->preset->itemData(ui_->preset->currentIndex()).toString();
|
|
|
|
QString name_displayed = ui_->preset->currentText();
|
2014-02-07 16:34:20 +01:00
|
|
|
if (!presets_.contains(name) || name.isEmpty()) return;
|
2010-04-07 19:39:07 +02:00
|
|
|
|
|
|
|
int ret = QMessageBox::question(
|
|
|
|
this, tr("Delete preset"),
|
2014-02-07 16:34:20 +01:00
|
|
|
tr("Are you sure you want to delete the \"%1\" preset?")
|
|
|
|
.arg(name_displayed),
|
2010-04-07 19:39:07 +02:00
|
|
|
QMessageBox::Yes, QMessageBox::No);
|
|
|
|
|
2014-02-07 16:34:20 +01:00
|
|
|
if (ret == QMessageBox::No) return;
|
2010-04-07 19:39:07 +02:00
|
|
|
|
|
|
|
presets_.remove(name);
|
2010-05-10 23:50:31 +02:00
|
|
|
ui_->preset->removeItem(ui_->preset->currentIndex());
|
2010-04-07 19:39:07 +02:00
|
|
|
Save();
|
2010-04-07 18:26:04 +02:00
|
|
|
}
|
|
|
|
|
2014-02-07 16:34:20 +01:00
|
|
|
EqualizerSlider* Equalizer::AddSlider(const QString& label) {
|
2010-05-10 23:50:31 +02:00
|
|
|
EqualizerSlider* ret = new EqualizerSlider(label, ui_->slider_container);
|
|
|
|
ui_->slider_container->layout()->addWidget(ret);
|
2010-04-07 18:26:04 +02:00
|
|
|
connect(ret, SIGNAL(ValueChanged(int)), SLOT(ParametersChanged()));
|
|
|
|
|
|
|
|
return ret;
|
|
|
|
}
|
|
|
|
|
2014-02-07 16:34:20 +01:00
|
|
|
bool Equalizer::is_enabled() const { return ui_->enable->isChecked(); }
|
2010-04-08 17:13:34 +02:00
|
|
|
|
2014-02-07 16:34:20 +01:00
|
|
|
int Equalizer::preamp_value() const { return preamp_->value(); }
|
2010-04-07 18:26:04 +02:00
|
|
|
|
|
|
|
QList<int> Equalizer::gain_values() const {
|
|
|
|
QList<int> ret;
|
2014-02-07 16:34:20 +01:00
|
|
|
for (int i = 0; i < kBands; ++i) {
|
2010-04-07 18:26:04 +02:00
|
|
|
ret << gain_[i]->value();
|
|
|
|
}
|
|
|
|
return ret;
|
|
|
|
}
|
|
|
|
|
2010-04-09 02:23:17 +02:00
|
|
|
Equalizer::Params Equalizer::current_params() const {
|
|
|
|
QList<int> gains = gain_values();
|
|
|
|
|
|
|
|
Params ret;
|
|
|
|
ret.preamp = preamp_value();
|
|
|
|
std::copy(gains.begin(), gains.end(), ret.gain);
|
|
|
|
return ret;
|
|
|
|
}
|
|
|
|
|
2013-04-27 05:05:42 +02:00
|
|
|
float Equalizer::stereo_balance() const {
|
2014-02-07 16:34:20 +01:00
|
|
|
return qBound(-1.0f, ui_->balance_slider->value() / 100.0f, 1.0f);
|
2013-04-27 05:05:42 +02:00
|
|
|
}
|
|
|
|
|
2010-04-07 18:26:04 +02:00
|
|
|
void Equalizer::ParametersChanged() {
|
2014-02-07 16:34:20 +01:00
|
|
|
if (loading_) return;
|
2010-04-08 17:13:34 +02:00
|
|
|
|
2010-04-07 18:26:04 +02:00
|
|
|
emit ParametersChanged(preamp_value(), gain_values());
|
2010-04-07 19:39:07 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
void Equalizer::Save() {
|
|
|
|
QSettings s;
|
|
|
|
s.beginGroup(kSettingsGroup);
|
|
|
|
|
|
|
|
// Presets
|
|
|
|
s.beginWriteArray("presets", presets_.count());
|
2014-02-07 16:34:20 +01:00
|
|
|
int i = 0;
|
|
|
|
foreach(const QString & name, presets_.keys()) {
|
2010-04-07 19:39:07 +02:00
|
|
|
s.setArrayIndex(i++);
|
|
|
|
s.setValue("name", name);
|
|
|
|
s.setValue("params", QVariant::fromValue(presets_[name]));
|
|
|
|
}
|
|
|
|
s.endArray();
|
|
|
|
|
|
|
|
// Selected preset
|
2011-03-23 01:42:35 +01:00
|
|
|
s.setValue("selected_preset",
|
2014-02-07 16:34:20 +01:00
|
|
|
ui_->preset->itemData(ui_->preset->currentIndex()).toString());
|
2010-04-07 19:39:07 +02:00
|
|
|
|
|
|
|
// Enabled?
|
2010-05-10 23:50:31 +02:00
|
|
|
s.setValue("enabled", ui_->enable->isChecked());
|
2013-04-27 05:05:42 +02:00
|
|
|
|
|
|
|
s.setValue("stereo_balance", ui_->balance_slider->value());
|
2010-04-07 19:39:07 +02:00
|
|
|
}
|
|
|
|
|
2010-04-09 02:23:17 +02:00
|
|
|
void Equalizer::closeEvent(QCloseEvent* e) {
|
2010-05-10 23:50:31 +02:00
|
|
|
QString name = ui_->preset->currentText();
|
2014-02-07 16:34:20 +01:00
|
|
|
if (!presets_.contains(name)) return;
|
2010-04-09 02:23:17 +02:00
|
|
|
|
2014-02-07 16:34:20 +01:00
|
|
|
if (presets_[name] == current_params()) return;
|
2010-04-09 02:23:17 +02:00
|
|
|
|
|
|
|
SavePreset();
|
|
|
|
}
|
|
|
|
|
2014-02-07 16:34:20 +01:00
|
|
|
Equalizer::Params::Params() : preamp(0) {
|
|
|
|
for (int i = 0; i < Equalizer::kBands; ++i) gain[i] = 0;
|
2010-04-07 19:39:07 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
Equalizer::Params::Params(int g0, int g1, int g2, int g3, int g4, int g5,
|
|
|
|
int g6, int g7, int g8, int g9, int pre)
|
2014-02-07 16:34:20 +01:00
|
|
|
: preamp(pre) {
|
|
|
|
gain[0] = g0;
|
|
|
|
gain[1] = g1;
|
|
|
|
gain[2] = g2;
|
|
|
|
gain[3] = g3;
|
|
|
|
gain[4] = g4;
|
|
|
|
gain[5] = g5;
|
|
|
|
gain[6] = g6;
|
|
|
|
gain[7] = g7;
|
|
|
|
gain[8] = g8;
|
|
|
|
gain[9] = g9;
|
2010-04-07 19:39:07 +02:00
|
|
|
}
|
|
|
|
|
2014-02-07 16:34:20 +01:00
|
|
|
bool Equalizer::Params::operator==(const Equalizer::Params& other) const {
|
2010-04-09 02:23:17 +02:00
|
|
|
if (preamp != other.preamp) return false;
|
2014-02-07 16:34:20 +01:00
|
|
|
for (int i = 0; i < Equalizer::kBands; ++i) {
|
2010-04-09 02:23:17 +02:00
|
|
|
if (gain[i] != other.gain[i]) return false;
|
|
|
|
}
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
|
2014-02-07 16:34:20 +01:00
|
|
|
bool Equalizer::Params::operator!=(const Equalizer::Params& other) const {
|
|
|
|
return !(*this == other);
|
2010-04-09 02:23:17 +02:00
|
|
|
}
|
|
|
|
|
2013-04-27 05:05:42 +02:00
|
|
|
void Equalizer::StereoSliderChanged(int value) {
|
|
|
|
emit StereoBalanceChanged(stereo_balance());
|
|
|
|
Save();
|
|
|
|
}
|
|
|
|
|
2014-02-07 16:34:20 +01:00
|
|
|
QDataStream& operator<<(QDataStream& s, const Equalizer::Params& p) {
|
2010-04-07 19:39:07 +02:00
|
|
|
s << p.preamp;
|
2014-02-07 16:34:20 +01:00
|
|
|
for (int i = 0; i < Equalizer::kBands; ++i) s << p.gain[i];
|
2010-04-07 19:39:07 +02:00
|
|
|
return s;
|
|
|
|
}
|
|
|
|
|
2014-02-07 16:34:20 +01:00
|
|
|
QDataStream& operator>>(QDataStream& s, Equalizer::Params& p) {
|
2010-04-07 19:39:07 +02:00
|
|
|
s >> p.preamp;
|
2014-02-07 16:34:20 +01:00
|
|
|
for (int i = 0; i < Equalizer::kBands; ++i) s >> p.gain[i];
|
2010-04-07 19:39:07 +02:00
|
|
|
return s;
|
2010-04-07 18:26:04 +02:00
|
|
|
}
|