Re: MusicPlayer questions
Re: MusicPlayer questions
- Subject: Re: MusicPlayer questions
- From: email@hidden (Patrick Beard)
- Date: Tue, 10 Dec 2002 06:12:05 -0800
On Thursday, November 7, 2002, at 07:10 PM, Bill Stewart wrote:
On Wednesday, November 6, 2002, at 11:54 AM, Lars Peters wrote:
Hello,
MusicPlayer.h states that MusicTimeStamp depends on the unit the
track has. If so, how can I set the unit?
The unit currently is beats per minute
In case this didn't completely answer your question (it didn't for me),
I'll add here that to set what the current BPM value should be during
playback, you use MusicSequenceGetTempoTrack(), and then call
MusicTrackNewExtendedTempoEvent() to specify at what beat the tempo
should change to. In code:
OSStatus ChangeSequenceTempo(MusicSequence sequence, MusicTimeStamp
when, Float64 beatsPerMinute)
{
OSStatus status;
MusicTrack tempoTrack;
status = MusicSequenceGetTempoTrack(sequence, &tempoTrack);
if (status == noErr)
status = MusicTrackNewExtendedTempoEvent(tempoTrack, when,
beatsPerMinute);
return status;
}
Note that the time this will happen is a function of what the tempo was
at the time this beat occurs, so it's probably a good idea to call this
at time stamp 0 to establish an initial tempo. If this was already
painfully clear to everybody, forgive me for being redundant.
- Patrick
_______________________________________________
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.