some little melody

This commit is contained in:
twobit 2012-08-06 16:51:01 +02:00
parent 2dd9f75836
commit 4d72760342

View File

@ -6,7 +6,7 @@
enum { WAVE_OFF, WAVE_PULSE, WAVE_SAW, WAVE_NOISE }; enum { WAVE_OFF, WAVE_PULSE, WAVE_SAW, WAVE_NOISE };
enum { enum {
channel_count = 3, channel_count = 3,
tick_length = 600, tick_length = 800,
row_length = 4, row_length = 4,
pattern_length = 16 pattern_length = 16
}; };
@ -36,9 +36,9 @@ typedef struct {
static const synth_instrument_t instruments[] = { static const synth_instrument_t instruments[] = {
{ 1<<15, 255, 8 }, { 1<<15, 255, 8 },
{ 0, 255, 8 }, { 0, 255, 8 },
{ 0, 0, 5 }, { 0, 200, 5 },
{ 1<<14, 0, 0, 3 }, { 1<<13, 0, 0, 2 },
{ 1<<14, 0, 10, 3 }, { 1<<13, 0, 10, 2 },
}; };
static const uint8_t wave_table[][2] = { static const uint8_t wave_table[][2] = {
@ -49,7 +49,7 @@ static const uint8_t wave_table[][2] = {
{ 256 - 4, 0xff }, { 256 - 4, 0xff },
{ 0, WAVE_NOISE }, { 0, WAVE_NOISE },
{ 0, WAVE_SAW }, { 0, WAVE_PULSE },
{ 0xff, 0xff }, { 0xff, 0xff },
{ 0, WAVE_PULSE }, { 0, WAVE_PULSE },
@ -64,6 +64,7 @@ static const uint8_t wave_table[][2] = {
static const uint8_t patterns[][pattern_length][2] = { static const uint8_t patterns[][pattern_length][2] = {
{},
{ {
{ 33 - 12, 0 }, { 33 - 12, 0 },
{ 0xff, 1 }, { 0xff, 1 },
@ -101,46 +102,86 @@ static const uint8_t patterns[][pattern_length][2] = {
{ 0xff, 1 }, { 0xff, 1 },
}, },
{ {
{ 69, 2 }, { 0, 0 },
{ 0, 0 }, { 0, 0 },
{ 57 - 24, 2 }, { 0, 0 },
{ 0, 0 }, { 0, 0 },
{ 0xff, 0 }, { 0, 0 },
{ 45, 2 }, { 0, 0 },
{ 0, 0 }, { 0, 0 },
{ 0xff, 0 }, { 0, 0 },
{ 45+3, 2 }, { 57, 3 },
{ 0, 0 },
{ 45+7, 2 },
{ 0, 0 },
{ 0xff, 0 },
}, },
{ {
{ 0, 0 }, { 0, 0 },
{ 0, 0 }, { 0, 0 },
{ 0, 0 }, { 0, 0 },
{ 0, 0 }, { 0, 0 },
{ 57, 3 }, { 0, 0 },
{ 0, 0 },
{ 0, 0 },
{ 0, 0 },
{ 57, 4 },
},
{
{ 60, 2 },
}, },
{ {
{ 0, 0 }, { 0, 0 },
{ 0, 0 }, { 0, 0 },
{ 0, 0 }, { 0, 0 },
{ 0, 0 }, { 0, 0 },
{ 57, 4 }, { 57, 2 },
} { 0, 0 },
{ 0, 0 },
{ 0, 0 },
{ 0, 0 },
{ 0, 0 },
{ 0, 0 },
{ 0, 0 },
{ 55, 2 },
{ 0, 0 },
{ 57, 2 },
{ 0, 0 },
},
{
{ 55, 2 },
},
{
{ 0, 0 },
{ 0, 0 },
{ 0, 0 },
{ 0, 0 },
{ 0, 0 },
{ 0, 0 },
{ 0, 0 },
{ 0, 0 },
{ 0, 0 },
{ 0, 0 },
{ 0, 0 },
{ 0, 0 },
{ 57, 2 },
},
{
{ 55-3, 2 },
},
}; };
static const uint8_t pattern_table[][channel_count] = { static const uint8_t pattern_table[][channel_count] = {
{ 0, 2, 3 }, { 1, 0, 5 },
{ 0, 2, 3 }, { 1, 3, 0 },
{ 0, 2, 3 }, { 1, 0, 7 },
{ 0, 2, 3 }, { 1, 3, 6 },
{ 1, 2, 4 }, { 2, 0, 7 },
{ 1, 2, 4 }, { 2, 4, 8 },
{ 1, 2, 4 }, { 2, 0, 9 },
{ 1, 2, 4 }, { 2, 4, 0 },
}; };
enum { enum {
pattern_table_length = sizeof(pattern_table) / sizeof(pattern_table[0]) pattern_table_length = sizeof(pattern_table) / sizeof(pattern_table[0])