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.

119 lines
3.3KB

  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 (Custom)
  19. from carla_shared import *
  20. from carla_utils import *
  21. # -----------------------------------------------------------------------
  22. # Imports (ExternalUI)
  23. from carla_app import CarlaApplication
  24. from externalui import ExternalUI
  25. from digitalpeakmeter import DigitalPeakMeter
  26. # -----------------------------------------------------------------------
  27. # External UI
  28. class DistrhoUIBigMeter(ExternalUI, DigitalPeakMeter):
  29. def __init__(self):
  30. ExternalUI.__init__(self)
  31. DigitalPeakMeter.__init__(self, None)
  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(50, 400)
  38. self.setWindowTitle(self.fUiName)
  39. self.fIdleTimer = self.startTimer(30)
  40. self.ready()
  41. # -------------------------------------------------------------------
  42. # DSP Callbacks
  43. def dspParameterChanged(self, index, value):
  44. if index == 0:
  45. color = int(value)
  46. if color not in (DigitalPeakMeter.GREEN, DigitalPeakMeter.BLUE):
  47. return
  48. self.setColor(color)
  49. elif index == 1:
  50. style = int(value)
  51. if style not in (DigitalPeakMeter.STYLE_DEFAULT, DigitalPeakMeter.STYLE_OPENAV):
  52. return
  53. self.setMeterStyle(style)
  54. else:
  55. self.displayMeter(index-1, value)
  56. # -------------------------------------------------------------------
  57. # ExternalUI Callbacks
  58. def uiShow(self):
  59. self.show()
  60. def uiHide(self):
  61. self.hide()
  62. def uiQuit(self):
  63. self.closeExternalUI()
  64. self.close()
  65. app.quit()
  66. def uiTitleChanged(self, uiTitle):
  67. self.setWindowTitle(uiTitle)
  68. # -------------------------------------------------------------------
  69. # Qt events
  70. def timerEvent(self, event):
  71. if event.timerId() == self.fIdleTimer:
  72. self.idleExternalUI()
  73. DigitalPeakMeter.timerEvent(self, event)
  74. def closeEvent(self, event):
  75. self.closeExternalUI()
  76. DigitalPeakMeter.closeEvent(self, event)
  77. #--------------- main ------------------
  78. if __name__ == '__main__':
  79. import resources_rc
  80. pathBinaries, pathResources = getPaths()
  81. gCarla.utils = CarlaUtils(os.path.join(pathBinaries, "libcarla_utils." + DLL_EXTENSION))
  82. gCarla.utils.set_locale_C()
  83. gCarla.utils.set_process_name("BigMeter")
  84. app = CarlaApplication("BigMeter")
  85. gui = DistrhoUIBigMeter()
  86. app.exit_exec()