merge note data

This commit is contained in:
Joachim Fenkes 2012-08-11 10:39:35 +02:00
parent 62c720ab1b
commit 5f96c41f5f

View file

@ -11,11 +11,10 @@ static inline uint8_t THREEQUARTERS(uint8_t x)
return (x >> 2) + (x >> 1); return (x >> 2) + (x >> 1);
} }
const int notes[37] = { 134, 142, 150, 159, 169, 179, 189, 201, 213, 225, 239, 253, 268, 284, 301, 319, 338, 358, 379, 401, 425, 451, 477, 506, 536, 568, 601, 637, 675, 715, 758, 803, 851, 901, 955, 1011, 1072 }; const uint16_t notes[] = {
-1, 134, 159, 179, 201, 213, 239, 268, 301, 319, 358, 401, 425, 451, 477, 536, 601, 637, 715
const uint8_t arpnotes[] = {
8, 10, 12, 14, 15, 17, 19, 20, 21, 22, 24, 26, 27, 29,
}; };
#define arpnotes (notes + 5)
const uint16_t arpeggio[][2] = { const uint16_t arpeggio[][2] = {
{ 0x24, 0x6A }, { 0x24, 0x6A },
@ -50,12 +49,8 @@ const uint32_t arptiming = B32(00001100,00110000,11111011,00001100);
const int bassbeat[8] = { 0, 0, 1, 0, 0, 1, 0, 1 }; const int bassbeat[8] = { 0, 0, 1, 0, 0, 1, 0, 1 };
const int bassline[] = { const int bassline[] = {
12, 12, 15, 10, 12, 12, 17, 10, 12, 12, 15, 7, 8, 8, 3, 7, 7, 7, 9, 6, 7, 7, 10, 6, 7, 7, 9, 4, 5, 5, 2, 4,
8, 8, 10, 10, 12, 12, 5, 5, 8, 8, 10, 10, 5, 5, 6, 6, 7, 7, 3, 3, 5, 5, 6, 6
};
const uint8_t leadnotes[] = {
0xFF, 0, 3, 5, 7, 8, 10, 12, 14, 15, 17, 19, 20, 22, 24, 26, 27
}; };
const uint8_t leadtimes[] = { const uint8_t leadtimes[] = {
@ -64,8 +59,8 @@ const uint8_t leadtimes[] = {
const uint8_t leaddata[] = { const uint8_t leaddata[] = {
0x67, 0x24, 0x20, 0x27, 0x20, 0x28, 0x89, 0x0, 0x28, 0x20, 0x27, 0x20, 0x28, 0x89, 0x0, 0x28, 0x67, 0x24, 0x20, 0x27, 0x20, 0x28, 0x89, 0x0, 0x28, 0x20, 0x27, 0x20, 0x28, 0x89, 0x0, 0x28,
0x20, 0x27, 0x20, 0x28, 0x86, 0x0, 0x44, 0x0, 0x63, 0x24, 0x62, 0xA1, 0xE0, 0xE0, 0xE0, 0xE0, 0x20, 0x27, 0x20, 0x28, 0x86, 0x0, 0x44, 0x0, 0x63, 0x24, 0x62, 0xA1, 0xE0, 0xE0, 0xE0, 0xE0,
0x20, 0x29, 0x20, 0x2A, 0x8B, 0x0, 0x4D, 0x0, 0x6E, 0x2F, 0x70, 0xAE, 0xE0, 0xE0, 0xE0, 0xE0, 0x20, 0x29, 0x20, 0x2A, 0x8B, 0x0, 0x4E, 0x0, 0x6F, 0x30, 0x71, 0xAF, 0xE0, 0xE0, 0xE0, 0xE0,
0x20, 0x29, 0x20, 0x2A, 0x8B, 0x0, 0x4D, 0x0, 0x6E, 0x2F, 0x6E, 0xAC, 0xE0, 0xE0, 0xE0, 0xE0, 0x20, 0x29, 0x20, 0x2A, 0x8B, 0x0, 0x4E, 0x0, 0x6F, 0x30, 0x6F, 0xAC, 0xE0, 0xE0, 0xE0, 0xE0,
0x65, 0x22, 0x20, 0x65, 0x26, 0x87, 0x0, 0x68, 0x69, 0x2B, 0xAA, 0xC0, 0x67, 0x24, 0x20, 0x67, 0x65, 0x22, 0x20, 0x65, 0x26, 0x87, 0x0, 0x68, 0x69, 0x2B, 0xAA, 0xC0, 0x67, 0x24, 0x20, 0x67,
0x28, 0x89, 0x0, 0x68, 0x69, 0x2B, 0xAA, 0xC0, 0x65, 0x22, 0x20, 0x65, 0x26, 0xA7, 0x28, 0x20, 0x28, 0x89, 0x0, 0x68, 0x69, 0x2B, 0xAA, 0xC0, 0x65, 0x22, 0x20, 0x65, 0x26, 0xA7, 0x28, 0x20,
0x69, 0x2B, 0xAA, 0x29, 0x20, 0x68, 0x29, 0xAA, 0x2B, 0x20, 0x69, 0x28, 0x69, 0x67, 0x69, 0x2B, 0xAA, 0x29, 0x20, 0x68, 0x29, 0xAA, 0x2B, 0x20, 0x69, 0x28, 0x69, 0x67,
@ -113,10 +108,10 @@ static unsigned char voice_lead(unsigned long i, int voice_nr)
} }
uint8_t melody = leadnotes[leaddata[(leadseq[leadptr >> 4] << 4) | (leadptr & 0xF)] & 0x1F]; uint8_t melody = leaddata[(leadseq[leadptr >> 4] << 4) | (leadptr & 0xF)] & 0x1F;
lead_osc += notes[melody]; lead_osc += notes[melody];
uint8_t sample = ((lead_osc >> 6) & 0x7F) + ((lead_osc >> 6) & 0x3F); uint8_t sample = ((lead_osc >> 6) & 0x7F) + ((lead_osc >> 6) & 0x3F);
return (melody == 0xFF) ? 0 : ((boosts & (1 << voice_nr)) ? sample : THREEQUARTERS(sample)); return (0 == melody) ? 0 : ((boosts & (1 << voice_nr)) ? sample : THREEQUARTERS(sample));
} }
static inline unsigned char voice_arp(unsigned long i) static inline unsigned char voice_arp(unsigned long i)
@ -130,7 +125,7 @@ static inline unsigned char voice_arp(unsigned long i)
if (!(i & 0x80)) if (!(i & 0x80))
arpptr >>= 4; arpptr >>= 4;
int note = notes[arpnotes[arpptr & 0xF]]; int note = arpnotes[arpptr & 0xF];
arp_osc += note; arp_osc += note;
return ((arptiming & (1 << (31 - (i >> 9)))) && (arp_osc & (1 << 12)) && ((i >> 13) > 15)) ? 0 : 140; return ((arptiming & (1 << (31 - (i >> 9)))) && (arp_osc & (1 << 12)) && ((i >> 13) > 15)) ? 0 : 140;
} }