| 854 | } |
| 855 | |
| 856 | bool process(const clap_process_t* const process) |
| 857 | { |
| 858 | #if DISTRHO_PLUGIN_WANT_MIDI_INPUT |
| 859 | fMidiEventCount = 0; |
| 860 | #endif |
| 861 | |
| 862 | #if DISTRHO_PLUGIN_HAS_UI |
| 863 | if (const clap_output_events_t* const outputEvents = process->out_events) |
| 864 | { |
| 865 | const RecursiveMutexTryLocker crmtl(fEventQueue.lock); |
| 866 | |
| 867 | if (crmtl.wasLocked()) |
| 868 | { |
| 869 | // reuse the same struct for gesture and parameters, they are compatible up to where it matters |
| 870 | clap_event_param_value_t clapEvent = { |
| 871 | { 0, 0, 0, 0, CLAP_EVENT_IS_LIVE }, |
| 872 | 0, nullptr, 0, 0, 0, 0, 0.0 |
| 873 | }; |
| 874 | |
| 875 | for (uint32_t i=0; i<fEventQueue.used; ++i) |
| 876 | { |
| 877 | const Event& event(fEventQueue.events[i]); |
| 878 | |
| 879 | switch (event.type) |
| 880 | { |
| 881 | case kEventGestureBegin: |
| 882 | clapEvent.header.size = sizeof(clap_event_param_gesture_t); |
| 883 | clapEvent.header.type = CLAP_EVENT_PARAM_GESTURE_BEGIN; |
| 884 | clapEvent.param_id = event.index; |
| 885 | break; |
| 886 | case kEventGestureEnd: |
| 887 | clapEvent.header.size = sizeof(clap_event_param_gesture_t); |
| 888 | clapEvent.header.type = CLAP_EVENT_PARAM_GESTURE_END; |
| 889 | clapEvent.param_id = event.index; |
| 890 | break; |
| 891 | case kEventParamSet: |
| 892 | clapEvent.header.size = sizeof(clap_event_param_value_t); |
| 893 | clapEvent.header.type = CLAP_EVENT_PARAM_VALUE; |
| 894 | clapEvent.param_id = event.index; |
| 895 | clapEvent.value = event.value; |
| 896 | fPlugin.setParameterValue(event.index, event.value); |
| 897 | break; |
| 898 | default: |
| 899 | continue; |
| 900 | } |
| 901 | |
| 902 | outputEvents->try_push(outputEvents, &clapEvent.header); |
| 903 | } |
| 904 | |
| 905 | fEventQueue.used = 0; |
| 906 | } |
| 907 | } |
| 908 | #endif |
| 909 | |
| 910 | #if DISTRHO_PLUGIN_WANT_TIMEPOS |
| 911 | if (const clap_event_transport_t* const transport = process->transport) |
| 912 | { |
| 913 | fTimePosition.playing = (transport->flags & CLAP_TRANSPORT_IS_PLAYING) != 0 && |
no test coverage detected