Main Page | Class Hierarchy | Alphabetical List | Data Structures | Directories | File List | Data Fields | Globals

sound.c

Go to the documentation of this file.
00001 /*sound.c*/
00002 
00003 #include <config.h>
00004 #if defined(CONF_DSOUND)
00005 #include <dsound.h>
00006 #include <tm.h>
00007 
00008 /*array of notes that make up the refrain*/
00009 /*of Devil with a Blue Dress*/
00010 
00011 static const note_t devil[] = { 
00012   { PITCH_G4, QUARTER },
00013   { PITCH_G4, QUARTER },
00014   { PITCH_G4, QUARTER },
00015   { PITCH_G4, QUARTER },
00016   { PITCH_G4, HALF },
00017   { PITCH_G4, HALF },
00018 
00019   { PITCH_G4, HALF },
00020   { PITCH_G4, HALF },
00021   { PITCH_G4, HALF },
00022   { PITCH_G4, HALF },
00023 
00024   { PITCH_F4, QUARTER },
00025   { PITCH_F4, QUARTER },
00026   { PITCH_F4, QUARTER },
00027   { PITCH_F4, QUARTER },
00028   { PITCH_F4, HALF },
00029   { PITCH_F4, HALF },
00030 
00031   { PITCH_F4, HALF },
00032   { PITCH_PAUSE, HALF },
00033   { PITCH_PAUSE, HALF },
00034   { PITCH_PAUSE, HALF },
00035 
00036   { PITCH_E4, QUARTER },
00037   { PITCH_E4, QUARTER },
00038   { PITCH_E4, QUARTER },
00039   { PITCH_E4, QUARTER },
00040   { PITCH_F4, HALF },
00041   { PITCH_F4, HALF },
00042 
00043   { PITCH_E4, HALF },
00044   { PITCH_E4, HALF },
00045   { PITCH_F4, HALF },
00046   { PITCH_F4, HALF },
00047 
00048   { PITCH_E4, QUARTER },
00049   { PITCH_E4, QUARTER },
00050   { PITCH_E4, QUARTER },
00051   { PITCH_E4, QUARTER },
00052   { PITCH_F4, HALF },
00053   { PITCH_F4, HALF },
00054 
00055   { PITCH_E4, HALF },
00056   { PITCH_PAUSE, HALF }, 
00057   { PITCH_PAUSE, HALF }, 
00058   { PITCH_PAUSE, HALF }, 
00059   { PITCH_END, 0 }
00060 };
00061 
00062 int main(int argc,char *argv[]) {
00063   
00064   /*The default makes this a really, really slow song*/
00065   /*So, we speed it up a little bit.*/
00066   dsound_set_duration(40);
00067 
00068   /*now, we play it*/
00069   while (!shutdown_requested()) {
00070     if (wait_event(dsound_finished,0) != 0)
00071         dsound_play(devil);
00072     sleep(1);
00073   }
00074 
00075   return 0;
00076 }
00077 #else
00078 #warning sound.c requires CONF_DSOUND which is not set
00079 #warning sound demo will do nothing
00080 int main(int argc, char *argv[]) {
00081   return 0;
00082 }
00083 #endif // CONF_DSOUND

Generated on Fri Feb 25 08:02:35 2005 for brickos by  doxygen 1.3.9.1