Qmmp
|
00001 /*************************************************************************** 00002 * Based on madplay project * 00003 * * 00004 * Copyright (C) 2000-2004 Robert Leslie <rob@mars.org> * 00005 * Copyright (C) 2016 Ilya Kotov forkotov02@hotmail.ru * 00006 * * 00007 * This program is free software; you can redistribute it and/or modify * 00008 * it under the terms of the GNU General Public License as published by * 00009 * the Free Software Foundation; either version 2 of the License, or * 00010 * (at your option) any later version. * 00011 * * 00012 * This program is distributed in the hope that it will be useful, * 00013 * but WITHOUT ANY WARRANTY; without even the implied warranty of * 00014 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * 00015 * GNU General Public License for more details. * 00016 * * 00017 * You should have received a copy of the GNU General Public License * 00018 * along with this program; if not, write to the * 00019 * Free Software Foundation, Inc., * 00020 * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. * 00021 ***************************************************************************/ 00022 00023 00024 #ifndef DITHERING_P_H 00025 #define DITHERING_P_H 00026 00027 #include "effect.h" 00028 00032 class Dithering : public Effect 00033 { 00034 public: 00035 Dithering(); 00036 00037 void configure(quint32 srate, ChannelMap map); 00038 void setFormats(Qmmp::AudioFormat in, Qmmp::AudioFormat out); 00039 void applyEffect(Buffer *b); 00040 void setEnabled(bool enabled); 00041 00042 private: 00043 int m_chan; 00044 00045 typedef struct 00046 { 00047 float error[3]; 00048 quint32 random; 00049 00050 } AudioDither; 00051 00052 AudioDither m_dither[9]; 00053 float m_lsb; 00054 bool m_required, m_enabled; 00055 00056 00057 quint32 prng(quint32 state); 00058 float audioLinearDither(float sample, AudioDither *dither); 00059 }; 00060 00061 #endif // DITHERING_P_H