moduscreate / ATMlib2

Arduboy Tracker Music Library
http://www.team-arg.org/ATMlib-manual.html
BSD 3-Clause "New" or "Revised" License
3 stars 0 forks source link

Complex song to try #12

Closed jaygarcia closed 7 years ago

jaygarcia commented 7 years ago

I Manually converted EVADE Song 1 to the new format and it doesn't play. In fact, it crashes. I may have missed something in the conversion.

Original song

#ifndef SONG_H
#define SONG_H

#define Song const uint8_t PROGMEM

Song music[] = {
0x14,           // Number of tracks
0x00, 0x00,     // Address of track 0
0x27, 0x00,     // Address of track 1
0x42, 0x00,     // Address of track 2
0x43, 0x00,     // Address of track 3
0x50, 0x00,     // Address of track 4
0x56, 0x00,     // Address of track 5
0x5d, 0x00,     // Address of track 6
0x6e, 0x00,     // Address of track 7
0x77, 0x00,     // Address of track 8
0x80, 0x00,     // Address of track 9
0x93, 0x00,     // Address of track 10
0x9c, 0x00,     // Address of track 11
0xa5, 0x00,     // Address of track 12
0xb2, 0x00,     // Address of track 13
0xbf, 0x00,     // Address of track 14
0xd0, 0x00,     // Address of track 15
0xe1, 0x00,     // Address of track 16
0xf0, 0x00,     // Address of track 17
0x12, 0x01,     // Address of track 18
0x1f, 0x01,     // Address of track 19
0x00,           // Channel 0 entry track
0x01,           // Channel 1 entry track
0x02,           // Channel 2 entry track
0x03,           // Channel 3 entry track
//"Track channel 0"
0x40, 64,       // FX: SET VOLUME: volume = 64
0x9D, 22,       // FX: SET TEMPO: tempo = 22
0xFD, 2, 6,     // REPEAT: count = 2 + 1 / track = 6
0xFC, 7,        // GOTO track 7
0xFD, 2, 6,     // REPEAT: count = 2 + 1 / track = 6
0xFC, 8,        // GOTO track 8
0xFC, 10,       // GOTO track 10
0xFC, 11,       // GOTO track 11
0xFC, 10,       // GOTO track 10
0xFC, 11,       // GOTO track 11
0xFC, 10,       // GOTO track 10
0xFC, 12,       // GOTO track 12
0xFC, 10,       // GOTO track 10
0xFC, 11,       // GOTO track 11
0xFC, 10,       // GOTO track 10
0xFC, 11,       // GOTO track 11
0xFC, 10,       // GOTO track 10
0xFC, 13,       // GOTO track 13
0x9F,           // FX: STOP CURRENT CHANNEL
//"Track channel 1"
0x40, 50,       // FX: SET VOLUME: volume = 50
0xFD, 11, 14,       // REPEAT: count = 11 + 1 / track = 14
0xFD, 3, 15,        // REPEAT: count = 3 + 1 / track = 15
0xFD, 11, 14,       // REPEAT: count = 11 + 1 / track = 14
0xFD, 3, 16,        // REPEAT: count = 3 + 1 / track = 16
0xFD, 9, 14,        // REPEAT: count = 9 + 1 / track = 14
0xFD, 1, 15,        // REPEAT: count = 1 + 1 / track = 15
0xFD, 9, 14,        // REPEAT: count = 9 + 1 / track = 14
0xFD, 1, 16,        // REPEAT: count = 1 + 1 / track = 16
0x9F,           // FX: STOP CURRENT CHANNEL
//"Track channel 2"
0x9F,           // FX: STOP CURRENT CHANNEL
//"Track channel 3"
0x40, 64,       // FX: SET VOLUME: volume = 64
0xFD, 6, 9,     // REPEAT: count = 6 + 1 / track = 9
0xFC, 17,       // GOTO track 17
0xFD, 10, 18,       // REPEAT: count = 10 + 1 / track = 18
0xFC, 19,       // GOTO track 19
0x9F,           // FX: STOP CURRENT CHANNEL
//"Track tick"
0x40, 32,       // FX: SET VOLUME: volume = 32
0x9F + 1,       // DELAY: ticks = 1
0x40, 0,        // FX: SET VOLUME: volume = 0
0xFE,           // RETURN
//"Track snare"
0x40, 32,       // FX: SET VOLUME: volume = 32
0x41, -16,      // FX: VOLUME SLIDE ON: steps = -16
0x9F + 2,       // DELAY: ticks = 2
0x43,           // FX: VOLUME SLIDE OFF
0xFE,           // RETURN
//"Track ld 1"
0x00 + 25,      // NOTE ON: note = 25
0x9F + 5,       // DELAY: ticks = 5
0x00 + 0,       // NOTE ON: note = 0
0x9F + 4,       // DELAY: ticks = 4
0x00 + 25,      // NOTE ON: note = 25
0x9F + 3,       // DELAY: ticks = 3
0x00 + 0,       // NOTE ON: note = 0
0x9F + 1,       // DELAY: ticks = 1
0x00 + 27,      // NOTE ON: note = 27
0x9F + 4,       // DELAY: ticks = 4
0x00 + 0,       // NOTE ON: note = 0
0x9F + 4,       // DELAY: ticks = 4
0x00 + 28,      // NOTE ON: note = 28
0x9F + 7,       // DELAY: ticks = 7
0x00 + 0,       // NOTE ON: note = 0
0x9F + 4,       // DELAY: ticks = 4
0xFE,           // RETURN
//"Track ld 2"
0x00 + 30,      // NOTE ON: note = 30
0x9F + 8,       // DELAY: ticks = 8
0x00 + 0,       // NOTE ON: note = 0
0x9F + 4,       // DELAY: ticks = 4
0x00 + 32,      // NOTE ON: note = 32
0x9F + 8,       // DELAY: ticks = 8
0x00 + 0,       // NOTE ON: note = 0
0x9F + 12,      // DELAY: ticks = 12
0xFE,           // RETURN
//"Track ld 3"
0x00 + 35,      // NOTE ON: note = 35
0x9F + 8,       // DELAY: ticks = 8
0x00 + 0,       // NOTE ON: note = 0
0x9F + 5,       // DELAY: ticks = 5
0x00 + 32,      // NOTE ON: note = 32
0x9F + 11,      // DELAY: ticks = 11
0x00 + 0,       // NOTE ON: note = 0
0x9F + 8,       // DELAY: ticks = 8
0xFE,           // RETURN
//"Track perc"
0xFC, 4,        // GOTO track 4
0x9F + 7,       // DELAY: ticks = 7
0xFC, 4,        // GOTO track 4
0x9F + 7,       // DELAY: ticks = 7
0xFC, 4,        // GOTO track 4
0x9F + 7,       // DELAY: ticks = 7
0xFC, 4,        // GOTO track 4
0x9F + 3,       // DELAY: ticks = 3
0xFC, 4,        // GOTO track 4
0x9F + 1,       // DELAY: ticks = 1
0xFC, 4,        // GOTO track 4
0x9F + 1,       // DELAY: ticks = 1
0xFE,           // RETURN
//"Track ld 4"
0x00 + 25,      // NOTE ON: note = 25
0x9F + 6,       // DELAY: ticks = 6
0x00 + 0,       // NOTE ON: note = 0
0x9F + 2,       // DELAY: ticks = 2
0x00 + 35,      // NOTE ON: note = 35
0x9F + 7,       // DELAY: ticks = 7
0x00 + 0,       // NOTE ON: note = 0
0x9F + 1,       // DELAY: ticks = 1
0xFE,           // RETURN
//"Track LD 5"
0x00 + 25,      // NOTE ON: note = 25
0x9F + 7,       // DELAY: ticks = 7
0x00 + 0,       // NOTE ON: note = 0
0x9F + 1,       // DELAY: ticks = 1
0x00 + 37,      // NOTE ON: note = 37
0x9F + 7,       // DELAY: ticks = 7
0x00 + 0,       // NOTE ON: note = 0
0x9F + 1,       // DELAY: ticks = 1
0xFE,           // RETURN
//"Track ld 6"
0x00 + 23,      // NOTE ON: note = 23
0x9F + 3,       // DELAY: ticks = 3
0x00 + 0,       // NOTE ON: note = 0
0x9F + 2,       // DELAY: ticks = 2
0x00 + 28,      // NOTE ON: note = 28
0x9F + 6,       // DELAY: ticks = 6
0x00 + 0,       // NOTE ON: note = 0
0x9F + 2,       // DELAY: ticks = 2
0x00 + 27,      // NOTE ON: note = 27
0x9F + 2,       // DELAY: ticks = 2
0x00 + 0,       // NOTE ON: note = 0
0x9F + 1,       // DELAY: ticks = 1
0xFE,           // RETURN
//"Track LD 8"
0x00 + 23,      // NOTE ON: note = 23
0x9F + 3,       // DELAY: ticks = 3
0x00 + 0,       // NOTE ON: note = 0
0x9F + 2,       // DELAY: ticks = 2
0x00 + 40,      // NOTE ON: note = 40
0x9F + 5,       // DELAY: ticks = 5
0x00 + 0,       // NOTE ON: note = 0
0x9F + 2,       // DELAY: ticks = 2
0x00 + 39,      // NOTE ON: note = 39
0x9F + 2,       // DELAY: ticks = 2
0x00 + 0,       // NOTE ON: note = 0
0x9F + 2,       // DELAY: ticks = 2
0xFE,           // RETURN
//"Track Bass C"
0x00 + 13,      // NOTE ON: note = 13
0x9F + 1,       // DELAY: ticks = 1
0x00 + 0,       // NOTE ON: note = 0
0x9F + 1,       // DELAY: ticks = 1
0x00 + 25,      // NOTE ON: note = 25
0x9F + 1,       // DELAY: ticks = 1
0x00 + 0,       // NOTE ON: note = 0
0x9F + 1,       // DELAY: ticks = 1
0x00 + 13,      // NOTE ON: note = 13
0x9F + 1,       // DELAY: ticks = 1
0x00 + 0,       // NOTE ON: note = 0
0x9F + 1,       // DELAY: ticks = 1
0x00 + 25,      // NOTE ON: note = 25
0x9F + 1,       // DELAY: ticks = 1
0x00 + 0,       // NOTE ON: note = 0
0x9F + 1,       // DELAY: ticks = 1
0xFE,           // RETURN
//"Track BASS A#"
0x00 + 11,      // NOTE ON: note = 11
0x9F + 1,       // DELAY: ticks = 1
0x00 + 0,       // NOTE ON: note = 0
0x9F + 1,       // DELAY: ticks = 1
0x00 + 23,      // NOTE ON: note = 23
0x9F + 1,       // DELAY: ticks = 1
0x00 + 0,       // NOTE ON: note = 0
0x9F + 1,       // DELAY: ticks = 1
0x00 + 11,      // NOTE ON: note = 11
0x9F + 1,       // DELAY: ticks = 1
0x00 + 0,       // NOTE ON: note = 0
0x9F + 1,       // DELAY: ticks = 1
0x00 + 23,      // NOTE ON: note = 23
0x9F + 1,       // DELAY: ticks = 1
0x00 + 0,       // NOTE ON: note = 0
0x9F + 1,       // DELAY: ticks = 1
0xFE,           // RETURN
//"Track BASS D"
0x00 + 15,      // NOTE ON: note = 15
0x9F + 1,       // DELAY: ticks = 1
0x00 + 27,      // NOTE ON: note = 27
0x9F + 1,       // DELAY: ticks = 1
0x00 + 0,       // NOTE ON: note = 0
0x9F + 2,       // DELAY: ticks = 2
0x00 + 15,      // NOTE ON: note = 15
0x9F + 1,       // DELAY: ticks = 1
0x00 + 0,       // NOTE ON: note = 0
0x9F + 1,       // DELAY: ticks = 1
0x00 + 27,      // NOTE ON: note = 27
0x9F + 1,       // DELAY: ticks = 1
0x00 + 0,       // NOTE ON: note = 0
0x9F + 1,       // DELAY: ticks = 1
0xFE,           // RETURN
//"Track PERC2"
0xFC, 4,        // GOTO track 4
0x9F + 3,       // DELAY: ticks = 3
0xFC, 4,        // GOTO track 4
0x9F + 1,       // DELAY: ticks = 1
0xFC, 4,        // GOTO track 4
0x9F + 1,       // DELAY: ticks = 1
0xFC, 4,        // GOTO track 4
0x9F + 3,       // DELAY: ticks = 3
0xFC, 4,        // GOTO track 4
0x9F + 3,       // DELAY: ticks = 3
0xFC, 4,        // GOTO track 4
0x9F + 3,       // DELAY: ticks = 3
0xFC, 4,        // GOTO track 4
0x9F + 3,       // DELAY: ticks = 3
0xFC, 4,        // GOTO track 4
0x9F + 1,       // DELAY: ticks = 1
0xFC, 4,        // GOTO track 4
0x9F + 1,       // DELAY: ticks = 1
0xFC, 4,        // GOTO track 4
0x9F + 1,       // DELAY: ticks = 1
0xFC, 4,        // GOTO track 4
0x9F + 1,       // DELAY: ticks = 1
0xFE,           // RETURN
//"Track PERC3"
0xFC, 5,        // GOTO track 5
0x9F + 2,       // DELAY: ticks = 2
0xFC, 4,        // GOTO track 4
0x9F + 3,       // DELAY: ticks = 3
0xFC, 5,        // GOTO track 5
0x9F + 2,       // DELAY: ticks = 2
0xFC, 4,        // GOTO track 4
0x9F + 3,       // DELAY: ticks = 3
0xFE,           // RETURN
//"Track PERC 4"
0xFC, 5,        // GOTO track 5
0x9F + 2,       // DELAY: ticks = 2
0xFC, 5,        // GOTO track 5
0xFC, 4,        // GOTO track 4
0x9F + 1,       // DELAY: ticks = 1
0xFC, 5,        // GOTO track 5
0xFC, 4,        // GOTO track 4
0x9F + 1,       // DELAY: ticks = 1
0xFC, 5,        // GOTO track 5
0xFC, 4,        // GOTO track 4
0xFC, 4,        // GOTO track 4
0xFE,           // RETURN
};
#endif
jaygarcia commented 7 years ago

