Web-Multi-Media / multi-web-audio-sequencer

Web collaborative step sequencer
https://labs.freesound.org/sequencer
GNU General Public License v3.0
10 stars 2 forks source link

Avoid adding track with same name #5

Closed xavierfav closed 6 years ago

xavierfav commented 6 years ago

As explained in #4, when a track is added with the same name as another, the sequencer behaves in a strange way.

Whenever we create a track, we should check that the name is not already used.

valou5940 commented 6 years ago

Should we leave a message to the user warning him that the track should have different name ? Or can this be done in the issue 6 with the UI improvement ?

xavierfav commented 6 years ago

Yes we should do it here

xavierfav commented 6 years ago

The PR #13 prevents adding a track with the same name of another. However, there is no feedback to the user telling him that he should choose another name.

I also think the system should automatically assign a new name, and allow to rename the tracks.

I also think using the name as identifier is not a good practice. We should use an id for selecting and managing them. The sequencer state could maybe store the list of track names, and use indexes to describe them, something like this:

state = 
{
  trackNames: ['kick', 'snare'],
  trackPads: {
    '0': [<list of activated pads>],
    '1': [<list of activated pads>] 
  },
  trackSounds: {
    '0': <soundUrl>,
    '1': <soundUrl>
  },
  trackWaves: {
    '0': [<startTime>, <endTime>],
    '1': [<startTime>, <endTime>]
  }
}
xavierfav commented 6 years ago

Adding tracks with same names is no longer a problem thanks to #23.