tableimix
Prev | Orchestra Opcodes and Operators | Next

## tableimix

tableimix — Mixes two tables.

## Description

Mixes two tables.

## Syntax

    tableimix idft, idoff, ilen, is1ft, is1off, is1g, is2ft, is2off, is2g

## Initialization

idft -- Destination function table.

idoff -- Offset to start writing from. Can be negative.

ilen -- Number of write operations to perform. Negative means work backwards.

is1ft, is2ft -- Source function tables. These can be the same as the destination table, if care is exercised about direction of copying data.

is1off, is2off -- Offsets to start reading from in source tables.

is1g, is2g -- Gains to apply when reading from the source tables. The results are added and the sum is written to the destination table.

## Performance

tableimix -- This opcode mixes from two tables, with separate gains into the destination table. Writing is done for klen locations, usually stepping forward through the table - if klen is positive. If it is negative, then the writing and reading order is backwards - towards lower indexes in the tables. This bi-directional option makes it easy to shift the contents of a table sideways by reading from it and writing back to it with a different offset.

If klen is 0, no writing occurs. Note that the internal integer value of klen is derived from the ANSI C floor() function - which returns the next most negative integer. Hence a fractional negative klen value of -2.3 would create an internal length of 3, and cause the copying to start from the offset locations and proceed for two locations to the left.

The total index for table reading and writing is calculated from the starting offset for each table, plus the index value, which starts at 0 and then increments (or decrements) by 1 as mixing proceeds.

These total indexes can potentially be very large, since there is no restriction on the offset or the klen. However each total index for each table is ANDed with a length mask (such as 0000 0111 for a table of length 8) to form a final index which is actually used for reading or writing. So no reading or writing can occur outside the tables. This is the same as “wrap” mode in table read and write. These opcodes do not read or write the guardpoint. If a table has been rewritten with one of these, then if it has a guardpoint which is supposed to contain the same value as the location 0, then call tablegpw afterwards.

The indexes and offsets are all in table steps - they are not normalized to 0 - 1. So for a table of length 256, klen should be set to 256 if all the table was to be read or written.

The tables do not need to be the same length - wrapping occurs individually for each table.

## See Also

tablecopy, tablegpw, tablemix, tableicopy, tableigpw

## Credits

Author: Robin Whittle
Australia
May 1997

New in version 3.47

Prev | Up | Next
tableikt | Home | tableiw