Platform game written for the GHI/OutrageousCircuits RETRO game device. Navigate the caves collecting all the pickups and avoiding the creatures and haunted mine carts that patrol the caves. Oh and remember to watch out for the poisonous plants... This game demonstrates the ability to have multiple animated sprites where the sprites can overlap the background environment. See how the player moves past the fence and climbs the wall in the 3rd screen.
OneBitSound/SoundChannel.h@3:a93fe5f207f5, 2014-12-27 (annotated)
- Committer:
- taylorza
- Date:
- Sat Dec 27 23:24:30 2014 +0000
- Revision:
- 3:a93fe5f207f5
Working before fixed point audio
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
taylorza | 3:a93fe5f207f5 | 1 | #ifndef __SOUNDCHANNEL_H__ |
taylorza | 3:a93fe5f207f5 | 2 | #define __SOUNDCHANNEL_H__ |
taylorza | 3:a93fe5f207f5 | 3 | class SoundChannel |
taylorza | 3:a93fe5f207f5 | 4 | { |
taylorza | 3:a93fe5f207f5 | 5 | public: |
taylorza | 3:a93fe5f207f5 | 6 | SoundChannel(); |
taylorza | 3:a93fe5f207f5 | 7 | |
taylorza | 3:a93fe5f207f5 | 8 | protected: |
taylorza | 3:a93fe5f207f5 | 9 | void play(const SoundBlock soundBlocks[], int count); |
taylorza | 3:a93fe5f207f5 | 10 | bool update(bool &pinState); |
taylorza | 3:a93fe5f207f5 | 11 | |
taylorza | 3:a93fe5f207f5 | 12 | private: |
taylorza | 3:a93fe5f207f5 | 13 | void updateTone(); |
taylorza | 3:a93fe5f207f5 | 14 | void updateNoise(); |
taylorza | 3:a93fe5f207f5 | 15 | |
taylorza | 3:a93fe5f207f5 | 16 | void startSoundBlock(); |
taylorza | 3:a93fe5f207f5 | 17 | bool updateCounters(); |
taylorza | 3:a93fe5f207f5 | 18 | void updateAudioCounters(); |
taylorza | 3:a93fe5f207f5 | 19 | |
taylorza | 3:a93fe5f207f5 | 20 | static uint16_t lfsr_rand(); |
taylorza | 3:a93fe5f207f5 | 21 | |
taylorza | 3:a93fe5f207f5 | 22 | private: |
taylorza | 3:a93fe5f207f5 | 23 | int _state; |
taylorza | 3:a93fe5f207f5 | 24 | uint16_t _stepCounter; |
taylorza | 3:a93fe5f207f5 | 25 | uint16_t _stepDurationCounter; |
taylorza | 3:a93fe5f207f5 | 26 | uint32_t _basePitchHighCount; |
taylorza | 3:a93fe5f207f5 | 27 | uint32_t _basePitchLowCount; |
taylorza | 3:a93fe5f207f5 | 28 | int32_t _pitchHighCounter; |
taylorza | 3:a93fe5f207f5 | 29 | int32_t _pitchLowCounter; |
taylorza | 3:a93fe5f207f5 | 30 | int16_t _pitchOffset; |
taylorza | 3:a93fe5f207f5 | 31 | int8_t _dutyOffset; |
taylorza | 3:a93fe5f207f5 | 32 | |
taylorza | 3:a93fe5f207f5 | 33 | const SoundBlock *_soundBlocks; |
taylorza | 3:a93fe5f207f5 | 34 | int _count; |
taylorza | 3:a93fe5f207f5 | 35 | int _index; |
taylorza | 3:a93fe5f207f5 | 36 | bool _pinState; |
taylorza | 3:a93fe5f207f5 | 37 | |
taylorza | 3:a93fe5f207f5 | 38 | SoundBlock _currentSoundBlock; |
taylorza | 3:a93fe5f207f5 | 39 | |
taylorza | 3:a93fe5f207f5 | 40 | friend class OneBitSound; |
taylorza | 3:a93fe5f207f5 | 41 | }; |
taylorza | 3:a93fe5f207f5 | 42 | #endif //__SOUNDCHANNEL_H__ |