Version of Robotron arcade game using LPC1768, a Gameduino shield, a serial EEPROM (for high scores), two microswitch joysticks and two buttons plus a box to put it in. 20 levels of mayhem.
Dependencies: 25LCxxx_SPI CommonTypes Gameduino mbed
Revision 9:fa7e7b37b632, committed 2013-06-09
- Comitter:
- RichardE
- Date:
- Sun Jun 09 14:28:53 2013 +0000
- Parent:
- 8:82d88f9381f3
- Child:
- 10:bfa1c307c99d
- Commit message:
- Sound is now working. Now a complete working game, albeit with only 2 levels.
Changed in this revision
--- a/GameRobotRic.cpp Sat Jun 08 17:51:33 2013 +0000 +++ b/GameRobotRic.cpp Sun Jun 09 14:28:53 2013 +0000 @@ -89,6 +89,8 @@ // humans so they would need to be J type to collide with humans. But then player and // enemies are both J type and so collisions between players and enemies are not detected. gd.wr( Gameduino::JK_MODE, 0 ); + // Pass Gameduino to sound manager. + SoundManager::Instance.SetGameduino( &gd ); // Initialise serial EEPROM object which is on same SPI bus as the Gameduino. Ser25LCxxx eeprom( &spi, p14, 32768, 64 ); // Create a high score table that uses the EEPROM.
--- a/Level.h Sat Jun 08 17:51:33 2013 +0000 +++ b/Level.h Sun Jun 09 14:28:53 2013 +0000 @@ -30,10 +30,8 @@ #include "BrainObject.h" #include "MutantObject.h" #include "BlueMeanyObject.h" -#if 0 #include "SoundManager.h" #include "Sounds.h" -#endif class Level {
--- a/LevelNormal.cpp Sat Jun 08 17:51:33 2013 +0000 +++ b/LevelNormal.cpp Sun Jun 09 14:28:53 2013 +0000 @@ -142,10 +142,8 @@ if( enemy->SquashesHumans ) { // Change human to dead state. human->CurrentState = HumanObject::Dead; - #if 0 // Make a noise. SoundManager::Instance.PlaySound( Sounds::HumanDies, 0, 0 ); - #endif } else if( enemy->GetEnemyType() == Brain ) { // Kill human by inserting a null into humans array. humans[ humanIndex ] = (GameObject*)NULL; @@ -199,10 +197,8 @@ enemy->RegisterHitByBullet(); // Kill off the bullet. currentInstance->player->KillBullet( currentInstance->gd, bulletIndex ); - #if 0 // Make a noise. SoundManager::Instance.PlaySound( Sounds::Explosion, 0, 0 ); - #endif // Start explosion animation using coordinates of enemy. ExplosionManager::Instance.StartExplosion( enemy->Xco, enemy->Yco ); } @@ -240,10 +236,8 @@ human->CurrentState = HumanObject::Rescued; // Give player 50 points (in BCD!). player->AddToScore( 0x50 ); - #if 0 // Make a noise. SoundManager::Instance.PlaySound( Sounds::RescueHuman, 0, 0 ); - #endif } } } @@ -255,23 +249,21 @@ // Pass sound to play in soundToPlay parameter. void LevelNormal::PlaySoundAndWait( const UInt8 *soundToPlay ) { -#if 0 // Keep trying to play sound until it works and meanwhile // keep currently playing sounds going. while( ! SoundManager::Instance.PlaySound( soundToPlay, 0, 0 ) ) { // Update sound manager. SoundManager::Instance.Update(); // Wait for frame flyback. - GD.waitvblank(); + gd->waitvblank(); } // Now wait until all sounds have finished. while( SoundManager::Instance.CountSoundsPlaying() > 0 ) { // Update sound manager. SoundManager::Instance.Update(); // Wait for frame flyback. - GD.waitvblank(); + gd->waitvblank(); } -#endif } /*************/ @@ -302,7 +294,7 @@ bool firstDraw = true; while( ! allEnemiesAreDead && ! gameIsOver ) { // Update sound manager. - // SoundManager::Instance.Update(); + SoundManager::Instance.Update(); // Wait for frame flyback. gd->waitvblank(); // Check for collisions between player and other objects. @@ -327,7 +319,7 @@ FrameCounter++; // After first redraw play level start sound and wait for it to end. if( firstDraw ) { - // PlaySoundAndWait( Sounds::StartLevel ); + PlaySoundAndWait( Sounds::StartLevel ); firstDraw = false; } // If player was killed then play death march and wait for it to finish. @@ -336,7 +328,7 @@ pc.puts( "Player got killed.\r\n" ); #endif // Player got killed. - // PlaySoundAndWait( Sounds::PlayerDead ); + PlaySoundAndWait( Sounds::PlayerDead ); // One less life for player. if( player->Lives > 0 ) { player->Lives--;
--- a/LevelNormal.h Sat Jun 08 17:51:33 2013 +0000 +++ b/LevelNormal.h Sun Jun 09 14:28:53 2013 +0000 @@ -15,9 +15,7 @@ #include "Level.h" #include "LevelData.h" -#if 0 #include "ExplosionManager.h" -#endif class LevelNormal : public Level { @@ -93,7 +91,7 @@ /* WAIT UNTIL SLOT FREE FOR A NEW SOUND, PLAY IT AND WAIT FOR ALL SOUNDS TO FINISH */ /***********************************************************************************/ // Pass sound to play in soundToPlay parameter. - static void PlaySoundAndWait( const UInt8 *soundToPlay ); + void PlaySoundAndWait( const UInt8 *soundToPlay ); };
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/Notes.cpp Sun Jun 09 14:28:53 2013 +0000 @@ -0,0 +1,114 @@ +/* + * SOURCE FILE : Notes.cpp + * + * Enumeration of notes on a piano keyboard and array + * of notes frequencies for each note. + * + */ + +#include "Notes.h" + +#define FrequencyConvert( freq ) (UInt16)( freq * 4.0 + 0.5 ) + +// Array of note frequencies. +const UInt16 Notes::NoteFrequencies[ Notes::NoteCount ] = { + 0, + 0, + FrequencyConvert( 27.5 ), + FrequencyConvert( 29.1352350948806 ), + FrequencyConvert( 30.8677063285078 ), + FrequencyConvert( 32.7031956625748 ), + FrequencyConvert( 34.647828872109 ), + FrequencyConvert( 36.7080959896759 ), + FrequencyConvert( 38.8908729652601 ), + FrequencyConvert( 41.2034446141087 ), + FrequencyConvert( 43.6535289291255 ), + FrequencyConvert( 46.2493028389543 ), + FrequencyConvert( 48.9994294977187 ), + FrequencyConvert( 51.9130871974931 ), + FrequencyConvert( 55 ), + FrequencyConvert( 58.2704701897612 ), + FrequencyConvert( 61.7354126570155 ), + FrequencyConvert( 65.4063913251497 ), + FrequencyConvert( 69.295657744218 ), + FrequencyConvert( 73.4161919793519 ), + FrequencyConvert( 77.7817459305202 ), + FrequencyConvert( 82.4068892282175 ), + FrequencyConvert( 87.307057858251 ), + FrequencyConvert( 92.4986056779086 ), + FrequencyConvert( 97.9988589954373 ), + FrequencyConvert( 103.826174394986 ), + FrequencyConvert( 110 ), + FrequencyConvert( 116.540940379522 ), + FrequencyConvert( 123.470825314031 ), + FrequencyConvert( 130.812782650299 ), + FrequencyConvert( 138.591315488436 ), + FrequencyConvert( 146.832383958704 ), + FrequencyConvert( 155.56349186104 ), + FrequencyConvert( 164.813778456435 ), + FrequencyConvert( 174.614115716502 ), + FrequencyConvert( 184.997211355817 ), + FrequencyConvert( 195.997717990875 ), + FrequencyConvert( 207.652348789973 ), + FrequencyConvert( 220 ), + FrequencyConvert( 233.081880759045 ), + FrequencyConvert( 246.941650628062 ), + FrequencyConvert( 261.625565300599 ), + FrequencyConvert( 277.182630976872 ), + FrequencyConvert( 293.664767917408 ), + FrequencyConvert( 311.126983722081 ), + FrequencyConvert( 329.62755691287 ), + FrequencyConvert( 349.228231433004 ), + FrequencyConvert( 369.994422711634 ), + FrequencyConvert( 391.995435981749 ), + FrequencyConvert( 415.304697579945 ), + FrequencyConvert( 440 ), + FrequencyConvert( 466.16376151809 ), + FrequencyConvert( 493.883301256124 ), + FrequencyConvert( 523.251130601197 ), + FrequencyConvert( 554.365261953744 ), + FrequencyConvert( 587.329535834815 ), + FrequencyConvert( 622.253967444162 ), + FrequencyConvert( 659.25511382574 ), + FrequencyConvert( 698.456462866008 ), + FrequencyConvert( 739.988845423269 ), + FrequencyConvert( 783.990871963499 ), + FrequencyConvert( 830.60939515989 ), + FrequencyConvert( 880 ), + FrequencyConvert( 932.32752303618 ), + FrequencyConvert( 987.766602512248 ), + FrequencyConvert( 1046.50226120239 ), + FrequencyConvert( 1108.73052390749 ), + FrequencyConvert( 1174.65907166963 ), + FrequencyConvert( 1244.50793488832 ), + FrequencyConvert( 1318.51022765148 ), + FrequencyConvert( 1396.91292573202 ), + FrequencyConvert( 1479.97769084654 ), + FrequencyConvert( 1567.981743927 ), + FrequencyConvert( 1661.21879031978 ), + FrequencyConvert( 1760 ), + FrequencyConvert( 1864.65504607236 ), + FrequencyConvert( 1975.5332050245 ), + FrequencyConvert( 2093.00452240479 ), + FrequencyConvert( 2217.46104781498 ), + FrequencyConvert( 2349.31814333926 ), + FrequencyConvert( 2489.01586977665 ), + FrequencyConvert( 2637.02045530296 ), + FrequencyConvert( 2793.82585146403 ), + FrequencyConvert( 2959.95538169308 ), + FrequencyConvert( 3135.96348785399 ), + FrequencyConvert( 3322.43758063956 ), + FrequencyConvert( 3520 ), + FrequencyConvert( 3729.31009214472 ), + FrequencyConvert( 3951.06641004899 ), + FrequencyConvert( 4186.00904480958 ), + FrequencyConvert( 4434.92209562995 ), + FrequencyConvert( 4698.63628667852 ), + FrequencyConvert( 4978.03173955329 ), + FrequencyConvert( 5274.04091060592 ), + FrequencyConvert( 5587.65170292806 ), + FrequencyConvert( 5919.91076338615 ), + FrequencyConvert( 6271.92697570799 ), + FrequencyConvert( 6644.87516127912 ), +}; +
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/Notes.h Sun Jun 09 14:28:53 2013 +0000 @@ -0,0 +1,139 @@ +/* + * SOURCE FILE : Notes.h + * + * Enumeration of notes on a piano keyboard and array + * of notes frequencies for each note. + * + */ + +#ifndef NotesIncluded + + #define NotesIncluded + + #include "Types.h" + + class Notes { + + public : + + enum NoteId { + + NoteEndMarker, + NoteSilent, + + NoteA0, + NoteAS0, + NoteB0, + NoteC0, + NoteCS0, + NoteD0, + NoteDS0, + NoteE0, + NoteF0, + NoteFS0, + NoteG0, + NoteGS0, + + NoteA1, + NoteAS1, + NoteB1, + NoteC1, + NoteCS1, + NoteD1, + NoteDS1, + NoteE1, + NoteF1, + NoteFS1, + NoteG1, + NoteGS1, + + NoteA2, + NoteAS2, + NoteB2, + NoteC2, + NoteCS2, + NoteD2, + NoteDS2, + NoteE2, + NoteF2, + NoteFS2, + NoteG2, + NoteGS2, + + NoteA3, + NoteAS3, + NoteB3, + NoteC3, + NoteCS3, + NoteD3, + NoteDS3, + NoteE3, + NoteF3, + NoteFS3, + NoteG3, + NoteGS3, + + NoteA4, + NoteAS4, + NoteB4, + NoteC4, + NoteCS4, + NoteD4, + NoteDS4, + NoteE4, + NoteF4, + NoteFS4, + NoteG4, + NoteGS4, + + NoteA5, + NoteAS5, + NoteB5, + NoteC5, + NoteCS5, + NoteD5, + NoteDS5, + NoteE5, + NoteF5, + NoteFS5, + NoteG5, + NoteGS5, + + NoteA6, + NoteAS6, + NoteB6, + NoteC6, + NoteCS6, + NoteD6, + NoteDS6, + NoteE6, + NoteF6, + NoteFS6, + NoteG6, + NoteGS6, + + NoteA7, + NoteAS7, + NoteB7, + NoteC7, + NoteCS7, + NoteD7, + NoteDS7, + NoteE7, + NoteF7, + NoteFS7, + NoteG7, + NoteGS7, + + NoteCount // MUST COME LAST! + }; + + // Array of note frequencies. + static const UInt16 NoteFrequencies[ NoteCount ]; + + }; + +#endif + +// End of Notes.h +
--- a/PlayerObject.cpp Sat Jun 08 17:51:33 2013 +0000 +++ b/PlayerObject.cpp Sun Jun 09 14:28:53 2013 +0000 @@ -14,8 +14,8 @@ #endif #include "PlayerObject.h" -// #include "SoundManager.h" -// #include "Sounds.h" +#include "SoundManager.h" +#include "Sounds.h" #include "FrameCounter.h" // Bullet velocity information. @@ -83,9 +83,7 @@ pc.printf( "Bullet started at %d, %d with velocities %d, %d.\r\n", (int)Xco, (int)Yco, (int)pair->X, (int)pair->Y ); #endif // If bullet was started then make a bullet sound. - #if 0 SoundManager::Instance.PlaySound( Sounds::FireGun, 0, 0 ); - #endif } // Reset countdown until another bullet can start. bulletCountdown = 8; @@ -173,10 +171,7 @@ // If it has then you must have passed through a thousand point // boundary so award an extra life but don't let it overflow. if( ( digit != (UInt8)( ( Score & 0xF000 ) >> 12 ) ) && ( Lives < 255 ) ) { -#if 0 SoundManager::Instance.PlaySound( Sounds::ExtraLife, 0, 0 ); -#endif Lives++; } } -
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/SoundManager.cpp Sun Jun 09 14:28:53 2013 +0000 @@ -0,0 +1,129 @@ +/* + * SOURCE FILE : SoundManager.cpp + * + * Responsible for playing simple sounds. + * + */ + +#include "SoundManager.h" +#include "Notes.h" + +// An instance of the SoundManager class. +SoundManager SoundManager::Instance; + +/***************/ +/* CONSTRUCTOR */ +/***************/ +SoundManager::SoundManager() : + gd( (Gameduino*)NULL ) +{ +} + +/*****************************/ +/* UPDATE A SINGLE TUNE SLOT */ +/*****************************/ +// Do NOT call with a record containing zero in TuneAddress (a free slot). +void SoundManager::UpdateTuneSection( UInt8 voiceNum, TuneRecord *rec ) { + if( rec->Countdown > 0 ) { + rec->Countdown--; + } + else { + // Countdown has reached zero. Load next section of tune. + UInt8 noteNum = *(rec->TuneAddress++); + if( noteNum == 0 ) { + // End of tune. Silence voice and set tune address to NULL to + // indicate slot is free. + gd->voice( voiceNum, Gameduino::SineWave, 0, 0, 0 ); + rec->TuneAddress = (UInt8*)NULL; + } + else { + // Convert note number to frequency. + UInt16 frequency = Notes::NoteFrequencies[ noteNum ]; + // Read amplitude for next tune section and add biases. + UInt8 amp = *(rec->TuneAddress++); + // Start playing section. + gd->voice( voiceNum, rec->TuneWaveform, frequency, amp + rec->LeftAmpBias, amp + rec->RightAmpBias ); + // Set countdown according to length of this section. + rec->Countdown = *(rec->TuneAddress++); + } + } +} + +/************************/ +/* TRY AND PLAY A SOUND */ +/************************/ +// Pass address of tune in program memory in tuneAddress. +// Pass bias to apply to left speaker amplitude in leftAmpBias. +// Pass bias to apply to right speaker amplitude in leftAmpBias. +// Returns true if sound was started, false if no sound slots free. +bool SoundManager::PlaySound( const UInt8 *tuneAddress, UInt8 leftAmpBias, UInt8 rightAmpBias ) { + // Find a tune record that is free. + UInt8 i = 0; + TuneRecord *rec = tuneRecords; + while( ( i < VoiceCount ) && ( rec->TuneAddress != (UInt8*)NULL ) ) { + i++; + rec++; + } + if( i < VoiceCount ) { + // Found a free tune record. Initialise it. + rec->TuneWaveform = (Gameduino::WaveForm)*tuneAddress; + rec->TuneAddress = tuneAddress + 1; + rec->LeftAmpBias = leftAmpBias; + rec->RightAmpBias = rightAmpBias; + rec->Countdown = 0; + // Start playing first part of sound. + UpdateTuneSection( FirstVoice + i, rec ); + return true; + } + else { + // No free counter found. + return false; + } +} + +/****************************/ +/* UPDATE PLAYING OF SOUNDS */ +/****************************/ +// Should be called at regular intervals. +void SoundManager::Update( void ) { + TuneRecord *ptr = tuneRecords; + // Repeat for all tune records. + for( UInt8 i = 0; i < VoiceCount; ++i ) { + // Skip over any unused records (with TuneAddress of zero). + if( ptr->TuneAddress != (UInt8*)NULL ) { + UpdateTuneSection( FirstVoice + i, ptr ); + } + ptr++; + } +} + +/**********************************/ +/* COUNT NUMBER OF SOUNDS PLAYING */ +/**********************************/ +// Returns number of sounds playing. +UInt8 SoundManager::CountSoundsPlaying( void ) { + UInt8 count = 0; + TuneRecord *ptr = tuneRecords; + // Repeat for all tune records. + for( UInt8 i = 0; i < VoiceCount; ++i ) { + // If TuneAddress is not zero then increment count. + if( ptr->TuneAddress != (UInt8*)NULL ) { + count++; + } + ptr++; + } + return count; +} + +/******************************/ +/* SILENCE ALL SOUNDS PLAYING */ +/******************************/ +void SoundManager::SilenceAll( void ) { + TuneRecord *ptr = tuneRecords; + for( UInt8 i = 0; i < VoiceCount; ++i ) { + gd->voice( FirstVoice + i, Gameduino::SineWave, 0, 0, 0 ); + ptr->TuneAddress = (UInt8*)NULL; + ptr++; + } +} +
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/SoundManager.h Sun Jun 09 14:28:53 2013 +0000 @@ -0,0 +1,104 @@ +/* + * SOURCE FILE : SoundManager.h + * + * Responsible for playing simple sounds. + * + */ + +#ifndef SoundManagerIncluded + + #define SoundManagerIncluded + + #include <stdio.h> // for NULL + #include "Types.h" // various types + #include "Gameduino.h" // Gameduino stuff + + class SoundManager { + + public : + + // An instance of this class. + static SoundManager Instance; + + /***************/ + /* CONSTRUCTOR */ + /***************/ + SoundManager(); + + /*******************************************/ + /* SET GAMEDUINO THAT WILL PLAY THE SOUNDS */ + /*******************************************/ + // Pass pointer to a Gameduino which will play the sounds. + // You must call this before using other routines. + void SetGameduino( Gameduino *gameduino ) { + gd = gameduino; + } + + /************************/ + /* TRY AND PLAY A SOUND */ + /************************/ + // Pass address of tune in program memory in tuneAddress. + // Pass bias to apply to left speaker amplitude in leftAmpBias. + // Pass bias to apply to right speaker amplitude in leftAmpBias. + // Returns true if sound was started, false if no sound slots free. + bool PlaySound( const UInt8 *tuneAddress, UInt8 leftAmpBias, UInt8 rightAmpBias ); + + /****************************/ + /* UPDATE PLAYING OF SOUNDS */ + /****************************/ + // Should be called at regular intervals. + void Update( void ); + + /**********************************/ + /* COUNT NUMBER OF SOUNDS PLAYING */ + /**********************************/ + // Returns number of sounds playing. + UInt8 CountSoundsPlaying( void ); + + /******************************/ + /* SILENCE ALL SOUNDS PLAYING */ + /******************************/ + void SilenceAll( void ); + + private : + + enum { + FirstVoice = 0, // First Gameduino voice channel used + VoiceCount = 8, // Number of voice channels used + }; + + // Record for tune associated with each voice used. + class TuneRecord { + public : + + TuneRecord() : + TuneAddress( (UInt8*)NULL ) + { + } + + Gameduino::WaveForm TuneWaveform; + UInt8 LeftAmpBias, RightAmpBias; + const UInt8 *TuneAddress; + UInt8 Countdown; + + }; + + // Records used to step through each tune. + // A value of zero in TuneAddress field indicates an unused slot. + TuneRecord tuneRecords[ VoiceCount ]; + + // Gameduino that plays the sounds. + Gameduino *gd; + + /*****************************/ + /* UPDATE A SINGLE TUNE SLOT */ + /*****************************/ + // Do NOT call with a record containing zero in TuneAddress (a free slot). + void UpdateTuneSection( UInt8 voiceNum, TuneRecord *rec ); + + }; + +#endif + +/* END of SoundManager.h */ +
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/Sounds.cpp Sun Jun 09 14:28:53 2013 +0000 @@ -0,0 +1,157 @@ +/* + * SOURCE FILE : Sounds.cpp + * + * Various sounds in program memory. + * + */ + +#include "Sounds.h" +#include "Gameduino.h" +#include "Notes.h" + +const UInt8 Sounds::FireGun[] = { + Gameduino::WhiteNoise, // waveform + Notes::NoteD1, 15, 10, // frequency, amplitude, duration + Notes::NoteC1, 12, 5, + Notes::NoteB1, 9, 5, + Notes::NoteA1, 6, 5, + Notes::NoteEndMarker +}; + +const UInt8 Sounds::Explosion[] = { + Gameduino::WhiteNoise, // waveform + Notes::NoteD0, 15, 20, // frequency, amplitude, duration + Notes::NoteC0, 12, 5, + Notes::NoteB0, 9, 5, + Notes::NoteA0, 6, 5, + Notes::NoteEndMarker +}; + +const UInt8 Sounds::RescueHuman[] = { + Gameduino::SineWave, // waveform + Notes::NoteG4, 15, 5, // frequency, amplitude, duration + Notes::NoteCS5, 15, 5, + Notes::NoteG5, 15, 5, + Notes::NoteEndMarker +}; + +const UInt8 Sounds::HumanDies[] = { + Gameduino::SineWave, // waveform + Notes::NoteC5, 15, 5, // frequency, amplitude, duration + Notes::NoteAS5, 15, 5, + Notes::NoteC5, 15, 5, + Notes::NoteAS5, 15, 5, + Notes::NoteC5, 15, 5, + Notes::NoteAS5, 15, 5, + Notes::NoteG4, 15, 5, + Notes::NoteDS4, 15, 5, + Notes::NoteC4, 15, 5, + Notes::NoteAS4, 15, 5, + Notes::NoteG3, 15, 5, + Notes::NoteEndMarker +}; + +const UInt8 Sounds::PlayerDead[] = { + Gameduino::SineWave, // waveform + Notes::NoteA4, 20, 39, // frequency, amplitude, duration + Notes::NoteSilent, 0, 1, + Notes::NoteA4, 20, 29, + Notes::NoteSilent, 0, 1, + Notes::NoteA4, 20, 9, + Notes::NoteSilent, 0, 1, + Notes::NoteA4, 20, 39, + Notes::NoteSilent, 0, 1, + Notes::NoteC4, 20, 29, + Notes::NoteSilent, 0, 1, + Notes::NoteB4, 20, 9, + Notes::NoteSilent, 0, 1, + Notes::NoteB4, 20, 29, + Notes::NoteSilent, 0, 1, + Notes::NoteA4, 20, 9, + Notes::NoteSilent, 0, 1, + Notes::NoteA4, 20, 29, + Notes::NoteSilent, 0, 1, + Notes::NoteGS3, 20, 9, + Notes::NoteSilent, 0, 1, + Notes::NoteA4, 20, 79, + Notes::NoteEndMarker +}; + +const UInt8 Sounds::StartLevel[] = { + Gameduino::SineWave, // waveform + + Notes::NoteG0, 20, 2, // frequency, amplitude, duration + Notes::NoteB1, 20, 2, + Notes::NoteD1, 20, 2, + Notes::NoteC1, 20, 2, + Notes::NoteE1, 20, 2, + Notes::NoteG1, 20, 2, + Notes::NoteFS1, 20, 2, + Notes::NoteA2, 20, 2, + Notes::NoteC2, 20, 2, + + Notes::NoteG1, 20, 2, // frequency, amplitude, duration + Notes::NoteB2, 20, 2, + Notes::NoteD2, 20, 2, + Notes::NoteC2, 20, 2, + Notes::NoteE2, 20, 2, + Notes::NoteG2, 20, 2, + Notes::NoteFS2, 20, 2, + Notes::NoteA3, 20, 2, + Notes::NoteC3, 20, 2, + + Notes::NoteG2, 20, 2, // frequency, amplitude, duration + Notes::NoteB3, 20, 2, + Notes::NoteD3, 20, 2, + Notes::NoteC3, 20, 2, + Notes::NoteE3, 20, 2, + Notes::NoteG3, 20, 2, + Notes::NoteFS3, 20, 2, + Notes::NoteA4, 20, 2, + Notes::NoteC4, 20, 2, + + Notes::NoteG3, 20, 2, // frequency, amplitude, duration + Notes::NoteB4, 20, 2, + Notes::NoteD4, 20, 2, + Notes::NoteC4, 20, 2, + Notes::NoteE4, 20, 2, + Notes::NoteG4, 20, 2, + Notes::NoteFS4, 20, 2, + Notes::NoteA5, 20, 2, + Notes::NoteC5, 20, 2, + + Notes::NoteG4, 20, 2, // frequency, amplitude, duration + Notes::NoteB5, 20, 2, + Notes::NoteD5, 20, 2, + Notes::NoteC5, 20, 2, + Notes::NoteE5, 20, 2, + Notes::NoteG5, 20, 2, + Notes::NoteFS5, 20, 2, + Notes::NoteA6, 20, 2, + Notes::NoteC6, 20, 2, + + Notes::NoteG5, 20, 2, // frequency, amplitude, duration + Notes::NoteB6, 20, 2, + Notes::NoteD6, 20, 2, + Notes::NoteG6, 20, 20, + Notes::NoteSilent, 0, 10, + Notes::NoteG6, 20, 20, + Notes::NoteSilent, 0, 10, + Notes::NoteG6, 20, 20, + + Notes::NoteEndMarker +}; + +const UInt8 Sounds::ExtraLife[] = { + Gameduino::SineWave, // waveform + Notes::NoteG5, 15, 5, // frequency, amplitude, duration + Notes::NoteCS6, 15, 5, + Notes::NoteG6, 15, 5, + Notes::NoteG5, 15, 5, + Notes::NoteCS6, 15, 5, + Notes::NoteG6, 15, 5, + Notes::NoteG5, 15, 5, + Notes::NoteCS6, 15, 5, + Notes::NoteG6, 15, 5, + Notes::NoteEndMarker +};
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/Sounds.h Sun Jun 09 14:28:53 2013 +0000 @@ -0,0 +1,31 @@ +/* + * SOURCE FILE : Sounds.h + * + * Various sounds in program memory. + * + */ + +#ifndef SoundsIncluded + + #define SoundsIncluded + + #include "Types.h" + + class Sounds { + + public : + + static const UInt8 FireGun[]; + static const UInt8 Explosion[]; + static const UInt8 RescueHuman[]; + static const UInt8 PlayerDead[]; + static const UInt8 StartLevel[]; + static const UInt8 ExtraLife[]; + static const UInt8 HumanDies[]; + + }; + +#endif + +/* END of Sounds.h */ +