improve melody timing

This commit is contained in:
Joachim Fenkes 2012-08-10 23:18:29 +02:00
parent 479d4f4377
commit 8ae6a0bc0b

View file

@ -57,22 +57,32 @@ const int bassline[BASSSIZE] = {
8, 8, 10, 10, 12, 12, 5, 5, 8, 8, 10, 10, 8, 8, 10, 10, 12, 12, 5, 5, 8, 8, 10, 10,
}; };
#define LEADSIZE 159 #if 0
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[] = {
};
#endif
#define LEADSIZE 180
const int leadmelody[LEADSIZE] = { 0, 0, 0, 0, const int leadmelody[LEADSIZE] = { 0, 0, 0, 0,
12, 7, 0, 12, 0, 14, 15, 0, 14, 0, 12, 0, 14, 15, 0, 14, 0, 12, 0, 14, 10, 0, 7, 5, 7, 3, 1, 0, 12, 7, 0, 12, 0, 14, 15, 0, 14, 0, 12, 0, 14, 15, 0, 14, 0, 12, 0, 14, 10, 0, 7, 0, 5, 7, 3, 1, 0,
12, 7, 0, 12, 0, 14, 15, 0, 14, 0, 12, 0, 14, 15, 0, 14, 0, 15, 0, 17, 19, 0, 22, 24, 26, 27, 24, 0, 12, 7, 0, 12, 0, 14, 15, 0, 14, 0, 12, 0, 14, 15, 0, 14, 0, 15, 0, 17, 19, 0, 22, 0, 24, 26, 27, 24, 0,
12, 7, 0, 12, 0, 14, 15, 0, 14, 0, 12, 0, 14, 15, 0, 14, 0, 12, 0, 14, 10, 0, 7, 5, 7, 3, 1, 0, 12, 7, 0, 12, 0, 14, 15, 0, 14, 0, 12, 0, 14, 15, 0, 14, 0, 12, 0, 14, 10, 0, 7, 0, 5, 7, 3, 1, 0,
12, 7, 0, 12, 0, 14, 15, 0, 14, 0, 12, 0, 14, 15, 0, 14, 0, 15, 0, 17, 19, 0, 22, 24, 26, 24, 20, 0, 12, 7, 0, 12, 0, 14, 15, 0, 14, 0, 12, 0, 14, 15, 0, 14, 0, 15, 0, 17, 19, 0, 22, 0, 24, 26, 24, 20, 0,
8, 3, 0, 8, 10, 12, 14, 15, 19, 17, 0, 12, 7, 0, 12, 14, 15, 14, 15, 19, 17, 0, 8, 3, 0, 8, 10, 12, 0, 14, 15, 19, 17, 0, 12, 7, 0, 12, 14, 15, 0, 14, 15, 19, 17, 0,
8, 3, 0, 8, 10, 12, 14, 15, 19, 17, 15, 0, 14, 15, 17, 19, 0, 15, 14, 15, 12, 8, 3, 0, 8, 10, 12, 14, 0, 15, 19, 17, 15, 0, 14, 15, 17, 19, 0, 15, 14, 15, 12,
}; };
const int leadtiming[LEADSIZE] = { 0, 62, 200, 250, const int leadtiming[LEADSIZE] = { 0, 62, 200, 250,
4, 2, 2, 2, 2, 2, 4, 2, 2, 2, 2, 2, 2, 4, 2, 2, 2, 2, 2, 2, 4, 2, 4, 4, 2, 4, 6, 56, 4, 2, 2, 2, 2, 2, 5, 1, 2, 2, 2, 2, 2, 5, 1, 2, 2, 2, 2, 2, 5, 1, 3, 1, 4, 2, 4, 6, 56,
4, 2, 2, 2, 2, 2, 4, 2, 2, 2, 2, 2, 2, 4, 2, 2, 2, 2, 2, 2, 4, 2, 4, 4, 2, 4, 6, 56, 4, 2, 2, 2, 2, 2, 5, 1, 2, 2, 2, 2, 2, 5, 1, 2, 2, 2, 2, 2, 5, 1, 3, 1, 4, 2, 4, 6, 56,
4, 2, 2, 2, 2, 2, 4, 2, 2, 2, 2, 2, 2, 4, 2, 2, 2, 2, 2, 2, 4, 2, 4, 4, 2, 4, 6, 56, 4, 2, 2, 2, 2, 2, 5, 1, 2, 2, 2, 2, 2, 5, 1, 2, 2, 2, 2, 2, 5, 1, 3, 1, 4, 2, 4, 6, 56,
4, 2, 2, 2, 2, 2, 4, 2, 2, 2, 2, 2, 2, 4, 2, 2, 2, 2, 2, 2, 4, 2, 4, 4, 2, 4, 6, 56, 4, 2, 2, 2, 2, 2, 5, 1, 2, 2, 2, 2, 2, 5, 1, 2, 2, 2, 2, 2, 5, 1, 3, 1, 4, 2, 4, 6, 56,
4, 2, 2, 4, 2, 6, 4, 4, 2, 6, 28, 4, 2, 2, 4, 2, 6, 4, 4, 2, 6, 28, 4, 2, 2, 4, 2, 5, 1, 4, 4, 2, 6, 28, 4, 2, 2, 4, 2, 5, 1, 4, 4, 2, 6, 28,
4, 2, 2, 4, 2, 6, 4, 4, 2, 6, 2, 2, 4, 2, 6, 2, 2, 4, 2, 4, 4, 4, 2, 2, 4, 2, 6, 2, 2, 4, 2, 6, 2, 2, 4, 2, 6, 2, 2, 4, 2, 4, 4,
}; };
struct leadvoice_s { struct leadvoice_s {
@ -157,7 +167,7 @@ static inline uint8_t next_sample()
return ret; return ret;
} }
void fill(char *data) void fill(uint8_t *data)
{ {
static uint8_t max = 0; static uint8_t max = 0;
@ -192,7 +202,7 @@ int main(int argc, char *argv[])
}; };
int i = 0; int i = 0;
fill(bufs[i].lpData); fill((uint8_t *)bufs[i].lpData);
bufs[i].dwFlags = WHDR_PREPARED; bufs[i].dwFlags = WHDR_PREPARED;
waveOutPrepareHeader(out, bufs + i, sizeof(WAVEHDR)); waveOutPrepareHeader(out, bufs + i, sizeof(WAVEHDR));
waveOutWrite(out, bufs + i, sizeof(WAVEHDR)); waveOutWrite(out, bufs + i, sizeof(WAVEHDR));
@ -200,7 +210,7 @@ int main(int argc, char *argv[])
while (!(GetAsyncKeyState(VK_ESCAPE) & 1)) while (!(GetAsyncKeyState(VK_ESCAPE) & 1))
{ {
fill(bufs[i].lpData); fill((uint8_t *)bufs[i].lpData);
bufs[i].dwFlags = WHDR_PREPARED; bufs[i].dwFlags = WHDR_PREPARED;
waveOutPrepareHeader(out, bufs + i, sizeof(WAVEHDR)); waveOutPrepareHeader(out, bufs + i, sizeof(WAVEHDR));
waveOutWrite(out, bufs + i, sizeof(WAVEHDR)); waveOutWrite(out, bufs + i, sizeof(WAVEHDR));