Add "Velocity Ignore" and "Note Off Ignore" setup change via MIDI,

Add channel_id, velocity_ignore_note, note_off_ignore_note, velocity_ignore_flag, note_off_ignore_flag control ports,
Add LV2 port-groups support,
Minor changes.
This commit is contained in:
Arnaud G. GIBERT 2022-05-11 12:52:37 +02:00
parent 7cbad040ee
commit 843d73655d
6 changed files with 366 additions and 90 deletions

View File

@ -2893,8 +2893,19 @@ DRT_Status DR_DataStruct_Init( DRT_Base *Base_Ptr, DRT_SampleRate SampleRate,
}
Base_Ptr->SampleRate = SampleRate;
Base_Ptr->Velocity_Ignore = DRD_VELOCITY_IGNORE_DEFAULT;
Base_Ptr->Note_Off_Ignore = DRD_NOTE_OFF_IGNORE_DEFAULT;
/*
Base_Ptr->Velocity_Ignore_Flag = DRD_VELOCITY_IGNORE_FLAG_DEFAULT;
Base_Ptr->Note_Off_Ignore_Flag = DRD_NOTE_OFF_IGNORE_FLAG_DEFAULT;
Base_Ptr->Velocity_Ignore_Note = DRD_VELOCITY_IGNORE_NOTE_DEFAULT;
Base_Ptr->Note_Off_Ignore_Note = DRD_NOTE_OFF_IGNORE_NOTE_DEFAULT;
*/
Base_Ptr->Channel_Id_Ptr = NULL;
Base_Ptr->Base_Note_Ptr = NULL;
Base_Ptr->Velocity_Ignore_Note_Ptr = NULL;
Base_Ptr->Note_Off_Ignore_Note_Ptr = NULL;
Base_Ptr->Velocity_Ignore_Flag_Ptr = NULL;
Base_Ptr->Note_Off_Ignore_Flag_Ptr = NULL;
Base_Ptr->Task_Number = Task_Number;
Base_Ptr->Task_Load_Layer_Flag = DRD_TASK_LOAD_LAYER_DEFAULT;
Base_Ptr->Task_Load_Instrument_Flag = DRD_TASK_LOAD_INSTRUMENT_DEFAULT;

View File

@ -24,6 +24,27 @@ typedef struct DRT_Kit DRT_Kit;
/* Global definitions */
/*----------------------------------------------------------------------------*/
#define DRD_CHANNEL_ID_DEFAULT 10
#define DRD_BASE_NOTE_DEFAULT 36
#define DRD_VELOCITY_IGNORE_NOTE_DEFAULT 24
#define DRD_NOTE_OFF_IGNORE_NOTE_DEFAULT 25
#define DRD_VELOCITY_IGNORE_FLAG_DEFAULT false
#define DRD_NOTE_OFF_IGNORE_FLAG_DEFAULT false
#define DRD_THREAD_NUMBER_DEFAULT 16L
#define DRD_TASK_LOAD_LAYER_DEFAULT DRD_TRUE
#define DRD_TASK_LOAD_INSTRUMENT_DEFAULT DRD_FALSE
#define DRD_TASK_LOAD_KIT_DEFAULT DRD_FALSE
#define DRD_TASK_SYNC_KIT_DEFAULT DRD_TRUE
#define DRD_TASK_SYNC_KITS_DEFAULT DRD_TRUE
/*----------------------------------------------------------------------------*/
/* DSl definitions */
/*----------------------------------------------------------------------------*/
#define NDD_CMD_ID_REFRESH ( NDT_Command) 65
#define NDD_CMD_STATS_GET ( NDT_Command) 66
#define NDD_CMD_GRAPH_PRINT ( NDT_Command) 67
@ -161,8 +182,12 @@ typedef struct DRT_Base
DRT_SampleRate SampleRate;
//Config
bool Velocity_Ignore;
bool Note_Off_Ignore;
float *Channel_Id_Ptr;
float *Base_Note_Ptr;
float *Velocity_Ignore_Note_Ptr;
float *Note_Off_Ignore_Note_Ptr;
float *Velocity_Ignore_Flag_Ptr;
float *Note_Off_Ignore_Flag_Ptr;
DRT_Task_Id Task_Number;
DRT_Boolean Task_Load_Layer_Flag;

