On Sunday 03 Jul 2005 14:08, Stephen Torri wrote: > should suffice. The first thing that I am not sure about is the > concept of a Note. So far RG directly calls a Note an Event.
Well, kind of. Rosegarden's Note class is one of a set of classes in NotationTypes and elsewhere that are essentially "data objects" -- they pull data out of unstructured Events and present an interface to client code that allows it to interpret the data in a way relevant to notes. Let's start with Event. This is written up (somewhat) in docs/code/creating_events.txt. An Event is a fairly unstructured bag of data -- it consists of a name, a type (an arbitrary string), some timing information, and an arbitrary set of named and typed properties. Some of the properties are commonly-understood and named in base/BaseProperties.h; others are commonly used for notation and are named in gui/notationproperties.h. A note (small "n") is an Event that happens to have the type Note::EventType. It presumably also has a pitch, stored in the property of name BaseProperties::Pitch. It can have a limitless number of other properties. To see some, open a notation view on a piece of music and shift-double-click on a note with the arrow tool. Where Note comes into play is in providing the basic structure necessary for client code to interpret these properties. (Actually, Note only does the very simplest stuff -- durations. It doesn't even handle pitch, for which you just get and set the pitch property directly.) Create a Note object from a given Event and, assuming the constructor doesn't throw an exception because it isn't actually a Note, you can then query the note type, number of dots and so on. Clef and Key are more interesting examples of this type of facade. The important point is that Note objects are _never_ stored anywhere. They're only created on the fly when something needs the data in notelike form. Events are what's stored, and they can contain anything. Similarly, the Chord classes in base/Sets.h and gui/notationsets.h work by picking relationships out of existing Events in Segments and Tracks. You construct a Chord by giving it a container (for example a Segment) and an iterator pointing to an Event in that chord, and it scans the surrounding Events and constructs a set of those that constitute a chord according to its principles (e.g. that start at the same time, or that will be notated as if they did). There are also "groups", which generally means beamed groups in notation, also defined in gui/notationsets.h. These are pretty simplistic -- they just consist of a set of Events having the same beamed group id property. > In my case a Note is an Event plus additional information. That's an Event. Event already holds any additional information you want. Think of it as a database table or something -- it doesn't have any policy on what the data it holds is used for, it's the classes that query it and present the data to clients that care about that. Or, the clients can query it directly. Of course it isn't _quite_ that general. For example, if you want a note to be played by Rosegarden, it has to have a valid MIDI pitch in the pitch property. Chris ------------------------------------------------------- SF.Net email is sponsored by: Discover Easy Linux Migration Strategies from IBM. Find simple to follow Roadmaps, straightforward articles, informative Webcasts and more! Get everything you need to get up to speed, fast. http://ads.osdn.com/?ad_id=7477&alloc_id=16492&op=click _______________________________________________ Rosegarden-devel mailing list [email protected] - use the link below to unsubscribe https://lists.sourceforge.net/lists/listinfo/rosegarden-devel
