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.

105 lines
2.4KB

  1. /*
  2. * Carla Pipe Tests
  3. * Copyright (C) 2014 Filipe Coelho <falktx@falktx.com>
  4. *
  5. * This program is free software; you can redistribute it and/or
  6. * modify it under the terms of the GNU General Public License as
  7. * published by the Free Software Foundation; either version 2 of
  8. * the License, or any later version.
  9. *
  10. * This program is distributed in the hope that it will be useful,
  11. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  12. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  13. * GNU General Public License for more details.
  14. *
  15. * For a full copy of the GNU General Public License see the doc/GPL.txt file.
  16. */
  17. #include "CarlaPipeUtils.hpp"
  18. static bool gStopNow = false;
  19. class ExternalPluginUI : public CarlaPipeServer
  20. {
  21. public:
  22. ExternalPluginUI()
  23. {
  24. }
  25. ~ExternalPluginUI() override
  26. {
  27. }
  28. void fail(const char* const error) override
  29. {
  30. carla_stderr2(error);
  31. //fHost->dispatcher(fHost->handle, HOST_OPCODE_UI_UNAVAILABLE, 0, 0, nullptr, 0.0f);
  32. }
  33. void msgReceived(const char* const msg) override
  34. {
  35. carla_stderr("msgReceived : %s", msg);
  36. if (std::strcmp(msg, "exiting") == 0)
  37. {
  38. waitChildClose();
  39. gStopNow = true;
  40. }
  41. #if 0
  42. if (std::strcmp(msg, "control") == 0)
  43. {
  44. int index;
  45. float value;
  46. if (readNextLineAsInt(index) && readNextLineAsFloat(value))
  47. handleSetParameterValue(index, value);
  48. }
  49. else if (std::strcmp(msg, "configure") == 0)
  50. {
  51. char* key;
  52. char* value;
  53. if (readNextLineAsString(key) && readNextLineAsString(value))
  54. {
  55. handleSetState(key, value);
  56. std::free(key);
  57. std::free(value);
  58. }
  59. }
  60. else if (std::strcmp(msg, "exiting") == 0)
  61. {
  62. waitChildClose();
  63. fHost->ui_closed(fHost->handle);
  64. }
  65. else
  66. {
  67. carla_stderr("unknown message HOST: \"%s\"", msg);
  68. }
  69. #endif
  70. }
  71. };
  72. int main()
  73. {
  74. ExternalPluginUI ui;
  75. if (! ui.start("/home/falktx/FOSS/GIT-mine/Carla/source/notes-ui", "44100.0", "Ui title here"))
  76. {
  77. carla_stderr("failed to start");
  78. return 1;
  79. }
  80. ui.writeMsg("show\n", 5);
  81. for (int i=0; i < 500 && ! gStopNow; ++i)
  82. {
  83. ui.idle();
  84. carla_msleep(10);
  85. }
  86. //ui.stop();
  87. return 0;
  88. }