Audio plugin host https://kx.studio/carla
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

digitalpeakmeter.hpp 1.8KB

11 years ago
11 years ago
11 years ago
11 years ago
11 years ago
11 years ago
12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273
  1. /*
  2. * Digital Peak Meter, a custom Qt4 widget
  3. * Copyright (C) 2011-2013 Filipe Coelho <falktx@falktx.com>
  4. *
  5. * This program is free software; you can redistribute it and/or
  6. * modify it under the terms of the GNU General Public License as
  7. * published by the Free Software Foundation; either version 2 of
  8. * the License, or any later version.
  9. *
  10. * This program is distributed in the hope that it will be useful,
  11. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  12. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  13. * GNU General Public License for more details.
  14. *
  15. * For a full copy of the GNU General Public License see the GPL.txt file
  16. */
  17. #ifndef __DIGITALPEAKMETER_HPP__
  18. #define __DIGITALPEAKMETER_HPP__
  19. #include <QtCore/QTimer>
  20. #include <QtGui/QWidget>
  21. class DigitalPeakMeter : public QWidget
  22. {
  23. public:
  24. enum Orientation {
  25. HORIZONTAL = 1,
  26. VERTICAL = 2
  27. };
  28. enum Color {
  29. GREEN = 1,
  30. BLUE = 2
  31. };
  32. DigitalPeakMeter(QWidget* parent);
  33. void displayMeter(int meter, float level);
  34. void setChannels(int channels);
  35. void setColor(Color color);
  36. void setOrientation(Orientation orientation);
  37. void setRefreshRate(int rate);
  38. void setSmoothRelease(int value);
  39. QSize minimumSizeHint() const;
  40. QSize sizeHint() const;
  41. protected:
  42. void updateSizes();
  43. void paintEvent(QPaintEvent* event);
  44. void resizeEvent(QResizeEvent* event);
  45. private:
  46. int m_channels;
  47. int m_smoothMultiplier;
  48. int m_width, m_height, m_sizeMeter;
  49. Orientation m_orientation;
  50. QColor m_colorBackground;
  51. QLinearGradient m_gradientMeter;
  52. QColor m_colorBase;
  53. QColor m_colorBaseT;
  54. QList<float> m_channelsData;
  55. QList<float> m_lastValueData;
  56. QTimer m_paintTimer;
  57. };
  58. #endif // __DIGITALPEAKMETER_HPP__