View File

@ -22,6 +22,10 @@ add_port()
"4")
printf >>${out_file} "$2" "${idx}" "$3" "$4"
;;
"5")
printf >>${out_file} "$2" "${idx}" "$3" "$4" "$5"
;;
esac
echo -e >>${out_file} "\n ]$1"
@ -33,16 +37,50 @@ add_port()
add_group()
{
echo -e >>${out_file} ""
case "$#"
in
"2")
printf >>${out_file} "$2" "${idx}"
;;
"3")
printf >>${out_file} "$2" "${idx}" "$3"
;;
"4")
printf >>${out_file} "$2" "${idx}" "$3" "$4"
;;
"5")
printf >>${out_file} "$2" "${idx}" "$3" "$4" "$5"
;;
esac
echo -e >>${out_file} " $1"
idx=$((${idx} + 1))
}
>${out_file}
echo -n >>${out_file} '@prefix lv2: <http://lv2plug.in/ns/lv2core#>.
@prefix foaf: <http://xmlns.com/foaf/0.1/>.
@prefix doap: <http://usefulinc.com/ns/doap#>.
@prefix rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#>.
@prefix rdfs: <http://www.w3.org/2000/01/rdf-schema#>.
@prefix ui: <http://lv2plug.in/ns/extensions/ui#>.
@prefix atom: <http://lv2plug.in/ns/ext/atom#>.
@prefix urid: <http://lv2plug.in/ns/ext/urid#>.
echo -n >>${out_file} '@prefix lv2: <http://lv2plug.in/ns/lv2core#>.
@prefix foaf: <http://xmlns.com/foaf/0.1/>.
@prefix doap: <http://usefulinc.com/ns/doap#>.
@prefix rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#>.
@prefix rdfs: <http://www.w3.org/2000/01/rdf-schema#>.
@prefix ui: <http://lv2plug.in/ns/extensions/ui#>.
@prefix atom: <http://lv2plug.in/ns/ext/atom#>.
@prefix urid: <http://lv2plug.in/ns/ext/urid#>.
@prefix pg: <http://lv2plug.in/ns/ext/port-groups#>.
@prefix drummer: <http://rx3.net/AlkorZ3/drummer#>.
<http://rx3.net/AlkorZ3/drummer>
a lv2:InstrumentPlugin, lv2:Plugin;
@ -72,14 +110,18 @@ add_port "," " a lv2:InputPort , atom:AtomPort;
add_port "," " a lv2:AudioPort, lv2:OutputPort;
lv2:index %d;
lv2:symbol \"master_out_1\";
lv2:name \"Master - Out 1\";"
lv2:index %d;
lv2:symbol \"master_out_1\";
lv2:name \"Master - Out 1\";
lv2:designation pg:left;
pg:group drummer:audio_master_out;"
add_port "," " a lv2:AudioPort, lv2:OutputPort;
lv2:index %d;
lv2:symbol \"master_out_2\";
lv2:name \"Master - Out 2\";"
lv2:index %d;
lv2:symbol \"master_out_2\";
lv2:name \"Master - Out 2\";
lv2:designation pg:right;
pg:group drummer:audio_master_out;"
@ -90,18 +132,31 @@ do
add_port "," " a lv2:AudioPort, lv2:OutputPort;
lv2:index %d;
lv2:symbol \"audio_%02d_out_1\";
lv2:name \"Audio %02d - Out 1\";" "${out_id}" "${out_id}"
lv2:name \"Audio %02d - Out 1\";
lv2:designation pg:left;
pg:group drummer:audio_%02d_out;" "${out_id}" "${out_id}" "${out_id}"
add_port "," " a lv2:AudioPort, lv2:OutputPort;
lv2:index %d;
lv2:symbol \"audio_%02d_out_2\";
lv2:name \"Audio %02d - Out 2\";" "${out_id}" "${out_id}"
lv2:name \"Audio %02d - Out 2\";
lv2:designation pg:right;
pg:group drummer:audio_%02d_out;" "${out_id}" "${out_id}" "${out_id}"
out_id=$((${out_id} + 1))
done
add_port "," " a lv2:ControlPort, lv2:InputPort;
lv2:index %d;
lv2:symbol \"channel_id\";
lv2:name \"Midi Channel Id\";
lv2:minimum 0;
lv2:maximum 15;
lv2:default 10;
lv2:portProperty lv2:integer;"
add_port "," " a lv2:ControlPort, lv2:InputPort;
lv2:index %d;
lv2:symbol \"base_note\";
@ -111,6 +166,38 @@ add_port "," " a lv2:ControlPort, lv2:InputPort;
lv2:default 36;
lv2:portProperty lv2:integer;"
add_port "," " a lv2:ControlPort, lv2:InputPort;
lv2:index %d;
lv2:symbol \"velocity_ignore_note\";
lv2:name \"MIDI Velocity Ignore Note\";
lv2:minimum 21;
lv2:maximum 107;
lv2:default 24;
lv2:portProperty lv2:integer;"
add_port "," " a lv2:ControlPort, lv2:InputPort;
lv2:index %d;
lv2:symbol \"note_off_ignore_note\";
lv2:name \"MIDI Note Off Ignore Note\";
lv2:minimum 21;
lv2:maximum 107;
lv2:default 25;
lv2:portProperty lv2:integer;"
add_port "," " a lv2:ControlPort, lv2:InputPort;
lv2:index %d;
lv2:symbol \"velocity_ignore_flag\";
lv2:name \"Velocity Ignore Flag\";
lv2:default 0;
lv2:portProperty lv2:toggled;"
add_port "," " a lv2:ControlPort, lv2:InputPort;
lv2:index %d;
lv2:symbol \"note_off_ignore_flag\";
lv2:name \"Note Off Ignore Flag\";
lv2:default 1;
lv2:portProperty lv2:toggled;"
out_id=0
@ -158,6 +245,37 @@ add_port "." " a lv2:OutputPort , atom:AtomPort ;
lv2:symbol \"core_events\" ;
lv2:name \"Core Events\""
echo >>${out_file} '
drummer:audio_master_out
a pg:StereoGroup, pg:OutputGroup ;
lv2:name "Audio Master Out" ;
lv2:symbol "audio_master_out" .'
out_id=0
idx=0
while [[ "${out_id}" -lt "32" ]]
do
add_group "." "drummer:audio_%02d_out
a pg:StereoGroup, pg:OutputGroup ;
lv2:name \"Audio %02d Out\" ;
lv2:symbol \"audio_%02d_out\"" "${out_id}" "${out_id}"
out_id=$((${out_id} + 1))
done
echo >>${out_file} '
<http://github.com/AlkorZ3/drmr2#ui>

