Re: Sequence position display
Re: Sequence position display
- Subject: Re: Sequence position display
- From: Philippe Wicker <email@hidden>
- Date: Wed, 20 Aug 2003 22:13:08 +0200
On Wednesday, August 20, 2003, at 09:32 PM, Patrick Gostovic wrote:
Hi.
I'm hoping to get some ideas on how to implement a song position
display (i.e. bars/beats or time) for a sequencing app. I'm using the
MusicPlayer api, and my first hope was that I would be able to specify
some kind of notification callback function. I don't see anything in
the api for that (correct me if I'm wrong), so as far as I can tell I
have two options: 1) poll the MusicPlayer fairly often and update the
display as needed, or 2) create a metronome track in the sequence and
aim it at MIDIEndpoint that can advance the display. The first option
seems clumsy to me, and the second option seems like overkill.
I've not used the MusicPlayer since a long time so I don't know if
there is a direct way to get what you want. Anyway, the idea of polling
the player is not so clumsy. Notification of AU parameter changes is
based on a timer which fires at regular time interval. You could create
a timer run loop source and attach this source to your UI run loop.
Using a timer period of 50 ms or 100 ms should do it.
Is option 2 an expensive way to achieve this? I don't have a lot of
experience with CoreMIDI so I don't know.
Should not be overkill. If your "clock" resolution is e.g. 24 PPQ (same
as the midi clock), it will give you a tick about every 12.5 ms at 200
bpm (which is a fast tempo). That means that you will receive one midi
event every 12.5 ms. Not so much.
The true problem with the use of a MIDIEndpoint is that it cannot be
private (AFAIK), and that your midi clock may be polluted with midi
events coming from any other apps running on the machine (because this
endpoint will appear as a destination to all midi clients and may be
chosen accidentally by the user).
Any thoughts?
Thanks.
pg
_______________________________________________
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.