[PD] midifile

Martin Peach martinrp at vax2.concordia.ca
Wed Nov 9 18:43:45 CET 2005


OK, it was my code :(
I've just uploaded a new midifile.c to:
http://puredata.info/Members/martinrp
You no longer need to worry about endianness, I realized that the code 
for variable length values is portable and doesn't need to be reversed 
for ppc. (at least I think so...). Please let me know how it goes on OSX.
The MSW thing is a hack because I don't use a makefile. Pure Data source 
code uses MSW or NT to identify that OS, so midifile.c should build on 
Windows with the same setup as for any other external.

Martin

Pall Thayer wrote:

> Here's the code I've edited:
>
> // if PPC, define _BIG_ENDIAN
>
> #define    _BIG_ENDIAN
>
> /*#ifdef MSW
> #define EXPORT_SHARED __declspec(dllexport)
> #else*/
> #define EXPORT_SHARED
> //#endif
> #define NO_MORE_ELEMENTS 0xFFFFFFFF
>
> define MSW is commented out in the code so I would guess that my  
> commenting out the ifdef MSW stuff doesn't really change anything.  
> defining _BIG_ENDIAN  gives me the following warning:
>
> midifile.c:30:1: warning: "_BIG_ENDIAN" redefined
> <built-in>:1:1: warning: this is the location of the previous definition
>
> Here's my line for compiling:
>
> gcc -o midifile.pd_darwin midifile.c -bundle -bundle_loader ../bin/pd  
> -flat_namespace (maybe this is wrong?)
>
> It gives me a bunch of errors about signedness but from what i  
> understand, they shouldn't really matter and it's a gcc4 thing.
>
> Still always get the same error in PD when I try loading a midi file.  
> The file plays fine in quicktime, so it's valid.
>
> Pall
>
> On 8.11.2005, at 13:22, Martin Peach wrote:
>
>>
>> ...and also undefine MSW...
>> change
>> #define MSW
>> to
>> //define MSW
>> Martin Peach wrote:
>>
>>> You need to add a line in midifile.c where it has:
>>> // if PPC, define _BIG_ENDIAN
>>> put this:
>>> #define _BIG_ENDIAN
>>> If that doesn't work, there is a bug in my byteswapping code or  the 
>>> file isn't a midi file.
>>>
>>> Martin
>>>
>>> Pall Thayer wrote:
>>>
>>>> Hi, trying to compile this on OS X. Don't really know what I'm  
>>>> doing  but got it to compile and now it gives me errors that look  
>>>> like this:
>>>>
>>>> Opened /Users/palli/downloads/Chestnuts_Roasting.mid
>>>> Header chunk type: MThd
>>>> Header chunk length: 100663296
>>>> error: midifile_read_header_chunk: bad file format: bad header  
>>>> chunk  length
>>>>
>>>> Regardless of what I open, it always looks identical except for  
>>>> the  name of the file. Any ideas?
>>>>
>>>> Pall
>>>>
>>>> On 31.10.2005, at 14:17, Martin Peach wrote:
>>>>
>>>>> I have posted my external for reading midi files here:
>>>>>
>>>>> http://puredata.info/Members/martinrp
>>>>>
>>>>> There is code and a compiled dll for windoze as well as a shell   
>>>>> script to compile it for lignux, and a help patch. Should work  
>>>>> on  OSX too with slight changes (define _BIG_ENDIAN for ppc).
>>>>>
>>>>> Midifile reads type 0 and 1 SMF (.mid) files and may work on  
>>>>> type  2; it should ignore any non-standard meta codes.
>>>>> Please let me know how you got it to crash ;)
>>>>> Write functionality may be forthcoming in a few weeks...
>>>>>
>>>>> Martin
>>>>>
>>>>>
>>>>>
>>>>> _______________________________________________
>>>>> PD-list at iem.at mailing list
>>>>> UNSUBSCRIBE and account-management -> http:// lists.puredata.info/ 
>>>>> listinfo/pd-list
>>>>
>>>>
>>>>
>>>>
>>>>
>>>>
>>>> -- 
>>>> Pall Thayer
>>>> palli at pallit.lhi.is
>>>> http://www.this.is/pallit
>>>>
>>>>
>>>>
>>>>
>>>> _______________________________________________
>>>> PD-list at iem.at mailing list
>>>> UNSUBSCRIBE and account-management -> http://lists.puredata.info/ 
>>>> listinfo/pd-list
>>>>
>>>
>>>
>>> _______________________________________________
>>> PD-list at iem.at mailing list
>>> UNSUBSCRIBE and account-management -> http://lists.puredata.info/ 
>>> listinfo/pd-list
>>>
>>
>>
>> _______________________________________________
>> PD-list at iem.at mailing list
>> UNSUBSCRIBE and account-management -> http://lists.puredata.info/ 
>> listinfo/pd-list
>
>
>
>
> -- 
> Pall Thayer
> palli at pallit.lhi.is
> http://www.this.is/pallit
>
>
>
>
> _______________________________________________
> PD-list at iem.at mailing list
> UNSUBSCRIBE and account-management -> 
> http://lists.puredata.info/listinfo/pd-list
>





More information about the Pd-list mailing list