5) Tom Satter rightly pointed out that we have to choices: having callback
that gets called  each time an element is found or creating the entire
structure and offering an API for navigating into it. I do esitate to do the
latter because I've heard of ABC files with thousands of songs in it! I
would like to be able ot handle them without requiring megs and megs of
memory.

Good idea. I've written a parser - it parses the entire file it is given and generates C++ objects of the appropriate type for each thing found. I have some files with 16500+ ABC tunes in. You would not believe (or maybe you would!) the memory consumption required for this. Its not that I've done a bad design - I write commercial software for a living, I know what I'm doing - its just staggering the overhead turning each ABC this-that-the other into an object with all its state etc. 'F' in ABC is one byte - but as an abcNote object its a shed load larger (virtual function table, note, accidental, all the other things that a note can have, data related to drawing it, playing it etc, etc, etc, then the C++ compiler wades in and aligns everything, consuming more space, etc, etc).


A different approach of find the tune you want and then parsing that tune requires a lot less memory, although that approach doesn't provide some of the searching facilities at your disposal if you take the approach I did (but my approach requires a good machine to run on - no low memory machines need apply!).

(Sorry, the parser I wrote is not available as a candidate for this project).

Stephen
--
Stephen Kellett
Object Media Limited    http://www.objmedia.demon.co.uk
RSI Information:        http://www.objmedia.demon.co.uk/rsi.html
To subscribe/unsubscribe, point your browser to: http://www.tullochgorm.com/lists.html

Reply via email to