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.

74 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. JackClientState* const jclient = (JackClientState*)client;
  41. CARLA_SAFE_ASSERT_RETURN(jclient != nullptr, 0);
  42. return static_cast<jack_nframes_t>(jclient->server.sampleRate);
  43. }
  44. CARLA_EXPORT
  45. jack_nframes_t jack_get_buffer_size(jack_client_t* client)
  46. {
  47. carla_debug("%s(%p)", __FUNCTION__, client);
  48. JackClientState* const jclient = (JackClientState*)client;
  49. CARLA_SAFE_ASSERT_RETURN(jclient != nullptr, 0);
  50. return jclient->server.bufferSize;
  51. }
  52. CARLA_EXPORT
  53. float jack_cpu_load(jack_client_t*)
  54. {
  55. // TODO
  56. return 0.0f;
  57. }
  58. // --------------------------------------------------------------------------------------------------------------------