Please see this overview page first to understand some basic principles about using scripting functions in SIGVIEW.


All scripts will use several common data types (Julia structs) to represent SIGVIEW windows. 


For example, if you create a Script signal window you will get an array of SigviewSignalWindow or SigviewInstrumentWindow objects as input, one for each of parent (source) windows of the window you are creating. As a result of your script, you will provide one instance of SigviewSignalWindow which will define the content of a new window.


  • SigviewWindow is simply a abstract base struct for both SigviewSignalWindow and SigviewInstrumentWindow;


abstract type SigviewWindow end


  • SigviewSignalWindow is probably the most important struct you will use. It describes one SIGVIEW signal window. Please remember that any sequence of values in SIGVIEW is considered to be a "signal", for example time-domain signal from your sound card, FFT result (spectrum), octave plot,...


Only samples array and samplingRate values are mandatory.


mutable struct SigviewSignalWindow <: SigviewWindow

   #Array with signal values. It will be already filled with values in input structs,

   #must be filled with values in your script for output struct

   samples :: Array{Float32}  

   #Sampling rate of the signal. For signals which are not result 

   #of sampling, simply a 1.0/<distance on x-axis between values>. 

   #Must be filled for output signals.

   samplingRate :: Float64

   #x-axis unit as string, for example "Hz" or "seconds". Default is empty string.

   xAxisUnit :: String

   #x-axis begin. Default is 0.0

   xAxisBegin :: Float64

   #y-axis unit as string, for example "dB". Default is empty string.

   yAxisUnit :: String

   #Optional text which will be displayed in the upper left part 

   #of the window. You can use "\n" characters to get a multiline display.

   textToDisplay :: String

   #defines line color. You can choose between predefined line colors only

   #see LineColorType struct below for possible values. Default is COLOR_INPUT_SIGNAL.

   lineColor :: LineColorType

   #list of markers which will be displayed in the result signal.

   #See Marker struct below for details.

   markers :: Array{Marker}

end


  • SigviewInstrumentWindow represent one instrument window. It is currently used only as input parameter for Script signal windows.


mutable struct SigviewInstrumentWindow <: SigviewWindow

   #current instrument value

   value :: Float64

   #unit of the instrument value as a string, for example "dB"        

   unit :: String

end


  • And here are some helper structs/types used by structs described above:


Marker structure is used to define signal markers which should be displayed in a window which content is generated from your script.


mutable struct Marker

   #Marker position in x-axis units

   x_position :: Float64

   #Optional text to display in the marker

   text :: String

end


And the enumeration for line colors:


@enum LineColorType begin

   #color normally used for input signals (blue)

   COLOR_INPUT_SIGNAL = 1

   #color normally used analysis results (red)

   COLOR_ANALYSIS = 2

   #color normally used displaying for special windows like track or parallel view (black)

   COLOR_TRACK = 3

end