TTKMusicPlayer  3.7.0.0
TTKMusicPlayer imitates Kugou UI, the music player uses of qmmp core library based on Qt for windows and linux
dithering_p.h
Go to the documentation of this file.
1 /***************************************************************************
2  * Based on madplay project *
3  * *
4  * Copyright (C) 2000-2004 Robert Leslie <rob@mars.org> *
5  * Copyright (C) 2016-2024 Ilya Kotov forkotov02@ya.ru *
6  * *
7  * This program is free software; you can redistribute it and/or modify *
8  * it under the terms of the GNU General Public License as published by *
9  * the Free Software Foundation; either version 2 of the License, or *
10  * (at your option) any later version. *
11  * *
12  * This program is distributed in the hope that it will be useful, *
13  * but WITHOUT ANY WARRANTY; without even the implied warranty of *
14  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
15  * GNU General Public License for more details. *
16  * *
17  * You should have received a copy of the GNU General Public License *
18  * along with this program; if not, write to the *
19  * Free Software Foundation, Inc., *
20  * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. *
21  ***************************************************************************/
22 
23 #ifndef DITHERING_P_H
24 #define DITHERING_P_H
25 
26 #include "effect.h"
27 
32 {
33 public:
34  Dithering();
35 
36  virtual void configure(quint32 srate, ChannelMap map) override final;
37  virtual void applyEffect(Buffer *b) override final;
38 
39  void setFormats(Qmmp::AudioFormat in, Qmmp::AudioFormat out);
40  void setEnabled(bool enabled);
41 
42 private:
43  void clearHistory();
44  int m_chan = 2;
45 
46  struct AudioDither
47  {
48  float error[3];
49  quint32 random;
50  };
51 
52  AudioDither m_dither[9];
53  float m_lsb = 0.0f;
54  bool m_required= false, m_enabled;
55 
56  quint32 prng(quint32 state);
57  float audioLinearDither(float sample, AudioDither *dither);
58 
59 };
60 
61 #endif
The Effect class provides the base interface class of audio effects.
Definition: effect.h:36
virtual void applyEffect(Buffer *b)=0
This class represents audio channel mapping.
Definition: channelmap.h:30
virtual void configure(quint32 srate, ChannelMap map)
static void setEnabled(EffectFactory *factory, bool enable=true)
#define QMMP_EXPORT
Definition: qmmp_export.h:29
Audio buffer class.
Definition: buffer.h:33
AudioFormat
Definition: qmmp.h:129
state
Definition: http_parser.c:279