- Re-enable kits database load on ui side (waiting shared datastructure implementation!),

- Implement and use DR_Kits_Name_Get().
This commit is contained in:
Arnaud G. GIBERT 2024-04-10 10:05:11 +02:00
parent 1368d988d1
commit 82df708879
7 changed files with 403 additions and 38 deletions

View File

@ -2491,6 +2491,76 @@ DRT_Status DR_Kits_Load()
/*----------------------------------------------------------------------------*/
/* DR_Kits_Name_Get */
/*----------------------------------------------------------------------------*/
DRT_Status DR_Kits_Name_Get( DRT_Kit_Name **Kit_Name_Tab_Ptr, long *Kit_Number_Ptr)
{
NDT_Status nd_status;
NDT_Node *node_cur_ptr;
DRT_Kit *kit_cur_ptr;
long kit_id;
*Kit_Number_Ptr = DRG_Base.Kit_DS_Ptr->Index_Tab[NDD_INDEX_PRIMARY].Node_Number;
if( *Kit_Number_Ptr == 0)
{
*Kit_Name_Tab_Ptr = NULL;
return( DRS_OK);
}
else
{
if( ( nd_status = ND_Index_Node_First_Get( &node_cur_ptr, DRG_Base.Kit_DS_Ptr, 1)) != NDS_OK)
{
DR_LOG_INFO_1( "Can't find the first kit: ND_Index_Node_First_Get() failed (%d)!", nd_status);
*Kit_Name_Tab_Ptr = NULL;
return( DRS_KO);
}
else
{
if( ( *Kit_Name_Tab_Ptr = malloc( sizeof( DRT_Kit_Name) * *Kit_Number_Ptr)) == NULL)
{
DR_LOG_INFO_0( "Can't allocate kit name tab memory!");
*Kit_Name_Tab_Ptr = NULL;
return( DRS_KO);
}
else
{
kit_id = 0;
while( node_cur_ptr != NULL)
{
kit_cur_ptr = node_cur_ptr->Value;
// DR_LOG_INFO_1( "Kit Name: [%s]", kit_cur_ptr->Name);
(*Kit_Name_Tab_Ptr)[ kit_id].Id = kit_cur_ptr->Id;
(*Kit_Name_Tab_Ptr)[ kit_id].Logical_Id = kit_cur_ptr->Logical_Id;
strcpy( (*Kit_Name_Tab_Ptr)[ kit_id].Name, kit_cur_ptr->Name);
kit_id++;
if( ( nd_status = ND_Index_Node_Next_Get( &node_cur_ptr, node_cur_ptr)) != NDS_OK)
{
DR_LOG_INFO_1( "Can't find the next kit: ND_Index_Node_Next_Get() failed (%d)!", nd_status);
node_cur_ptr = NULL;
}
}
return( DRS_OK);
}
}
}
}
/*----------------------------------------------------------------------------*/
/* DR_Kits_Stats_Dump */
/*----------------------------------------------------------------------------*/

View File

@ -326,6 +326,15 @@ typedef struct DRT_Kit
typedef struct DRT_Kit_Name
{
DRT_Kit_Id Id;
DRT_Kit_Id Logical_Id;
char Name[ DRD_NAME_SIZE];
} DRT_Kit_Name;
# ifdef _DATASTRUCT_C_
@ -739,6 +748,14 @@ DRT_Status DR_Kits_Load();
/*----------------------------------------------------------------------------*/
/* DR_Kits_Name_Get */
/*----------------------------------------------------------------------------*/
DRT_Status DR_Kits_Name_Get( DRT_Kit_Name **, long *);
/*----------------------------------------------------------------------------*/
/* DR_Kits_Stats_Dump */
/*----------------------------------------------------------------------------*/
@ -956,6 +973,14 @@ extern DRT_Status DR_Kits_Load();
/*----------------------------------------------------------------------------*/
/* DR_Kits_Name_Get */
/*----------------------------------------------------------------------------*/
extern DRT_Status DR_Kits_Name_Get( DRT_Kit_Name **, long *);
/*----------------------------------------------------------------------------*/
/* DR_Kits_Stats_Dump */
/*----------------------------------------------------------------------------*/

View File

