Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
Diff: OneBitSound/SoundChannel.h
- Revision:
- 0:d85c449aca6d
diff -r 000000000000 -r d85c449aca6d OneBitSound/SoundChannel.h
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/OneBitSound/SoundChannel.h Wed Jan 28 03:26:07 2015 +0000
@@ -0,0 +1,42 @@
+#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__
\ No newline at end of file