Mercurial > hg > svapp
changeset 61:215b8b1b0308
* 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)
author | Chris Cannam |
---|---|
date | Fri, 23 Nov 2007 16:48:23 +0000 |
parents | 7b71da2d0631 |
children | ae2627ac7db2 |
files | audioio/AudioGenerator.cpp framework/Document.cpp framework/SVFileReader.cpp |
diffstat | 3 files changed, 14 insertions(+), 1 deletions(-) [+] |
line wrap: on
line diff
--- 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
--- 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;
--- 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; }