12.07.2015 Views

Chapter Quiz

Chapter Quiz

Chapter Quiz

SHOW MORE
SHOW LESS
  • No tags were found...

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

The PlayWave Program 513//initialize the programallegro_init();install_keyboard();install_timer();set_color_depth(16);set_gfx_mode(MODE, WIDTH, HEIGHT, 0, 0);text_mode(0);//install a digital sound driverif (install_sound(DIGI_AUTODETECT, MIDI_NONE, “”) != 0){allegro_message(“Error initializing sound system”);return;}//display program informationtextout(screen,font,”PlayWave Program (ESC to quit)”,0,0,WHITE);textprintf(screen,font,0,10,WHITE,”Sound Driver: %s”,digi_driver->name);textout(screen,font,”Playing clapping.wav...”,0,20,WHITE);textout(screen,font,”Left,Right - Pan Left,Right”,0,50,WHITE);textout(screen,font,”Up,Down - Pitch Raise,Lower”,0,60,WHITE);textout(screen,font,”-,+ - Volume Down,Up”,0,70,WHITE);//load the wave filesample = load_sample(“clapping.wav”);if (!sample){allegro_message(“Error reading wave file”);return;}//play the sample with loopingplay_sample(sample, volume, pan, pitch, TRUE);//main loopwhile (!key[KEY_ESC]){//change the panningif ((key[KEY_LEFT]) && (panning > 0))panning—;else if ((key[KEY_RIGHT]) && (panning < 255))panning++;

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!