You read from ahi.device
by passing an AHIRequest
to the
device with CMD_READ
set in io_Command
, the number of bytes
to be read set in io_Length
, the address of the read buffer set in
io_Data
, the desired sample format set in ahir_Type
and the
desired sample frequency set in ahir_Frequency
. The first read
command in a sequence should also have io_Offset
set to 0.
io_Length
must be an even multiple of the sample frame size.
To do double buffering, just fill the first buffer with DoIO()
and
io_Offset
set to 0, then start filling the second buffer with
SendIO()
using the same I/O request (but don't clear
io_Offset
!). After you have processed the first buffer, wait until
the I/O request is finished and start over with SendIO()
on the
first buffer.
The samples will automatically be converted to the sample format set in
ahir_Type
and to the sample frequency set in ahir_Frequency
.
Because it is quite unlikely that you ask for the same sample frequency the
user has chosen in the preference program, chances that the quality is
lower than expected are pretty high. The worst problem is probably the
anti-aliasing filter before the A/D converter. If the user has selected a
higher sampling/mixing frequency than you request, the signal will be
distorted according to the Nyquist sampling theorem. If, on the other
hand, the user has selected a lower sampling/mixing frequency than you
request, the signal will not be distorted but rather bandlimited more than
necessary.
Go to the first, previous, next, last section, table of contents.