Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*/
+#include <cctype>
#include <string>
#include <vector>
#include <limits>
{
char* str = NULL;
const int ret = g_vasprintf(&str, fmt, args);
+ /* strip trailing whitespace */
+ while (strlen (str) > 0 && isspace (str[strlen (str) - 1])) {
+ str[strlen (str) - 1] = '\0';
+ }
+ if (strlen (str) == 0) {
+ return 0;
+ }
+
if (type == URIMap::instance().urids.log_Error) {
error << str << endmsg;
} else if (type == URIMap::instance().urids.log_Warning) {
if (_session.transport_frame() != _next_cycle_start ||
_session.transport_speed() != _next_cycle_speed) {
// Transport has changed, write position at cycle start
- tmap.bbt_time(_session.transport_frame(), bbt);
+ bbt = tmap.bbt_at_frame (_session.transport_frame());
write_position(&_impl->forge, _ev_buffers[port_index],
tmetric, bbt, _session.transport_speed(),
_session.transport_frame(), 0);
++m;
} else {
tmetric.set_metric(metric);
- bbt = metric->start();
+ bbt = tmap.bbt_at_pulse (metric->pulse());
write_position(&_impl->forge, _ev_buffers[port_index],
tmetric, bbt, _session.transport_speed(),
metric->frame(),
// -> add automation event..
AutomationCtrlPtr c = get_automation_control (p);
if (c && c->ac->automation_state() == Touch) {
+ framepos_t when = std::max ((framepos_t) 0, _session.transport_frame() + frames - _current_latency);
+ assert (_session.transport_frame() + frames - _current_latency >= 0);
if (c->guard) {
c->guard = false;
- c->ac->list()->add (_session.transport_frame() + frames, v, true, true);
+ c->ac->list()->add (when, v, true, true);
} else {
- c->ac->set_double (v, _session.transport_frame() + frames, true);
+ c->ac->set_double (v, when, true);
}
}
}
const uint32_t p = ((const LV2_Atom_Int*)parameter)->body;
AutomationCtrlPtr c = get_automation_control (p);
if (c) {
- c->ac->start_touch (_session.transport_frame());
+ c->ac->start_touch (std::max ((framepos_t)0, _session.transport_frame() - _current_latency));
c->guard = true;
}
}
const uint32_t p = ((const LV2_Atom_Int*)parameter)->body;
AutomationCtrlPtr c = get_automation_control (p);
if (c) {
- c->ac->stop_touch (true, _session.transport_frame());
+ c->ac->stop_touch (true, std::max ((framepos_t)0, _session.transport_frame() - _current_latency));
}
}
}