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.

104 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 sys import exit
  20. # -----------------------------------------------------------------------
  21. # Imports (ExternalUI)
  22. from carla_style import CarlaApplication
  23. from externalui import ExternalUI
  24. from digitalpeakmeter import DigitalPeakMeter
  25. # -----------------------------------------------------------------------
  26. # External UI
  27. class DistrhoUIBigMeter(DigitalPeakMeter, ExternalUI):
  28. def __init__(self):
  29. DigitalPeakMeter.__init__(self, None)
  30. ExternalUI.__init__(self)
  31. channels = 2 #6 if argv[0].endswith("bigmeterM-ui") else 2
  32. self.setChannels(channels)
  33. self.setColor(self.GREEN)
  34. self.setOrientation(self.VERTICAL)
  35. #self.setSmoothRelease(0) # till 5
  36. self.resize(30, 400)
  37. self.setWindowTitle(self.fUiName)
  38. self.fIdleTimer = self.startTimer(30)
  39. self.showUiIfTesting()
  40. # -------------------------------------------------------------------
  41. # DSP Callbacks
  42. def d_parameterChanged(self, index, value):
  43. if index == 0:
  44. color = int(value)
  45. if color not in (self.GREEN, self.BLUE):
  46. return
  47. self.setColor(color)
  48. else:
  49. self.displayMeter(index, value)
  50. # -------------------------------------------------------------------
  51. # ExternalUI Callbacks
  52. def d_uiShow(self):
  53. self.show()
  54. def d_uiHide(self):
  55. self.hide()
  56. def d_uiQuit(self):
  57. self.close()
  58. app.quit()
  59. def d_uiTitleChanged(self, uiTitle):
  60. self.setWindowTitle(uiTitle)
  61. # -------------------------------------------------------------------
  62. # Qt events
  63. def timerEvent(self, event):
  64. if event.timerId() == self.fIdleTimer and not self.idleExternalUI():
  65. self.d_uiQuit()
  66. DigitalPeakMeter.timerEvent(self, event)
  67. def closeEvent(self, event):
  68. self.closeExternalUI()
  69. DigitalPeakMeter.closeEvent(self, event)
  70. #--------------- main ------------------
  71. if __name__ == '__main__':
  72. app = CarlaApplication("BigMeter")
  73. #app...
  74. gui = DistrhoUIBigMeter()
  75. exit(app.exec_())