>Thanks to both Jonathon (and by implication, Alain) and Jay for replying to >my question about records. > >I am ignorant enough about records that I don't really understand >Jonathon's post. However, I will study the Reference Manual and Jonathon's >answer and see if I can put it all together. On the advice of you both, as >well as from Chris Wyatt who emailed be off list, I will attempt to use >true records. > >Jay, I understand the value of dynamic arrays, but I don't know how to >construct them. Is this where XREF is used? Dynamic arrays are XREF@s that FB manages for you. IOW, you don't need to know anything about them except how to use an array! >I've never done any of this >sophisticated stuff, but I hope I can learn how. Dynamic arrays are to keep you from needing to do any sophisticated stuff! >With a dynamic array of >records, I could have a record for each measure of a tune and have the user >input the desired number of measures. A dynamic array would then be >allocated with the user's chosen number of measures. Each record of a >measure would contain smaller records of its notes, and each note record >would contain fields for duration and tone, with a null tone representing a >rest. Does this make sense? It does, but I think I would use a slightly different strategy. I havent' thought this through as much as you, but my first inclination would be not to separate measures, but to have one array of records for notes and rests, and a second array for characteristics like meter, dynamics, tempo, articulation. Here is a quick stab at what I mean: begin record Note dim pitch`` //pitch: 0 = rest dim length`` //in 128th notes, if that is adequate dim style`` //for characteristics attached to note dim reserve`` //more style info, flags, # add'l notes on this beat, etc end record //4 bytes begin record Characteristic //Attached to bar or staff, not note dim trigger& //At which 128th note of the music is this invoked? dim type`` //_meter, _tempo, _dynamic, _articulation, _Clef, _text dim param1`` //1 byte data or index to define characteristic dim param2% //2 bytes more data to define characteristic end record //8 bytes This way, you can keep a list of current characteristics and proceed though your note array until you get to the next trigger. Change your list and keep going. For arrays, all you should need (for starters) is: Dynamic gNotes(_MaxLong) as Note Dynamic gCharacteristics(_MaxLong) as Characteristic 'Can use shorter name Dynamic gTextArray(_MaxLong) as STR127 //To hold text to print You don't have to worry about how many notes or characteristics you have--FB will keep the array big enough to hold all of them. You access a field like this: gNextTriggerVal = gCharacteristics.trigger(NextTriggerID) ... SELECT gCharacteristics.type(NextTriggerID) CASE _meter Beats = gCharacteristics.param1(NextTriggerID) BeatSize = gCharacteristics.param2(NextTriggerID) Fn showMeterChange(Beats,BeatSize) CASE _text FN setPenForText(gCharacteristics.param1(NextTriggerID)) //Vert pos) FN showText(gTextArray(gCharacteristics.param2(NextTriggerID)) I'll quit before I get tempted to do the whole thing. I hope this is clear. If not, please don't hesitate to ask for clarification. I won't get into how you can swap different handles into a dynamic array, but you may need that before you're done, so ask when you're ready. 0"0 =J= a y "