Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Updated the soundLoop.interval #458

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions src/soundLoop.js
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,12 @@ define(function (require) {

this._interval = interval || 1;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

can we do the check on this line? this._interval = Math.max(interval, 0.01) ? And then, the question is how can we set the default? We could set the default in the constructor function on line 57, by saying interval = 1 https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Functions/Default_parameters


// Set the limit of the desiredInterval to zero.

let desiredInterval = 0;

SoundLoop._interval = max(desiredInterval, 0.01);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

hrm, SoundLoop doesn't exist, instead we have a function called p5.SoundLoop that exists on the p5 object.

We don't want to set _interval on the class, but not on the instance (which is represented by this).

That is happening on line 66. So we should do this check on that line.


/**
* musicalTimeMode variables
* modify these only when the interval is specified in musicalTime format as a string
Expand Down