- Fix Kit_Update_Reply on async sample load by using DRG_LV2_Base.Kit_Updated_Flag.

This commit is contained in:
Arnaud G. GIBERT 2024-04-13 09:54:07 +02:00
parent 0082554711
commit e1b8414c51
2 changed files with 35 additions and 26 deletions

View File

@ -240,18 +240,9 @@ DRT_Status DR_LV2_CurKit_Sample_Load()
status = DR_LV2_Kit_Sample_Load( Kit_Ptr); status = DR_LV2_Kit_Sample_Load( Kit_Ptr);
LV2_Atom_Forge_Frame obj_frame; DRG_LV2_Base.Kit_Updated_Flag = true;
DR_LOG_INFO_0( "Sample loaded!"); DR_LOG_INFO_0( "Sample loaded!");
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_Update_Reply, 0);
lv2_atom_forge_long( &( DRG_LV2_Base.Forge), DRG_LV2_Base.Kit_Id); // Cur kit Id
lv2_atom_forge_pop( &( DRG_LV2_Base.Forge), &obj_frame);
DR_LOG_INFO_2( "Kit Update Reply: Kit_Id: (%ld) Kit_Name: [%s]", DRG_LV2_Base.Kit_Id, DRG_LV2_Base.Kit_Ptr->Name);
} }
} }
@ -653,14 +644,15 @@ static LV2_Handle DR_LV2_Instantiate( const LV2_Descriptor *LV2_Descripto
DRG_LV2_Base.Logger.log = NULL; DRG_LV2_Base.Logger.log = NULL;
DRG_LV2_Base.Kit_Ptr = NULL; DRG_LV2_Base.Kit_Ptr = NULL;
DRG_LV2_Base.Kit_Id = DRD_ID_UNKNOWN;
DRG_LV2_Base.Kit_Id_New = DRD_ID_UNKNOWN;
DRG_LV2_Base.Bank_Id_LSB = -1; DRG_LV2_Base.Bank_Id_LSB = -1;
DRG_LV2_Base.Bank_Id_LSB = -1; DRG_LV2_Base.Bank_Id_LSB = -1;
DRG_LV2_Base.Program_Id = -1; DRG_LV2_Base.Program_Id = -1;
DRG_LV2_Base.Bank_Id_LSB_New = 0; DRG_LV2_Base.Bank_Id_LSB_New = 0;
DRG_LV2_Base.Bank_Id_MSB_New = 0; DRG_LV2_Base.Bank_Id_MSB_New = 0;
DRG_LV2_Base.Program_Id_New = 0; DRG_LV2_Base.Program_Id_New = 0;
DRG_LV2_Base.Kit_Id = DRD_ID_UNKNOWN; DRG_LV2_Base.Kit_Updated_Flag = false;
DRG_LV2_Base.Kit_Id_New = DRD_ID_UNKNOWN;
DRG_LV2_Base.Current_Path = NULL; DRG_LV2_Base.Current_Path = NULL;
DRG_LV2_Base.CurReq = -1; DRG_LV2_Base.CurReq = -1;
@ -1336,6 +1328,22 @@ static void DR_LV2_Run( LV2_Handle Instance_Ptr, uint32_t N_Samples)
pthread_cond_signal( &( lv2_base_ptr->Load_Cond)); pthread_cond_signal( &( lv2_base_ptr->Load_Cond));
} }
*/ */
if( lv2_base_ptr->Kit_Updated_Flag)
{
lv2_base_ptr->Kit_Updated_Flag = false;
// Send Kit_Update_Reply
LV2_Atom_Forge_Frame obj_frame;
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_Update_Reply, 0);
lv2_atom_forge_long( &( DRG_LV2_Base.Forge), DRG_LV2_Base.Kit_Id); // Cur kit Id
lv2_atom_forge_pop( &( DRG_LV2_Base.Forge), &obj_frame);
DR_LOG_INFO_2( "Kit Update Reply: Kit_Id: (%ld) Kit_Name: [%s]", DRG_LV2_Base.Kit_Id, DRG_LV2_Base.Kit_Ptr->Name);
}
/* /*
if( current_kit_changed) if( current_kit_changed)
{ {

View File

@ -294,6 +294,7 @@ typedef struct DRT_LV2_Base
uint8_t Bank_Id_LSB_New; uint8_t Bank_Id_LSB_New;
uint8_t Bank_Id_MSB_New; uint8_t Bank_Id_MSB_New;
uint8_t Program_Id_New; uint8_t Program_Id_New;
int Kit_Updated_Flag;
char *Current_Path; char *Current_Path;
char **Request_Buf; char **Request_Buf;
int CurReq; int CurReq;