• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: Is there something wrong here (AU Properties)
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Is there something wrong here (AU Properties)


  • Subject: Re: Is there something wrong here (AU Properties)
  • From: Kyle Sluder <email@hidden>
  • Date: Sat, 29 Oct 2011 14:51:13 -0700

On Wed, Oct 26, 2011 at 10:09 AM, Stephen Blinkhorn
<email@hidden> wrote:
> typedef struct Event
> {
>        int mMIDINote
>        int mMIDIVelocity;
> } Event;
>
> typedef struct EventProperty
> {
>        int     mNumEvents;
>        Event   *mEvents; // << array of C structs
> } AS_SequencerTrackProperty;
>
>
> ..then in GetPropertyInfo():
>
> case kAudioUnitCustomProperty_event:
>        outWritable = false;
>        outDataSize = sizeof(EventProperty);
>        return noErr;
>
>
> ..and in GetProperty():
>
> case kAudioUnitCustomProperty_event:
>        EventProperty *event_property = (EventProperty*)outData;
>        event_property->mEvents[0]->mMIDINote = 64;
>        event_property->mEvents[0]->mMIDIVelocity = 127;
>        return noErr;

This doesn't match up, and will not compile. struct EventProperty is
defined to have an array of struct Events at the end, but you're
treating it as if it has an array of pointers to struct Event. Since
your definition of struct Event is missing a semicolon after int
mMIDINote, I suspect you didn't actually copy-paste your code, and
have therefore introduced errors. You also aren't allocating any space
for the array at all; this only magically works on 64-bit machines
because sizeof(struct Event) == sizeof(struct Event *) since struct
Event is composed of two 32-bit ints.

If mEvents really is an array of pointers to struct Event, then you
are indeed violating the host/AU separation. If you did in fact intend
for mEvents to be an array of struct Event, you need to replace your
dereferences (mEvents[0]->mMIDINote) with struct member accesses
(mEvents[0].mMIDINote) and you need to actually allocate the proper
space for an array of structs.

--Kyle Sluder
 _______________________________________________
Do not post admin requests to the list. They will be ignored.
Coreaudio-api mailing list      (email@hidden)
Help/Unsubscribe/Update your Subscription:

This email sent to email@hidden

  • Follow-Ups:
    • Re: Is there something wrong here (AU Properties)
      • From: Stephen Blinkhorn <email@hidden>
References: 
 >Is there something wrong here (AU Properties) (From: Stephen Blinkhorn <email@hidden>)

  • Prev by Date: Re: AUVal Source Code
  • Next by Date: Re: AUVal Source Code
  • Previous by thread: Is there something wrong here (AU Properties)
  • Next by thread: Re: Is there something wrong here (AU Properties)
  • Index(es):
    • Date
    • Thread