• 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: Adding UserEvent to Track
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Adding UserEvent to Track


  • Subject: Re: Adding UserEvent to Track
  • From: William Stewart <email@hidden>
  • Date: Mon, 1 Dec 2003 18:17:21 -0800

typedef struct MusicEventUserData
{
UInt32 length;
UInt8 data[1];
} MusicEventUserData;

So, the default size of this struct is being set incorrectly.

On 26/11/2003, at 9:30 AM, Craig Bakalian wrote:

> Hi,
> When I add this to a track
>
> MusicEventUserData trackTypeID;
> int size = sizeof(int);
int size = 1; // ie. this is the 1 byte that you are using

Everything else should be fine I think with this change

Bill


> trackTypeID.length = size;
> trackTypeID.data[0] = 1;
> MusicTrackNewUserEvent(track, 0.0, &trackTypeID);
>
> and then try to retrieve it like this,
>
> -(int)getTrackTypeUserEventForTrack: (MusicTrack)track
> {
> MusicEventIterator iter;
> Boolean b;
> NewMusicEventIterator(track, &iter);
> MusicEventIteratorHasNextEvent(iter, &b);
> while(b)
> {
> MidiEventInfo info;
> MusicEventIteratorGetEventInfo(iter, &info.stamp, &info.type,
> (const void **) &info.data, &info.size);
> if(info.stamp == 0.0)
> {
> if(info.type == kMusicEventType_User)
> {
> MusicEventUserData *userData = (MusicEventUserData
> *)info.data;
> return userData->data[0];
> }
> }
> MusicEventIteratorHasNextEvent(iter, &b);
> MusicEventIteratorNextEvent(iter);
> }
> return 0;
> DisposeMusicEventIterator(iter);
> }
>
> I get junk. What am I doing wrong? The iterator is not even return in
> the test for if(info.type == kMusicEventType_User).
>
>
> Craig Bakalian
> www.eThinkingCap.com
> _______________________________________________
> coreaudio-api mailing list | email@hidden
> Help/Unsubscribe/Archives:
> http://www.lists.apple.com/mailman/listinfo/coreaudio-api
> Do not post admin requests to the list. They will be ignored.
>
>
--
mailto:email@hidden
tel: +1 408 974 4056

________________________________________________________________________
__
"Much human ingenuity has gone into finding the ultimate Before.
The current state of knowledge can be summarized thus:
In the beginning, there was nothing, which exploded" - Terry Pratchett
________________________________________________________________________
__
_______________________________________________
coreaudio-api mailing list | email@hidden
Help/Unsubscribe/Archives: http://www.lists.apple.com/mailman/listinfo/coreaudio-api
Do not post admin requests to the list. They will be ignored.

  • Prev by Date: Re: AIFF/AIFC current documentation?
  • Next by Date: Re: unable to populate MusicTrack (one solved, one new problem)
  • Previous by thread: Re: AIFF/AIFC current documentation?
  • Next by thread: Re: unable to populate MusicTrack (one solved, one new problem)
  • Index(es):
    • Date
    • Thread