DPF

DISTRHO Plugin Framework
Log | Files | Refs | Submodules | README | LICENSE

control-input-port-change-request.h (3187B)


      1 /*
      2   LV2 ControlInputPort change request extension
      3   Copyright 2020 Filipe Coelho <falktx@falktx.com>
      4 
      5   Permission to use, copy, modify, and/or distribute this software for any
      6   purpose with or without fee is hereby granted, provided that the above
      7   copyright notice and this permission notice appear in all copies.
      8 
      9   THIS SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
     10   WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
     11   MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
     12   ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
     13   WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
     14   ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
     15   OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
     16 */
     17 
     18 /**
     19    @file control-input-port-change-request.h
     20    C header for the LV2 ControlInputPort change request extension <http://kx.studio/ns/lv2ext/control-input-port-change-request>.
     21 */
     22 
     23 #ifndef LV2_CONTROL_INPUT_PORT_CHANGE_REQUEST_H
     24 #define LV2_CONTROL_INPUT_PORT_CHANGE_REQUEST_H
     25 
     26 #include "lv2.h"
     27 
     28 #define LV2_CONTROL_INPUT_PORT_CHANGE_REQUEST_URI    "http://kx.studio/ns/lv2ext/control-input-port-change-request"
     29 #define LV2_CONTROL_INPUT_PORT_CHANGE_REQUEST_PREFIX LV2_CONTROL_INPUT_PORT_CHANGE_REQUEST_URI "#"
     30 
     31 #include <stdint.h>
     32 
     33 #ifdef __cplusplus
     34 extern "C" {
     35 #else
     36 #include <stdbool.h>
     37 #endif
     38 
     39 /** A status code for LV2_CONTROL_INPUT_PORT_CHANGE_REQUEST_URI functions. */
     40 typedef enum {
     41 	LV2_CONTROL_INPUT_PORT_CHANGE_SUCCESS           = 0,  /**< Completed successfully. */
     42 	LV2_CONTROL_INPUT_PORT_CHANGE_ERR_UNKNOWN       = 1,  /**< Unknown error. */
     43 	LV2_CONTROL_INPUT_PORT_CHANGE_ERR_INVALID_INDEX = 2   /**< Failed due to invalid port index. */
     44 } LV2_ControlInputPort_Change_Status;
     45 
     46 /**
     47  *  Opaque handle for LV2_CONTROL_INPUT_PORT_CHANGE_REQUEST_URI feature.
     48  */
     49 typedef void* LV2_ControlInputPort_Change_Request_Handle;
     50 
     51 /**
     52  * On instantiation, host must supply LV2_CONTROL_INPUT_PORT_CHANGE_REQUEST_URI feature.
     53  * LV2_Feature::data must be pointer to LV2_ControlInputPort_Change_Request.
     54 */
     55 typedef struct _LV2_ControlInputPort_Change_Request {
     56     /**
     57      *  Opaque host data.
     58      */
     59     LV2_ControlInputPort_Change_Request_Handle handle;
     60 
     61     /**
     62      * request_change()
     63      *
     64      * Ask the host to change a plugin's control input port value.
     65      * Parameter handle MUST be the 'handle' member of this struct.
     66      * Parameter index is port index to change.
     67      * Parameter value is the requested value to change the control port input to.
     68      *
     69      * Returns status of the request.
     70      * The host may decline this request, if e.g. it is currently automating this port.
     71      *
     72      * The plugin MUST call this function during run().
     73      */
     74     LV2_ControlInputPort_Change_Status (*request_change)(LV2_ControlInputPort_Change_Request_Handle handle,
     75                                                          uint32_t index,
     76                                                          float value);
     77 
     78 } LV2_ControlInputPort_Change_Request;
     79 
     80 #ifdef __cplusplus
     81 } /* extern "C" */
     82 #endif
     83 
     84 #endif /* LV2_CONTROL_INPUT_PORT_CHANGE_REQUEST_H */