Re: MusicPlayerIsPlaying() : is it done yet?
Re: MusicPlayerIsPlaying() : is it done yet?
- Subject: Re: MusicPlayerIsPlaying() : is it done yet?
- From: Bill Stewart <email@hidden>
- Date: Thu, 24 Jul 2003 12:49:26 -0700
The player doesn't automatically stop.
We've added a track property in Panther to determine the "duration" of
a track
This is calculated (and can be done by you on Jaguar) by:
Iterate over the tracks in the sequence
Find the last event of each track (make a track iterator and seek to
the last event)
Is it later than my last kept know event time
- yes - that's my new last event time
Then at the end of this you have the latest event time in the
sequence...
You might want to add a couple of seconds to this for reverb tails,
etc...
Here's some code you can use to do this:
// figure out sequence length
UInt32 ntracks;
require_noerr(MusicSequenceGetTrackCount (sequence, &ntracks), fail);
MusicTimeStamp sequenceLength = 0;
for (UInt32 i = 0; i < ntracks; ++i) {
MusicTrack track;
require_noerr (MusicSequenceGetIndTrack(sequence, i, &track), fail);
MusicEventIterator iter = 0;
require_noerr (NewMusicEventIterator (track, &iter), fail);
require_noerr (MusicEventIteratorSeek(iter,
kMusicTimeStamp_EndOfTrack), fail);
if (!MusicEventIteratorPreviousEvent (iter)) {
MusicTimeStamp timeStamp;
MusicEventType eventType;
if (!MusicEventIteratorGetEventInfo (iter,
&timeStamp, &eventType, NULL, NULL)) {
// add 4 beats - nice and arbitrary!!!
timeStamp += 4;
if (timeStamp > sequenceLength)
sequenceLength = timeStamp;
}
}
if (iter)
DisposeMusicEventIterator (iter);
}
Bill
On Thursday, July 24, 2003, at 10:37 AM, Roy Lovejoy wrote:
They work wonderfully-
I spoke too soon.. Apparently, MusicPlayerIsPlaying seems to want to
keep the party going by
_NEVER_ returning false..
Boolean stillPlaying = false;
err = MusicPlayerIsPlaying(player, &stillPlaying);
stillPlaying is true, even long after the end of the midi sequence is
over.
is there anyway of determining when the sequence is over, after
issuing a MusicPlayerStart() ?
_______________________________________________
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.