From 9bd9ca323d705e41336e906cdb849cd693c87417 Mon Sep 17 00:00:00 2001 From: Christian Franke Date: Thu, 30 Apr 2009 15:02:09 +0200 Subject: [PATCH 3/3] Added variable BPM support --- player.cpp | 6 ++++-- 1 files changed, 4 insertions(+), 2 deletions(-) diff --git a/player.cpp b/player.cpp index f5d5492..51a6903 100644 --- a/player.cpp +++ b/player.cpp @@ -29,6 +29,7 @@ double carrier; int resx; int resy; int horizontalspan; +int bpm; double pixelclock; SDL_Surface *screen; @@ -206,7 +207,7 @@ void flushplay () SDL_UpdateRect(screen,0,0,resx,resy); zeit length; - length.setdouble(curlen/40.0); + length.setdouble(curlen/((bpm*32.0)/60.0)); timefornextsound.add(length); loaded=false; }; @@ -273,13 +274,14 @@ int main(int argc, char *argv[]) "if you do not read it, you will NOT know what to do\n" ); - if (argc!=7) usage(); + if (argc!=7 && argc!=8) usage(); pixelclock=atof(argv[1]); resx=atol(argv[2]); resy=atol(argv[3]); horizontalspan=atol(argv[4]); carrier=atof(argv[5]); filename=argv[6]; + bpm = (argc == 8) ? atoi(argv[7]) : 75; printf("\n" "Pixel Clock %.0f Hz\n" -- 1.6.2.2