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.

carla-patchbay 3.4KB

11 years ago
123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107
  1. #!/usr/bin/env python3
  2. # -*- coding: utf-8 -*-
  3. # Carla plugin host
  4. # Copyright (C) 2011-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 GPL.txt file
  17. # ------------------------------------------------------------------------------------------------------------
  18. # Imports (Custom Stuff)
  19. from carla_host import *
  20. from carla_patchbay import CarlaPatchbayW
  21. # ------------------------------------------------------------------------------------------------------------
  22. # Main Window
  23. class CarlaHostW(HostWindow):
  24. def __init__(self, parent=None):
  25. HostWindow.__init__(self, parent)
  26. self.fContainer = CarlaPatchbayW(self)
  27. self.setupContainer(True, self.fContainer.themeData)
  28. # -----------------------------------------------------------------
  29. def showEvent(self, event):
  30. HostWindow.showEvent(self, event)
  31. # set our gui as parent for all plugins UIs
  32. if gCarla.host is not None:
  33. gCarla.host.set_engine_option(ENGINE_OPTION_FRONTEND_WIN_ID, 0, str(self.winId()))
  34. # ------------------------------------------------------------------------------------------------------------
  35. # Main
  36. if __name__ == '__main__':
  37. # -------------------------------------------------------------
  38. # Read CLI args
  39. initName = os.path.basename(__file__) if ("__file__" in dir() and os.path.dirname(__file__) in PATH) else sys.argv[0]
  40. libPrefix = None
  41. for arg in sys.argv:
  42. if arg.startswith("--with-appname="):
  43. initName = os.path.basename(arg.replace("--with-initname=", ""))
  44. elif arg.startswith("--with-libprefix="):
  45. libPrefix = arg.replace("--with-libprefix=", "")
  46. # -------------------------------------------------------------
  47. # App initialization
  48. app = CarlaApplication("Carla2-Patchbay", libPrefix)
  49. # -------------------------------------------------------------
  50. # Set-up custom signal handling
  51. setUpSignals()
  52. # -------------------------------------------------------------
  53. # Init host backend
  54. gCarla.isControl = False
  55. gCarla.isLocal = True
  56. gCarla.isPlugin = False
  57. gCarla.processMode = ENGINE_PROCESS_MODE_MULTIPLE_CLIENTS
  58. initHost(initName, libPrefix)
  59. # -------------------------------------------------------------
  60. # Create GUI
  61. gCarla.gui = CarlaHostW()
  62. # -------------------------------------------------------------
  63. # Load project file if set
  64. args = app.arguments()
  65. if len(args) > 1:
  66. arg = args[-1]
  67. if arg.startswith("--with-appname=") or arg.startswith("--with-libprefix="):
  68. pass
  69. elif os.path.exists(arg):
  70. gCarla.gui.loadProjectLater(arg)
  71. # -------------------------------------------------------------
  72. # Show GUI
  73. gCarla.gui.show()
  74. # -------------------------------------------------------------
  75. # App-Loop
  76. app.exit_exec()