Arnaud G. GIBERT
0e9f183b15
- Replace internal log system with LibLog V1.0.x, - Code cleanup, - Add GPL Licenses files.
373 lines
13 KiB
C
373 lines
13 KiB
C
/*----------------------------------------------------------------------------*/
|
|
/* lv2_ui.h */
|
|
/*----------------------------------------------------------------------------*/
|
|
|
|
/*----------------------------------------------------------------------------*/
|
|
/* This file is part of Drummer. */
|
|
/* */
|
|
/* Drummer is free software: you can redistribute it and/or modify it */
|
|
/* under the terms of the GNU General Public License as published by */
|
|
/* the Free Software Foundation, either version 3 of the License, or */
|
|
/* (at your option) any later version. */
|
|
/* */
|
|
/* Drummer is distributed in the hope that it will be useful, */
|
|
/* but WITHOUT ANY WARRANTY; without even the implied warranty of */
|
|
/* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the */
|
|
/* GNU General Public License for more details. */
|
|
/* */
|
|
/* You should have received a copy of the GNU General Public License */
|
|
/* along with Drummer. If not, see <https://www.gnu.org/licenses/>. */
|
|
/*----------------------------------------------------------------------------*/
|
|
|
|
|
|
|
|
/*----------------------------------------------------------------------------*/
|
|
/* Includes */
|
|
/*----------------------------------------------------------------------------*/
|
|
|
|
#ifndef _LV2_UI_H_
|
|
#define _LV2_UI_H_
|
|
|
|
#include <limits.h>
|
|
|
|
#include "lv2/ui/ui.h"
|
|
|
|
#include <gtk/gtk.h>
|
|
#include <gdk/gdk.h>
|
|
|
|
|
|
|
|
|
|
|
|
/*----------------------------------------------------------------------------*/
|
|
/* Global definitions */
|
|
/*----------------------------------------------------------------------------*/
|
|
|
|
#define DRD_DRUMMER_UI_URI "http://rx3.org/AlkorZ3/drummer#ui"
|
|
|
|
|
|
|
|
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
|
|
DRT_Kit_Id Kit_Id;
|
|
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_Drummer_URIS URIS;
|
|
|
|
// Logger
|
|
LV2_Log_Logger Logger;
|
|
|
|
// UI
|
|
GtkWidget *Main_Widget_Ptr;
|
|
char Title_Label_Buf[128];
|
|
GtkWidget *Title_Label_Ptr;
|
|
GtkWidget *Kit_ComboBox_Ptr;
|
|
char Id_Bank_Program_Label_Buf[128];
|
|
GtkWidget *Id_Bank_Program_Label_Ptr;
|
|
GtkWidget *Channel_ComboBox_Ptr;
|
|
char Base_Note_Label_Buf[32];
|
|
GtkWidget *Base_Note_Label_Ptr;
|
|
GtkWidget *Base_Note_Spin_Ptr;
|
|
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;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/*----------------------------------------------------------------------------*/
|
|
/* DRD DATA & API definition */
|
|
/*----------------------------------------------------------------------------*/
|
|
|
|
# ifdef _LV2_UI_C_
|
|
# define DRD_GUI_DATA
|
|
# define DRD_GUI_API
|
|
# else
|
|
# define DRD_GUI_DATA extern
|
|
# define DRD_GUI_API extern
|
|
# endif
|
|
|
|
|
|
|
|
|
|
|
|
/*----------------------------------------------------------------------------*/
|
|
/* Public Data */
|
|
/*----------------------------------------------------------------------------*/
|
|
|
|
/*----------------------------------------------------------------------------*/
|
|
/* DRT_Base */
|
|
/*----------------------------------------------------------------------------*/
|
|
|
|
|
|
|
|
|
|
|
|
/*----------------------------------------------------------------------------*/
|
|
/* Public Prototypes */
|
|
/*----------------------------------------------------------------------------*/
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
# ifdef _LV2_UI_C_
|
|
|
|
/*----------------------------------------------------------------------------*/
|
|
/* Private Definitions */
|
|
/*----------------------------------------------------------------------------*/
|
|
|
|
#define DRD_MODULE_NAME "gui"
|
|
#define LGD_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_Drummer_URIS *);
|
|
|
|
|
|
|
|
/*----------------------------------------------------------------------------*/
|
|
/* DR_LV2UI_UI_Enable_Send */
|
|
/*----------------------------------------------------------------------------*/
|
|
|
|
static DRT_Status DR_LV2UI_UI_Enable_Send( void);
|
|
|
|
|
|
|
|
/*----------------------------------------------------------------------------*/
|
|
/* DR_LV2UI_UI_Disable_Send */
|
|
/*----------------------------------------------------------------------------*/
|
|
|
|
static DRT_Status DR_LV2UI_UI_Disable_Send( void);
|
|
|
|
|
|
|
|
/*----------------------------------------------------------------------------*/
|
|
/* DR_LV2UI_Kit_Update_Request_Send */
|
|
/*----------------------------------------------------------------------------*/
|
|
|
|
static DRT_Status DR_LV2UI_Kit_Update_Request_Send( void);
|
|
|
|
|
|
|
|
/*----------------------------------------------------------------------------*/
|
|
/* DR_LV2UI_Title_Label_Set */
|
|
/*----------------------------------------------------------------------------*/
|
|
|
|
static void DR_LV2UI_Title_Label_Set( DRT_Kit_Id);
|
|
|
|
|
|
|
|
/*----------------------------------------------------------------------------*/
|
|
/* DR_LV2UI_Id_Bank_Program_Label_Set */
|
|
/*----------------------------------------------------------------------------*/
|
|
|
|
static void DR_LV2UI_Id_Bank_Program_Label_Set( DRT_Kit_Id);
|
|
|
|
|
|
|
|
/*----------------------------------------------------------------------------*/
|
|
/* DR_LV2UI_Kit_ComboBox_Create */
|
|
/*----------------------------------------------------------------------------*/
|
|
|
|
static GtkWidget *DR_LV2UI_Kit_ComboBox_Create( void);
|
|
|
|
|
|
|
|
/*----------------------------------------------------------------------------*/
|
|
/* DR_LV2UI_Kit_ComboBox_Change */
|
|
/*----------------------------------------------------------------------------*/
|
|
|
|
static void DR_LV2UI_Kit_ComboBox_Changed( GtkComboBox *, gpointer);
|
|
|
|
|
|
|
|
/*----------------------------------------------------------------------------*/
|
|
/* DR_LV2UI_Kit_Update_Reply */
|
|
/*----------------------------------------------------------------------------*/
|
|
|
|
static DRT_Status DR_LV2UI_Kit_Update_Reply( DRT_Kit_Id);
|
|
|
|
|
|
|
|
/*----------------------------------------------------------------------------*/
|
|
/* 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_
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
# endif // ifdef _LV2_UI_C_
|
|
|
|
|
|
|
|
|
|
|
|
/*----------------------------------------------------------------------------*/
|
|
|
|
#endif // ifndef _LV2_UI_H_
|
|
|