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.

102 lines
2.8KB

  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 "CarlaPipeUtils.hpp"
  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, const char* argv[])
  43. {
  44. if (argc != 1)
  45. {
  46. carla_stdout("CLIENT STARTED %i", argc);
  47. CarlaPipeClient2 p;
  48. const bool ok = p.initPipeClient(argv);
  49. CARLA_SAFE_ASSERT_RETURN(ok,1);
  50. p.lockPipe();
  51. p.writeMessage("CLIENT=>SERVER\n");
  52. p.writeAndFixMessage("heheheheheh");
  53. p.unlockPipe();
  54. carla_msleep(500);
  55. carla_stderr2("CLIENT idle start");
  56. p.idlePipe();
  57. carla_stderr2("CLIENT idle end");
  58. carla_msleep(500);
  59. }
  60. else
  61. {
  62. carla_stdout("SERVER STARTED %i", argc);
  63. CarlaPipeServer2 p;
  64. #ifdef CARLA_OS_WIN
  65. const bool ok = p.startPipeServer("H:\\Source\\falkTX\\Carla\\source\\tests\\CarlaPipeUtils.exe", "/home/falktx/Videos", "/home/falktx");
  66. #else
  67. const bool ok = p.startPipeServer("/home/falktx/Source/falkTX/Carla/source/tests/CarlaPipeUtils", "/home/falktx/Videos", "/home/falktx");
  68. #endif
  69. CARLA_SAFE_ASSERT_RETURN(ok,1);
  70. p.lockPipe();
  71. p.writeMessage("SERVER=>CLIENT\n");
  72. p.unlockPipe();
  73. carla_msleep(500);
  74. carla_stderr2("SERVER idle start");
  75. p.idlePipe();
  76. carla_stderr2("SERVER idle end");
  77. carla_msleep(500);
  78. }
  79. return 0;
  80. }
  81. // -----------------------------------------------------------------------
  82. #include "../utils/CarlaPipeUtils.cpp"
  83. // -----------------------------------------------------------------------