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.

105 lines
2.9KB

  1. #!/usr/bin/env python3
  2. # -*- coding: utf-8 -*-
  3. # Carla Native Plugins
  4. # Copyright (C) 2012-2014 Filipe Coelho <falktx@falktx.com>
  5. #
  6. # This program is free software; you can redistribute it and/or
  7. # modify it under the terms of the GNU General Public License as
  8. # published by the Free Software Foundation; either version 2 of
  9. # the License, or any later version.
  10. #
  11. # This program is distributed in the hope that it will be useful,
  12. # but WITHOUT ANY WARRANTY; without even the implied warranty of
  13. # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  14. # GNU General Public License for more details.
  15. #
  16. # For a full copy of the GNU General Public License see the doc/GPL.txt file.
  17. # ------------------------------------------------------------------------------------------------------------
  18. # Imports (Global)
  19. from numpy import rint
  20. from sys import exit
  21. # -----------------------------------------------------------------------
  22. # Imports (ExternalUI)
  23. from carla_style import CarlaApplication
  24. from externalui import ExternalUI
  25. from digitalpeakmeter import DigitalPeakMeter
  26. # -----------------------------------------------------------------------
  27. # External UI
  28. class DistrhoUIBigMeter(DigitalPeakMeter, ExternalUI):
  29. def __init__(self):
  30. DigitalPeakMeter.__init__(self, None)
  31. ExternalUI.__init__(self)
  32. channels = 2 #6 if argv[0].endswith("bigmeterM-ui") else 2
  33. self.setChannels(channels)
  34. self.setColor(self.GREEN)
  35. self.setOrientation(self.VERTICAL)
  36. #self.setSmoothRelease(0) # till 5
  37. self.resize(30, 400)
  38. self.setWindowTitle(self.fUiName)
  39. self.fIdleTimer = self.startTimer(30)
  40. self.showUiIfTesting()
  41. # -------------------------------------------------------------------
  42. # DSP Callbacks
  43. def d_parameterChanged(self, index, value):
  44. if index == 0:
  45. color = rint(value)+1
  46. if color not in (self.GREEN, self.BLUE):
  47. return
  48. self.setColor(color)
  49. else:
  50. self.displayMeter(index, value)
  51. # -------------------------------------------------------------------
  52. # ExternalUI Callbacks
  53. def d_uiShow(self):
  54. self.show()
  55. def d_uiHide(self):
  56. self.hide()
  57. def d_uiQuit(self):
  58. self.close()
  59. app.quit()
  60. def d_uiTitleChanged(self, uiTitle):
  61. self.setWindowTitle(uiTitle)
  62. # -------------------------------------------------------------------
  63. # Qt events
  64. def timerEvent(self, event):
  65. if event.timerId() == self.fIdleTimer and not self.idleExternalUI():
  66. self.d_uiQuit()
  67. DigitalPeakMeter.timerEvent(self, event)
  68. def closeEvent(self, event):
  69. self.closeExternalUI()
  70. DigitalPeakMeter.closeEvent(self, event)
  71. #--------------- main ------------------
  72. if __name__ == '__main__':
  73. app = CarlaApplication("BigMeter")
  74. #app...
  75. gui = DistrhoUIBigMeter()
  76. exit(app.exec_())