static MidiByte getByte(const Event &e, const PropertyName &name) { long value = -1; try { value = e.get<Int>(name); } catch (...) { } if (value < 0 || value > 255) throw MIDIValueOutOfRange(name.getName()); return MidiByte(value); }
string Event::getAsString(const PropertyName &name) const // throw (NoData) { PropertyMap::const_iterator i; const PropertyMap *map = find(name, i); if (map) { return i->second->unparse(); } else { throw NoData(name.getName(), __FILE__, __LINE__); } }
void ControlRulerWidget::slotAddPropertyRuler(const PropertyName &propertyName) { if (!m_viewSegment) return; PropertyControlRuler *controlruler = new PropertyControlRuler(propertyName, m_viewSegment, m_scale, this); controlruler->setXOffset(m_gutter); controlruler->updateSelection(&m_selectedElements); // little kludge here, we only have the one property ruler, and the string // "velocity" wasn't already in a context (any context) where it could be // translated, and "velocity" doesn't look good with "PitchBend" or "Reverb" // so we address a number of little problems thus: QString name = QString::fromStdString(propertyName.getName()); if (name == "velocity") name = tr("Velocity"); addRuler(controlruler, name); }