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.

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