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.

Dependencies:   mbed

OneBitSound/SoundChannel.h

Committer:
taylorza
Date:
2015-02-16
Revision:
16:f9227904afc4
Parent:
5:a758c7d4da03

File content as of revision 16:f9227904afc4:

#ifndef __SOUNDCHANNEL_H__
#define __SOUNDCHANNEL_H__
class SoundChannel
{   
public: 
    SoundChannel();
    
    protected:
        void play(const SoundBlock soundBlocks[], int count);
        bool update(bool &pinState);            
    
    private:
        void updateTone();
        void updateNoise();
        
        void startSoundBlock();
        bool updateCounters();
        void updateAudioCounters();
        
        static uint16_t lfsr_rand();
        
    private:
        int         _state;
        uint16_t    _stepCounter;
        uint16_t    _stepDurationCounter;
        fix16_t     _basePitchHighCount;
        fix16_t     _basePitchLowCount;
        fix16_t     _pitchHighCounter;
        fix16_t     _pitchLowCounter;
        fix16_t     _pitchOffset;
        fix16_t     _dutyOffset;
        
        const SoundBlock *_soundBlocks;        
        int         _count;
        int         _index;  
        bool        _pinState;
        
        SoundBlock  _currentSoundBlock;
        
    friend class OneBitSound;           
};
#endif //__SOUNDCHANNEL_H__