[fpc-pascal] MIDI & Kylix

Peter H.M. Brooks peter at new.co.za
Fri Jan 14 04:49:19 CET 2005


Pedro Lopez-Cabanillas wrote:

>Hi,
>
>On Thursday 13 January 2005 20:38, Peter H.M. Brooks wrote:
>  
>
>>I've been enjoying looking through these. Your smf.pas unit looks
>>perfect for my requirements - it's nicely put together.
>>
>>I'm using fpc, not kylix, and I it chokes over the variable length array
>>"fred : array of byte" is illegal in fpc, but presumably fine in Kylix.
>>
>>Have you got a version that has compiled in fpc? I've tried setting the
>>Delphi compatability switches but it doesn't help. I could set it up as
>>a fixed length array and modify the code where necessary, but, if you do
>>have a version that works with fpc then I'd rather use that!
>>
>>While I'm asking, I don't suppose that you have a sample program that
>>uses the unit, do you? It isn't, of course, necessary, but it would be
>>nice to see, if you have one.
>>    
>>
>
>I've uploaded the latests sources (one year old) here:
>	http://perso.wanadoo.es/plcl/alsapas/midiobjects-0.1.tar.bz2
>	http://perso.wanadoo.es/plcl/alsapas/midiobjects-0.1.tar.gz
>
>You need to use FPC 1.9.4 or later; 1.9.6 should work, as Jonas pointed, 
>because I'm using some features not available in older releases.
>
>There is an example program "spysmf.pas", that shows how to read and dump a  
>MIDI file contents to stdout. To create a MIDI file from scratch is very 
>similar: First create an instance of the component, assign some properties as 
>Division, Number of Tracks, and FileFormat (0 or 1). You should also assign 
>event handlers for the OnWriteTrack (and optionally OnWriteTempoTrack) 
>events. Inside these handlers you should issue calls to the methods 
>WriteMidiEvent, WriteMetaEvent etc.; to start the output, invoke WriteToFile 
>or WriteToStream and the engine shall perform the calls to your supplied 
>handlers. That's all (more or less) ;-)
>
>  
>
Brilliant! Thank you very much....!






More information about the fpc-pascal mailing list