A bit of testing shows you can do it with the STL and a minimal amount of mucking around. I fitted 10 sequences on the Uno (just) so you should be OK with the Mega1280.
#include <iterator>
#include <vector>
#include <new.cpp>
#define SEQUENCES 10
#define BARS 4
#define CHANNELS 10
#define NOTES 32
std::vector<bool> sequenzen (SEQUENCES * BARS * CHANNELS * NOTES);
void setItem (const byte seq, const byte bar, const byte channel, const byte note, const bool value = true)
{
int i = (seq * BARS * CHANNELS * NOTES) +
(bar * CHANNELS * NOTES) +
(channel * NOTES) +
note;
sequenzen [i] = value;
}
bool getItem (const byte seq, const byte bar, const byte channel, const byte note)
{
int i = (seq * BARS * CHANNELS * NOTES) +
(bar * CHANNELS * NOTES) +
(channel * NOTES) +
note;
return sequenzen [i];
}
void setup ()
{
Serial.begin (115200);
// testing
setItem (2, 3, 5, 1);
setItem (4, 1, 8, 2);
setItem (SEQUENCES - 1, BARS - 1, CHANNELS - 1, NOTES - 1);
setItem (0, 0, 0, 0);
setItem (0, 0, 1, 0);
setItem (0, 1, 0, 0);
setItem (1, 0, 0, 0);
Serial.println ("These are set:");
// debugging display
int j = 0;
for (std::vector<bool>::const_iterator i = sequenzen.begin ();
i != sequenzen.end ();
i++, j++)
if (*i)
Serial.println (j);
} // end of setup
void loop ()
{}
The STL "bool" vector uses an efficient storage technique that lets you address bits individually (and fit 8 into a byte). This theoretically would take 1600 bytes (and a memory check confirmed this). My example setItem and getItem show how you just multiply out the wanted sequence/bar/channel/note by the correct number (I hope I got it right) to get to the correct bit in the vector.
My numbers are zero-relative (ie. bars 0, 1, 2, 3 rather than 1, 2, 3, 4) but if you prefer one-relative just change the way the index value is calculated. eg.
int i = ((seq - 1) * BARS * CHANNELS * NOTES) +
((bar - 1) * CHANNELS * NOTES) +
((channel - 1) * NOTES) +
note - 1;
STL from here:
http://andybrown.me.uk/ws/2011/01/15/the-standard-template-library-stl-for-avr-with-c-streams/Follow installation instructions on that page.