MCPcopy
hub / github.com/processing/p5.js / SoundLoop

Function SoundLoop

lib/addons/p5.sound.js:9725–9839  ·  view source on GitHub ↗
(callback, interval)

Source from the content-addressed store, hash-verified

9723var soundLoop_SoundLoop =
9724function () {
9725 function SoundLoop(callback, interval) {
9726 soundLoop_classCallCheck(this, SoundLoop);
9727
9728 /**
9729 * Getters and Setters, setting any paramter will result in a change in the clock's
9730 * frequency, that will be reflected after the next callback
9731 * beats per minute (defaults to 60)
9732 * @property {Number} bpm
9733 * @for p5.SoundLoop
9734 */
9735 Object.defineProperty(this, 'bpm', {
9736 get: function get() {
9737 return this._bpm;
9738 },
9739 set: function set(bpm) {
9740 if (!this.musicalTimeMode) {
9741 console.warn('Changing the BPM in "seconds" mode has no effect. ' + 'BPM is only relevant in musicalTimeMode ' + 'when the interval is specified as a string ' + '("2n", "4n", "1m"...etc)');
9742 }
9743
9744 this._bpm = bpm;
9745
9746 this._update();
9747 }
9748 });
9749 /**
9750 * number of quarter notes in a measure (defaults to 4)
9751 * @property {Number} timeSignature
9752 * @for p5.SoundLoop
9753 */
9754
9755 Object.defineProperty(this, 'timeSignature', {
9756 get: function get() {
9757 return this._timeSignature;
9758 },
9759 set: function set(timeSig) {
9760 if (!this.musicalTimeMode) {
9761 console.warn('Changing the timeSignature in "seconds" mode has no effect. ' + 'BPM is only relevant in musicalTimeMode ' + 'when the interval is specified as a string ' + '("2n", "4n", "1m"...etc)');
9762 }
9763
9764 this._timeSignature = timeSig;
9765
9766 this._update();
9767 }
9768 });
9769 /**
9770 * length of the loops interval
9771 * @property {Number|String} interval
9772 * @for p5.SoundLoop
9773 */
9774
9775 Object.defineProperty(this, 'interval', {
9776 get: function get() {
9777 return this._interval;
9778 },
9779 set: function set(interval) {
9780 this.musicalTimeMode = typeof interval === 'number' ? false : true;
9781 this._interval = interval;
9782

Callers

nothing calls this directly

Calls 2

soundLoop_classCallCheckFunction · 0.85
_updateMethod · 0.45

Tested by

no test coverage detected