NAME

sampfunc - return a value from a function table


SYNOPSIS

value = sampfunc(table_number, index)


DESCRIPTION

Returns the value stored in a specified location of a function table. The function table must already have been created by calling makegen.

NOTE: Much of the functionality of sampfunc has been duplicated and extended by the samptable scorefile command 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 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, 6,  3, 1, 0, 5, 2, 4)  /* stores 6 values */
   value1 = sampfunc(1, 0)          /* gets value at index 0 */
   value2 = sampfunc(1, 4)          /* gets value at index 4 */
   print(value1)                    /* prints "3" */
   print(value2)                    /* prints "2" */

   for (i = 0; i < 6; i = i + 1) {  /* prints all 6 values */
      value = sampfunc(1, i)
      print(value)
   }


NOTES

If you want to interpolate between successive values stored in a table, use sampfunci.


SEE ALSO

makegen, sampfunci, gen2