ftprint

ftprint — Print the contents of a table (for debugging)

Description

Plugin opcode in emugens.

Prints the contents of a table (for debugging). It works at k-time, a trigger controls when to print (use ktrig=1, which is the default, to print only at i-time)

Syntax

ftprint ifn [, ktrig, kstart, kend, kstep, inumcols ]

Initialization

ifn - The table to print

inumcols - The number of elements to print in one column (default = 10)

Performance

ktrig - The table will be printed whenever this value changes from 0 to possitive. Can be used together with metro to print at a given time interval. A value of -1 indicates to print at each k-cycle (default = 1)

kstart - The first index to print. (default = 0)

kend - The end index to print (non inclusive). (default = length of table)

kstep - How many elements to skip (default = 1)

Examples

Here is an example of the ftprint opcode. It uses the file ftprint.csd.

Example 401. Example of the ftprint opcode.

<CsoundSynthesizer>
<CsOptions>

--nosound

</CsOptions>
<CsInstruments>

; This is the example file for ftprint

/*

  ftprint

  Print the contents of an f-table
  (mostly for debuggin purposes)

  ftprint ifn, ktrig=1, kstart=0, kend=0, kstep=1, inumcols=0

  ifn: the table to print
  ktrig: table will be printed whenever this changes
         from non-positive to positive
  kstart: start index
  kend: end index (non inclusive)
  kstep: number of elements to skip
  inumcols: number of elements to print per line

  See also: printarray

*/

instr 1
  ifn   ftgentmp 0, 0, -13, -2,  0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12

  ; print all elements
  ftprint ifn

  ; print all elements in columns of 4 elements
  ftprint ifn, 1, 0, 0, 1, 4

  ; assume that a table holds a 2D matrix, print the matrix 
  imatrix  ftgentmp 0, 0, 0, -2, \
      00, 01, 02, 03, 04,  \
      10, 11, 12, 13, 14,  \
      20, 21, 22, 23, 24,  \
      30, 31, 32, 33, 34

  ; print the whole matrix, 5 columns per line
  ftprint imatrix, 1, 0, 0, 1, 5

  ; print one row
  irow = 2
  inumcols = 5
  ftprint imatrix, 1, 2*inumcols, 3*inumcols

  ; print one column
  ftprint imatrix, 1, 3, 0, inumcols, 1

  turnoff
endin

</CsInstruments>

<CsScore>
i 1 0 0.01
</CsScore>

</CsoundSynthesizer>


See also

Printing and Display

Read/Write Operations

Credits

By: Eduardo Moguillansky 2018

New plugin in version 6.12