Skip to content

Commit

Permalink
improve melody timing
Browse files Browse the repository at this point in the history
  • Loading branch information
dojoe committed Aug 10, 2012
1 parent 479d4f4 commit 8ae6a0b
Showing 1 changed file with 26 additions and 16 deletions.
42 changes: 26 additions & 16 deletions win/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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,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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 {
Expand Down Expand Up @@ -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;

Expand Down Expand Up @@ -192,15 +202,15 @@ 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));
i ^= 1;

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));
Expand Down

0 comments on commit 8ae6a0b

Please sign in to comment.