[ < ] | [ > ] | [ << ] | [ Up ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
WFDB_Sample sample(WFDB_Signal s, WFDB_Time t) int sample_valid(void) |
sample
): The value (in raw adus) of sample number t
in open signal s,if successful, or the value of the previous
successfully read sample.
sample_valid
): The most recent value returned by
sample
was invalid
sample_valid
): The most recent value returned by
sample
was valid
The sample
function allows the caller to read samples of the
currently open input signals in any order. The first argument is a
signal number (a non-negative integer between 0 and nsig-1,
where nsig is the number of open input signals), and the second
is a time, expressed as a non-negative sample number. If sample
is invoked with valid input arguments, the companion function
sample_valid
returns 1.
There are three ways in which sample
can be invoked with invalid
input arguments. In each case, sample_valid
returns 0, but
sample
attempts to return a reasonable value. If s is
invalid, sample
returns the value of signal 0 at the specified
time. If t is negative, the returned value is that of sample
number zero of the specified signal. If t specifies a sample
number beyond the end of the record, the returned value is that of the
last valid sample of the specified signal. For an example of the use
of sample
and sample_valid
, see section Example 7: A General-Purpose FIR Filter.
Be sure to call wfdbquit
before exiting from any program that
uses sample
, to be certain that dynamically allocated memory
used by sample
is freed.