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.

bigmeter-ui 4.1KB

10 years ago
10 years ago
10 years ago
123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143
  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 (Config)
  19. from carla_config import *
  20. # ------------------------------------------------------------------------------------------------------------
  21. # Imports (Global)
  22. if config_UseQt5:
  23. from PyQt5.QtCore import Qt
  24. else:
  25. from PyQt4.QtCore import Qt
  26. # -----------------------------------------------------------------------
  27. # Imports (Custom)
  28. from carla_shared import *
  29. from carla_utils import *
  30. # -----------------------------------------------------------------------
  31. # Imports (ExternalUI)
  32. from carla_app import CarlaApplication
  33. from externalui import ExternalUI
  34. from digitalpeakmeter import DigitalPeakMeter
  35. # -----------------------------------------------------------------------
  36. # External UI
  37. class DistrhoUIBigMeter(ExternalUI, DigitalPeakMeter):
  38. def __init__(self):
  39. ExternalUI.__init__(self)
  40. DigitalPeakMeter.__init__(self, None)
  41. channels = 2 #6 if argv[0].endswith("bigmeterM-ui") else 2
  42. self.setChannelCount(channels)
  43. self.setMeterColor(self.COLOR_GREEN)
  44. self.setMeterOrientation(self.VERTICAL)
  45. #self.setSmoothRelease(0) # till 5
  46. self.resize(50, 400)
  47. self.setWindowTitle(self.fUiName)
  48. self.fIdleTimer = self.startTimer(30)
  49. self.ready()
  50. # -------------------------------------------------------------------
  51. # DSP Callbacks
  52. def dspParameterChanged(self, index, value):
  53. if index == 0:
  54. color = int(value)
  55. if color not in (DigitalPeakMeter.COLOR_GREEN,
  56. DigitalPeakMeter.COLOR_BLUE):
  57. return
  58. self.setMeterColor(color)
  59. elif index == 1:
  60. style = int(value)
  61. if style not in (DigitalPeakMeter.STYLE_DEFAULT,
  62. DigitalPeakMeter.STYLE_OPENAV,
  63. DigitalPeakMeter.STYLE_RNCBC):
  64. return
  65. self.setMeterStyle(style)
  66. else:
  67. self.displayMeter(index-1, value)
  68. # -------------------------------------------------------------------
  69. # ExternalUI Callbacks
  70. def uiShow(self):
  71. self.show()
  72. def uiFocus(self):
  73. self.setWindowState((self.windowState() & ~Qt.WindowMinimized) | Qt.WindowActive)
  74. self.show()
  75. self.raise_()
  76. self.activateWindow()
  77. def uiHide(self):
  78. self.hide()
  79. def uiQuit(self):
  80. self.closeExternalUI()
  81. self.close()
  82. app.quit()
  83. def uiTitleChanged(self, uiTitle):
  84. self.setWindowTitle(uiTitle)
  85. # -------------------------------------------------------------------
  86. # Qt events
  87. def timerEvent(self, event):
  88. if event.timerId() == self.fIdleTimer:
  89. self.idleExternalUI()
  90. DigitalPeakMeter.timerEvent(self, event)
  91. def closeEvent(self, event):
  92. self.closeExternalUI()
  93. DigitalPeakMeter.closeEvent(self, event)
  94. # there might be other qt windows open which will block the UI from quitting
  95. app.quit()
  96. #--------------- main ------------------
  97. if __name__ == '__main__':
  98. import resources_rc
  99. pathBinaries, pathResources = getPaths()
  100. gCarla.utils = CarlaUtils(os.path.join(pathBinaries, "libcarla_utils." + DLL_EXTENSION))
  101. gCarla.utils.set_process_name("BigMeter")
  102. app = CarlaApplication("BigMeter")
  103. gui = DistrhoUIBigMeter()
  104. app.exit_exec()