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/SoundBlock.cpp
- Revision:
- 0:d85c449aca6d
diff -r 000000000000 -r d85c449aca6d OneBitSound/SoundBlock.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/OneBitSound/SoundBlock.cpp Wed Jan 28 03:26:07 2015 +0000 @@ -0,0 +1,28 @@ +#include "mbed.h" +#include "Fix16.h" +#include "SoundBlock.h" + +SoundBlock::SoundBlock(ToneType toneType, uint16_t stepCount, uint16_t stepDuration, uint16_t pitch, int16_t pitchSlide, uint8_t duty, int8_t dutySlide) +{ + initialize(toneType, stepCount, stepDuration, pitch, pitchSlide, duty, dutySlide); +} + +SoundBlock::SoundBlock(ToneType toneType, uint16_t stepCount, uint16_t stepDuration) +{ + initialize(toneType, stepCount, stepDuration, 0, 0, 128, 0); +} + +SoundBlock::SoundBlock() {} + +void SoundBlock::initialize(ToneType toneType, uint16_t stepCount, uint16_t stepDuration, uint16_t pitch, int16_t pitchSlide, uint8_t duty, int8_t dutySlide) +{ + _toneType = toneType; + + _stepCount = stepCount; + _stepDuration = stepDuration; + _pitch = fix16_from(pitch); + _pitchSlide = fix16_from(pitchSlide); + _duty = duty; + _dutySlide = dutySlide; +} +