/*---------------------------------------------------------------------------------*/ /* Includes */ /*---------------------------------------------------------------------------------*/ #ifndef _LV2_UI_H_ #define _LV2_UI_H_ #include #include "lv2/ui/ui.h" #include #include /*----------------------------------------------------------------------------*/ /* Global definitions */ /*----------------------------------------------------------------------------*/ #define DRD_DRUMMER_UI_URI "http://rx3.org/AlkorZ3/drummer#ui" /* typedef struct { LV2_Atom_Forge forge; LV2_URID_Map* map; LV2UI_Request_Value* request_value; LV2_Log_Logger logger; SamplerURIs uris; PeaksReceiver precv; LV2UI_Write_Function write; LV2UI_Controller controller; GtkWidget* box; GtkWidget* play_button; GtkWidget* file_button; GtkWidget* request_file_button; GtkWidget* button_box; GtkWidget* canvas; uint32_t width; uint32_t requested_n_peaks; char* filename; uint8_t forge_buf[1024]; // Optional show/hide interface GtkWidget* window; bool did_init; } SamplerUI; */ typedef struct DRT_LV2UI_URIS { LV2_URID Atom_Object; LV2_URID String_URId; LV2_URID Bool_URId; LV2_URID Int_URId; LV2_URID Midi_Event; LV2_URID UI_Msg; // LV2_URID kit_path; LV2_URID Atom_EventTransfer; // LV2_URID get_state; // LV2_URID midi_info; // LV2_URID sample_trigger; // LV2_URID channel_id; LV2_URID Velocity_Ignore_Flag_Toggle; LV2_URID Note_Off_Ignore_Flag_Toggle; // LV2_URID zero_position; // LV2_URID sample_add; // LV2_URID sample_remove; } DRT_LV2UI_URIS; typedef struct DRT_LV2UI_Base { // LV2 LV2UI_Write_Function Write; LV2UI_Controller Controller; LV2_Atom_Forge Forge; // Ports LV2_Atom_Sequence *Control_Port; LV2_Atom_Sequence *Core_Event_Port; //Config float Channel_Id; float Base_Note; float Velocity_Ignore_Note; float Note_Off_Ignore_Note; float Velocity_Ignore_Flag; float Note_Off_Ignore_Flag; float Position_Id; // params int Zero_Position; float **Gains; float **Pans; // URIs LV2_URID_Map *Map_Ptr; DRT_LV2UI_URIS URIS; // Logger LV2_Log_Logger Logger; // UI GtkWidget *Main_Widget_Ptr; GtkWidget *Channel_ComboBox_Ptr; GtkWidget *Base_Note_Spin_Ptr; GtkWidget *Base_Note_Label_Ptr; char Base_Note_Label_Buf[32]; GtkWidget *Position_ComboBox_Ptr; GtkWidget *Velocity_Ignore_Note_Spin_Ptr; GtkWidget *Note_Off_Ignore_Note_Spin_Ptr; GtkWidget *Velocity_Ignore_Flag_CheckBox_Ptr; GtkWidget *Note_Off_Ignore_Flag_CheckBox_Ptr; } DRT_LV2UI_Base; # ifdef _LV2_UI_C_ /*----------------------------------------------------------------------------*/ /* Private Definitions */ /*----------------------------------------------------------------------------*/ #define DRD_MODULE_NAME "gui" /*----------------------------------------------------------------------------*/ /* DRT_LV2UI_Base */ /*----------------------------------------------------------------------------*/ DRT_LV2UI_Base DRG_LV2UI_Base; char *DRG_LV2UI_Note_String = "C C#D D#E F F#G G#A A#B "; /*----------------------------------------------------------------------------*/ /* Private Prototypes */ /*----------------------------------------------------------------------------*/ /*----------------------------------------------------------------------------*/ /* DR_LV2UI_Map_URIS */ /*----------------------------------------------------------------------------*/ static inline void DR_LV2UI_Map_URIS( LV2_URID_Map *, DRT_LV2UI_URIS *); /*----------------------------------------------------------------------------*/ /* DR_LV2UI_Log_Write */ /*----------------------------------------------------------------------------*/ DRT_Status DR_LV2UI_Log_Write( DRT_Log_Type_Id, char *, va_list); /*----------------------------------------------------------------------------*/ /* DR_LV2UI_Channel_ID_ComboBox_Create */ /*----------------------------------------------------------------------------*/ static GtkWidget *DR_LV2UI_Channel_Id_ComboBox_Create( void); /*----------------------------------------------------------------------------*/ /* DR_LV2UI_Channel_Id_ComboBox_Change */ /*----------------------------------------------------------------------------*/ static void DR_LV2UI_Channel_Id_ComboBox_Changed( GtkComboBox *, gpointer); /*----------------------------------------------------------------------------*/ /* DR_LV2UI_Position_Id_ComboBox_Create */ /*----------------------------------------------------------------------------*/ static GtkWidget *DR_LV2UI_Position_Id_ComboBox_Create( void); /*----------------------------------------------------------------------------*/ /* DR_LV2UI_Position_Id_ComboBox_Change */ /*----------------------------------------------------------------------------*/ static void DR_LV2UI_Position_Id_ComboBox_Changed( GtkComboBox *, gpointer); /*----------------------------------------------------------------------------*/ /* DR_LV2UI_Velocity_Ignore_Flag_Toggled */ /*----------------------------------------------------------------------------*/ static gboolean DR_LV2UI_Velocity_Ignore_Flag_Toggled( GtkToggleButton *, gpointer); /*----------------------------------------------------------------------------*/ /* DR_LV2UI_Note_Off_Ignore_Flag_Toggled */ /*----------------------------------------------------------------------------*/ static gboolean DR_LV2UI_Note_Off_Ignore_Flag_Toggled( GtkToggleButton *, gpointer); /*----------------------------------------------------------------------------*/ /* DR_LV2UI_Build */ /*----------------------------------------------------------------------------*/ DRT_Status DR_LV2UI_UI_Build(); /*----------------------------------------------------------------------------*/ /* DR_LV2UI_Instantiate */ /*----------------------------------------------------------------------------*/ static LV2UI_Handle DR_LV2UI_Instantiate( const LV2UI_Descriptor *, const char *, const char *, LV2UI_Write_Function, LV2UI_Controller, LV2UI_Widget *, const LV2_Feature * const *); /*----------------------------------------------------------------------------*/ /* DR_LV2UI_Cleanup */ /*----------------------------------------------------------------------------*/ static void DR_LV2UI_Cleanup( LV2UI_Handle); /*----------------------------------------------------------------------------*/ /* DR_LV2UI_Port_Event */ /*----------------------------------------------------------------------------*/ static void DR_LV2UI_Port_Event( LV2UI_Handle, uint32_t, uint32_t, uint32_t, const void *); /*----------------------------------------------------------------------------*/ /* LV2UI_Descritor */ /*----------------------------------------------------------------------------*/ LV2_SYMBOL_EXPORT const LV2UI_Descriptor *lv2ui_descriptor( uint32_t); /*----------------------------------------------------------------------------*/ /* Post Private Definitions */ /*----------------------------------------------------------------------------*/ /*----------------------------------------------------------------------------*/ /* DRG_LV2UI_Descritor */ /*----------------------------------------------------------------------------*/ static const LV2UI_Descriptor DRG_LV2UI_Descriptor = { DRD_DRUMMER_URI "#ui", DR_LV2UI_Instantiate, DR_LV2UI_Cleanup, DR_LV2UI_Port_Event, NULL}; # else // ifdef _LV2_UI_C_ /*----------------------------------------------------------------------------*/ /* Public Prototypes */ /*----------------------------------------------------------------------------*/ # endif // ifndef _LV2_UI_C_ /*----------------------------------------------------------------------------*/ #endif // ifndef _LV2_UI_H_