Home

pwline.plug

  

Piecewise line drawing for the Wavesurfer

 

 

 

 

Draft API

Provided the pwline.plug has been loaded in WaveSurfer, the following procedures are available :

w and pane stand for widget and pane respectively

pwline::init w pane args
Initializes pwline with default values. args may be any or none of the following option pairs, shown with their default values:

-nodeFill "#c0c0c0"
-nodeOutline "blue"
-selectedNodeFill "red"
-selectedNodeOutline "red"
-activeNodeFill "blue"
-activeNodeOutline "blue"
-lineColor "#0080ff"
-unit "Hz"
-sz 3
-lineWidth 1
-minValue "60"
-maxValue "250"
-yState "normal"
-unitState "normal"
-showscale "0"
-scalebase "65.4064"
-scalecolor "#b5b5b5"
-pitchline 0
-pitchlinecolor "black"
-pitchdots 0
-pitchdotcolor "red"

pwline::events w pane flag (flag is not yet functional)
Activate/deactivate pwline mouse events on pane, depending on flag. flag is boolean

pwline::drawPitch w pane spec
Draws the pwline pitch line made from the loaded sound. spec is a list of four options: pd pdc pl plc
pd - Boolean. If set, draws pitch line dots
pdc - dot color
pl - Boolean. If set, draws the pitch line
plc - The pitch line color

pwline::drawNoteScale w pane
Draws the musical note scale.

pwline::insertNode w pane x y
Inserts node at canvas coordinates x y, in canvas units.

pwline::selectNode w pane nIdx
Selects node with index nIdx. Node indices are integers in time sequence, starting from 0.

pwline::selectNodeRange w pane range
Selects nodes in range range. Range is a pair of node indices, start to end.

pwline::deselectNodes w pane
Deselects all nodes

pwline::delNode w pane nIdx
Deletes the node indicated by node index nIdx.

pwline::delSelNodes w pane
Deletes all selected nodes

pwline::delAllNodes w pane
Deletes all nodes (and the pwline)

pwline::drawPwline w pane
Draws the pwline and nodes

pwline::moveNodes w pane nIdxList dx dy
Move nodes in the nIdxList list by dx and dy canvas units. The nIdxList is a list of node indices, in time sequence, starting with nIdx 0.

Usage:
From the WaveSurfer console, type:

set w [wsurf::GetCurrent]

#assuming .x.s1.workspace.pane_1 is an existing pane,
#that can show our nodes,
#like a waveform, spectrum or pwline pane

set pane .x.s1.workspace.pane_1
::wsurf::pwline::init $w $pane
::wsurf::pwline::events $w $pane 1
::wsurf::pwline::insertNode $w $pane 50 15
::wsurf::pwline::insertNode $w $pane 80 26
 

 

 

 

Installation and use

pwline.plug download

Contact: dzach_at_hol.gr subject=pwline.plug

 

 

 

 

 

 

 

Last modified on: 7. Oct. 2004 (c) 2004 D.Zachariadis