Mercurial > hg > beaglert
diff projects/tank_wars/main.cpp @ 274:cf98c06c72fd prerelease
merge
author | Liam Donovan <l.b.donovan@qmul.ac.uk> |
---|---|
date | Tue, 17 May 2016 16:42:02 +0100 |
parents | 8d80eda512cd |
children |
line wrap: on
line diff
--- a/projects/tank_wars/main.cpp Tue May 17 16:31:51 2016 +0100 +++ b/projects/tank_wars/main.cpp Tue May 17 16:42:02 2016 +0100 @@ -19,6 +19,9 @@ int gMusicBufferLength = 0; float *gSoundBoomBuffer = 0; int gSoundBoomBufferLength = 0; +float *gSoundHitBuffer = 0; +int gSoundHitBufferLength = 0; + using namespace std; @@ -80,7 +83,8 @@ BeagleRTInitSettings settings; // Standard audio settings string musicFileName = "music.wav"; string soundBoomFileName = "boom.wav"; - + string soundHitFileName = "hit.wav"; + struct option customOptions[] = { {"help", 0, NULL, 'h'}, @@ -121,7 +125,10 @@ if(loadSoundFile(soundBoomFileName, &gSoundBoomBuffer, &gSoundBoomBufferLength) != 0) { cout << "Warning: unable to load sound file " << soundBoomFileName << endl; } - + if(loadSoundFile(soundHitFileName, &gSoundHitBuffer, &gSoundHitBufferLength) != 0) { + cout << "Warning: unable to load sound file " << soundHitFileName << endl; + } + // Initialise the PRU audio device if(BeagleRT_initAudio(&settings, 0) != 0) { cout << "Error: unable to initialise audio" << endl; @@ -154,7 +161,9 @@ free(gMusicBuffer); if(gSoundBoomBuffer != 0) free(gSoundBoomBuffer); - + if(gSoundHitBuffer != 0) + free(gSoundHitBuffer); + // All done! return 0; }