MAL.Waveform |
ref_waveform_out = MAL.Waveform( BYREF waveform_out AS ARRAY, BYVAL vixa AS INTEGER, BYVAL type AS INTEGER, BYVAL length AS INTEGER, [BYVAL amplitude AS REAL=1], [BYVAL offset AS REAL=0], [BYVAL phase AS REAL=0], [BYVAL invert AS INTEGER=0], [BYVAL nFrames AS INTEGER=ML_ALL] ) AS REFERENCE
ref_waveform_out = MAL.Waveform( [BYREF waveform_out AS ARRAY], BYVAL type AS INTEGER, BYVAL length AS INTEGER, [BYVAL amplitude AS REAL=1], [BYVAL offset AS REAL=0], [BYVAL phase AS REAL=0], [BYVAL invert AS INTEGER=0], [BYVAL nPoint AS INTEGER=ML_ALL], [BYVAL nFrameOffset AS INTEGER=0] ) AS REFERENCE
Fills a one dimensional array with a waveform. The waveform can be one of Sine, Square, Triangle, Sawtooth or Ramp. If the array has multiple points/channels, all of them are filled with the same waveform unless you specify the point(s)/channel(s) to use. The second syntax allows you to omit the output array. In this case a dynamic array will be created and the reference can be used to access the waveform.
If you specify a frame offset, the waveform will start on frame nFrameOffset + 1.
Following constants have been defined in MyBASIC2_MaxMAL.bis
' Waveform Types CONST ML_SINE = 1 ' Create Sine Waveform CONST ML_SQUARE = 2 ' Create Square Waveform CONST ML_TRIANGLE = 3 ' Create Triangular Waveform CONST ML_SAWTOOTH = 4 ' Create Sawtooth Waveform CONST ML_RAMP = 5 ' Create a Ramp
Example:
OPTION EXPLICIT ON OPTION BASE 1
' Include the MaxMAL Library $INCLUDE "MyBASIC2_MaxMAL /once" $LIBRARY "MyBASIC2_MaxMALLib"
' Programs to Display Result CONST cDisplayArray = "ArrayTable" CONST cPlotArray = "ArrayPlot"
' Declare variables and arrays DIM Nisse( 1000, 5, 1 ) AS REAL
' Create a Ramp Waveform DIM i AS INTEGER
FOR i = ML_SINE TO ML_RAMP IF i = ML_RAMP THEN MAL.Waveform( Nisse, i, 1000, 200, -100, 0, 0, i ) ELSE MAL.Waveform( Nisse, i, 100, 100, 0, 0, 0, i ) ENDIF ENDFOR
' Display Results in a Grid and a Graph RUN( cDisplayArray, REF( Nisse ), TRUE ) RUN( cPlotArray, REF( Nisse ), TRUE )
PRINT "[END]"
END
|