Monday, 2 April 2018

Wothke backend scriptplayer VU meter addon using CODEF

As recently I have been making CODEF versions of the myriad of mod and chiptune players which Juergen Wothke has been creating in Javascript, I decided to make a simple VU meter addon - which would work (in theory) with ANY of them! 
(NOTE: As long as the player uses the scriptprocessor.js and backend_XXX.js files).

Simply add this line into your CODEF HTML code, along with the other scripts being called.

<script src="http://codef.namwollem.co.uk/JS/wothke/wothke_vu.js"></script>

How the script works can be demonstrated in the URLs below.

http://codef.namwollem.co.uk/sc68_vu_TEST.html

http://codef.namwollem.co.uk/sc68_test_vu.html 



It can then be called using the following command:
drawWothkeSpectrum(context,Xpos,Ypos,EQ_WIDTH,EQ_HEIGHT,numBars,BAR_WIDTH,
SPACER_WIDTH,EQcolour,circles);

The variables are pretty self-explanatory, but detailed below for clarity.
context = name of the destination CODEF canvas the VU meter is to be drawn upon.
Xpos / Ypos = the X and Y co-ordinates on the destination CODEF canvas you want the VU meter to be drawn.
EQ_WIDTH = the width in pixels of the VU meter.
EQ_HEIGHT = the height in pixels of the VU meter.
numBars = the number of bars in your VU meter.
BAR_WIDTH = the width in pixels of EACH individual bar.
SPACER_WIDTH = the width of the space between each bar (including the bar itself).
EQcolour = the required colour (in HEX) - i.e. #FF0000 (Red).
circles = if you want the EQ to be in circles or bars (see above) - if you want circles, set to=1, if bars, set to=0

For example:
drawWothkeSpectrum(mycanvas,100,300,520,120,64,6,8,'#FF0000',1);
Hope you like! Feel free to use it in your own screens!

EDIT: The URL link was not working. Now fixed.
EDIT # 2: New feature added!

No comments:

Post a Comment