# HG changeset patch # User Chris Cannam # Date 1195836503 0 # Node ID 215b8b1b0308e6da085977abc32f2bcb1d0c92d9 # Parent 7b71da2d0631a009b460ee518e2c0ac4f6488aba * Add Erase tool and mode * Add icons for Normalize buttons in property boxes, and for Show Peaks * Add support for velocity in notes -- not yet reflected in display or editable in the note edit dialog, but they are imported from MIDI, played, and exported * Begin work on making pastes align pasted times (subtler than I thought) diff -r 7b71da2d0631 -r 215b8b1b0308 audioio/AudioGenerator.cpp --- a/audioio/AudioGenerator.cpp Thu Nov 22 14:17:19 2007 +0000 +++ b/audioio/AudioGenerator.cpp Fri Nov 23 16:48:23 2007 +0000 @@ -735,6 +735,12 @@ onEv.data.note.note = lrintf(pli->value); } + if (pli->level > 0.f && pli->level <= 1.f) { + onEv.data.note.velocity = lrintf(pli->level * 127); + } else { + onEv.data.note.velocity = 100; + } + plugin->sendEvent(eventTime, &onEv); #ifdef DEBUG_AUDIO_GENERATOR diff -r 7b71da2d0631 -r 215b8b1b0308 framework/Document.cpp --- a/framework/Document.cpp Thu Nov 22 14:17:19 2007 +0000 +++ b/framework/Document.cpp Fri Nov 23 16:48:23 2007 +0000 @@ -157,6 +157,8 @@ Layer * Document::createEmptyLayer(LayerFactory::LayerType type) { + if (!m_mainModel) return 0; + Model *newModel = LayerFactory::getInstance()->createEmptyModel(type, m_mainModel); if (!newModel) return 0; diff -r 7b71da2d0631 -r 215b8b1b0308 framework/SVFileReader.cpp --- a/framework/SVFileReader.cpp Thu Nov 22 14:17:19 2007 +0000 +++ b/framework/SVFileReader.cpp Fri Nov 23 16:48:23 2007 +0000 @@ -851,7 +851,12 @@ size_t duration = 0; duration = attributes.value("duration").trimmed().toUInt(&ok); QString label = attributes.value("label"); - nm->addPoint(NoteModel::Point(frame, value, duration, label)); + float level = attributes.value("level").trimmed().toFloat(&ok); + if (!ok) { // level is optional + level = 1.f; + ok = true; + } + nm->addPoint(NoteModel::Point(frame, value, duration, level, label)); return ok; }