SaControls.h 3.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127
  1. /*
  2. * SaControls.h - declaration of SaControls class.
  3. *
  4. * Copyright (c) 2019 Martin Pavelek <he29/dot/HS/at/gmail/dot/com>
  5. *
  6. * This file is part of LMMS - https://lmms.io
  7. *
  8. * This program is free software; you can redistribute it and/or
  9. * modify it under the terms of the GNU General Public
  10. * License as published by the Free Software Foundation; either
  11. * version 2 of the License, or (at your option) any later version.
  12. *
  13. * This program is distributed in the hope that it will be useful,
  14. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  15. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
  16. * General Public License for more details.
  17. *
  18. * You should have received a copy of the GNU General Public
  19. * License along with this program (see COPYING); if not, write to the
  20. * Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
  21. * Boston, MA 02110-1301 USA.
  22. *
  23. */
  24. #ifndef SACONTROLS_H
  25. #define SACONTROLS_H
  26. #include "ComboBoxModel.h"
  27. #include "EffectControls.h"
  28. //#define SA_DEBUG 1 // define SA_DEBUG to enable performance measurements
  29. // Frequency ranges (in Hz).
  30. // Full range is defined by LOWEST_LOG_FREQ and current sample rate.
  31. const int LOWEST_LOG_FREQ = 10; // arbitrary low limit for log. scale, >1
  32. enum FREQUENCY_RANGES
  33. {
  34. FRANGE_FULL = 0,
  35. FRANGE_AUDIBLE,
  36. FRANGE_BASS,
  37. FRANGE_MIDS,
  38. FRANGE_HIGH
  39. };
  40. const int FRANGE_AUDIBLE_START = 20;
  41. const int FRANGE_AUDIBLE_END = 20000;
  42. const int FRANGE_BASS_START = 20;
  43. const int FRANGE_BASS_END = 300;
  44. const int FRANGE_MIDS_START = 200;
  45. const int FRANGE_MIDS_END = 5000;
  46. const int FRANGE_HIGH_START = 4000;
  47. const int FRANGE_HIGH_END = 20000;
  48. // Amplitude ranges.
  49. // Reference: sine wave from -1.0 to 1.0 = 0 dB.
  50. // I.e. if master volume is 100 %, positive values signify clipping.
  51. // Doubling or halving the amplitude produces 3 dB difference.
  52. enum AMPLITUDE_RANGES
  53. {
  54. ARANGE_EXTENDED = 0,
  55. ARANGE_DEFAULT,
  56. ARANGE_AUDIBLE,
  57. ARANGE_NOISE
  58. };
  59. const int ARANGE_EXTENDED_START = -80;
  60. const int ARANGE_EXTENDED_END = 20;
  61. const int ARANGE_DEFAULT_START = -30;
  62. const int ARANGE_DEFAULT_END = 0;
  63. const int ARANGE_AUDIBLE_START = -50;
  64. const int ARANGE_AUDIBLE_END = 10;
  65. const int ARANGE_NOISE_START = -60;
  66. const int ARANGE_NOISE_END = -20;
  67. class Analyzer;
  68. // Holds all the configuration values
  69. class SaControls : public EffectControls
  70. {
  71. Q_OBJECT
  72. public:
  73. explicit SaControls(Analyzer* effect);
  74. virtual ~SaControls() {}
  75. EffectControlDialog* createView() override;
  76. void saveSettings (QDomDocument& doc, QDomElement& parent) override;
  77. void loadSettings (const QDomElement &_this) override;
  78. QString nodeName() const override {return "Analyzer";}
  79. int controlCount() override {return 12;}
  80. private:
  81. Analyzer *m_effect;
  82. BoolModel m_pauseModel;
  83. BoolModel m_refFreezeModel;
  84. BoolModel m_waterfallModel;
  85. BoolModel m_smoothModel;
  86. BoolModel m_stereoModel;
  87. BoolModel m_peakHoldModel;
  88. BoolModel m_logXModel;
  89. BoolModel m_logYModel;
  90. ComboBoxModel m_freqRangeModel;
  91. ComboBoxModel m_ampRangeModel;
  92. ComboBoxModel m_blockSizeModel;
  93. ComboBoxModel m_windowModel;
  94. QColor m_colorL;
  95. QColor m_colorR;
  96. QColor m_colorMono;
  97. QColor m_colorBG;
  98. QColor m_colorGrid;
  99. QColor m_colorLabels;
  100. friend class SaControlsDialog;
  101. friend class SaSpectrumView;
  102. friend class SaWaterfallView;
  103. friend class SaProcessor;
  104. };
  105. #endif // SACONTROLS_H