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.

76 lines
2.1KB

  1. /*
  2. * Carla JACK API for external applications
  3. * Copyright (C) 2016-2018 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_freewheel(jack_client_t* client, int freewheel)
  22. {
  23. carla_debug("%s(%p, %i)", __FUNCTION__, client, freewheel);
  24. return ENOSYS;
  25. // unused
  26. (void)client;
  27. (void)freewheel;
  28. }
  29. CARLA_EXPORT
  30. int jack_set_buffer_size(jack_client_t* client, jack_nframes_t nframes)
  31. {
  32. carla_debug("%s(%p, %u)", __FUNCTION__, client, nframes);
  33. JackClientState* const jclient = (JackClientState*)client;
  34. CARLA_SAFE_ASSERT_RETURN(jclient != nullptr, 0);
  35. return (jclient->server.bufferSize == nframes) ? 0 : 1;
  36. }
  37. CARLA_EXPORT
  38. jack_nframes_t jack_get_sample_rate(jack_client_t* client)
  39. {
  40. carla_debug("%s(%p)", __FUNCTION__, client);
  41. JackClientState* const jclient = (JackClientState*)client;
  42. CARLA_SAFE_ASSERT_RETURN(jclient != nullptr, 0);
  43. return static_cast<jack_nframes_t>(jclient->server.sampleRate);
  44. }
  45. CARLA_EXPORT
  46. jack_nframes_t jack_get_buffer_size(jack_client_t* client)
  47. {
  48. carla_debug("%s(%p)", __FUNCTION__, client);
  49. JackClientState* const jclient = (JackClientState*)client;
  50. CARLA_SAFE_ASSERT_RETURN(jclient != nullptr, 0);
  51. return jclient->server.bufferSize;
  52. }
  53. CARLA_EXPORT
  54. float jack_cpu_load(jack_client_t*)
  55. {
  56. // TODO
  57. return 0.0f;
  58. }
  59. // --------------------------------------------------------------------------------------------------------------------