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.

98 lines
2.7KB

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