A major milestone was reached today. I now have working export functions.
The only thing remaining is to get the song update loop to read these tables.
This is what an Rboy tracker song will look like on the Gamebuino. My aim is to make the data so simple to read that in worst case scenario, you can fix any mistakes directly from the file, without needing to go to tracker and exporting again.
Each pattern can contain 3 blocks. Each block contains 4 phrases of 16 notes each, a note is 2 bytes. Each instrument is 13 bytes. Song header is 5 bytes. Each pattern entry takes 3 bytes.
This means that a song of 10 different blocks and 10 instruments and 10 patterns in sequence will be 10 * 64 * 2 + 10 * 13 + 10 * 3 + 5 = 1610 bytes in flash memory.
I've also figured a way to do note by note pitch slides and volume slides without the need for extra memory, but I'll get to that later.
And oh yeah, after a bit of heavy optimization, I'm now getting around 39 FPS in Operation Fox even when music is playing
- Code: Select all
// Rboy Tracker song .c export file
// Rbtracker version :0.030000
#include <Arduino.h>
#include <songs.h>
// Song data
const prog_uchar Song[200] PROGMEM = {
0, // Song length
0, // Loop to
3, // Number of blocks used
5, // Number of patches used
230, // BPM
// Sequence
0,1,2,// Pattern 0
// Block data
255,0,255,0,255,0,255,0,255,0,255,0,255,0,255,0,255,0,255,0,255,0,255,0,255,0,255,0,255,0,255,0,// Block 0 phrase 1
255,0,255,0,255,0,255,0,255,0,255,0,255,0,255,0,255,0,255,0,255,0,255,0,255,0,255,0,255,0,255,0,// Block 0 phrase 2
255,0,255,0,255,0,255,0,255,0,255,0,255,0,255,0,255,0,255,0,255,0,255,0,255,0,255,0,255,0,255,0,// Block 0 phrase 3
255,0,255,0,255,0,255,0,255,0,255,0,255,0,255,0,255,0,255,0,255,0,255,0,255,0,255,0,255,0,255,0,// Block 0 phrase 4
//
255,0,255,0,255,0,255,0,255,0,255,0,255,0,255,0,255,0,255,0,255,0,255,0,255,0,255,0,255,0,255,0,// Block 1 phrase 1
255,0,255,0,255,0,255,0,255,0,255,0,255,0,255,0,255,0,255,0,255,0,255,0,255,0,255,0,255,0,255,0,// Block 1 phrase 2
255,0,255,0,255,0,255,0,255,0,255,0,255,0,255,0,255,0,255,0,255,0,255,0,255,0,255,0,255,0,255,0,// Block 1 phrase 3
255,0,255,0,255,0,255,0,255,0,255,0,255,0,255,0,255,0,255,0,255,0,255,0,255,0,255,0,255,0,255,0,// Block 1 phrase 4
//
255,0,255,0,255,0,255,0,255,0,255,0,255,0,255,0,255,0,255,0,255,0,255,0,255,0,255,0,255,0,255,0,// Block 2 phrase 1
255,0,255,0,255,0,255,0,255,0,255,0,255,0,255,0,255,0,255,0,255,0,255,0,255,0,255,0,255,0,255,0,// Block 2 phrase 2
255,0,255,0,255,0,255,0,255,0,255,0,255,0,255,0,255,0,255,0,255,0,255,0,255,0,255,0,255,0,255,0,// Block 2 phrase 3
255,0,255,0,255,0,255,0,255,0,255,0,255,0,255,0,255,0,255,0,255,0,255,0,255,0,255,0,255,0,255,0,// Block 2 phrase 4
//
}; // end of song data
// Patches data
const prog_uchar Patches[65] PROGMEM = {
// Patch 1
1, // Waveform
127, // Volume
0x0, // Pitch bend rate UPPER BYTE
0x0, // Pitch bend rate LOWER BYTE
0x0, // Pitch bend max UPPER BYTE
0x0, // Pitch bend max LOWER BYTE
0, // Transpose
0, // Arp mode
0, // Options ADSR off LOOP off ECHO off OVERDRIVE off NORMALIZE off
0, // Attack
20, // Decay
0, // Sustain
0, // Release
// Patch 2
1, // Waveform
127, // Volume
0x0, // Pitch bend rate UPPER BYTE
0x0, // Pitch bend rate LOWER BYTE
0x0, // Pitch bend max UPPER BYTE
0x0, // Pitch bend max LOWER BYTE
0, // Transpose
0, // Arp mode
0, // Options ADSR off LOOP off ECHO off OVERDRIVE off NORMALIZE off
0, // Attack
20, // Decay
0, // Sustain
0, // Release
}; // end of patches data