After decimating the enemy forces that have attacked your ship, you are charged with taking out as many of the remaining enemy fighters as possible. 3d space fighter game was initially written while I was testing some 3d routines I was implementing for a flight simulator, but my daughter started playing it and seemed to enjoy it so I added a few sound effects, explosions etc. and so this little game was born.

Dependencies:   mbed

Files at this revision

API Documentation at this revision

Comitter:
taylorza
Date:
Sun Feb 08 01:38:18 2015 +0000
Parent:
3:421ecc846d15
Commit message:
Removed duty lookup table

Changed in this revision

OneBitSound/SoundChannel.cpp Show annotated file Show diff for this revision Revisions of this file
OneBitSound/lookupTables.h Show diff for this revision Revisions of this file
--- a/OneBitSound/SoundChannel.cpp	Sun Feb 01 00:43:36 2015 +0000
+++ b/OneBitSound/SoundChannel.cpp	Sun Feb 08 01:38:18 2015 +0000
@@ -1,6 +1,5 @@
 #include "mbed.h"
 #include "Fix16.h"
-#include "lookupTables.h"
 #include "SoundBlock.h"
 #include "SoundChannel.h"
 
@@ -156,7 +155,7 @@
     if (_currentSoundBlock.getToneType() == SoundBlock::Noise)
         pitch = fix16_div(pitch, fix16_100);
         
-    _basePitchHighCount = fix16_mul(pitch, g_dutyLookup[_currentSoundBlock.getDuty(_dutyOffset)]);
+    _basePitchHighCount = fix16_mul(pitch, _currentSoundBlock.getDuty(_dutyOffset) * 0x100);
     _basePitchLowCount = pitch - _basePitchHighCount;    
 }
 
--- a/OneBitSound/lookupTables.h	Sun Feb 01 00:43:36 2015 +0000
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,19 +0,0 @@
-static const fix16_t g_dutyLookup[] = 
-{
-    0x0,0x100,0x200,0x300,0x400,0x500,0x600,0x700,0x800,0x900,0xa00,0xb00,0xc00,0xd00,0xe00,0xf00,
-    0x1000,0x1100,0x1200,0x1300,0x1400,0x1500,0x1600,0x1700,0x1800,0x1900,0x1a00,0x1b00,0x1c00,0x1d00,0x1e00,0x1f00,
-    0x2000,0x2100,0x2200,0x2300,0x2400,0x2500,0x2600,0x2700,0x2800,0x2900,0x2a00,0x2b00,0x2c00,0x2d00,0x2e00,0x2f00,
-    0x3000,0x3100,0x3200,0x3300,0x3400,0x3500,0x3600,0x3700,0x3800,0x3900,0x3a00,0x3b00,0x3c00,0x3d00,0x3e00,0x3f00,
-    0x4000,0x4100,0x4200,0x4300,0x4400,0x4500,0x4600,0x4700,0x4800,0x4900,0x4a00,0x4b00,0x4c00,0x4d00,0x4e00,0x4f00,
-    0x5000,0x5100,0x5200,0x5300,0x5400,0x5500,0x5600,0x5700,0x5800,0x5900,0x5a00,0x5b00,0x5c00,0x5d00,0x5e00,0x5f00,
-    0x6000,0x6100,0x6200,0x6300,0x6400,0x6500,0x6600,0x6700,0x6800,0x6900,0x6a00,0x6b00,0x6c00,0x6d00,0x6e00,0x6f00,
-    0x7000,0x7100,0x7200,0x7300,0x7400,0x7500,0x7600,0x7700,0x7800,0x7900,0x7a00,0x7b00,0x7c00,0x7d00,0x7e00,0x7f00,
-    0x8000,0x8100,0x8200,0x8300,0x8400,0x8500,0x8600,0x8700,0x8800,0x8900,0x8a00,0x8b00,0x8c00,0x8d00,0x8e00,0x8f00,
-    0x9000,0x9100,0x9200,0x9300,0x9400,0x9500,0x9600,0x9700,0x9800,0x9900,0x9a00,0x9b00,0x9c00,0x9d00,0x9e00,0x9f00,
-    0xa000,0xa100,0xa200,0xa300,0xa400,0xa500,0xa600,0xa700,0xa800,0xa900,0xaa00,0xab00,0xac00,0xad00,0xae00,0xaf00,
-    0xb000,0xb100,0xb200,0xb300,0xb400,0xb500,0xb600,0xb700,0xb800,0xb900,0xba00,0xbb00,0xbc00,0xbd00,0xbe00,0xbf00,
-    0xc000,0xc100,0xc200,0xc300,0xc400,0xc500,0xc600,0xc700,0xc800,0xc900,0xca00,0xcb00,0xcc00,0xcd00,0xce00,0xcf00,
-    0xd000,0xd100,0xd200,0xd300,0xd400,0xd500,0xd600,0xd700,0xd800,0xd900,0xda00,0xdb00,0xdc00,0xdd00,0xde00,0xdf00,
-    0xe000,0xe100,0xe200,0xe300,0xe400,0xe500,0xe600,0xe700,0xe800,0xe900,0xea00,0xeb00,0xec00,0xed00,0xee00,0xef00,
-    0xf000,0xf100,0xf200,0xf300,0xf400,0xf500,0xf600,0xf700,0xf800,0xf900,0xfa00,0xfb00,0xfc00,0xfd00,0xfe00,0xff00,
-};
\ No newline at end of file