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

generating unique names for new tracks #7557

Open
wants to merge 8 commits into
base: master
Choose a base branch
from

Conversation

szeli1
Copy link
Contributor

@szeli1 szeli1 commented Oct 22, 2024

This Pull request adds 2 methods that assigns numbers to tracks that would have the same name otherwise.

Tracks with the same name are still possible, but all new tracks and all cloned tracks will have a unique name by default. Instruments of the same kind will also have differentiating numbers added to them.

Tracks loaded from a save should not be effected.

Issues:

  • Tracks that have names consisting only from digits will get the absolute highest number across all tracks. (if 1. track is named "12" and 2. track is named "automation 42", and if the 1. Track is cloned, then the new name will be "43" instead of "13")
  • Change how PatternTrack clones are named #7550 does the same thing, but only in pattern track

@JohannesLorenz JohannesLorenz added needs style review A style review is currently required for this PR needs code review A functional code review is currently required for this PR needs testing This pull request needs more testing labels Nov 20, 2024
@JohannesLorenz
Copy link
Contributor

Does this close an existing issue?

@szeli1
Copy link
Contributor Author

szeli1 commented Nov 21, 2024

Does this close an existing issue?

I believe there is no open issue about this on github.

@tresf
Copy link
Member

tresf commented Jan 28, 2025

Overall, this is a very nice feature. It seems very stable and intuitive. Here's some feedback:

Some testing:

  • 4294967295, cloned becomes 1 (I would expect 4294967295 1 if integer overflow occurs)
  • E7, cloned becomes E 8 (space added -- I would expect E7 1 or possibly E8)
  • a42949672951, cloned becomes a 1.
  • 0.1 cloned becomes 0. 2 (space added)
  • 1,000 cloned becomes 1,1

Other items:

  • Presets do not get renamed when added through the sidebar. (e.g. Hit Enter on AudioFileProcessor -> Bass-Mania.xpf a bunch of times, they all will have the same name. This differs from when cloned)
  • Samples do not get renamed when added through the sidebar. (e.g. Basses -> bass_acid1.ogg)
  • Soundfonts do not get renamed when added through the sidebar

Some notes:

  • For some reason we call the first BBEditor track "Pattern 0", but instruments do not have the zero after them. The project may want to make this more consistent. Edit: This may be saved in the default template. Deleting "Pattern 0" and adding a new pattern, it's called "Pattern" (without the zero).

I compared this to some other software...

  • Gimp adds #1 to identically named layers. Layer 1 will become Layer 1 #1
  • GarageBand starts the vocal track at "Audio 1" so that when more are added, they're called "Audio 2", etc.
    • Garageband is buggy though, for example:
    • If the there's only one track called "Audio 2" and you create a new one, Garage Band calls it "Audio 2" still.
    • GarageBand's counter can break and get stuck. Right now I have 5 tracks called "Audio 2".
    • GarageBand only treats vocal tracks this way, instrument tracks do not get auto numbered for some reason.

@szeli1
Copy link
Contributor Author

szeli1 commented Jan 28, 2025

4294967295, cloned becomes 1 (I would expect 4294967295 1 if integer overflow occurs)

I think this is fine. I can fix it if you think it is important.

E7, cloned becomes E 8 (space added -- I would expect E7 1 or possibly E8)

I think I will fix this so it will be "E8".

a42949672951, cloned becomes a 1.

I may look into this. I believe an ideal solution would be "a42949672951 1".

Presets do not get renamed when added through the sidebar. (e.g. Hit Enter on AudioFileProcessor -> Bass-Mania.xpf a bunch of times, they all will have the same name. This differs from when cloned)
Samples do not get renamed when added through the sidebar. (e.g. Basses -> bass_acid1.ogg)
Soundfonts do not get renamed when added through the sidebar

Thanks for noticing these issues

For some reason we call the first BBEditor track "Pattern 0", but instruments do not have the zero after them. The project may want to make this more consistent. Edit: This may be saved in the default template. Deleting "Pattern 0" and adding a new pattern, it's called "Pattern" (without the zero).

So should I change the default template?

Thanks for the review tresf!

@tresf
Copy link
Member

tresf commented Jan 28, 2025

My instinct is:

  • yes, change the default template to remove the zero for consistency
  • try to not parse the number at the end of a word unless there's a space before it.
    • this has the disadvantage of 3xosc1 becoming 3xosc1 1
  • if you still want to parse the number without spaces, maybe we change it to remember whether or not a space was there.

Not a bug, but a funny use-case I thought of yesterday but omitted from my testing:

  • Call a track name "Roland 808"
  • Clone track
  • New track is called "Roland 809"

:D

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
needs code review A functional code review is currently required for this PR needs style review A style review is currently required for this PR needs testing This pull request needs more testing
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants