moodbar: Formatting

This commit is contained in:
Jonas Kvinge
2024-09-22 12:41:22 +02:00
parent 0919d5d3de
commit 28a29d219e
14 changed files with 305 additions and 247 deletions

View File

@@ -1,19 +1,23 @@
/* This file was part of Clementine.
Copyright 2014, David Sansome <me@davidsansome.com>
Strawberry 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.
Strawberry 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 Strawberry. If not, see <http://www.gnu.org/licenses/>.
*/
/*
* Strawberry Music Player
* This file was part of Clementine.
* Copyright 2014, David Sansome <me@davidsansome.com>
* Copyright 2019-2024, Jonas Kvinge <jonas@jkvinge.net>
*
* Strawberry 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.
*
* Strawberry 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 Strawberry. If not, see <http://www.gnu.org/licenses/>.
*
*/
#ifndef MOODBARBUILDER_H
#define MOODBARBUILDER_H
@@ -26,19 +30,19 @@ class MoodbarBuilder {
public:
explicit MoodbarBuilder();
void Init(int bands, int rate_hz);
void AddFrame(const double *magnitudes, int size);
QByteArray Finish(int width);
void Init(const int bands, const int rate_hz);
void AddFrame(const double *magnitudes, const int size);
QByteArray Finish(const int width);
private:
struct Rgb {
Rgb() : r(0), g(0), b(0) {}
Rgb(double r_, double g_, double b_) : r(r_), g(g_), b(b_) {}
Rgb(const double r_, const double g_, const double b_) : r(r_), g(g_), b(b_) {}
double r, g, b;
};
int BandFrequency(int band) const;
int BandFrequency(const int band) const;
static void Normalize(QList<Rgb> *vals, double Rgb::*member);
QList<uint> barkband_table_;