• 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: MusicEventIteratorHasNextEvent
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: MusicEventIteratorHasNextEvent


  • Subject: Re: MusicEventIteratorHasNextEvent
  • From: Philippe Wicker <email@hidden>
  • Date: Thu, 23 Oct 2003 21:32:59 +0200

On Thursday, October 23, 2003, at 06:35 PM, Craig Bakalian wrote:

> Hi,
> I am trying to get access to the events placed in a MusicTrack of a
> MusicSequence. Is there example code of this somewhere? I am kinda
> old for iterators, I normally pop a "for" or "while" loop on something
> and get the data that way. I have always stayed away from those new
> fangled iterator objects.

Here is how I do it (C++ code). If you plan to test it in a C or objC
program you will have to change some little things such as replacing
C++ references (e.g. RawEventInfos& ) by "standard" pointers
(RawEventInfos*).

struct RawEventInfos {
MusicTimeStamp time;
MusicEventType type;
UInt32 size;
void* data;
};

OSStatus GetEventInfos(MusicEventIterator the_iterator,
RawEventInfos& inf)
{
return MusicEventIteratorGetEventInfo (the_iterator, &inf.time,
&inf.type, (const void**) &inf.data, &inf.size );
}

void WalkthroughMusicTrack(MusicTrack the_track)
{
OSStatus status;
int event_count = 0;
MusicEventIterator the_iterator;

// Should add some error checking code here
NewMusicEventIterator(the_track, &the_iterator);
MusicEventIteratorSeek(the_iterator, 0);
while (1) {
RawEventInfos event_infos ;
status = GetEventInfos (the_iterator, event_infos);
if (status == noErr) { /* --> Your code here */ }
else if (status == kAudioToolboxErr_EndOfTrack) /* OK , End of
track */ break;
else /* KO, unexpected error, should not happen */ break;
MusicEventIteratorNextEvent(the_iterator);
}
DisposeMusicEventIterator(the_iterator);
return status;
}

>
> 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.
>
>
Philippe Wicker
email@hidden
_______________________________________________
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.

References: 
 >MusicEventIteratorHasNextEvent (From: Craig Bakalian <email@hidden>)

  • Prev by Date: MusicEventIteratorHasNextEvent
  • Next by Date: Re: MusicEventIteratorHasNextEvent
  • Previous by thread: MusicEventIteratorHasNextEvent
  • Next by thread: MusicEventIteratorHasNextEvent
  • Index(es):
    • Date
    • Thread