NAME

sampfunci - return an interpolated value from a function table


SYNOPSIS

value = sampfunci(table_number, index)


DESCRIPTION

Returns the value stored in a specified location of a function table, or a value interpolated between two successive locations. The function table must already have been created by calling makegen.

NOTE: Much of the functionality of sampfunci has been duplicated and extended by the samptable in the new (in RTcmix 4.0) table-handle scheme.


ARGUMENTS

table_number
The numeric ID for the function table. If this table hasn't been created by makegen yet, the script will die.

index
The location in the function table of the value you want to retrieve, starting from zero. If index has a fractional part, then the value is interpolated between two successive locations. The interpolation is linear.

For example, if index is 1.5, the value returned will be halfway between the values stored at locations 1 and 2.

If index is greater than or equal to the number of elements in the table, sampfunc returns the last element in the table.


EXAMPLES

   makegen(1, 2, 4,  0, 2, 4, 6) /* stores 4 values */
   value = sampfunci(1, 0)       /* returns 0 */
   value = sampfunci(1, 1)       /* returns 2 */
   value = sampfunci(1, 0.5)     /* returns 1 - halfway btw. 0 and 2 */


NOTES

If you simply want to retrieve a value from a table, without interpolation, use sampfunc.


SEE ALSO

makegen, sampfunc, gen2