VST3: fetch midi mappings all at once, use it for note/sound-off
[carla.git] / source / libjack / libjack_transport.cpp
blobdaf6d8cab2e9c009cef11c368718ac2c6870e6dc
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_engine_takeover_timebase(jack_client_t* client)
27 carla_debug("%s(%p)", __FUNCTION__, client);
28 return ENOSYS;
30 // unused
31 (void)client;
34 // --------------------------------------------------------------------------------------------------------------------
36 CARLA_PLUGIN_EXPORT
37 int jack_release_timebase(jack_client_t* client)
39 carla_debug("%s(%p)", __FUNCTION__, client);
40 return 0;
42 // unused
43 (void)client;
46 CARLA_PLUGIN_EXPORT
47 int jack_set_sync_callback(jack_client_t* client, JackSyncCallback callback, void* arg)
49 carla_debug("%s(%p, %p, %p)", __FUNCTION__, client, callback, arg);
51 JackClientState* const jclient = (JackClientState*)client;
52 CARLA_SAFE_ASSERT_RETURN(jclient != nullptr, 1);
54 const CarlaMutexLocker cms(jclient->mutex);
56 jclient->syncCb = callback;
57 jclient->syncCbPtr = arg;
58 return 0;
61 CARLA_PLUGIN_EXPORT
62 int jack_set_sync_timeout(jack_client_t* client, jack_time_t timeout)
64 carla_stderr2("%s(%p, " P_UINT64 ")", __FUNCTION__, client, timeout);
65 return 0;
68 CARLA_PLUGIN_EXPORT
69 int jack_set_timebase_callback(jack_client_t* client, int conditional, JackTimebaseCallback callback, void* arg)
71 carla_debug("%s(%p, %i, %p, %p)", __FUNCTION__, client, conditional, callback, arg);
72 return conditional ? EBUSY : 0;
74 // unused
75 (void)client;
76 (void)callback;
77 (void)arg;
80 CARLA_PLUGIN_EXPORT
81 int jack_transport_locate(jack_client_t* client, jack_nframes_t frame)
83 carla_stderr2("%s(%p, %u)", __FUNCTION__, client, frame);
84 return ENOSYS;
87 CARLA_PLUGIN_EXPORT
88 jack_transport_state_t jack_transport_query(const jack_client_t* client, jack_position_t* pos)
90 if (const JackClientState* const jclient = (const JackClientState*)client)
92 const JackServerState& jserver(jclient->server);
94 if (pos != nullptr)
95 std::memcpy(pos, &jserver.position, sizeof(jack_position_t));
97 return jserver.playing ? JackTransportRolling : JackTransportStopped;
100 if (pos != nullptr)
101 std::memset(pos, 0, sizeof(jack_position_t));
103 return JackTransportStopped;
106 CARLA_PLUGIN_EXPORT
107 jack_nframes_t jack_get_current_transport_frame(const jack_client_t* client)
109 if (const JackClientState* const jclient = (const JackClientState*)client)
110 return jclient->server.position.frame;
112 return 0;
115 CARLA_PLUGIN_EXPORT
116 int jack_transport_reposition(jack_client_t* client, const jack_position_t* pos)
118 carla_stderr2("%s(%p, %p)", __FUNCTION__, client, pos);
119 return ENOSYS;
122 CARLA_PLUGIN_EXPORT
123 void jack_transport_start(jack_client_t* client)
125 carla_stderr2("%s(%p)", __FUNCTION__, client);
128 CARLA_PLUGIN_EXPORT
129 void jack_transport_stop(jack_client_t* client)
131 carla_stderr2("%s(%p)", __FUNCTION__, client);
134 // --------------------------------------------------------------------------------------------------------------------
136 CARLA_PLUGIN_EXPORT
137 void jack_get_transport_info(jack_client_t* client, void* tinfo)
139 carla_stderr2("%s(%p, %p)", __FUNCTION__, client, tinfo);
142 CARLA_PLUGIN_EXPORT
143 void jack_set_transport_info(jack_client_t* client, void* tinfo)
145 carla_stderr2("%s(%p, %p)", __FUNCTION__, client, tinfo);
148 // --------------------------------------------------------------------------------------------------------------------