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.

170 lines
5.2KB

  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_set_thread_init_callback(jack_client_t* client, JackThreadInitCallback callback, void* arg)
  22. {
  23. carla_debug("%s(%p, %p, %p)", __FUNCTION__, client, callback, arg);
  24. JackClientState* const jclient = (JackClientState*)client;
  25. CARLA_SAFE_ASSERT_RETURN(jclient != nullptr, 1);
  26. const CarlaMutexLocker cms(jclient->mutex);
  27. jclient->threadInitCb = callback;
  28. jclient->threadInitCbPtr = arg;
  29. return 0;
  30. }
  31. CARLA_EXPORT
  32. void jack_on_shutdown(jack_client_t* client, JackShutdownCallback callback, void* arg)
  33. {
  34. carla_debug("%s(%p, %p, %p)", __FUNCTION__, client, callback, arg);
  35. JackClientState* const jclient = (JackClientState*)client;
  36. CARLA_SAFE_ASSERT_RETURN(jclient != nullptr,);
  37. const CarlaMutexLocker cms(jclient->mutex);
  38. jclient->shutdownCb = callback;
  39. jclient->shutdownCbPtr = arg;
  40. }
  41. CARLA_EXPORT
  42. void jack_on_info_shutdown(jack_client_t* client, JackInfoShutdownCallback callback, void* arg)
  43. {
  44. carla_debug("%s(%p, %p, %p)", __FUNCTION__, client, callback, arg);
  45. JackClientState* const jclient = (JackClientState*)client;
  46. CARLA_SAFE_ASSERT_RETURN(jclient != nullptr,);
  47. const CarlaMutexLocker cms(jclient->mutex);
  48. jclient->infoShutdownCb = callback;
  49. jclient->infoShutdownCbPtr = arg;
  50. }
  51. CARLA_EXPORT
  52. int jack_set_process_callback(jack_client_t* client, JackProcessCallback callback, void* arg)
  53. {
  54. carla_debug("%s(%p, %p, %p)", __FUNCTION__, client, callback, arg);
  55. JackClientState* const jclient = (JackClientState*)client;
  56. CARLA_SAFE_ASSERT_RETURN(jclient != nullptr, 1);
  57. const CarlaMutexLocker cms(jclient->mutex);
  58. jclient->processCb = callback;
  59. jclient->processCbPtr = arg;
  60. return 0;
  61. }
  62. CARLA_EXPORT
  63. int jack_set_freewheel_callback(jack_client_t* client, JackFreewheelCallback callback, void* arg)
  64. {
  65. carla_debug("%s(%p, %p, %p)", __FUNCTION__, client, callback, arg);
  66. JackClientState* const jclient = (JackClientState*)client;
  67. CARLA_SAFE_ASSERT_RETURN(jclient != nullptr, 1);
  68. const CarlaMutexLocker cms(jclient->mutex);
  69. jclient->freewheelCb = callback;
  70. jclient->freewheelCbPtr = arg;
  71. return 0;
  72. }
  73. CARLA_EXPORT
  74. int jack_set_buffer_size_callback(jack_client_t* client, JackBufferSizeCallback callback, void* arg)
  75. {
  76. carla_debug("%s(%p, %p, %p)", __FUNCTION__, client, callback, arg);
  77. JackClientState* const jclient = (JackClientState*)client;
  78. CARLA_SAFE_ASSERT_RETURN(jclient != nullptr, 1);
  79. const CarlaMutexLocker cms(jclient->mutex);
  80. jclient->bufferSizeCb = callback;
  81. jclient->bufferSizeCbPtr = arg;
  82. return 0;
  83. }
  84. CARLA_EXPORT
  85. int jack_set_sample_rate_callback(jack_client_t* client, JackSampleRateCallback callback, void* arg)
  86. {
  87. carla_debug("%s(%p, %p, %p)", __FUNCTION__, client, callback, arg);
  88. JackClientState* const jclient = (JackClientState*)client;
  89. CARLA_SAFE_ASSERT_RETURN(jclient != nullptr, 1);
  90. const CarlaMutexLocker cms(jclient->mutex);
  91. jclient->sampleRateCb = callback;
  92. jclient->sampleRateCbPtr = arg;
  93. return 0;
  94. }
  95. CARLA_EXPORT
  96. int jack_set_client_registration_callback(jack_client_t* client, JackClientRegistrationCallback callback, void* arg)
  97. {
  98. carla_stderr2("%s(%p, %p, %p)", __FUNCTION__, client, callback, arg);
  99. return 0;
  100. }
  101. CARLA_EXPORT
  102. int jack_set_port_registration_callback(jack_client_t* client, JackPortRegistrationCallback callback, void* arg)
  103. {
  104. carla_stderr2("%s(%p, %p, %p)", __FUNCTION__, client, callback, arg);
  105. return 0;
  106. }
  107. CARLA_EXPORT
  108. int jack_set_port_connect_callback(jack_client_t* client, JackPortConnectCallback callback, void* arg)
  109. {
  110. carla_stderr2("%s(%p, %p, %p)", __FUNCTION__, client, callback, arg);
  111. return 0;
  112. }
  113. CARLA_EXPORT
  114. int jack_set_port_rename_callback(jack_client_t* client, JackPortRenameCallback callback, void* arg)
  115. {
  116. carla_stderr2("%s(%p, %p, %p)", __FUNCTION__, client, callback, arg);
  117. return 0;
  118. }
  119. CARLA_EXPORT
  120. int jack_set_graph_order_callback(jack_client_t* client, JackGraphOrderCallback callback, void* arg)
  121. {
  122. carla_stderr2("%s(%p, %p, %p)", __FUNCTION__, client, callback, arg);
  123. return 0;
  124. }
  125. CARLA_EXPORT
  126. int jack_set_xrun_callback(jack_client_t* client, JackXRunCallback callback, void* arg)
  127. {
  128. carla_stderr2("%s(%p, %p, %p)", __FUNCTION__, client, callback, arg);
  129. return 0;
  130. }
  131. // --------------------------------------------------------------------------------------------------------------------