Re: Sample Rate: 44100 or 48000
Re: Sample Rate: 44100 or 48000
- Subject: Re: Sample Rate: 44100 or 48000
- From: Marc Van Olmen <email@hidden>
- Date: Sun, 14 Aug 2005 16:11:05 -0400
mmm...
I tried both pieces codes and it seems to giving back the cpu clock
instead of the card clock...
or it runs at the rate of the cpu clock instead of the hardware device.
mvo
On Aug 14, 2005, at 1:10 PM, Marc Van Olmen wrote:
On Aug 14, 2005, at 11:23 AM, Marc Van Olmen wrote:
to answer this part of the question my self found some sample code
and created this:
typedef double OS_TimeValue;
AudioTimeStamp theCurrentTime;
OSStatus anError;
theCurrentTime.mHostTime = 0;
theCurrentTime.mRateScalar = 0;
theCurrentTime.mReserved = 0;
theCurrentTime.mSampleTime = 0;
//theCurrentTime.mSMPTETime = 0;
theCurrentTime.mWordClockTime = 0;
theCurrentTime.mFlags = kAudioTimeStampSampleTimeValid |
kAudioTimeStampHostTimeValid;
anError = AudioDeviceGetCurrentTime(fOSMovie->fAudioClockDeviceID,
&theCurrentTime);
pDeviceClock-
>setTime((OS_TimeValue)AudioConvertHostTimeToNanos(theCurrentTime.mHos
tTime),kOS_TimeToNanoSeconds);
I'm wondering this code is not wrong?
shouldn't I add "AudioDeviceTranslateTime"?????
I'm wondering if the 'AudioConvertHostTimeToNanos' works only in the
macOS x hardware clock??? and not from my device???? because how does
it now the clock frequency of the device?? maybe this is stored inside
the mHostTime value???
I just doubt it a little bit?
So maybe this is then more Correct?????
typedef float64 OS_TimeValue;
AudioTimeStamp theCurrentDeviceTime;
AudioTimeStamp theCurrentTimeInMacOSXHardware;
OSStatus anError;
theCurrentDeviceTime.mHostTime = 0;
theCurrentDeviceTime.mRateScalar = 0;
theCurrentDeviceTime.mReserved = 0;
theCurrentDeviceTime.mSampleTime = 0;
//theCurrentTime.mSMPTETime = 0;
theCurrentDeviceTime.mWordClockTime = 0;
theCurrentDeviceTime.mFlags = kAudioTimeStampSampleTimeValid |
kAudioTimeStampHostTimeValid;
anError = AudioDeviceGetCurrentTime(fOSMovie->fAudioClockDeviceID, &
theCurrentDeviceTime);
FW_FAIL(anError);
anError = AudioDeviceTranslateTime(fOSMovie->fAudioClockDeviceID, &
theCurrentDeviceTime, & theCurrentTimeInMacOSXHardware);
FW_FAIL(anError);
// Time can now be converted to my NanoSeconds precisions clock
pDeviceClock-
>setTime((OS_TimeValue)AudioConvertHostTimeToNanos(theCurrentTimeInMacO
SXHardware.mHostTime),kOS_TimeToNanoSeconds);
I'm aware that the fOSMovie->fAudioClockDeviceID needs to be running
to make this work....
_______________________________________________
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