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.

119 lines
3.3KB

  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. // need to include this first
  18. #include "libjack.hpp"
  19. CARLA_BACKEND_USE_NAMESPACE
  20. // --------------------------------------------------------------------------------------------------------------------
  21. CARLA_EXPORT
  22. int jack_engine_takeover_timebase(jack_client_t*)
  23. {
  24. return ENOSYS;
  25. }
  26. // int jack_release_timebase (jack_client_t *client) JACK_OPTIONAL_WEAK_EXPORT;
  27. CARLA_EXPORT
  28. int jack_set_sync_callback(jack_client_t* client, JackSyncCallback callback, void* arg)
  29. {
  30. JackClientState* const jclient = (JackClientState*)client;
  31. CARLA_SAFE_ASSERT_RETURN(jclient != nullptr, 1);
  32. const CarlaMutexLocker cms(jclient->mutex);
  33. jclient->syncCb = callback;
  34. jclient->syncCbPtr = arg;
  35. return 0;
  36. }
  37. // int jack_set_sync_timeout (jack_client_t *client,
  38. // jack_time_t timeout) JACK_OPTIONAL_WEAK_EXPORT;
  39. CARLA_EXPORT
  40. int jack_set_timebase_callback(jack_client_t*, int, JackTimebaseCallback, void*)
  41. {
  42. // FIXME?
  43. return EBUSY;
  44. }
  45. CARLA_EXPORT
  46. int jack_transport_locate(jack_client_t*, jack_nframes_t)
  47. {
  48. // FIXME?
  49. return 1;
  50. }
  51. CARLA_EXPORT
  52. jack_transport_state_t jack_transport_query(const jack_client_t* client, jack_position_t* pos)
  53. {
  54. if (const JackClientState* const jclient = (JackClientState*)client)
  55. {
  56. const JackServerState& jserver(jclient->server);
  57. if (pos != nullptr)
  58. std::memcpy(pos, &jserver.position, sizeof(jack_position_t));
  59. return jserver.playing ? JackTransportRolling : JackTransportStopped;
  60. }
  61. if (pos != nullptr)
  62. std::memset(pos, 0, sizeof(jack_position_t));
  63. return JackTransportStopped;
  64. }
  65. jack_nframes_t jack_get_current_transport_frame(const jack_client_t* client)
  66. {
  67. if (const JackClientState* const jclient = (JackClientState*)client)
  68. return jclient->server.position.frame;
  69. return 0;
  70. }
  71. CARLA_EXPORT
  72. int jack_transport_reposition(jack_client_t*, const jack_position_t*)
  73. {
  74. carla_stdout("CarlaJackClient :: %s", __FUNCTION__);
  75. return EINVAL;
  76. }
  77. CARLA_EXPORT
  78. void jack_transport_start(jack_client_t*)
  79. {
  80. carla_stdout("CarlaJackClient :: %s", __FUNCTION__);
  81. }
  82. CARLA_EXPORT
  83. void jack_transport_stop (jack_client_t*)
  84. {
  85. carla_stdout("CarlaJackClient :: %s", __FUNCTION__);
  86. }
  87. // void jack_get_transport_info (jack_client_t *client,
  88. // jack_transport_info_t *tinfo) JACK_OPTIONAL_WEAK_EXPORT;
  89. // void jack_set_transport_info (jack_client_t *client,
  90. // jack_transport_info_t *tinfo) JACK_OPTIONAL_WEAK_EXPORT;
  91. // --------------------------------------------------------------------------------------------------------------------