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.

144 lines
3.9KB

  1. /*
  2. * Carla JACK API for external applications
  3. * Copyright (C) 2016-2017 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 "libjack.hpp"
  18. CARLA_BACKEND_USE_NAMESPACE
  19. // --------------------------------------------------------------------------------------------------------------------
  20. CARLA_EXPORT
  21. int jack_engine_takeover_timebase(jack_client_t* client)
  22. {
  23. carla_stdout("%s(%p)", __FUNCTION__, client);
  24. return ENOSYS;
  25. }
  26. // --------------------------------------------------------------------------------------------------------------------
  27. CARLA_EXPORT
  28. int jack_release_timebase(jack_client_t* client)
  29. {
  30. carla_stdout("%s(%p)", __FUNCTION__, client);
  31. return 0;
  32. }
  33. CARLA_EXPORT
  34. int jack_set_sync_callback(jack_client_t* client, JackSyncCallback callback, void* arg)
  35. {
  36. carla_stdout("%s(%p, %p, %p)", __FUNCTION__, client, callback, arg);
  37. JackClientState* const jclient = (JackClientState*)client;
  38. CARLA_SAFE_ASSERT_RETURN(jclient != nullptr, 1);
  39. const CarlaMutexLocker cms(jclient->mutex);
  40. jclient->syncCb = callback;
  41. jclient->syncCbPtr = arg;
  42. return 0;
  43. }
  44. CARLA_EXPORT
  45. int jack_set_sync_timeout(jack_client_t* client, jack_time_t timeout)
  46. {
  47. carla_stdout("%s(%p, " P_UINT64 ")", __FUNCTION__, client, timeout);
  48. return 0;
  49. }
  50. CARLA_EXPORT
  51. int jack_set_timebase_callback(jack_client_t* client, int conditional, JackTimebaseCallback callback, void* arg)
  52. {
  53. carla_stdout("%s(%p, %i, %p, %p)", __FUNCTION__, client, conditional, callback, arg);
  54. return EBUSY;
  55. }
  56. CARLA_EXPORT
  57. int jack_transport_locate(jack_client_t* client, jack_nframes_t frame)
  58. {
  59. carla_stdout("%s(%p, %u)", __FUNCTION__, client, frame);
  60. return ENOSYS;
  61. }
  62. CARLA_EXPORT
  63. jack_transport_state_t jack_transport_query(const jack_client_t* client, jack_position_t* pos)
  64. {
  65. if (const JackClientState* const jclient = (JackClientState*)client)
  66. {
  67. const JackServerState& jserver(jclient->server);
  68. if (pos != nullptr)
  69. std::memcpy(pos, &jserver.position, sizeof(jack_position_t));
  70. return jserver.playing ? JackTransportRolling : JackTransportStopped;
  71. }
  72. if (pos != nullptr)
  73. std::memset(pos, 0, sizeof(jack_position_t));
  74. return JackTransportStopped;
  75. }
  76. CARLA_EXPORT
  77. jack_nframes_t jack_get_current_transport_frame(const jack_client_t* client)
  78. {
  79. if (const JackClientState* const jclient = (JackClientState*)client)
  80. return jclient->server.position.frame;
  81. return 0;
  82. }
  83. CARLA_EXPORT
  84. int jack_transport_reposition(jack_client_t* client, const jack_position_t* pos)
  85. {
  86. carla_stdout("%s(%p, %p)", __FUNCTION__, client, pos);
  87. return ENOSYS;
  88. }
  89. CARLA_EXPORT
  90. void jack_transport_start(jack_client_t* client)
  91. {
  92. carla_stdout("%s(%p)", __FUNCTION__, client);
  93. }
  94. CARLA_EXPORT
  95. void jack_transport_stop(jack_client_t* client)
  96. {
  97. carla_stdout("%s(%p)", __FUNCTION__, client);
  98. }
  99. // --------------------------------------------------------------------------------------------------------------------
  100. CARLA_EXPORT
  101. void jack_get_transport_info(jack_client_t* client, void* tinfo)
  102. {
  103. carla_stdout("%s(%p, %p)", __FUNCTION__, client, tinfo);
  104. }
  105. CARLA_EXPORT
  106. void jack_set_transport_info(jack_client_t* client, void* tinfo)
  107. {
  108. carla_stdout("%s(%p, %p)", __FUNCTION__, client, tinfo);
  109. }
  110. // --------------------------------------------------------------------------------------------------------------------