From 8ae6a0bc0ba845eace2ee39024b6f8749f32eda9 Mon Sep 17 00:00:00 2001 From: Joachim Fenkes Date: Fri, 10 Aug 2012 23:18:29 +0200 Subject: [PATCH] improve melody timing --- win/main.cpp | 42 ++++++++++++++++++++++++++---------------- 1 file changed, 26 insertions(+), 16 deletions(-) diff --git a/win/main.cpp b/win/main.cpp index 3d87f58..1312be1 100644 --- a/win/main.cpp +++ b/win/main.cpp @@ -57,22 +57,32 @@ const int bassline[BASSSIZE] = { 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, - 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, 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, 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, 15, 0, 17, 19, 0, 22, 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, 14, 15, 19, 17, 15, 0, 14, 15, 17, 19, 0, 15, 14, 15, 12, + 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, 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, 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, 0, 24, 26, 24, 20, 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, 0, 15, 19, 17, 15, 0, 14, 15, 17, 19, 0, 15, 14, 15, 12, }; 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, 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, 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, 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, 4, 2, 6, 4, 4, 2, 6, 28, 4, 2, 2, 4, 2, 6, 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, 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, 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, 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, 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, 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, 2, 2, 4, 2, 6, 2, 2, 4, 2, 6, 2, 2, 4, 2, 4, 4, }; struct leadvoice_s { @@ -157,7 +167,7 @@ static inline uint8_t next_sample() return ret; } -void fill(char *data) +void fill(uint8_t *data) { static uint8_t max = 0; @@ -192,7 +202,7 @@ int main(int argc, char *argv[]) }; int i = 0; - fill(bufs[i].lpData); + fill((uint8_t *)bufs[i].lpData); bufs[i].dwFlags = WHDR_PREPARED; waveOutPrepareHeader(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)) { - fill(bufs[i].lpData); + fill((uint8_t *)bufs[i].lpData); bufs[i].dwFlags = WHDR_PREPARED; waveOutPrepareHeader(out, bufs + i, sizeof(WAVEHDR)); waveOutWrite(out, bufs + i, sizeof(WAVEHDR));