Re: [AD] OSX qtmidi.m build failure fix

[ Thread Index | Date Index | More lists.liballeg.org/allegro-developers Archives ]


On Friday 14 April 2006 07:13, Jay Bernardo wrote:
> This is my first attempt at flagging something as broken and
> supplying a patch to fix it. If I improperly followed procedure,
> please let me know.
>
> When building Allegro for MacOS X from the 4.2 branch (revision 5777)
> the following errors occur:
>
> src/macosx/qtmidi.m: In function 'osx_midi_init':
> src/macosx/qtmidi.m:128: error: request for member 'bigEndianValue'
> in something not a structure or union
> src/macosx/qtmidi.m:129: error: request for member 'bigEndianValue'
> in something not a structure or union
>
> Below is a diff of a fix that remedies the problem. Testing may be
> required, as I'm not sure exactly what should be tested to ensure it
> does everything correctly. My poor test consisted of running exmidi
> and verifying that it properly plays a midi file.
>
> -Jay
>
> ===================================================================
> --- src/macosx/qtmidi.m (revision 5777)
> +++ src/macosx/qtmidi.m (working copy)
> @@ -125,8 +125,8 @@
>         voice[i].vol = -1;
>         voice[i].pan = -1;
>         memset(&note_request, 0, sizeof(note_request));
> -      note_request.info.polyphony.bigEndianValue = EndianU16_NtoB(8);
> -         note_request.info.typicalPolyphony.bigEndianValue =
> EndianS32_NtoB(X2Fix(1.0));
> +      *(short *)(&note_request.info.polyphony) = EndianU16_NtoB(8);
> +         *(long *)(&note_request.info.typicalPolyphony) =
> EndianS32_NtoB(X2Fix(1.0));
>         result = NAStuffToneDescription(note_allocator, 1,
> &note_request.tone);
>         result |= NANewNoteChannel(note_allocator, &note_request,
> &voice[i].channel);
>         result |= NAResetNoteChannel(note_allocator, voice[i].channel);
>
>
> -------------------------------------------------------
> This SF.Net email is sponsored by xPML, a groundbreaking scripting language
> that extends applications into web and mobile media. Attend the live
> webcast and join the prime developer group breaking into this new coding
> territory!
> http://sel.as-us.falkag.net/sel?cmd=lnk&kid=110944&bid=241720&dat=121642

This seems to be a problem, I'd imagine you are using a PPC mac?
I had originally changed it because peterhull suggested that should work on 
PPC as well as x86 hardware. As it doesn't I suppose the best thing to do is 
to provide a check for either platform.
Here is a patch that does so.

-- 
-juvinious

<a href="http://chasm.hopto.org";>The Chasm</a> - My Site.
Index: src/macosx/qtmidi.m
===================================================================
--- src/macosx/qtmidi.m	(revision 5777)
+++ src/macosx/qtmidi.m	(working copy)
@@ -125,8 +125,13 @@
       voice[i].vol = -1;
       voice[i].pan = -1;
       memset(&note_request, 0, sizeof(note_request));
-      note_request.info.polyphony.bigEndianValue = EndianU16_NtoB(8);
-	  note_request.info.typicalPolyphony.bigEndianValue = EndianS32_NtoB(X2Fix(1.0));
+      #ifndef __i386__
+	note_request.info.polyphony = 8;
+	note_request.info.typicalPolyphony = 0x00010000;
+      #else
+      	note_request.info.polyphony.bigEndianValue = EndianU16_NtoB(8);
+      	note_request.info.typicalPolyphony.bigEndianValue = EndianS32_NtoB(X2Fix(1.0));
+      #endif
       result = NAStuffToneDescription(note_allocator, 1, &note_request.tone);
       result |= NANewNoteChannel(note_allocator, &note_request, &voice[i].channel);
       result |= NAResetNoteChannel(note_allocator, voice[i].channel);


Mail converted by MHonArc 2.6.19+ http://listengine.tuxfamily.org/