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.

CarlaPipeUtils.cpp 2.6KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697
  1. /*
  2. * Carla Utility Tests
  3. * Copyright (C) 2013-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 "../utils/CarlaPipeUtils.cpp"
  18. // -----------------------------------------------------------------------
  19. class CarlaPipeClient2 : public CarlaPipeClient
  20. {
  21. public:
  22. CarlaPipeClient2()
  23. : CarlaPipeClient() {}
  24. bool msgReceived(const char* const msg) noexcept override
  25. {
  26. carla_stdout("CLIENT RECEIVED: \"%s\"", msg);
  27. return true;
  28. }
  29. };
  30. class CarlaPipeServer2 : public CarlaPipeServer
  31. {
  32. public:
  33. CarlaPipeServer2()
  34. : CarlaPipeServer() {}
  35. bool msgReceived(const char* const msg) noexcept override
  36. {
  37. carla_stdout("SERVER RECEIVED: \"%s\"", msg);
  38. return true;
  39. }
  40. };
  41. // -----------------------------------------------------------------------
  42. int main(int argc, char* argv[])
  43. {
  44. if (argc != 1)
  45. {
  46. carla_stdout("CLIENT STARTED %i", argc);
  47. CarlaPipeClient2 p;
  48. const bool ok = p.start(argv);
  49. CARLA_SAFE_ASSERT_RETURN(ok,1);
  50. p.lock();
  51. p.writeMsg("CLIENT=>SERVER\n");
  52. p.writeAndFixMsg("heheheheheh");
  53. p.unlock();
  54. carla_sleep(2);
  55. carla_stderr2("CLIENT idle start");
  56. p.idle();
  57. carla_stderr2("CLIENT idle end");
  58. carla_sleep(2);
  59. }
  60. else
  61. {
  62. carla_stdout("SERVER STARTED %i", argc);
  63. CarlaPipeServer2 p;
  64. #ifdef CARLA_OS_WIN
  65. const bool ok = p.start("H:\\Source\\falkTX\\Carla\\source\\tests\\CarlaPipeUtils.exe", "/home/falktx/Videos", "/home/falktx");
  66. #else
  67. const bool ok = p.start("/home/falktx/Source/falkTX/Carla/source/tests/CarlaPipeUtils", "/home/falktx/Videos", "/home/falktx");
  68. #endif
  69. CARLA_SAFE_ASSERT_RETURN(ok,1);
  70. p.lock();
  71. p.writeMsg("SERVER=>CLIENT\n");
  72. p.unlock();
  73. carla_sleep(2);
  74. carla_stderr2("SERVER idle start");
  75. p.idle();
  76. carla_stderr2("SERVER idle end");
  77. carla_sleep(2);
  78. }
  79. return 0;
  80. }
  81. // -----------------------------------------------------------------------