@ -158,7 +158,25 @@ int main( int argc, char **argv)
{
exit( -1);
}
*/
*/
DRT_Kit_Name *kit_name_tab;
long kit_number;
long kit_id;
if( ( status = DR_Kits_Name_Get( &kit_name_tab, &kit_number)) != DRS_OK)
{
exit( -1);
}
else
{
for( kit_id = 0; kit_id < kit_number; kit_id++)
{
DR_LOG_INFO_4( "Kit #: (%d) Id: (%d) Logical_Id: (%d) Name: [%s]",
kit_id, kit_name_tab[ kit_id].Id, kit_name_tab[ kit_id].Logical_Id, kit_name_tab[ kit_id].Name);
}
}
if( ( status = DR_Tasks_Dump()) != DRS_OK)
{
exit( -1);

View File

@ -80,6 +80,8 @@ static inline void DR_LV2_Map_URIS( LV2_URID_Map *Map_Ptr, DRT_Drummer_URIS *
URIS->String_URId = Map_Ptr->map( Map_Ptr->handle, LV2_ATOM__String);
URIS->Bool_URId = Map_Ptr->map( Map_Ptr->handle, LV2_ATOM__Bool);
URIS->Int_URId = Map_Ptr->map( Map_Ptr->handle, LV2_ATOM__Int);
URIS->Long_URId = Map_Ptr->map( Map_Ptr->handle, LV2_ATOM__Long);
URIS->Tuple_URId = Map_Ptr->map( Map_Ptr->handle, LV2_ATOM__Tuple);
URIS->Midi_Event = Map_Ptr->map( Map_Ptr->handle, "http://lv2plug.in/ns/ext/midi#MidiEvent");
@ -87,7 +89,10 @@ static inline void DR_LV2_Map_URIS( LV2_URID_Map *Map_Ptr, DRT_Drummer_URIS *
URIS->Atom_EventTransfer = Map_Ptr->map( Map_Ptr->handle, LV2_ATOM__eventTransfer);
URIS->Kit_Name_Tab_Update = Map_Ptr->map( Map_Ptr->handle, DRD_DRUMMER_URI "#kitnametabupdate");
URIS->UI_Enable = Map_Ptr->map( Map_Ptr->handle, DRD_DRUMMER_URI "#uienable");
URIS->UI_Disable = Map_Ptr->map( Map_Ptr->handle, DRD_DRUMMER_URI "#uidisable");
URIS->Kit_Name_Update = Map_Ptr->map( Map_Ptr->handle, DRD_DRUMMER_URI "#kitnameupdate");
URIS->Velocity_Ignore_Flag_Toggle = Map_Ptr->map( Map_Ptr->handle, DRD_DRUMMER_URI "#velocitytoggle");
URIS->Note_Off_Ignore_Flag_Toggle = Map_Ptr->map( Map_Ptr->handle, DRD_DRUMMER_URI "#noteofftoggle");
@ -697,7 +702,7 @@ static LV2_Handle DR_LV2_Instantiate( const LV2_Descriptor *LV2_Descripto
}
else
{
DR_LV2_Map_URIS( DRG_LV2_Base.Map_Ptr, &(DRG_LV2_Base.URIS));
DR_LV2_Map_URIS( DRG_LV2_Base.Map_Ptr, &( DRG_LV2_Base.URIS));
lv2_atom_forge_init( &(DRG_LV2_Base.Forge), DRG_LV2_Base.Map_Ptr);
@ -997,13 +1002,13 @@ static void DR_LV2_Run( LV2_Handle Instance_Ptr, uint32_t N_Samples)
LV2_Atom_Forge_Frame set_frame;
DR_LOG_INFO_1( "Update Kit Name Tab: [%d]", nn);
DR_LOG_INFO_1( "Update Kit Name: [%d]", nn);
lv2_atom_forge_frame_time( &( DRG_LV2_Base.Forge), 0);
lv2_atom_forge_object( &( DRG_LV2_Base.Forge), &set_frame, 1, DRG_LV2_Base.URIS.UI_Msg);
lv2_atom_forge_property_head( &( DRG_LV2_Base.Forge), DRG_LV2_Base.URIS.Kit_Name_Tab_Update, 0);
lv2_atom_forge_property_head( &( DRG_LV2_Base.Forge), DRG_LV2_Base.URIS.Kit_Name_Update, 0);
lv2_atom_forge_string( &( DRG_LV2_Base.Forge), "Hello World!", 13);
lv2_atom_forge_pop( &( DRG_LV2_Base.Forge), &set_frame);
@ -1101,7 +1106,63 @@ static void DR_LV2_Run( LV2_Handle Instance_Ptr, uint32_t N_Samples)
{
DR_LOG_INFO_0( "LV2 AO...");
const LV2_Atom_Object *obj_ptr = (LV2_Atom_Object *)&(ev_ptr->body);
const LV2_Atom_Object *obj_ptr = (LV2_Atom_Object *)&( ev_ptr->body);
if( obj_ptr->body.otype == lv2_base_ptr->URIS.UI_Msg)
{
const LV2_Atom *ui_enable = NULL;
const LV2_Atom *ui_disable = NULL;
lv2_atom_object_get( obj_ptr,
lv2_base_ptr->URIS.UI_Enable, &ui_enable,
lv2_base_ptr->URIS.UI_Disable, &ui_disable,
0);
if( ui_enable)
{
DRT_Kit_Name *kit_name_tab;
long kit_number;
DR_LOG_INFO_0( "UI Enable!");
if( ( status = DR_Kits_Name_Get( &kit_name_tab, &kit_number)) != DRS_OK)
{
DR_LOG_ERROR_1( "Can't get kit names: (%d)", status);
}
else
{
LV2_Atom_Forge_Frame obj_frame, tup_frame;
LV2_Atom_Forge_Ref ref;
DR_LOG_INFO_3( "Update Kit Name: Nb: (%d) First: [%s] Size: (%ld)", kit_number, kit_name_tab[0].Name, sizeof( DRT_Kit_Name) * kit_number);
lv2_atom_forge_frame_time( &( DRG_LV2_Base.Forge), 0);
lv2_atom_forge_object( &( DRG_LV2_Base.Forge), &obj_frame, 1, DRG_LV2_Base.URIS.UI_Msg);
lv2_atom_forge_property_head( &( DRG_LV2_Base.Forge), DRG_LV2_Base.URIS.Kit_Name_Update, 0);
lv2_atom_forge_tuple( &( DRG_LV2_Base.Forge), &tup_frame);
lv2_atom_forge_long( &( DRG_LV2_Base.Forge), kit_number); // Max number of kit
lv2_atom_forge_long( &( DRG_LV2_Base.Forge), DRG_LV2_Base.Kit_Cur_Ptr->Id); // Cur kit Id
// ref = lv2_atom_forge_write( &( DRG_LV2_Base.Forge), &( kit_name_tab[i]), sizeof( DRT_Kit_Name) * kit_number);
// DR_LOG_INFO_1( "Forge: KNT Ref: (%lx)", ref);
lv2_atom_forge_pop( &( DRG_LV2_Base.Forge), &tup_frame);
lv2_atom_forge_pop( &( DRG_LV2_Base.Forge), &obj_frame);
DR_LOG_INFO_3( "Kit Name Update: Kit_Number: (%ld) Kit_Cur_Id: (%ld) Kit_Cur_Name: [%s]", kit_number, DRG_LV2_Base.Kit_Cur_Ptr->Id, DRG_LV2_Base.Kit_Cur_Ptr->Name);
}
}
if( ui_disable)
{
DR_LOG_INFO_0( "UI Disable!");
}
/*
if( obj_ptr->body.otype == lv2_base_ptr->URIS.ui_msg)
@ -1199,7 +1260,8 @@ static void DR_LV2_Run( LV2_Handle Instance_Ptr, uint32_t N_Samples)
// build_state_message( lv2_base_ptr);
}
*/
}
}
}
else
{
DR_LOG_WARNING_2( "Unrecognized event (%d) != (%d)", ev_ptr->body.type, lv2_base_ptr->URIS.Atom_Object);

View File

@ -208,6 +208,8 @@ typedef struct DRT_Drummer_URIS
LV2_URID String_URId;
LV2_URID Bool_URId;
LV2_URID Int_URId;
LV2_URID Long_URId;
LV2_URID Tuple_URId;
LV2_URID Midi_Event;
@ -215,7 +217,10 @@ typedef struct DRT_Drummer_URIS
LV2_URID Atom_EventTransfer;
LV2_URID Kit_Name_Tab_Update;
LV2_URID UI_Enable;
LV2_URID UI_Disable;
LV2_URID Kit_Name_Update;
LV2_URID Velocity_Ignore_Flag_Toggle;
LV2_URID Note_Off_Ignore_Flag_Toggle;
@ -362,7 +367,7 @@ typedef struct
/*----------------------------------------------------------------------------*/
/* DRT_LV2_Base */
/* DRG_LV2_Base */
/*----------------------------------------------------------------------------*/
DRT_LV2_Base DRG_LV2_Base;

219
lv2_ui.c
View File

@ -73,6 +73,8 @@ static inline void DR_LV2UI_Map_URIS( LV2_URID_Map *Map_Ptr, DRT_LV2UI_URIS *
URIS->String_URId = Map_Ptr->map( Map_Ptr->handle, LV2_ATOM__String);
URIS->Bool_URId = Map_Ptr->map( Map_Ptr->handle, LV2_ATOM__Bool);
URIS->Int_URId = Map_Ptr->map( Map_Ptr->handle, LV2_ATOM__Int);
URIS->Long_URId = Map_Ptr->map( Map_Ptr->handle, LV2_ATOM__Long);
URIS->Tuple_URId = Map_Ptr->map( Map_Ptr->handle, LV2_ATOM__Tuple);
URIS->Midi_Event = Map_Ptr->map( Map_Ptr->handle, "http://lv2plug.in/ns/ext/midi#MidiEvent");
@ -80,7 +82,10 @@ static inline void DR_LV2UI_Map_URIS( LV2_URID_Map *Map_Ptr, DRT_LV2UI_URIS *
URIS->Atom_EventTransfer = Map_Ptr->map( Map_Ptr->handle, LV2_ATOM__eventTransfer);
URIS->Kit_Name_Tab_Update = Map_Ptr->map( Map_Ptr->handle, DRD_DRUMMER_URI "#kitnametabupdate");
URIS->UI_Enable = Map_Ptr->map( Map_Ptr->handle, DRD_DRUMMER_URI "#uienable");
URIS->UI_Disable = Map_Ptr->map( Map_Ptr->handle, DRD_DRUMMER_URI "#uidisable");
URIS->Kit_Name_Update = Map_Ptr->map( Map_Ptr->handle, DRD_DRUMMER_URI "#kitnameupdate");
URIS->Velocity_Ignore_Flag_Toggle = Map_Ptr->map( Map_Ptr->handle, DRD_DRUMMER_URI "#velocitytoggle");
URIS->Note_Off_Ignore_Flag_Toggle = Map_Ptr->map( Map_Ptr->handle, DRD_DRUMMER_URI "#noteofftoggle");
@ -140,7 +145,7 @@ static void send_ui_disable( LV2UI_Handle handle)
/* */
/*----------------------------------------------------------------------------*/
static void send_ui_enable(LV2UI_Handle handle)
static void send_ui_enable( LV2UI_Handle handle)
{
fprintf( stderr, "send_ui_enable called!\n");
@ -169,6 +174,86 @@ static void send_ui_enable(LV2UI_Handle handle)
/*----------------------------------------------------------------------------*/
/* DR_LV2UI_UI_Enable */
/*----------------------------------------------------------------------------*/
static DRT_Status DR_LV2UI_UI_Enable( void)
{
uint8_t obj_buf[64];
LV2_Atom_Forge_Frame set_frame;
LV2_Atom *msg;
DR_LOG_INFO_0( "UI Open!");
lv2_atom_forge_set_buffer( &( DRG_LV2UI_Base.Forge), obj_buf, sizeof( obj_buf));
lv2_atom_forge_frame_time( &( DRG_LV2UI_Base.Forge), 0);
msg = (LV2_Atom *)lv2_atom_forge_object( &( DRG_LV2UI_Base.Forge), &set_frame, 1, DRG_LV2UI_Base.URIS.UI_Msg);
lv2_atom_forge_property_head( &( DRG_LV2UI_Base.Forge), DRG_LV2UI_Base.URIS.UI_Enable, 0);
lv2_atom_forge_pop( &( DRG_LV2UI_Base.Forge), &set_frame);
DRG_LV2UI_Base.Write( DRG_LV2UI_Base.Controller, 0, lv2_atom_total_size( msg), DRG_LV2UI_Base.URIS.Atom_EventTransfer, msg);
// EgScopeUI *ui = (EgScopeUI*)handle;
/*
uint8_t obj_buf[64];
lv2_atom_forge_set_buffer( &( DRG_LV2UI_Base.Forge), obj_buf, sizeof(obj_buf));
LV2_Atom_Forge_Frame frame;
LV2_Atom* msg = (LV2_Atom*)lv2_atom_forge_object( &( DRG_LV2UI_Base.Forge), &frame, 0, DRG_LV2UI_Base.URIS.UI_Open);
assert(msg);
lv2_atom_forge_pop( &( DRG_LV2UI_Base.Forge), &frame);
DRG_LV2UI_Base.Write( DRG_LV2UI_Base.Controller, 0, lv2_atom_total_size( msg), DRG_LV2UI_Base.URIS.Atom_EventTransfer, msg);
*/
return( DRS_OK);
}
/*----------------------------------------------------------------------------*/
/* DR_LV2UI_UI_Disable */
/*----------------------------------------------------------------------------*/
static DRT_Status DR_LV2UI_UI_Disable( void)
{
uint8_t obj_buf[64];
LV2_Atom_Forge_Frame set_frame;
LV2_Atom *msg;
DR_LOG_INFO_0( "UI Close!");
lv2_atom_forge_set_buffer( &( DRG_LV2UI_Base.Forge), obj_buf, sizeof( obj_buf));
lv2_atom_forge_frame_time( &( DRG_LV2UI_Base.Forge), 0);
msg = (LV2_Atom *)lv2_atom_forge_object( &( DRG_LV2UI_Base.Forge), &set_frame, 1, DRG_LV2UI_Base.URIS.UI_Msg);
lv2_atom_forge_property_head( &( DRG_LV2UI_Base.Forge), DRG_LV2UI_Base.URIS.UI_Disable, 0);
lv2_atom_forge_pop( &( DRG_LV2UI_Base.Forge), &set_frame);
DRG_LV2UI_Base.Write( DRG_LV2UI_Base.Controller, 0, lv2_atom_total_size( msg), DRG_LV2UI_Base.URIS.Atom_EventTransfer, msg);
return( DRS_OK);
}
/*----------------------------------------------------------------------------*/
/* */
/*----------------------------------------------------------------------------*/
@ -228,6 +313,10 @@ static gboolean DR_LV2UI_Expose_Callback (GtkWidget *widget, GdkEventExpose *eve
static GtkWidget *DR_LV2UI_Kit_ComboBox_Create( void)
{
DRT_Status status;
DRT_Kit_Name *kit_name_tab;
DRT_Kit_Id kit_number;
GtkWidget *combobox_ptr;
GtkListStore *list_store_ptr;
GtkCellRenderer *cell_ptr;
@ -235,14 +324,45 @@ static GtkWidget *DR_LV2UI_Kit_ComboBox_Create( void)
int i;
char label[8];
NDT_Status nd_status;
/*
NDT_Node *node_cur_ptr;
DRT_Kit *kit_cur_ptr;
*/
list_store_ptr = gtk_list_store_new( 1, G_TYPE_STRING);
if( ( status = DR_Kits_Name_Get( &kit_name_tab, &kit_number)) != DRS_OK)
{
DR_LOG_ERROR_1( "Can't get kit names: (%d)", status);
}
else
{
for( i = 0; i < kit_number; i++)
{
gtk_list_store_append( list_store_ptr, &iter);
gtk_list_store_set( list_store_ptr, &iter, 0, kit_name_tab[i].Name, -1);
}
}
free( kit_name_tab);
combobox_ptr = gtk_combo_box_new_with_model( GTK_TREE_MODEL( list_store_ptr));
gtk_combo_box_set_active( GTK_COMBO_BOX( combobox_ptr), 0);
g_object_unref( list_store_ptr);
cell_ptr = gtk_cell_renderer_text_new();
gtk_cell_layout_pack_start( GTK_CELL_LAYOUT( combobox_ptr), cell_ptr, TRUE);
gtk_cell_layout_set_attributes( GTK_CELL_LAYOUT( combobox_ptr), cell_ptr, "text", 0, NULL);
return( combobox_ptr);
}
/*
DR_LOG_INFO_1( "DRG_Base_Ptr: (%lx)!", (char *)( &DRG_Base));
if( ( nd_status = ND_Index_Node_First_Get( &node_cur_ptr, DRG_Base.Kit_DS_Ptr, 1)) != NDS_OK)
@ -266,25 +386,12 @@ static GtkWidget *DR_LV2UI_Kit_ComboBox_Create( void)
}
}
}
combobox_ptr = gtk_combo_box_new_with_model( GTK_TREE_MODEL( list_store_ptr));
gtk_combo_box_set_active( GTK_COMBO_BOX( combobox_ptr), 0);
g_object_unref( list_store_ptr);
cell_ptr = gtk_cell_renderer_text_new();
gtk_cell_layout_pack_start( GTK_CELL_LAYOUT( combobox_ptr), cell_ptr, TRUE);
gtk_cell_layout_set_attributes( GTK_CELL_LAYOUT( combobox_ptr), cell_ptr, "text", 0, NULL);
return( combobox_ptr);
}
*/
/*----------------------------------------------------------------------------*/
/* DR_LV2UI_Kit_ComboBox_Change */
/*----------------------------------------------------------------------------*/
@ -532,8 +639,9 @@ DRT_Status DR_LV2UI_UI_Build( GtkWidget **Main_Widget_Ptr_Ptr)
opts_hbox2_ptr = gtk_hbox_new( false, 0);
// Kit
kit_label_ptr = gtk_label_new( "Kit: <b>No kit selected</b>");
gtk_label_set_use_markup( GTK_LABEL( kit_label_ptr), true);
// kit_label_ptr = gtk_label_new( "Kit: <b>No kit selected</b>");
kit_label_ptr = gtk_label_new( "Kit:");
// gtk_label_set_use_markup( GTK_LABEL( kit_label_ptr), true);
kit_combobox_ptr = DR_LV2UI_Kit_ComboBox_Create();
kit_hbox_ptr = gtk_hbox_new( false, 0);
@ -590,7 +698,7 @@ DRT_Status DR_LV2UI_UI_Build( GtkWidget **Main_Widget_Ptr_Ptr)
gtk_box_pack_start( GTK_BOX( *Main_Widget_Ptr_Ptr), opts_hbox2_ptr, false, false, 5);
// Signals
// g_signal_connect( G_OBJECT( kit_combobox), "changed", G_CALLBACK( kit_combobox_changed), &DRG_LV2UI_Note);
g_signal_connect( G_OBJECT( kit_combobox_ptr), "changed", G_CALLBACK( DR_LV2UI_Kit_ComboBox_Changed), &DRG_LV2UI_Base);
g_signal_connect( G_OBJECT( base_note_spin_ptr), "value-changed", G_CALLBACK( DR_LV2UI_Base_Note_Spin_Changed), &DRG_LV2UI_Base);
g_signal_connect( G_OBJECT( channel_id_combobox_ptr), "changed", G_CALLBACK( DR_LV2UI_Channel_Id_ComboBox_Changed), &DRG_LV2UI_Base);
g_signal_connect( G_OBJECT( position_id_combobox_ptr), "changed", G_CALLBACK( DR_LV2UI_Position_Id_ComboBox_Changed), &DRG_LV2UI_Base);
@ -698,12 +806,12 @@ static LV2UI_Handle DR_LV2UI_Instantiate( const LV2UI_Descriptor *LV2UI_Des
lv2_atom_forge_init( &(DRG_LV2UI_Base.Forge), DRG_LV2UI_Base.Map_Ptr);
/*
/* Load Local Database copy waiting a shared DataStruct implementation ! */
if( ( status = DR_Kits_Load()) != DRS_OK)
{
fprintf( stderr, "Can't load kits (%d)!\n", status);
}
else */
}
else
{
if( DR_LV2UI_UI_Build( (GtkWidget **)Widget_Ptr_Ptr) != DRS_OK)
{
@ -711,6 +819,8 @@ static LV2UI_Handle DR_LV2UI_Instantiate( const LV2UI_Descriptor *LV2UI_Des
}
else
{
DR_LV2UI_UI_Enable();
return( &DRG_LV2UI_Base);
}
}
@ -730,8 +840,10 @@ static LV2UI_Handle DR_LV2UI_Instantiate( const LV2UI_Descriptor *LV2UI_Des
static void DR_LV2UI_Cleanup( LV2UI_Handle Instance_Ptr)
{
fprintf( stderr, "cleanup called!\n");
DR_LOG_INFO_0( "Cleanup called!!");
DR_LV2UI_UI_Disable();
/*
EgScopeUI* ui = (EgScopeUI*)handle;
*/
@ -779,14 +891,65 @@ static void DR_LV2UI_Port_Event( LV2UI_Handle Instance_Ptr,
const LV2_Atom *note_off_ignore_flag_ptr = NULL;
lv2_atom_object_get( obj,
DRG_LV2UI_Base.URIS.Kit_Name_Tab_Update, &kit_name_tab_ptr,
DRG_LV2UI_Base.URIS.Kit_Name_Update, &kit_name_tab_ptr,
DRG_LV2UI_Base.URIS.Velocity_Ignore_Flag_Toggle, &velocity_ignore_flag_ptr,
DRG_LV2UI_Base.URIS.Note_Off_Ignore_Flag_Toggle, &note_off_ignore_flag_ptr,
NULL);
if( kit_name_tab_ptr)
{
DR_LOG_INFO_1( "UI Msg: Kit Name Tab Update! [%s]", (char*)LV2_ATOM_BODY( kit_name_tab_ptr));
LV2_Atom *iter;
long kit_number, kit_cur_id;
DR_LOG_INFO_0( "UI Msg: Kit Name Update! ");
iter = lv2_atom_tuple_begin( (const LV2_Atom_Tuple *)kit_name_tab_ptr);
kit_number = ( (const LV2_Atom_Long *)iter)->body;
iter = lv2_atom_tuple_next( iter);
kit_cur_id = ( (const LV2_Atom_Long *)iter)->body;
DR_LOG_INFO_2( "UI Msg: Kit Name Update: Kit_Number: (%ld) Kit_Cur_Id: (%ld)!", kit_number, kit_cur_id);
/*
int end;
long count, i;
LV2_ATOM_TUPLE_FOREACH( (const LV2_Atom_Tuple *)kit_name_tab_ptr, iter)
{
end = lv2_atom_tuple_is_end( LV2_ATOM_BODY( (const LV2_Atom_Tuple *)kit_name_tab_ptr), ((const LV2_Atom_Tuple *)kit_name_tab_ptr)->atom.size, lv2_atom_tuple_next( iter));
DR_LOG_INFO_3( "ATOM: type: (%d) size: (%d) Value: (%ld)", iter->type, iter->size, ( (const LV2_Atom_Long *)iter)->body);
DR_LOG_INFO_3( "ATOM: Iter: (%lx) size: (%ld) End: (%d)", lv2_atom_tuple_next( iter), ((const LV2_Atom_Tuple *)kit_name_tab_ptr)->atom.size, end);
if( iter->type == DRG_LV2UI_Base.URIS.Long_URId)
{
count = ( (const LV2_Atom_Long *)iter)->body;
DR_LOG_INFO_1( "ATOM: Long: (%ld)!", count);
}
else
{
if( iter->type == DRG_LV2UI_Base.URIS.String_URId)
{
DR_LOG_INFO_0( "ATOM: String!");
kit_name_tab = (DRT_Kit_Name *)LV2_ATOM_BODY( iter);
for( i = 0; i < count; i++)
{
DR_LOG_INFO_3( " Kit: #: (%ld) Id: (%ld) Name: [%s]", i, kit_name_tab[i].Id, kit_name_tab[i].Name);
}
}
else
{
DR_LOG_INFO_0( "ATOM: ???");
}
}
}
*/
}
if( velocity_ignore_flag_ptr)

View File

@ -65,13 +65,19 @@ typedef struct DRT_LV2UI_URIS
LV2_URID String_URId;
LV2_URID Bool_URId;
LV2_URID Int_URId;
LV2_URID Long_URId;
LV2_URID Tuple_URId;
LV2_URID Midi_Event;
LV2_URID UI_Msg;
// LV2_URID kit_path;
LV2_URID Kit_Name_Tab_Update;
LV2_URID UI_Enable;
LV2_URID UI_Disable;
LV2_URID Kit_Name_Update;
LV2_URID Atom_EventTransfer;
@ -186,6 +192,22 @@ DRT_Status DR_LV2UI_Log_Write( DRT_Log_Type_Id, char *, va_list);
/*----------------------------------------------------------------------------*/
/* DR_LV2UI_UI_Enable */
/*----------------------------------------------------------------------------*/
static DRT_Status DR_LV2UI_UI_Enable( void);
/*----------------------------------------------------------------------------*/
/* DR_LV2UI_UI_Disable */
/*----------------------------------------------------------------------------*/
static DRT_Status DR_LV2UI_UI_Disable( void);
/*----------------------------------------------------------------------------*/
/* DR_LV2UI_Channel_ID_ComboBox_Create */
/*----------------------------------------------------------------------------*/