HertzDevil / 0CC-FamiTracker

Extension of jsr's FamiTracker
http://0cc-famitracker.tumblr.com/
GNU General Public License v2.0
309 stars 32 forks source link

JSON export doesn't include dpcm mapping #104

Open nstbayless opened 1 year ago

nstbayless commented 1 year ago

Edit: Pull Request

Here's an example from .instruments[0] in a json export from a simple 0cc file containing only a dpcm channel.

You'll notice that there's no way to tell what dpcm samples are mapped to what notes. In this 0cc file, C#3 is keyed to a dpcm sample, but there's no way to tell this looking at the JSON.

{
  "chip": "2A03",
  "dpcm_map": [
    {
      "delta": -1,
      "dpcm_index": 0,
      "loop": false,
      "pitch": 13
    },
    {
      "delta": -1,
      "dpcm_index": 0,
      "loop": true,
      "pitch": 15
    },
    {
      "delta": -1,
      "dpcm_index": 0,
      "loop": true,
      "pitch": 12
    },
    {
      "delta": -1,
      "dpcm_index": 0,
      "loop": true,
      "pitch": 12
    }
  ],
  "index": 0,
  "name": "New instrument",
  "sequence_flags": []
}

I've verified that this information isn't encoded anywhere else in the json output by editing the key mapping in two different ways and diffing the resulting files (identical).

To resolve this, either a new field must be added to the entries in .instruments[].dpcm_map[], or else .instruments[].dpcm_map must be changed from a list to an object keyed by note.