Fix crash with clap plugins without MIDI input
[carla.git] / source / libjack / libjack_server-control.cpp
blobcd04f70cc54e541681c7cd19c62797f075b76928
1 /*
2 * Carla JACK API for external applications
3 * Copyright (C) 2016-2022 Filipe Coelho <falktx@falktx.com>
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.
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.
15 * For a full copy of the GNU General Public License see the doc/GPL.txt file.
18 #include "libjack.hpp"
20 CARLA_BACKEND_USE_NAMESPACE
22 // --------------------------------------------------------------------------------------------------------------------
24 CARLA_PLUGIN_EXPORT
25 int jack_set_freewheel(jack_client_t* client, int freewheel)
27 carla_debug("%s(%p, %i)", __FUNCTION__, client, freewheel);
28 return ENOSYS;
30 // unused
31 (void)client;
32 (void)freewheel;
35 CARLA_PLUGIN_EXPORT
36 int jack_set_buffer_size(jack_client_t* client, jack_nframes_t nframes)
38 carla_debug("%s(%p, %u)", __FUNCTION__, client, nframes);
40 JackClientState* const jclient = (JackClientState*)client;
41 CARLA_SAFE_ASSERT_RETURN(jclient != nullptr, 0);
43 return (jclient->server.bufferSize == nframes) ? 0 : 1;
46 CARLA_PLUGIN_EXPORT
47 jack_nframes_t jack_get_sample_rate(jack_client_t* client)
49 JackClientState* const jclient = (JackClientState*)client;
50 CARLA_SAFE_ASSERT_RETURN(jclient != nullptr, 0);
52 return static_cast<jack_nframes_t>(jclient->server.sampleRate);
55 CARLA_PLUGIN_EXPORT
56 jack_nframes_t jack_get_buffer_size(jack_client_t* client)
58 carla_debug("%s(%p)", __FUNCTION__, client);
60 JackClientState* const jclient = (JackClientState*)client;
61 CARLA_SAFE_ASSERT_RETURN(jclient != nullptr, 0);
63 return jclient->server.bufferSize;
66 CARLA_PLUGIN_EXPORT
67 float jack_cpu_load(jack_client_t*)
69 // TODO
70 return 0.0f;
73 // --------------------------------------------------------------------------------------------------------------------