Re: CAClockSetCurrentTime Help
Re: CAClockSetCurrentTime Help
- Subject: Re: CAClockSetCurrentTime Help
- From: Chad Williams <email@hidden>
- Date: Wed, 04 Mar 2009 12:52:09 -0800
- Thread-topic: CAClockSetCurrentTime Help
I have successfully used CAClockSMPTETimeToSeconds. It works great except
for the fact that I cannot get frames. Does kCAClockTimeFormat_SMPTESeconds
allow me to get frames? And will it work?
Thanks, Chad
On 3/4/09 12:29 PM, "Doug Wyatt" <email@hidden> wrote:
> The reason for this escapes me right now, but CAClockTranslateTime
> won't accept kCAClockTimeFormat_SMPTETime as a source format. This
> affects other APIs like CAClockSetCurrentTime, which use TranslateTime
> underneath the hood.
>
> You should be able to use CAClockSMPTETimeToSeconds to obtain a time
> in seconds which can then be passed to SetCurrentTime.
>
> Doug
>
>
> On Mar 4, 2009, at 12:09 , Chad Williams wrote:
>
>> Sorry if this is a resend. This message didnĀ¹t show up in my sent
>> items or inbox for the Core Audio List.
>>
>> - Chad
>>
>> Here are the values that I am assigning to clockTime.time. I am
>> including the console readout and the code that works to convert
>> SMPTE to seconds.
>>
>> Thanks, Chad
>>
>> {
>> OSStatus err;
>> //SMPTETime smpteTime;
>> CAClockTime clockTime;
>> //CAClockSeconds seconds;
>>
>> NSLog(@"SMPTE Time - %2.2hi:%2.2hi:%2.2hi:%2.2hi",(SInt16)
>> [hhField intValue], (SInt16)[mmField intValue], (SInt16)[ssField
>> intValue], (SInt16)[ffField intValue]);
>>
>> clockTime.format = kCAClockTimeFormat_SMPTETime;
>> clockTime.time.smpte.mType = kSMPTETimeType30;
>> clockTime.time.smpte.mHours = (SInt16)[hhField intValue];
>> clockTime.time.smpte.mMinutes = (SInt16)[mmField intValue];
>> clockTime.time.smpte.mSeconds = (SInt16)[ssField intValue];
>> clockTime.time.smpte.mFrames = (SInt16)[ffField intValue];
>> clockTime.time.smpte.mSubframeDivisor = 80;
>> clockTime.time.smpte.mSubframes = 0;
>>
>> err = CAClockSetCurrentTime(clockRef, &clockTime);
>> if (err != noErr) {
>> NSLog(@"SMPTETimeToSecond err = %d", err);
>> return;
>> }
>>
>> /*
>> smpteTime.mType = kSMPTETimeType30;
>> smpteTime.mHours = (SInt16)[hhField intValue];
>> smpteTime.mMinutes = (SInt16)[mmField intValue];
>> smpteTime.mSeconds = (SInt16)[ssField intValue];
>> smpteTime.mFrames = (SInt16)[ffField intValue];
>> smpteTime.mSubframeDivisor = 80;
>> smpteTime.mSubframes = 0;
>> CAClockSMPTETimeToSeconds(clockRef, &smpteTime, &seconds);
>>
>> CAClockTime secondTime;
>> secondTime.format = kCAClockTimeFormat_Seconds;
>> secondTime.time.seconds = seconds;
>> CAClockSetCurrentTime(clockRef, &secondTime);
>> */
>> }
>>
>> 2009-03-03 10:49:21.794 FlexMTC[4038:10b] SMPTE Time - 02:00:01:26
>> 2009-03-03 10:49:21.818 FlexMTC[4038:10b] SMPTETimeToSecond err =
>> -66814
>> 2009-03-03 10:49:24.106 FlexMTC[4038:10b] SMPTE Time - 02:01:01:26
>> 2009-03-03 10:49:24.107 FlexMTC[4038:10b] SMPTETimeToSecond err =
>> -66814
>> 2009-03-03 10:49:24.330 FlexMTC[4038:10b] SMPTE Time - 02:13:01:26
>> 2009-03-03 10:49:24.331 FlexMTC[4038:10b] SMPTETimeToSecond err =
>> -66814
>> 2009-03-03 10:49:35.642 FlexMTC[4038:10b] SMPTE Time - 02:13:01:26
>> 2009-03-03 10:49:35.643 FlexMTC[4038:10b] SMPTETimeToSecond err =
>> -66814
>> 2009-03-03 10:49:36.178 FlexMTC[4038:10b] SMPTE Time - 02:13:16:26
>> 2009-03-03 10:49:36.178 FlexMTC[4038:10b] SMPTETimeToSecond err =
>> -66814
>>
>>
>> On 3/3/09 8:38 AM, "Doug Wyatt" <email@hidden> wrote:
>>
>>> What are the values in clockTime.time? What is the error?
>>>
>>> On Mar 3, 2009, at 0:20 , Chad Williams wrote:
>>>
>>>> Thank you for all of the Core Audio postings. They have been
>> extremely
>>>> helpful to me. I have a bit of a dilemma. I can't seem to set the
>>>> CAClockTime from a SMPTETime. Any help would be great. I am trying
>>>> to set
>>>> the value from NSTextFields. The code compiles with no errors...I
>>>> just get
>>>> "err" when CAClockSetCurrentTime() is called. I have no issues
>>>> setting the
>>>> time from seconds.
>>>>
>>>> OSStatus err;
>>>> CAClockTime clockTime;
>>>>
>>>> clockTime.format = kCAClockTimeFormat_SMPTETime;
>>>> clockTime.time.smpte.mType = kSMPTETimeType30;
>>>> clockTime.time.smpte.mHours = (SInt16)[hhField intValue];
>>>> clockTime.time.smpte.mMinutes = (SInt16)[mmField intValue];
>>>> clockTime.time.smpte.mSeconds = (SInt16)[ssField intValue];
>>>> clockTime.time.smpte.mFrames = (SInt16)[ffField intValue];
>>>> clockTime.time.smpte.mSubframeDivisor = 80;
>>>> clockTime.time.smpte.mSubframes = 0;
>>>>
>>>> err = CAClockSetCurrentTime(clockRef, &clockTime);
>>>> if (err != noErr) {
>>>> NSLog(@"setClockToSMPTETime err = %d", err);
>>>> }
>>>>
>>>> Thanks, Chad
>>>
>>>
>
>
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Coreaudio-api mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden