Undo more incorrect sample/frame replacements

This commit is contained in:
Robin Gareus 2019-04-08 03:46:02 +02:00
parent 889bd35f4f
commit 46f0b75e12
Signed by: rgareus
GPG Key ID: A090BCE02CF57F04
9 changed files with 25 additions and 27 deletions

View File

@ -78,7 +78,7 @@ public:
uint32_t time_beatUnit;
uint32_t time_beatsPerBar;
uint32_t time_beatsPerMinute;
uint32_t time_sample;
uint32_t time_frame;
uint32_t time_speed;
uint32_t patch_Get;
uint32_t patch_Set;

View File

@ -2553,7 +2553,7 @@ write_position(LV2_Atom_Forge* forge,
LV2_Atom_Forge_Frame sample;
#ifdef HAVE_LV2_1_10_0
lv2_atom_forge_object(forge, &sample, 0, urids.time_Position);
lv2_atom_forge_key(forge, urids.time_sample);
lv2_atom_forge_key(forge, urids.time_frame);
lv2_atom_forge_long(forge, position);
lv2_atom_forge_key(forge, urids.time_speed);
lv2_atom_forge_float(forge, speed);
@ -2570,7 +2570,7 @@ write_position(LV2_Atom_Forge* forge,
lv2_atom_forge_float(forge, bpm);
#else
lv2_atom_forge_blank(forge, &sample, 1, urids.time_Position);
lv2_atom_forge_property_head(forge, urids.time_sample, 0);
lv2_atom_forge_property_head(forge, urids.time_frame, 0);
lv2_atom_forge_long(forge, position);
lv2_atom_forge_property_head(forge, urids.time_speed, 0);
lv2_atom_forge_float(forge, speed);

View File

@ -78,7 +78,7 @@ int MIDIDM::process (pframes_t nframes, PortEngine &pe, void *midi_in, void *mid
obuf[1] = (_monotonic_cnt) & 0x7f;
obuf[2] = (_monotonic_cnt >> 7) & 0x7f;
pe.midi_event_put (midi_out, 0, obuf, 3);
#else // sysex MTC sample
#else // sysex MTC frame
uint8_t obuf[10];
obuf[0] = 0xf0;
obuf[1] = 0x7f;

View File

@ -77,7 +77,7 @@ Session::setup_midi_control ()
outbound_mtc_timecode_frame = 0;
next_quarter_frame_to_send = 0;
/* Set up the qtr sample message */
/* Set up the qtr frame message */
mtc_msg[0] = 0xf1;
mtc_msg[2] = 0xf1;
@ -300,7 +300,7 @@ Session::mmc_locate (MIDI::MachineControl &/*mmc*/, const MIDI::byte* mmc_tc)
target_sample = max_samplepos;
}
/* Some (all?) MTC/MMC devices do not send a full MTC sample
/* Some (all?) MTC/MMC devices do not send a full MTC frame
at the end of a locate, instead sending only an MMC
locate command. This causes the current position
of an MTC slave to become out of date. Catch this.
@ -438,11 +438,9 @@ Session::send_full_time_code (samplepos_t const t, MIDI::pframes_t nframes)
DEBUG_TRACE (DEBUG::MTC, string_compose ("Full MTC TC %1 (off %2)\n", outbound_mtc_timecode_frame, mtc_offset));
// I don't understand this bit yet.. [DR]
// I do [rg]:
// according to MTC spec 24, 30 drop and 30 non-drop TC, the sample-number represented by 8 quarter frames must be even.
/* according to MTC spec 24, 30 drop and 30 non-drop TC, the frame-number represented by 8 quarter frames must be even. */
if (((mtc_timecode_bits >> 5) != MIDI::MTC_25_FPS) && (transmitting_timecode_time.frames % 2)) {
// start MTC quarter frame transmission on an even sample
/* start MTC quarter frame transmission on an even frame */
Timecode::increment (transmitting_timecode_time, config.get_subframes_per_frame());
outbound_mtc_timecode_frame += _samples_per_timecode_frame;
}
@ -474,7 +472,7 @@ Session::send_full_time_code (samplepos_t const t, MIDI::pframes_t nframes)
/** Send MTC (quarter-frame) messages for this cycle.
* Must be called exactly once per cycle from the process thread. Realtime safe.
* This function assumes the state of full Timecode is sane, eg. the slave is
* expecting quarter frame messages and has the right sample of reference (any
* expecting quarter frame messages and has the right frame of reference (any
* full MTC Timecode time messages that needed to be sent should have been sent
* earlier already this cycle by send_full_time_code)
*/
@ -575,8 +573,8 @@ Session::send_midi_time_code_for_cycle (samplepos_t start_sample, samplepos_t en
#ifndef NDEBUG
if (DEBUG_ENABLED(DEBUG::MTC)) {
DEBUG_STR_DECL(foo)
DEBUG_STR_APPEND(foo,"sending ");
DEBUG_STR_DECL(foo);
DEBUG_STR_APPEND(foo,"sending ");
DEBUG_STR_APPEND(foo, transmitting_timecode_time);
DEBUG_TRACE (DEBUG::MTC, string_compose ("%1 qfm = %2, stamp = %3\n", DEBUG_STR(foo).str(), next_quarter_frame_to_send,
out_stamp));

View File

@ -56,7 +56,7 @@ URIMap::URIDs::init(URIMap& uri_map)
time_beatUnit = uri_map.uri_to_id("http://lv2plug.in/ns/ext/time#beatUnit");
time_beatsPerBar = uri_map.uri_to_id("http://lv2plug.in/ns/ext/time#beatsPerBar");
time_beatsPerMinute = uri_map.uri_to_id("http://lv2plug.in/ns/ext/time#beatsPerMinute");
time_sample = uri_map.uri_to_id("http://lv2plug.in/ns/ext/time#frame");
time_frame = uri_map.uri_to_id("http://lv2plug.in/ns/ext/time#frame");
time_speed = uri_map.uri_to_id("http://lv2plug.in/ns/ext/time#speed");
patch_Get = uri_map.uri_to_id("http://lv2plug.in/ns/ext/patch#Get");
patch_Set = uri_map.uri_to_id("http://lv2plug.in/ns/ext/patch#Set");

View File

@ -780,7 +780,7 @@ static const MIDISequence s7[] = { // channel1, nonsense
};
static const MIDISequence s8[] = { // sysex
{ 0.00, 10, {0xf0, 0x7f, 0x7f, 0x01, 0x01, /*hour + tc */ 0x20, /*min*/ 0x00, /*sec*/ 0x00, /*sample*/ 0x00, 0xf7} }, // 25fps, 00:00:00:00
{ 0.00, 10, {0xf0, 0x7f, 0x7f, 0x01, 0x01, /*hour + tc */ 0x20, /*min*/ 0x00, /*sec*/ 0x00, /*frame*/ 0x00, 0xf7} }, // 25fps, 00:00:00:00
// quarter frames spacing (in samples) at 25fps: SR / (25 * 4)
// DummyMidiPort::setup_generator uses 120bpm ie (SR / 2)
// hence the spacing is: SR / (25 * 4) / (SR / 2) = 0.2

View File

@ -255,7 +255,7 @@ FramedCurve::render (Rect const & area, Cairo::RefPtr<Cairo::Context> context) c
break;
case Inside:
context->stroke_preserve ();
/* close the sample, possibly using the last _point's x rather than samples[right].x */
/* close the frame, possibly using the last _point's x rather than samples[right].x */
window_space = item_to_window (Duple (last_sample.x, draw.height()));
context->line_to (window_space.x, window_space.y);
window_space = item_to_window (Duple (first_sample.x, draw.height()));

View File

@ -189,7 +189,7 @@ Parser::process_mtc_quarter_frame (MIDI::byte *msg)
if (res.get_value_or (false)) {
/* no error, reset next expected sample */
/* no error, reset next expected frame */
switch (_mtc_running) {
case MTC_Forward:
@ -222,7 +222,7 @@ Parser::process_mtc_quarter_frame (MIDI::byte *msg)
/* skip counts as an error ... go back to waiting for the first sample */
#ifdef DEBUG_MTC
cerr << "Skipped MTC qtr sample, return to stopped state" << endl;
cerr << "Skipped MTC qtr frame, return to stopped state" << endl;
#endif
reset_mtc_state ();
mtc_status (MTC_Stopped);
@ -231,7 +231,7 @@ Parser::process_mtc_quarter_frame (MIDI::byte *msg)
} else {
/* received qtr sample matched expected */
/* received qtr frame matched expected */
consecutive_qtr_frame_cnt++;
}

View File

@ -133,7 +133,7 @@ typedef struct {
LV2_Log_Logger logger;
LV2_Worker_Schedule* schedule;
LV2_Atom_Forge forge;
LV2_Atom_Forge_Frame sample;
LV2_Atom_Forge_Frame frame;
#ifdef LV2_EXTENDED
LV2_Midnam* midnam;
@ -243,15 +243,15 @@ inform_ui (AFluidSynth* self)
return;
}
LV2_Atom_Forge_Frame sample;
LV2_Atom_Forge_Frame frame;
lv2_atom_forge_frame_time (&self->forge, 0);
x_forge_object (&self->forge, &sample, 1, self->patch_Set);
x_forge_object (&self->forge, &frame, 1, self->patch_Set);
lv2_atom_forge_property_head (&self->forge, self->patch_property, 0);
lv2_atom_forge_urid (&self->forge, self->afs_sf2file);
lv2_atom_forge_property_head (&self->forge, self->patch_value, 0);
lv2_atom_forge_path (&self->forge, self->current_sf2_file_path, strlen (self->current_sf2_file_path));
lv2_atom_forge_pop (&self->forge, &sample);
lv2_atom_forge_pop (&self->forge, &frame);
}
static float
@ -420,7 +420,7 @@ run (LV2_Handle instance, uint32_t n_samples)
const uint32_t capacity = self->notify->atom.size;
lv2_atom_forge_set_buffer (&self->forge, (uint8_t*)self->notify, capacity);
lv2_atom_forge_sequence_head (&self->forge, &self->sample, 0);
lv2_atom_forge_sequence_head (&self->forge, &self->frame, 0);
if (!self->initialized || self->reinit_in_progress) {
memset (self->p_ports[FS_PORT_OUT_L], 0, n_samples * sizeof (float));
@ -569,10 +569,10 @@ run (LV2_Handle instance, uint32_t n_samples)
self->inform_ui = false;
/* emit stateChanged */
LV2_Atom_Forge_Frame sample;
LV2_Atom_Forge_Frame frame;
lv2_atom_forge_frame_time(&self->forge, 0);
x_forge_object(&self->forge, &sample, 1, self->state_Changed);
lv2_atom_forge_pop(&self->forge, &sample);
x_forge_object(&self->forge, &frame, 1, self->state_Changed);
lv2_atom_forge_pop(&self->forge, &frame);
/* send .sf2 filename */
inform_ui (self);