Constructor
new Waveforms(_sketch, _x, _y, _w, _h, _xInSec, _wInSec, _wfHeight, _secPerBox)
Constructor for the Waveforms class
Parameters:
Name | Type | Description |
---|---|---|
_sketch |
Object | the p5.js sketch object |
_x |
number | the x-coordinate of the Waveforms object |
_y |
number | the y-coordinate of the Waveforms object |
_w |
number | the width of the Waveforms object |
_h |
number | the height of the Waveforms object |
_xInSec |
number | the x-coordinate of the Waveforms object, in seconds |
_wInSec |
number | the width of the Waveforms object, in seconds |
_wfHeight |
number | the height of each individual waveform in the set |
_secPerBox |
number | the number of seconds per grid box in the Waveforms object |
Methods
add_waveform(_url, _x, _y)
Adds a waveform to the array of waveforms.
Parameters:
Name | Type | Description |
---|---|---|
_url |
string | URL of the waveform audio file |
_x |
number | x-coordinate of the waveform |
_y |
number | y-coordinate of the waveform |
draw()
Draws the waveforms.
move()
Moves one of the waveforms.
playback()
Starts the playback of the waveforms.
touch_check()
Checks and stores which waveform is being touched.
touch_end()
Calls touch_end()
for an indiviual waveform that was being touched, and
resets the class' movingIdx
property to -1 (indicating that no waveform
is being touched).