Re: CallHostTransportState
Re: CallHostTransportState
- Subject: Re: CallHostTransportState
- From: Jeremy Sagan <email@hidden>
- Date: Sun, 1 Aug 2004 14:04:14 -0400
Olof,
On Aug 1, 2004, at 1:10 PM, <email@hidden> wrote:
>
> <snip>
>
Yepp, 6.1 only correctly refuses the service but 6.21 accepts
>
and delivers. I have some trouble interpreting the results though.
>
What I really need is the exact cycle endpoints in samples.
>
The cycle intervals are delivered in beats however and so I
>
need to be able to rescale beats to samples with accuracy.
>
The formula I use for this is
>
beats = 60 * tempo * samples / sample_rate
>
If you need to convert to samples why are you calculating beats here?
Off the top of my head, to get samples you would use something like:
double beats_per_second = tempo / 60.0;
double seconds = beats / beats_per_second;
samples = seconds * sample_rate;
Of course this does not work accurately if there are tempo changes in
the cycle.
Metro's CallHostTransportState code does this:
if (outCycleStartBeat)
*outCycleStartBeat = (PS.StartPlay.time - 1.0)/ cpqn;
if (outCycleEndBeat)
*outCycleEndBeat = (PS.EndCue.time - 1.0)/ cpqn;
PS.StartPlay.time and PS.EndCue.time are 1 based MIDI beat times based
on the current clocks per quarter note (cpqn) setting.
Jeremy
>
What bothers me is that when I take the currentBeat from the
>
CallHostBeatAndTempo and rescale it to samples I don't
>
get the same value as that given by CurrentSampleInTimeLine
>
of CallHostTransportState, which I sort of expected to.
>
Perhaps they are not supposed to be the same.
>
>
/Olof W
>
>
>
>
>
>
>
>
>
>>
>
>> On Jul 28, 2004, at 7:25 PM, <email@hidden> wrote:
>
>>
>
>>>> From: <email@hidden>
>
>>>> Date: 2004/07/27 ti PM 01:02:33 GMT
>
>>>> To: CoreAudio API <email@hidden>
>
>>>> Dmne: CallHostTransportState
>
>>>>
>
>>>> Is it OK to query the host for transport information yet?
>
>>>> I found the CallHostTransportState() to be inside a comment
>
>>>> in the 1.3.1 SDK. I tried to use it anyway but I get mostly
>
>>>> crashes out of Logic 6.4.1. Cannot really tell if it ever
>
>>>> returns anything useful.
>
>>>
>
>>> Has anybody tried to use the HostCallback_GetTransportState?
>
>>> Did it work? Did it not?
>
>>>
>
>>> Host developers, do you supports this?
>
>>>
>
>>> /Olof W
>
>>> _______________________________________________
>
>>> 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.
>
>> _______________________________________________
>
>> 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.
>
> _______________________________________________
>
> 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.
>
_______________________________________________
>
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.
_______________________________________________
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.