hydrogen-music / hydrogen

The advanced drum machine for Linux, macOS, and Windows
http://www.hydrogen-music.org
GNU General Public License v2.0
1.03k stars 172 forks source link

Proper notion of 'current drumkit' #1849

Closed theGreatWhiteShark closed 8 months ago

theGreatWhiteShark commented 11 months ago

Right now, a .h2song file and the corresponding Song class contains instrument list, components, and some selected meta data of the last loaded drumkit. After loading the user can add/remove instruments and components. All of these constitute what we call "current drumkit" right now (which can be altered via the main menu). It is about 95% what makes out the drumkit. But the remaining 5% cause trouble and inconsistencies.

Two things are bothersome in particular:

  1. Editing properties of the current drumkit will save it to disk and thus override the original. E.g. load kit A, add several instruments, alter the license, and kit A will be overridden and will contain additional instruments. This is counter intuitive since the properties of kit A can be edited without side effects via right clicking the kit in the Sound Library
  2. Loading a drumkit into a song will discard the instrument IDs of the kit. E.g. 1. load "GMRockKit" into a song, 2. load "Audiophob", 3. Save the drumkit. The original "Audiophob" kit used instrument IDs 0, 21, 19, 16, ... and was overridden with 0, 1, 2, 3, ...

Especially 2. is a nuisance in implementing #1691.

I would fix this by putting an actual Drumkit into the Song class. It's a massive refactoring :grimacing: . But it would significantly clean up the Song class.

On the downside the resulting .h2song will not be forward-compatible. This means, .h2song created with <=1.2.2 can be loaded in >=1.3 but not the other way around. That's quite unfortunate but will, at least in my point of view, pay off in the long run. To ease the pain, there will be the option of saving a song in "legacy" mode compatible with <=1.2.2.

theGreatWhiteShark commented 11 months ago

In addition, all the stuff specified in the SampleEditor is only stored to the .h2song right now. When adjusting settings there, saving the resulting drumkit, and loading them again the adjustments are lost.

That can't be right.