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.

113 lines
3.5KB

  1. #!/usr/bin/env python3
  2. # -*- coding: utf-8 -*-
  3. # Carla plugin host
  4. # Copyright (C) 2011-2013 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 GPL.txt file
  17. # ------------------------------------------------------------------------------------------------------------
  18. # Imports (Global)
  19. try:
  20. from PyQt5.QtCore import QTimer
  21. from PyQt5.QtWidgets import QApplication
  22. except:
  23. from PyQt4.QtCore import QTimer
  24. from PyQt4.QtGui import QApplication
  25. # ------------------------------------------------------------------------------------------------------------
  26. # Imports (Custom Stuff)
  27. from carla_host import *
  28. from carla_rack import CarlaRackW
  29. from carla_patchbay import CarlaPatchbayW
  30. # ------------------------------------------------------------------------------------------------------------
  31. # Main Window
  32. class CarlaMiniW(HostWindow):
  33. def __init__(self, parent=None):
  34. HostWindow.__init__(self, parent)
  35. self.fContainer = CarlaRackW(self)
  36. #self.fContainer = CarlaPatchbayW(self)
  37. self.setCentralWidget(self.fContainer)
  38. # ------------------------------------------------------------------------------------------------------------
  39. # Main
  40. if __name__ == '__main__':
  41. # -------------------------------------------------------------
  42. # App initialization
  43. app = QApplication(sys.argv)
  44. app.setApplicationName("Carla")
  45. app.setApplicationVersion(VERSION)
  46. app.setOrganizationName("falkTX")
  47. app.setWindowIcon(QIcon(":/scalable/carla.svg"))
  48. # -------------------------------------------------------------
  49. # Set-up custom signal handling
  50. setUpSignals()
  51. # -------------------------------------------------------------
  52. # Read CLI args
  53. appName = os.path.basename(__file__) if ("__file__" in dir() and os.path.dirname(__file__) in PATH) else sys.argv[0]
  54. libPrefix = None
  55. projectFilename = None
  56. argv = app.arguments()
  57. argc = len(argv)
  58. for i in range(argc):
  59. if i == 0: continue
  60. argument = argv[i]
  61. if argument.startswith("--with-appname="):
  62. appName = os.path.basename(argument.replace("--with-appname=", ""))
  63. elif argument.startswith("--with-libprefix="):
  64. libPrefix = argument.replace("--with-libprefix=", "")
  65. elif os.path.exists(argument):
  66. projectFilename = argument
  67. # -------------------------------------------------------------
  68. # Init host backend
  69. initHost(appName, libPrefix)
  70. # -------------------------------------------------------------
  71. # Create GUI
  72. Carla.gui = CarlaMiniW()
  73. # -------------------------------------------------------------
  74. # Load project file if set
  75. if projectFilename is not None:
  76. Carla.gui.loadProjectLater(projectFilename)
  77. # -------------------------------------------------------------
  78. # Show GUI
  79. Carla.gui.show()
  80. # -------------------------------------------------------------
  81. # App-Loop
  82. sys.exit(app.exec_())