Alg_parameters_ptr Alg_reader::process_attributes( Alg_parameters_ptr attributes, double time) { // print "process_attributes:", attributes bool ts_flag = false; if (attributes) { Alg_parameters_ptr a; bool in_seconds = seq->get_units_are_seconds(); if (a = Alg_parameters::remove_key(&attributes, "tempor")) { double tempo = a->parm.r; seq->insert_tempo(tempo, seq->get_time_map()->time_to_beat(time)); } if (a = Alg_parameters::remove_key(&attributes, "beatr")) { double beat = a->parm.r; seq->insert_beat(time, beat); } if (a = Alg_parameters::remove_key(&attributes, "timesig_numr")) { tsnum = a->parm.r; ts_flag = true; } if (a = Alg_parameters::remove_key(&attributes, "timesig_denr")) { tsden = a->parm.r; ts_flag = true; } if (ts_flag) { seq->set_time_sig(seq->get_time_map()->time_to_beat(time), tsnum, tsden); } if (in_seconds) seq->convert_to_seconds(); } return attributes; // in case it was modified }
void Alg_midifile_reader::Mf_on(int chan, int key, int vel) { assert(!seq->get_units_are_seconds()); if (vel == 0) { Mf_off(chan, key, vel); return; } Alg_note_ptr note = new Alg_note(); note_list = new Alg_note_list(note, note_list); /* trace("on: %d at %g\n", key, get_time()); */ note->time = get_time(); note->chan = chan + channel_offset + port * channel_offset_per_port; note->dur = 0; note->set_identifier(key); note->pitch = (float) key; note->loud = (float) vel; track->append(note); meta_channel = -1; }