3 ms·
This is both true and false at the same time. (1) It is absolutely not true that the system clock will track the audio clock "quite well". Real world numbers w
by PaulDavisThe1st 6y ago
This is both true and false at the same time.
(1) It is absolutely not true that the system clock will track the audio clock "quite well". Real world numbers would typically involve drift measurable in seconds within a low integer number of hours.
(2) It absolutely is true that on most sensible audio interface designs, you don't need interrupts except early after device open. At that point, you use them to set up a DLL (Delay Locked Loop) that will enable you to use the system clock to know where the audio hardware is reading/writing to in the buffer used to move data to/from the hardware. Once the DLL is correctly configured, you can just be woken by the system timer, determine the current audio hardware state and read/write data appropriately.
- marcan_42 6y agoBut on (2): unless you're a low level app directly driving the hardware, you shouldn't do this. And you especially shouldn't do this without good guarantees that system timers are indeed well behaved. Effectively, using a DLL and system timers instead of straight IRQs is a low level implementation detail, but that belongs either in the driver or in a very low level piece of code anyway (like JACK or some other audio daemon), not user applications. I was sort of throwing all of this together when I said hardware "events"; locking a DLL with a different time base to the playback hardware buffer pointer stats is still effectively that, and should be done, but only at a level low enough where you know it'll work. Which definitely isn't Android's high level thread scheduling framework.
- amluto 6y agoFor (1), by “quite well” I mean well enough to avoid buffer underruns. So I think we agree.
- PaulDavisThe1st 6y agoNo, we don't agree. The drift will exceed the buffer size is less than an hour, or certainly could with many hardware configurations.