From: Eckhard J. <e.j...@u-...> - 2005-03-14 19:51:01
|
Hi, I do need some help. I think it's like this. A segment consists of several events. An event contains all information including duration and pitch of a note. But where? What do I have to include if I want to create events in a segment and access/change information like note pitch within it? Thanks for any help Eckhard |
From: Pedro Lopez-C. <pl...@te...> - 2005-03-14 22:19:12
|
On Monday 14 March 2005 20:51, Eckhard Jokisch wrote: > Hi, I do need some help. > I think it's like this. A segment consists of several events. > An event contains all information including duration and pitch of a note. > But where? Rosegarden::Segment is a STL container, derived from std::multiset. See: http://rosegarden.sourceforge.net/code_doc/classRosegarden_1_1Segment.html Quote from the development documentation main page: "Segment is a series of consecutive Events found on the same Track, automatically ordered by their absolute time. It's the usual container for Events. A Segment has a starting time that can be changed, and a duration that is based solely on the end time of the last Event it contains. Note that in order to facilitate musical notation editing, we explicitly store silences as series of rest Events; thus a Segment really should contain no gaps between its Events. (This isn't checked anywhere and nothing will break very badly if there are gaps, but notation won't quite work correctly.)" http://rosegarden.sourceforge.net/code_doc/ > What do I have to include if I want to create events in a segment and > access/change information like note pitch within it? > Thanks for any help As any STL container, the usual way to access its members as a sequence is to use an iterator: for (Segment::iterator i = m_segment->begin(); i != m_segment->end(); ++i) { if ((*i)->isa(Rosegarden::Note::EventType)) { // It is a note!!! // ... } } You can take a look at SegmentSplitByPitchCommand::execute(), in segmentcommands.cpp:2050. This example shows how to access a segment, and process some events, and creating new segments on the fly. It implements the function "Split by Pitch", of course. Regards, Pedro |
From: Guillaume L. <gla...@te...> - 2005-03-16 18:59:39
|
On Monday 14 March 2005 23:19, Pedro Lopez-Cabanillas wrote: > > > What do I have to include if I want to create events in a segment and > > access/change information like note pitch within it? > > Thanks for any help > > As any STL container, the usual way to access its members as a sequence is > to use an iterator: Pedro wisely gave you a command as a reference, so if you're planning to add a feature to RG and to submit a patch, please make sure that any data-changing feature you create works within our undo/redo framework. See the various *Command classes for reference, it's not very complicated. -- Guillaume. http://www.telegraph-road.org |