Re: DefaultOutputDevice timestamps
Re: DefaultOutputDevice timestamps
- Subject: Re: DefaultOutputDevice timestamps
- From: email@hidden
- Date: Wed, 24 Oct 2001 04:44:47 -0500 (CDT)
You helped to find where the problem is - my appIOProc is *not* a simple c
function, it is a c function that calls an obj-c class' method.
The appIOProc is literally, this:
OSStatus appIOProcSWC (AudioDeviceID inDevice, const AudioTimeStamp*
inNow, const AudioBufferList* inInputData,
const AudioTimeStamp* inInputTime,
AudioBufferList* outOutputData, const AudioTimeStamp* inOutputTime,
void* defptr)
{
SimpleWaveController *controller = (SimpleWaveController *)defptr;
OSStatus status = [controller audioCallback:inDevice
inNow: inNow
inInputData: inInputData
inInputTime: inInputTime
outOutputData: outOutputData
inOutputTime: inOutputTime
defptr: defptr];
return status;
}
This is contained in SimpleWaveController, and so is the audioCallback
method. In the above appIOProc, it turns out, inOutputTime->mHostTime does
update properly. Then it gets to audioCallback where
- (OSStatus) audioCallback: (AudioDeviceID) inDevice
inNow: (const AudioTimeStamp*)inNow
inInputData: (const AudioBufferList*)inInputData
inInputTime: (const AudioTimeStamp*)inInputTim
outOutputData: (AudioBufferList*)outOutputData
inOutputTime: (const AudioTimeStamp*)inOutputTime
defptr: (void*) defptr;
{
NSLog(@"In audioCallback inOutputTime.mHostTime = %llu \n",
inOutputTime->mHostTime);
return 0;
}
doesn't update mHostTime properly and maintains a value earlier than the
first value printed by the appIOProc. Now, again, I'm not sure whether
this is an error in my coding or what. The parts of which I have less
understanding (calling a OBj-c method from a C function is code adjusted
from suggestions given to me by others on the list) is that perhaps the
defptr I use isn't handled correctly or perhaps I need to do something
else to call the audioCallback method. For the defptr I've tried
typedef struct {
@defs(SimpleWaveController);
} waveControllerDef;
and passing that in and treating the defptr in appIOProcSWC as
(waveControllerDef *), and I've also tried just sending a pointer to
SimpleWaveController through as the defptr, as above. Now I doubt any
mishandling here is the cause, even if I didn't handle it smoothly,
basically because the SimpleWaveController has nothing to do with the data
in the the inOutputTime field - it's just passed directly and printed. As
far as the audioCallback being called improperly, well, I'd need outside
advice on that one. I have absolutely no desire to have to structure this
as C-only code, especially as anymore I'm not even sure I'd know how, so
hopefully I just missed something small. What I really don't understand is
why I've no trouble outputting sound while the AudioTimeStamps don't work.
It seems like it should be all or nothing.
Thanks,
Ben
p.s. So does Apple need any help adding Ogg Vorbis support to the iPod?
Actually that wouldn't be my specialty but the guys at slashdot would love
you and help in any way possible. I suggest courting geeks and
supporting open standards.
p.s.s. The previous p.s. was entirely rhetorical and probably misplaced.
On Tue, 23 Oct 2001, Jeff Moore wrote:
>
on 10/22/01 11:22 PM, email@hidden <email@hidden> wrote:
>
>
> in my callback method the AudioDevice sets the
>
> kAudioTimeStampHostTimeValid in the mFlags field in the inOutputTime
>
> parameter to true but the the inOutputTime->mHostTime field is only
>
> updating once per couple of minutes after the callback is called many,
>
> many times.
>
>
Hmm. This is puzzling. That field should increment by more or less the same
>
amount each time your IOProc is called.
>
>
I just wrote a little command line tool that installs an IOProc and prints
>
out the value of that field and I see that number constantly increasing. It
>
doesn't ever appear as the same number. The difference between my code and
>
your code is that mine is in C++ and yours is in ObjC.
>
>
Is your IOProc a plain vanilla C routine in a plain vanilla .c module?
>
>
--
>
>
Jeff Moore
>
Core Audio
>
Apple
>
_______________________________________________
>
coreaudio-api mailing list
>
email@hidden
>
http://www.lists.apple.com/mailman/listinfo/coreaudio-api