Mercurial > hg > forks > pwpunix
view nykyaeka/musa.c @ 71:a87eb778f225
Improvements to the MinGW crossbuild. Should now build with default tools
from Debian mingw packages, though you need Win32 version of libSDL with the
necessary headers and so on in addition. 64-bit builds not tested and
probably won't work. Tested on Debian 7.0, earlier won't work.
binutils-mingw-w64-i686 gcc-mingw-w64-i686 mingw-w64-i686-dev
author | Matti Hamalainen <ccr@tnsp.org> |
---|---|
date | Tue, 14 Aug 2012 03:08:10 +0300 |
parents | acb5694e93d9 |
children |
line wrap: on
line source
#define pwplib_volume 64 /* to pwplib.h -- pwplib.setup[SOUND_VOLUME] */ #include "pwpdemo.h" #include "musa.h" struct { int ord,patt,row; int tick,tempo; }player; void newnote() { int c=0; for(;c<3;c++) { int note=pwpmusic[player.patt][c][player.row]; if(note==253) { if(player.tempo==6)player.tempo=50;else player.tempo=4; }else if(note==254) pwplib_sound_nv(c,0,0); else if(note!=255) pwplib_sound_nv(c,(note-5)<<8,pwplib_volume); } player.row++; if(player.row==64) { player.row=0; player.ord++; player.patt=pwpmusic_order[player.ord]; if(player.patt>128) { if(player.patt==255)player.ord=0;else { if(player.patt==254)player.tempo=5; player.ord++; } player.patt=pwpmusic_order[player.ord]; } } } void playtick() { if(player.tick==0) newnote(); player.tick++; if(player.tick==player.tempo) player.tick=0; } void initplayer() { player.row=player.ord; player.patt=pwpmusic_order[0]; player.tick=0; player.tempo=6; pwplib_setplayer(playtick); } /* loopflush(); */