Skip to content

Update p5.sound toggle behaviour #3522

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

Open
wants to merge 5 commits into
base: develop
Choose a base branch
from

Conversation

davepagurek
Copy link
Contributor

Fixes #3513

Changes:

  • Changing the p5 version now always does something to p5.sound:
    • If you switched from 1.x to 2.x or vice versa, it turns off p5.sound
    • If you switch minor 1.x versions, it updates p5.sound to use the URL associated with that version
    • No action for minor 2.x version switches, as p5.sound releases are no longer tied to p5 releases
  • Removes the behaviour of trying to remember your last p5.sound version
  • Always shows a link next to the p5.sound toggle with a link to either beta.p5js.org/reference/p5.sound or p5js.org/reference/p5.sound

image

I have verified that this pull request:

  • has no linting errors (npm run lint)
  • has no test errors (npm run test)
  • is from a uniquely-named feature branch and is up to date with the develop branch.
  • is descriptively named and links to an issue number, i.e. Fixes #123

'https://cdnjs.cloudflare.com/ajax/libs/p5.js/$VERSION/addons/p5.sound.min.js';
export const p5SoundURLOld = p5SoundURLOldTemplate.replace(
'$VERSION',
'1.11.3'
Copy link
Member

Choose a reason for hiding this comment

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

@davepagurek Would it be possible to use latest within 1.x? Since we are still bugfixing for a while.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Updated this to use currentP5Version. I also updated the default web editor version to 1.11.8, since it was still 1.11.7 elsewhere. @raclim ideally we use the same string and splice it into createDefaultFiles.js so we have less places to update when there's a new version, as currently the two were out of date. Looks like that file is run on the server? Is there a spot for anything currently that gets imported in both client and server that I could move that constant to?

Copy link
Collaborator

Choose a reason for hiding this comment

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

I...don't believe that it exists yet. I'm sorry I think it might have to be created!

Copy link
Contributor Author

Choose a reason for hiding this comment

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

No problem! I'm happy to create that. Would something like a top-level common folder be ok?

Copy link
Collaborator

Choose a reason for hiding this comment

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

Yes, that sounds good to me! Thank you so much!

Copy link
Contributor Author

Choose a reason for hiding this comment

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

ok I think I've added that! i added a thing to the dockerfile about the common folder, which seems to work running the project via docker, but I'm less confident that that's correct or necessary, so let me know if that seems ok to you!

Copy link
Collaborator

@raclim raclim Jun 16, 2025

Choose a reason for hiding this comment

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

Yes I think its correct, thanks so much for catching that I completely forgot about it! The folder setup/Dockerfile looks good to me! :)

@release-com release-com bot deployed to p5.js-web-editor: rachel-p5-sound-toggle (ted41ea) June 16, 2025 20:14 Active
@raclim
Copy link
Collaborator

raclim commented Jun 16, 2025

This overall looks great to me!!! This is small question—I noticed that if I have a new sketch, switch to 2.x, and then back to 1.x, it seems like p5.sound is still turned off. I was wondering if this is intentional, or something that we might want to address here as well?

@davepagurek
Copy link
Contributor Author

This overall looks great to me!!! This is small question—I noticed that if I have a new sketch, switch to 2.x, and then back to 1.x, it seems like p5.sound is still turned off. I was wondering if this is intentional, or something that we might want to address here as well?

Currently intentional, but we can talk about what we'd need to do if we want that! Our previous "remembering" logic was intended to try to capture the specific p5.sound URL that was being used, but that prevented you from switching to 2.0 and then turning on the 2.0 version of p5.sound. We could possibly do something where we have separate memory for 1.x and 2.x, and only try to restore when you go back and forth between them? That could possibly be a memory of a specific version like before (downside being, it's harder to switch between 1.x versions and update p5.sound accordingly), or just on/off and we pick the corresponding version for you (downside being, it may not correspond to the version you used to be using, especially if you revert to a different 1.x than you started with.)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Old p5.sound + p5 2.0 throws an error, but it's very hard to switch
3 participants