Re: Re: CallHostTransportState
Re: Re: CallHostTransportState
- Subject: Re: Re: CallHostTransportState
- From: <email@hidden>
- Date: Sun, 1 Aug 2004 18:40:45 +0000
>
From: Jeremy Sagan <email@hidden>
>
Date: 2004/08/01 sv PM 06:04:14 GMT
>
To: <email@hidden>
>
CC: CoreAudio API <email@hidden>
>
Dmne: Re: CallHostTransportState
>
>
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?
Well, I am a physicist. I was just trying to establish the
mathematical connection not the way I write the code.
It just felt simpler to write it on that form. Still, I got
it wrong ;-)
beats = (tempo / 60) * (samples / sample_rate)
looks better. And is the same as your pseudo code below.
>
>
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.
True. Luckily I already have a setting that allows people to
use another algorithm witch doesn't use the TransportInfo but
is also not as convenient to use.
>
>
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.
Ok, so currentBeat and CurrentSampleInTimeLine have different
offsets not just different scales. But currentBeat and
the cycle intervals can be compared as apples to apples.
Thanks
/Olof W
>
>
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.