New format:

#ifndef EVADE_SONG_H
#define EVADE_SONG_H

const PROGMEM struct evade_score_struct {
  uint8_t num_tracks;
  uint16_t tracks_offset[20];
  uint8_t start_patterns[4];
  uint8_t pattern0[39];
  uint8_t pattern1[27];
  uint8_t pattern2[1];
  uint8_t pattern3[13];
  uint8_t pattern4[6];
  uint8_t pattern5[7];
  uint8_t pattern6[17];
  uint8_t pattern7[9];
  uint8_t pattern8[9];
  uint8_t pattern9[19];
  uint8_t pattern10[9];
  uint8_t pattern11[9];
  uint8_t pattern12[13];
  uint8_t pattern13[13];
  uint8_t pattern14[17];
  uint8_t pattern15[17];
  uint8_t pattern16[15];
  uint8_t pattern17[34];
  uint8_t pattern18[13];
  uint8_t pattern19[20];
} evade_score = {
  .num_tracks = 0x13,  // 19
  .tracks_offset = {
    offsetof(struct evade_score_struct, pattern0),
    offsetof(struct evade_score_struct, pattern1),
    offsetof(struct evade_score_struct, pattern2),
    offsetof(struct evade_score_struct, pattern3),
    offsetof(struct evade_score_struct, pattern4),
    offsetof(struct evade_score_struct, pattern5),
    offsetof(struct evade_score_struct, pattern6),
    offsetof(struct evade_score_struct, pattern7),
    offsetof(struct evade_score_struct, pattern8),
    offsetof(struct evade_score_struct, pattern9),
    offsetof(struct evade_score_struct, pattern10),
    offsetof(struct evade_score_struct, pattern11),
    offsetof(struct evade_score_struct, pattern12),
    offsetof(struct evade_score_struct, pattern13),
    offsetof(struct evade_score_struct, pattern14),
    offsetof(struct evade_score_struct, pattern15),
    offsetof(struct evade_score_struct, pattern16),
    offsetof(struct evade_score_struct, pattern17),
    offsetof(struct evade_score_struct, pattern18),
    offsetof(struct evade_score_struct, pattern19),
  },
  .start_patterns = {
    0x00,                         // Channel 0 entry track (PULSE)
    0x01,                         // Channel 1 entry track (SQUARE)
    0x02,                         // Channel 2 entry track (TRIANGLE)
    0x03,                         // Channel 3 entry track (NOISE)
  },
  .pattern0 = {
    //"Track channel 0"
    0x40, 64,   // FX: SET VOLUME: volume = 64
    0x9D, 22,   // FX: SET TEMPO: tempo = 22
    0xFD, 2, 6,   // REPEAT: count = 2 + 1 / track = 6
    0xFC, 7,    // GOTO track 7
    0xFD, 2, 6,   // REPEAT: count = 2 + 1 / track = 6
    0xFC, 8,    // GOTO track 8
    0xFC, 10,   // GOTO track 10
    0xFC, 11,   // GOTO track 11
    0xFC, 10,   // GOTO track 10
    0xFC, 11,   // GOTO track 11
    0xFC, 10,   // GOTO track 10
    0xFC, 12,   // GOTO track 12
    0xFC, 10,   // GOTO track 10
    0xFC, 11,   // GOTO track 11
    0xFC, 10,   // GOTO track 10
    0xFC, 11,   // GOTO track 11
    0xFC, 10,   // GOTO track 10
    0xFC, 13,   // GOTO track 13
    0x9F,     // FX: STOP CURRENT CHANNEL
  },
  .pattern1 = {
    //"Track channel 1"
    0x40, 50,   // FX: SET VOLUME: volume = 50
    0xFD, 11, 14,   // REPEAT: count = 11 + 1 / track = 14
    0xFD, 3, 15,    // REPEAT: count = 3 + 1 / track = 15
    0xFD, 11, 14,   // REPEAT: count = 11 + 1 / track = 14
    0xFD, 3, 16,    // REPEAT: count = 3 + 1 / track = 16
    0xFD, 9, 14,    // REPEAT: count = 9 + 1 / track = 14
    0xFD, 1, 15,    // REPEAT: count = 1 + 1 / track = 15
    0xFD, 9, 14,    // REPEAT: count = 9 + 1 / track = 14
    0xFD, 1, 16,    // REPEAT: count = 1 + 1 / track = 16
    0x9F,     // FX: STOP CURRENT CHANNEL
  },
  .pattern2 = {
    //"Track channel 2"
    0x9F,     // FX: STOP CURRENT CHANNEL
  },
  .pattern3 = {
    //"Track channel 3"
    0x40, 64,   // FX: SET VOLUME: volume = 64
    0xFD, 6, 9,   // REPEAT: count = 6 + 1 / track = 9
    0xFC, 17,   // GOTO track 17
    0xFD, 10, 18,   // REPEAT: count = 10 + 1 / track = 18
    0xFC, 19,   // GOTO track 19
    0x9F,     // FX: STOP CURRENT CHANNEL
  },
  .pattern4 = {
    //"Track tick"
    0x40, 32,   // FX: SET VOLUME: volume = 32
    0x9F + 1,   // DELAY: ticks = 1
    0x40, 0,    // FX: SET VOLUME: volume = 0
    0xFE,     // RETURN
  },
  .pattern5 = {
    //"Track snare"
    0x40, 32,   // FX: SET VOLUME: volume = 32
    0x41, -16,    // FX: VOLUME SLIDE ON: steps = -16
    0x9F + 2,   // DELAY: ticks = 2
    0x43,     // FX: VOLUME SLIDE OFF
    0xFE,     // RETURN
  },
  .pattern6 = {
    //"Track ld 1"
    0x00 + 25,    // NOTE ON: note = 25
    0x9F + 5,   // DELAY: ticks = 5
    0x00 + 0,   // NOTE ON: note = 0
    0x9F + 4,   // DELAY: ticks = 4
    0x00 + 25,    // NOTE ON: note = 25
    0x9F + 3,   // DELAY: ticks = 3
    0x00 + 0,   // NOTE ON: note = 0
    0x9F + 1,   // DELAY: ticks = 1
    0x00 + 27,    // NOTE ON: note = 27
    0x9F + 4,   // DELAY: ticks = 4
    0x00 + 0,   // NOTE ON: note = 0
    0x9F + 4,   // DELAY: ticks = 4
    0x00 + 28,    // NOTE ON: note = 28
    0x9F + 7,   // DELAY: ticks = 7
    0x00 + 0,   // NOTE ON: note = 0
    0x9F + 4,   // DELAY: ticks = 4
    0xFE,     // RETURN
  },
  .pattern7 = {
    //"Track ld 2"
    0x00 + 30,    // NOTE ON: note = 30
    0x9F + 8,   // DELAY: ticks = 8
    0x00 + 0,   // NOTE ON: note = 0
    0x9F + 4,   // DELAY: ticks = 4
    0x00 + 32,    // NOTE ON: note = 32
    0x9F + 8,   // DELAY: ticks = 8
    0x00 + 0,   // NOTE ON: note = 0
    0x9F + 12,    // DELAY: ticks = 12
    0xFE,     // RETURN
  },
  .pattern8 = {
    //"Track ld 3"
    0x00 + 35,    // NOTE ON: note = 35
    0x9F + 8,   // DELAY: ticks = 8
    0x00 + 0,   // NOTE ON: note = 0
    0x9F + 5,   // DELAY: ticks = 5
    0x00 + 32,    // NOTE ON: note = 32
    0x9F + 11,    // DELAY: ticks = 11
    0x00 + 0,   // NOTE ON: note = 0
    0x9F + 8,   // DELAY: ticks = 8
    0xFE,     // RETURN
  },
  .pattern9 = {
    //"Track perc"
    0xFC, 4,    // GOTO track 4
    0x9F + 7,   // DELAY: ticks = 7
    0xFC, 4,    // GOTO track 4
    0x9F + 7,   // DELAY: ticks = 7
    0xFC, 4,    // GOTO track 4
    0x9F + 7,   // DELAY: ticks = 7
    0xFC, 4,    // GOTO track 4
    0x9F + 3,   // DELAY: ticks = 3
    0xFC, 4,    // GOTO track 4
    0x9F + 1,   // DELAY: ticks = 1
    0xFC, 4,    // GOTO track 4
    0x9F + 1,   // DELAY: ticks = 1
    0xFE,     // RETURN
  },
  .pattern10 = {
    //"Track ld 4"
    0x00 + 25,    // NOTE ON: note = 25
    0x9F + 6,   // DELAY: ticks = 6
    0x00 + 0,   // NOTE ON: note = 0
    0x9F + 2,   // DELAY: ticks = 2
    0x00 + 35,    // NOTE ON: note = 35
    0x9F + 7,   // DELAY: ticks = 7
    0x00 + 0,   // NOTE ON: note = 0
    0x9F + 1,   // DELAY: ticks = 1
    0xFE,     // RETURN
  },
  .pattern11 = {
    //"Track LD 5"
    0x00 + 25,    // NOTE ON: note = 25
    0x9F + 7,   // DELAY: ticks = 7
    0x00 + 0,   // NOTE ON: note = 0
    0x9F + 1,   // DELAY: ticks = 1
    0x00 + 37,    // NOTE ON: note = 37
    0x9F + 7,   // DELAY: ticks = 7
    0x00 + 0,   // NOTE ON: note = 0
    0x9F + 1,   // DELAY: ticks = 1
    0xFE,     // RETURN
  },
  .pattern12 = {
    //"Track ld 6"
    0x00 + 23,    // NOTE ON: note = 23
    0x9F + 3,   // DELAY: ticks = 3
    0x00 + 0,   // NOTE ON: note = 0
    0x9F + 2,   // DELAY: ticks = 2
    0x00 + 28,    // NOTE ON: note = 28
    0x9F + 6,   // DELAY: ticks = 6
    0x00 + 0,   // NOTE ON: note = 0
    0x9F + 2,   // DELAY: ticks = 2
    0x00 + 27,    // NOTE ON: note = 27
    0x9F + 2,   // DELAY: ticks = 2
    0x00 + 0,   // NOTE ON: note = 0
    0x9F + 1,   // DELAY: ticks = 1
    0xFE,     // RETURN
  },
  .pattern13 = {
    //"Track LD 8"
    0x00 + 23,    // NOTE ON: note = 23
    0x9F + 3,   // DELAY: ticks = 3
    0x00 + 0,   // NOTE ON: note = 0
    0x9F + 2,   // DELAY: ticks = 2
    0x00 + 40,    // NOTE ON: note = 40
    0x9F + 5,   // DELAY: ticks = 5
    0x00 + 0,   // NOTE ON: note = 0
    0x9F + 2,   // DELAY: ticks = 2
    0x00 + 39,    // NOTE ON: note = 39
    0x9F + 2,   // DELAY: ticks = 2
    0x00 + 0,   // NOTE ON: note = 0
    0x9F + 2,   // DELAY: ticks = 2
    0xFE,     // RETURN
  },
  .pattern14 = {
    //"Track Bass C"
    0x00 + 13,    // NOTE ON: note = 13
    0x9F + 1,   // DELAY: ticks = 1
    0x00 + 0,   // NOTE ON: note = 0
    0x9F + 1,   // DELAY: ticks = 1
    0x00 + 25,    // NOTE ON: note = 25
    0x9F + 1,   // DELAY: ticks = 1
    0x00 + 0,   // NOTE ON: note = 0
    0x9F + 1,   // DELAY: ticks = 1
    0x00 + 13,    // NOTE ON: note = 13
    0x9F + 1,   // DELAY: ticks = 1
    0x00 + 0,   // NOTE ON: note = 0
    0x9F + 1,   // DELAY: ticks = 1
    0x00 + 25,    // NOTE ON: note = 25
    0x9F + 1,   // DELAY: ticks = 1
    0x00 + 0,   // NOTE ON: note = 0
    0x9F + 1,   // DELAY: ticks = 1
    0xFE,     // RETURN
  },
  .pattern15 = {
    //"Track BASS A#"
    0x00 + 11,    // NOTE ON: note = 11
    0x9F + 1,   // DELAY: ticks = 1
    0x00 + 0,   // NOTE ON: note = 0
    0x9F + 1,   // DELAY: ticks = 1
    0x00 + 23,    // NOTE ON: note = 23
    0x9F + 1,   // DELAY: ticks = 1
    0x00 + 0,   // NOTE ON: note = 0
    0x9F + 1,   // DELAY: ticks = 1
    0x00 + 11,    // NOTE ON: note = 11
    0x9F + 1,   // DELAY: ticks = 1
    0x00 + 0,   // NOTE ON: note = 0
    0x9F + 1,   // DELAY: ticks = 1
    0x00 + 23,    // NOTE ON: note = 23
    0x9F + 1,   // DELAY: ticks = 1
    0x00 + 0,   // NOTE ON: note = 0
    0x9F + 1,   // DELAY: ticks = 1
    0xFE,     // RETURN
  },
  .pattern16 = {
    //"Track BASS D"
    0x00 + 15,    // NOTE ON: note = 15
    0x9F + 1,   // DELAY: ticks = 1
    0x00 + 27,    // NOTE ON: note = 27
    0x9F + 1,   // DELAY: ticks = 1
    0x00 + 0,   // NOTE ON: note = 0
    0x9F + 2,   // DELAY: ticks = 2
    0x00 + 15,    // NOTE ON: note = 15
    0x9F + 1,   // DELAY: ticks = 1
    0x00 + 0,   // NOTE ON: note = 0
    0x9F + 1,   // DELAY: ticks = 1
    0x00 + 27,    // NOTE ON: note = 27
    0x9F + 1,   // DELAY: ticks = 1
    0x00 + 0,   // NOTE ON: note = 0
    0x9F + 1,   // DELAY: ticks = 1
    0xFE,     // RETURN
  },
  .pattern17 = {
    //"Track PERC2"
    0xFC, 4,    // GOTO track 4
    0x9F + 3,   // DELAY: ticks = 3
    0xFC, 4,    // GOTO track 4
    0x9F + 1,   // DELAY: ticks = 1
    0xFC, 4,    // GOTO track 4
    0x9F + 1,   // DELAY: ticks = 1
    0xFC, 4,    // GOTO track 4
    0x9F + 3,   // DELAY: ticks = 3
    0xFC, 4,    // GOTO track 4
    0x9F + 3,   // DELAY: ticks = 3
    0xFC, 4,    // GOTO track 4
    0x9F + 3,   // DELAY: ticks = 3
    0xFC, 4,    // GOTO track 4
    0x9F + 3,   // DELAY: ticks = 3
    0xFC, 4,    // GOTO track 4
    0x9F + 1,   // DELAY: ticks = 1
    0xFC, 4,    // GOTO track 4
    0x9F + 1,   // DELAY: ticks = 1
    0xFC, 4,    // GOTO track 4
    0x9F + 1,   // DELAY: ticks = 1
    0xFC, 4,    // GOTO track 4
    0x9F + 1,   // DELAY: ticks = 1
    0xFE,     // RETURN
  },
  .pattern18 = {
    //"Track PERC3"
    0xFC, 5,    // GOTO track 5
    0x9F + 2,   // DELAY: ticks = 2
    0xFC, 4,    // GOTO track 4
    0x9F + 3,   // DELAY: ticks = 3
    0xFC, 5,    // GOTO track 5
    0x9F + 2,   // DELAY: ticks = 2
    0xFC, 4,    // GOTO track 4
    0x9F + 3,   // DELAY: ticks = 3
    0xFE,     // RETURN
  },
  .pattern19 = {
    //"Track PERC 4"
    0xFC, 5,    // GOTO track 5
    0x9F + 2,   // DELAY: ticks = 2
    0xFC, 5,    // GOTO track 5
    0xFC, 4,    // GOTO track 4
    0x9F + 1,   // DELAY: ticks = 1
    0xFC, 5,    // GOTO track 5
    0xFC, 4,    // GOTO track 4
    0x9F + 1,   // DELAY: ticks = 1
    0xFC, 5,    // GOTO track 5
    0xFC, 4,    // GOTO track 4
    0xFC, 4,    // GOTO track 4
    0xFE,     // RETURN
  }
};

#endif
jaygarcia commented 7 years ago

I resolved the issue. it was problem with num_tracks being 0x13 instead of 0x14.

dxxb commented 7 years ago

I resolved the issue. it was problem with num_tracks being 0x13 instead of 0x14.

To avoid this in the future let's standardise on writing:

  .num_tracks = ARRAY_SIZE(((struct evade_score_struct*)0)->tracks_offset);

instead of

  .num_tracks = 0x13,  // 19

Even better:

  .num_patterns = ARRAY_SIZE(((struct evade_score_struct*)0)->patterns_offset);

You can add this at the top of the file:

#define ARRAY_SIZE(a) (sizeof (a) / sizeof ((a)[0]))