add test case for #3317

This commit is contained in:
Alexandros Theodotou 2023-12-24 16:48:11 +09:00
parent ca90d3bc48
commit 14b25b1665
No known key found for this signature in database
GPG Key ID: 022EAE42313D70F3
3 changed files with 62 additions and 15 deletions

View File

@ -716,8 +716,7 @@ carla_native_plugin_process (
}
}
/* set actual audio out bufs (carla will write
* to these) */
/* set actual audio out bufs (carla will write to these) */
{
size_t audio_ports = 0;
for (int i = 0; i < self->plugin->num_out_ports; i++)
@ -763,9 +762,11 @@ carla_native_plugin_process (
ev->time < time_nfo->local_offset
|| ev->time >= time_nfo->local_offset + time_nfo->nframes)
{
/* skip events scheduled
* for another split within
* the processing cycle */
/* skip events scheduled for another split within the processing cycle
*/
# if 0
g_debug ("skip events scheduled for another split within the processing cycle: ev->time %u, local_offset %u, nframes %u", ev->time, time_nfo->local_offset, time_nfo->nframes);
# endif
continue;
}
@ -773,17 +774,15 @@ carla_native_plugin_process (
g_message (
"writing plugin input event %d "
"at time %u - "
"local frames %u nframes %u",
"local offset %u nframes %u",
num_events_written,
ev->time - time_nfo->local_offset,
time_nfo->local_offset, time_nfo->nframes);
midi_event_print (ev);
# endif
/* event time is relative to the current
* zrythm full cycle (not split). it
* needs to be made relative to the
* current split */
/* event time is relative to the current zrythm full cycle (not split). it
* needs to be made relative to the current split */
events[num_events_written].time = ev->time - time_nfo->local_offset;
events[num_events_written].size = 3;
events[num_events_written].data[0] = ev->raw_buffer[0];
@ -800,10 +799,9 @@ carla_native_plugin_process (
if (num_events_written > 0)
{
# if 0
g_message (
g_debug (
"Carla plugin %s has %d MIDI events",
self->plugin->descr->name,
num_events_written);
self->plugin->setting->descr->name, num_events_written);
# endif
}

View File

@ -1659,8 +1659,7 @@ plugin_process (Plugin * plugin, const EngineProcessTimeInfo * const time_nfo)
if (port->id.type != TYPE_AUDIO)
continue;
/* if close to 0 set it to the denormal
* prevention val */
/* if close to 0 set it to the denormal prevention val */
if (math_floats_equal_epsilon (plugin->gain->control, 0.f, 0.00001f))
{
dsp_fill (

View File

@ -631,6 +631,56 @@ test_fill_midi_events (void)
g_assert_cmpuint (ev->time, ==, 0);
midi_events_clear (events, F_QUEUED);
/**
* Premise (bug #3317):
* Region: <1.2.1.0 ~ 5.4.1.0> (loop end 4.2.1.0)
* Note: <2.4.3.37.2 ~ 4.2.3.37.2>
*
* Expected result:
* Note on at 2.4.3.37.2 and note off at 4.2.1.0.
*/
g_assert_true (position_parse (&r_obj->pos, "1.2.1.0.0"));
g_assert_true (position_parse (&r_obj->end_pos, "5.4.1.0.0"));
g_assert_true (position_parse (&r_obj->loop_end_pos, "4.2.1.0.0"));
position_set_to_bar (&TRANSPORT->loop_start_pos, 1);
position_set_to_bar (&TRANSPORT->loop_end_pos, 8);
g_assert_true (position_parse (&mn_obj->pos, "2.4.3.37.2"));
g_assert_true (position_parse (&mn_obj->end_pos, "4.2.3.37.2"));
/* check note on */
time_nfo.g_start_frame =
(unsigned_frame_t) r_obj->pos.frames + (unsigned_frame_t) mn_obj->pos.frames
- 4;
time_nfo.g_start_frame_w_offset =
(unsigned_frame_t) r_obj->pos.frames + (unsigned_frame_t) mn_obj->pos.frames
- 4;
time_nfo.local_offset = 0;
time_nfo.nframes = 30;
SET_CACHES_AND_FILL;
midi_events_print (events, F_QUEUED);
g_assert_cmpint (events->num_queued_events, ==, 1);
ev = &events->queued_events[0];
g_assert_true (midi_is_note_on (ev->raw_buffer));
g_assert_cmpuint (ev->time, ==, 4);
midi_events_clear (events, F_QUEUED);
/* check note off at region loop */
time_nfo.g_start_frame =
(unsigned_frame_t) r_obj->pos.frames
+ (unsigned_frame_t) r_obj->loop_end_pos.frames - 4;
time_nfo.g_start_frame_w_offset =
(unsigned_frame_t) r_obj->pos.frames
+ (unsigned_frame_t) r_obj->loop_end_pos.frames - 4;
time_nfo.local_offset = 0;
time_nfo.nframes = 30;
SET_CACHES_AND_FILL;
midi_events_print (events, F_QUEUED);
g_assert_cmpint (events->num_queued_events, ==, 1);
ev = &events->queued_events[0];
g_assert_true (midi_is_all_notes_off (ev->raw_buffer));
g_assert_cmpuint (ev->time, ==, 3);
midi_events_clear (events, F_QUEUED);
/**
*
* Premise: note starts inside region and ends