View File

@ -59,16 +59,6 @@ typedef short DRT_Boolean;
#define DRD_SAMPLE_RATE_DEFAULT 44100
#define DRD_VELOCITY_IGNORE_DEFAULT false
#define DRD_NOTE_OFF_IGNORE_DEFAULT false
#define DRD_THREAD_NUMBER_DEFAULT 16L
#define DRD_TASK_LOAD_LAYER_DEFAULT DRD_TRUE
#define DRD_TASK_LOAD_INSTRUMENT_DEFAULT DRD_FALSE
#define DRD_TASK_LOAD_KIT_DEFAULT DRD_FALSE
#define DRD_TASK_SYNC_KIT_DEFAULT DRD_TRUE
#define DRD_TASK_SYNC_KITS_DEFAULT DRD_TRUE

View File

@ -280,7 +280,7 @@ static inline LV2_Atom *build_state_message(DrMr *drmr)
/*----------------------------------------------------------------------------*/
/* */
/*----------------------------------------------------------------------------*/
/*
static inline LV2_Atom *DR_LV2_Message_Midi_Info_Build( DRT_LV2_Base *LV2_Base_Ptr, uint8_t *Data)
{
LV2_Atom_Forge_Frame set_frame;
@ -294,7 +294,7 @@ static inline LV2_Atom *DR_LV2_Message_Midi_Info_Build( DRT_LV2_Base *LV2_Base
return( msg);
}
*/
@ -406,15 +406,16 @@ static inline void DR_Sample_Trigger( DRT_LV2_Base *LV2_Base_Ptr, int Sample_
if( ( Sample_Id >= 0) && ( Sample_Id < LV2_Base_Ptr->Sample_Number))
{
/*
if( Data)
{
lv2_atom_forge_frame_time( &( LV2_Base_Ptr->Forge), 0);
DR_LV2_Message_Midi_Info_Build( LV2_Base_Ptr, Data);
}
*/
LV2_Base_Ptr->Samples[Sample_Id].Active = 1;
LV2_Base_Ptr->Samples[Sample_Id].Offset = 0;
LV2_Base_Ptr->Samples[Sample_Id].Velocity = LV2_Base_Ptr->Base.Velocity_Ignore ? 1.0f : ( (float)Data[2]) / DRD_VELOCITY_MAX;
LV2_Base_Ptr->Samples[Sample_Id].Velocity = *( LV2_Base_Ptr->Base.Velocity_Ignore_Flag_Ptr) ? 1.0f : ( (float)Data[2]) / DRD_VELOCITY_MAX;
LV2_Base_Ptr->Samples[Sample_Id].Data_Offset = Offset;
LV2_Base_Ptr->Samples[Sample_Id].Sustained = false;
@ -537,7 +538,7 @@ static LV2_Handle DR_LV2_Instantiate( const LV2_Descriptor *LV2_Descriptor
lv2_base_ptr->Current_Path = NULL;
lv2_base_ptr->CurReq = -1;
lv2_base_ptr->Channel_Nb = 0;
// lv2_base_ptr->Channel_Id = 0;
lv2_base_ptr->Zero_Position = 0;
lv2_base_ptr->Sustain = false;
@ -546,6 +547,7 @@ static LV2_Handle DR_LV2_Instantiate( const LV2_Descriptor *LV2_Descriptor
while( *LV2_Features_Ptr != NULL)
{
fprintf( stderr, "Feature URI: [%s]\n", (*LV2_Features_Ptr)->URI);
if( !strcmp( (*LV2_Features_Ptr)->URI, LV2_URID_URI "#map"))
{
lv2_base_ptr->Map_Ptr = (LV2_URID_Map *)((*LV2_Features_Ptr)->data);
@ -698,9 +700,39 @@ static void DR_LV2_Connect_Port( LV2_Handle Instance_Ptr, uint32_t Port_Id, v
break;
}
case DRD_LV2_BASENOTE:
case DRD_LV2_CHANNEL_ID:
{
if( Data_Ptr) lv2_base_ptr->BaseNote = (float *)Data_Ptr;
if( Data_Ptr) lv2_base_ptr->Base.Channel_Id_Ptr = (float *)Data_Ptr;
break;
}
case DRD_LV2_BASE_NOTE:
{
if( Data_Ptr) lv2_base_ptr->Base.Base_Note_Ptr = (float *)Data_Ptr;
break;
}
case DRD_LV2_VELOCITY_IGNORE_NOTE:
{
if( Data_Ptr) lv2_base_ptr->Base.Velocity_Ignore_Note_Ptr = (float *)Data_Ptr;
break;
}
case DRD_LV2_NOTE_OFF_IGNORE_NOTE:
{
if( Data_Ptr) lv2_base_ptr->Base.Note_Off_Ignore_Note_Ptr = (float *)Data_Ptr;
break;
}
case DRD_LV2_VELOCITY_IGNORE_FLAG:
{
if( Data_Ptr) lv2_base_ptr->Base.Velocity_Ignore_Flag_Ptr = (float *)Data_Ptr;
break;
}
case DRD_LV2_NOTE_OFF_IGNORE_FLAG:
{
if( Data_Ptr) lv2_base_ptr->Base.Note_Off_Ignore_Flag_Ptr = (float *)Data_Ptr;
break;
}
@ -751,6 +783,19 @@ static void DR_LV2_Connect_Port( LV2_Handle Instance_Ptr, uint32_t Port_Id, v
/*----------------------------------------------------------------------------*/
/* */
/*----------------------------------------------------------------------------*/
static void DR_LV2_Activate( LV2_Handle instance)
{
fprintf( stderr, "LV2 Activate!\n");
}
/*----------------------------------------------------------------------------*/
/* */
/*----------------------------------------------------------------------------*/
@ -758,13 +803,13 @@ static void DR_LV2_Connect_Port( LV2_Handle Instance_Ptr, uint32_t Port_Id, v
static void DR_LV2_Run( LV2_Handle Instance_Ptr, uint32_t N_Samples)
{
DRT_Status status;
int i, j, basenote;
int i, j, base_note;
DRT_LV2_Base *lv2_base_ptr = (DRT_LV2_Base *)Instance_Ptr;
// fprintf( stderr, "LV2 Run!\n");
basenote = (int)floorf( *( lv2_base_ptr->BaseNote));
base_note = (int)floorf( *( lv2_base_ptr->Base.Base_Note_Ptr));
const uint32_t event_capacity = lv2_base_ptr->Core_Event_Port->atom.size;
@ -775,7 +820,7 @@ static void DR_LV2_Run( LV2_Handle Instance_Ptr, uint32_t N_Samples)
LV2_ATOM_SEQUENCE_FOREACH( lv2_base_ptr->Control_Port, ev_ptr)
{
// fprintf( stderr, "LV2 Event!\n");
fprintf( stderr, "LV2 Event!\n");
if( ev_ptr->body.type == lv2_base_ptr->URIS.midi_event)
{
@ -789,16 +834,16 @@ static void DR_LV2_Run( LV2_Handle Instance_Ptr, uint32_t N_Samples)
// fprintf( stderr, " Midi Event!\n");
if( ( lv2_base_ptr->Channel_Nb == 0) || ( channel == ( lv2_base_ptr->Channel_Nb - 1)))
if( ( *( lv2_base_ptr->Base.Channel_Id_Ptr) == 0) || ( channel == ( *( lv2_base_ptr->Base.Channel_Id_Ptr) - 1)))
{
switch( ( *data) >> 4)
{
case 8: // Note Off
{
if( !lv2_base_ptr->Base.Note_Off_Ignore)
if( !*( lv2_base_ptr->Base.Note_Off_Ignore_Flag_Ptr))
{
nn = data[1];
nn -= basenote;
nn -= base_note;
DR_Sample_Untrigger( lv2_base_ptr, nn, offset);
}
@ -809,9 +854,36 @@ static void DR_LV2_Run( LV2_Handle Instance_Ptr, uint32_t N_Samples)
case 9: // Note On
{
nn = data[1];
nn -= basenote;
if( nn == *( lv2_base_ptr->Base.Velocity_Ignore_Note_Ptr))
{
// *( lv2_base_ptr->Base.Velocity_Ignore_Flag) ^= true;
*( lv2_base_ptr->Base.Velocity_Ignore_Flag_Ptr) = (float)( (int)*( lv2_base_ptr->Base.Velocity_Ignore_Flag_Ptr) ^ true);
fprintf( stderr, "Velocity Ignore: [%f] - [%f]\n", *( lv2_base_ptr->Base.Velocity_Ignore_Flag_Ptr), *( lv2_base_ptr->Base.Velocity_Ignore_Note_Ptr));
}
else
{
if( nn == *( lv2_base_ptr->Base.Note_Off_Ignore_Note_Ptr))
{
// *( lv2_base_ptr->Base.Note_Off_Ignore_Flag) ^= true;
*( lv2_base_ptr->Base.Note_Off_Ignore_Flag_Ptr) = (float)( (int)*( lv2_base_ptr->Base.Note_Off_Ignore_Flag_Ptr) ^ true);
fprintf( stderr, "Note Off Ignore: [%f] - [%f]\n", *( lv2_base_ptr->Base.Note_Off_Ignore_Flag_Ptr), *( lv2_base_ptr->Base.Note_Off_Ignore_Note_Ptr));
/*
LV2_Atom_Forge_Frame set_frame;
LV2_Atom *msg = (LV2_Atom *)lv2_atom_forge_object( &( lv2_base_ptr->forge), &set_frame, 1, drmr->uris.ui_msg);
lv2_atom_forge_property_head( &( lv2_base_ptr->forge), lv2_base_ptr->URIS.velocity_toggle, 0);
lv2_atom_forge_bool( &( lv2_base_ptr->forge), lv2_base_ptr->Base.Note_Off_Ignore_Flag ? true : false);
lv2_atom_forge_pop( &( lv2_base_ptr->forge), &set_frame);
*/
}
else
{
nn -= base_note;
DR_Sample_Trigger( lv2_base_ptr, nn, data, offset);
DR_Sample_Trigger( lv2_base_ptr, nn, data, offset);
}
}
break;
}
@ -918,29 +990,30 @@ static void DR_LV2_Run( LV2_Handle Instance_Ptr, uint32_t N_Samples)
fprintf( stderr, "LV2 AO...\n");
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 *path = NULL;
const LV2_Atom *trigger = NULL;
const LV2_Atom *ignvel = NULL;
const LV2_Atom *ignno = NULL;
const LV2_Atom *channel_nb = NULL;
const LV2_Atom *channel_id = NULL;
const LV2_Atom *zerop = NULL;
const LV2_Atom *sample_add = NULL;
const LV2_Atom *sample_remove = NULL;
lv2_atom_object_get( obj_ptr,
lv2_base_ptr->URIS.kit_path, &path,
lv2_base_ptr->URIS.sample_trigger, &trigger,
lv2_base_ptr->URIS.velocity_toggle, &ignvel,
lv2_base_ptr->URIS.note_off_toggle, &ignno,
lv2_base_ptr->URIS.channel_nb, &channel_nb,
lv2_base_ptr->URIS.channel_id, &channel_id,
lv2_base_ptr->URIS.zero_position, &zerop,
lv2_base_ptr->URIS.sample_add, &sample_add,
lv2_base_ptr->URIS.sample_remove, &sample_remove,
0);
if( path)
{
@ -957,7 +1030,7 @@ static void DR_LV2_Run( LV2_Handle Instance_Ptr, uint32_t N_Samples)
fprintf( stderr, "Path!\n");
}
if( trigger)
{
int32_t si = ( ( const LV2_Atom_Int *)trigger)->body;
@ -967,24 +1040,27 @@ static void DR_LV2_Run( LV2_Handle Instance_Ptr, uint32_t N_Samples)
fprintf(stderr, "Trigger event!\n");
mdata[0] = 0x90; // note on
mdata[1] = si + basenote;
mdata[1] = si + base_note;
mdata[2] = 0x7f;
DR_Sample_Trigger( lv2_base_ptr, si, mdata, offset);
}
if( ignvel)
lv2_base_ptr->Base.Velocity_Ignore = ((const LV2_Atom_Bool*)ignvel)->body;
lv2_base_ptr->Base.Velocity_Ignore_Flag = ((const LV2_Atom_Bool*)ignvel)->body;
if( ignno)
lv2_base_ptr->Base.Note_Off_Ignore = ((const LV2_Atom_Bool*)ignno)->body;
if( channel_nb)
lv2_base_ptr->Channel_Nb = ((const LV2_Atom_Int*)channel_nb)->body;
{
fprintf( stderr, "Change Note Off Ignore Flag!\n");
// lv2_base_ptr->Base.Note_Off_Ignore_Flag = ((const LV2_Atom_Bool*)ignno)->body;
}
if( channel_id)
lv2_base_ptr->Base.Channel_Id_Ptr = ((const LV2_Atom_Int*)channel_id)->body;
if( zerop)
lv2_base_ptr->Zero_Position = ((const LV2_Atom_Int*)zerop)->body;
if( sample_add)
{
fprintf(stderr, "Sample Add event!\n");
@ -1005,13 +1081,16 @@ static void DR_LV2_Run( LV2_Handle Instance_Ptr, uint32_t N_Samples)
}
else if( obj_ptr->body.otype == lv2_base_ptr->URIS.get_state)
{
fprintf( stderr, "Get state!\n");
lv2_atom_forge_frame_time( &(lv2_base_ptr->Forge), 0);
// build_state_message( lv2_base_ptr);
}
*/
}
else
{
fprintf( stderr, "unrecognized event (%d) != (%d)\n", ev_ptr->body.type, lv2_base_ptr->URIS.atom_object);
fprintf( stderr, "Unrecognized event (%d) != (%d)\n", ev_ptr->body.type, lv2_base_ptr->URIS.atom_object);
}
}
/*
@ -1133,6 +1212,19 @@ static void DR_LV2_Run( LV2_Handle Instance_Ptr, uint32_t N_Samples)
/*----------------------------------------------------------------------------*/
/* */
/*----------------------------------------------------------------------------*/
static void DR_LV2_DeActivate( LV2_Handle instance)
{
fprintf( stderr, "LV2 DeActivate!\n");
}
/*----------------------------------------------------------------------------*/
/* */
/*----------------------------------------------------------------------------*/
@ -1248,9 +1340,9 @@ static const LV2_Descriptor DRG_LV2_Descriptor =
DRD_DRUMMER_URI,
DR_LV2_Instantiate,
DR_LV2_Connect_Port,
NULL, // activate
DR_LV2_Activate,
DR_LV2_Run,
NULL, // deactivate
DR_LV2_DeActivate,
DR_LV2_Cleanup,
DR_LV2_Extension_Data
};

View File

@ -7,12 +7,23 @@
#include <pthread.h>
#include "lv2/lv2plug.in/ns/ext/atom/forge.h"
#include "lv2/atom/atom.h"
#include "lv2/atom/forge.h"
#include "lv2/atom/util.h"
#include "lv2/core/lv2.h"
#include "lv2/core/lv2_util.h"
#include "lv2/log/log.h"
#include "lv2/log/logger.h"
#include "lv2/midi/midi.h"
#include "lv2/urid/urid.h"
#include "lv2/state/state.h"
//#include "lv2/lv2plug.in/ns/ext/atom/forge.h"
// util includes atom.h
#include "lv2/lv2plug.in/ns/ext/atom/util.h"
#include "lv2/lv2plug.in/ns/lv2core/lv2.h"
#include "lv2/lv2plug.in/ns/ext/urid/urid.h"
#include "lv2/lv2plug.in/ns/ext/state/state.h"
//#include "lv2/lv2plug.in/ns/ext/atom/util.h"
//#include "lv2/lv2plug.in/ns/lv2core/lv2.h"
//#include "lv2/lv2plug.in/ns/ext/urid/urid.h"
//#include "lv2/lv2plug.in/ns/ext/state/state.h"
@ -115,7 +126,12 @@ typedef enum
DRD_LV2_RIGHT_30,
DRD_LV2_LEFT_31,
DRD_LV2_RIGHT_31,
DRD_LV2_BASENOTE,
DRD_LV2_CHANNEL_ID,
DRD_LV2_BASE_NOTE,
DRD_LV2_VELOCITY_IGNORE_NOTE,
DRD_LV2_NOTE_OFF_IGNORE_NOTE,
DRD_LV2_VELOCITY_IGNORE_FLAG,
DRD_LV2_NOTE_OFF_IGNORE_FLAG,
DRD_LV2_GAIN_00,
DRD_LV2_GAIN_01,
DRD_LV2_GAIN_02,
@ -188,23 +204,25 @@ typedef enum
typedef struct
{
LV2_URID midi_event;
LV2_URID ui_msg;
LV2_URID kit_path;
LV2_URID atom_eventTransfer;
LV2_URID atom_object;
LV2_URID string_urid;
LV2_URID bool_urid;
LV2_URID int_urid;
LV2_URID get_state;
LV2_URID midi_info;
LV2_URID sample_trigger;
LV2_URID velocity_toggle;
LV2_URID note_off_toggle;
LV2_URID channel_nb;
LV2_URID zero_position;
LV2_URID sample_add;
LV2_URID sample_remove;
LV2_URID midi_event;
// LV2_URID ui_msg;
// LV2_URID kit_path;
// LV2_URID atom_eventTransfer;
// LV2_URID string_urid;
// LV2_URID bool_urid;
// LV2_URID int_urid;
// LV2_URID get_state;
// LV2_URID midi_info;
// LV2_URID sample_trigger;
// LV2_URID channel_id;
// LV2_URID velocity_toggle;
// LV2_URID note_off_toggle;
// LV2_URID zero_position;
// LV2_URID sample_add;
// LV2_URID sample_remove;
} DRT_Drummer_URIS;
@ -222,6 +240,9 @@ typedef struct
int Data_Offset;
} DRT_Sample;
*/
typedef struct
{
DRT_Instrument *Instrument_Ptr;
@ -236,6 +257,8 @@ typedef struct
bool Sustained;
} DRT_Sample;
typedef struct DRT_LV2_Base
{
DRT_Base Base;
@ -251,12 +274,11 @@ typedef struct DRT_LV2_Base
LV2_Atom_Forge Forge;
// params
int Channel;
int Channel_Nb;
// int Channel;
// int Channel_Nb;
int Zero_Position;
float **Gains;
float **Pans;
float *BaseNote;
bool Sustain;
@ -337,7 +359,9 @@ typedef struct
static inline void DR_Map_Drummer_URIS( LV2_URID_Map *Map_Ptr, DRT_Drummer_URIS *URIS)
{
URIS->atom_object = Map_Ptr->map( Map_Ptr->handle, LV2_ATOM__Object);
URIS->midi_event = Map_Ptr->map( Map_Ptr->handle, "http://lv2plug.in/ns/ext/midi#MidiEvent");
/*
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);
@ -348,12 +372,12 @@ static inline void DR_Map_Drummer_URIS( LV2_URID_Map *Map_Ptr, DRT_Drummer_URI
URIS->sample_trigger = Map_Ptr->map( Map_Ptr->handle, DRD_DRUMMER_URI "#sampletrigger");
URIS->velocity_toggle = Map_Ptr->map( Map_Ptr->handle, DRD_DRUMMER_URI "#velocitytoggle");
URIS->note_off_toggle = Map_Ptr->map( Map_Ptr->handle, DRD_DRUMMER_URI "#noteofftoggle");
URIS->channel_nb = Map_Ptr->map( Map_Ptr->handle, DRD_DRUMMER_URI "#channelnb");
URIS->channel_id = Map_Ptr->map( Map_Ptr->handle, DRD_DRUMMER_URI "#channelid");
URIS->zero_position = Map_Ptr->map( Map_Ptr->handle, DRD_DRUMMER_URI "#zeroposition");
URIS->sample_add = Map_Ptr->map( Map_Ptr->handle, DRD_DRUMMER_URI "#sampleadd");
URIS->sample_remove = Map_Ptr->map( Map_Ptr->handle, DRD_DRUMMER_URI "#sampleremove");
URIS->atom_eventTransfer = Map_Ptr->map( Map_Ptr->handle, LV2_ATOM__eventTransfer);
URIS->atom_object = Map_Ptr->map( Map_Ptr->handle, LV2_ATOM__Object);
*/
}
@ -474,6 +498,14 @@ static void DR_LV2_Connect_Port( LV2_Handle, uint32_t, void *);
/*----------------------------------------------------------------------------*/
/* */
/*----------------------------------------------------------------------------*/
static void DR_LV2_Activate( LV2_Handle);
/*----------------------------------------------------------------------------*/
/* */
/*----------------------------------------------------------------------------*/
@ -482,6 +514,14 @@ static void DR_LV2_Run( LV2_Handle, uint32_t);
/*----------------------------------------------------------------------------*/
/* */
/*----------------------------------------------------------------------------*/
static void DR_LV2_DeActivate( LV2_Handle);
/*----------------------------------------------------------------------------*/
/* */
/*----------------------------------------------------------------------------*/