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.
OneBitSound/SoundBlock.cpp@0:d85c449aca6d, 2015-01-28 (annotated)
- Committer:
- taylorza
- Date:
- Wed Jan 28 03:26:07 2015 +0000
- Revision:
- 0:d85c449aca6d
Working maze scrolling, pre-maze compression
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
taylorza | 0:d85c449aca6d | 1 | #include "mbed.h" |
taylorza | 0:d85c449aca6d | 2 | #include "Fix16.h" |
taylorza | 0:d85c449aca6d | 3 | #include "SoundBlock.h" |
taylorza | 0:d85c449aca6d | 4 | |
taylorza | 0:d85c449aca6d | 5 | SoundBlock::SoundBlock(ToneType toneType, uint16_t stepCount, uint16_t stepDuration, uint16_t pitch, int16_t pitchSlide, uint8_t duty, int8_t dutySlide) |
taylorza | 0:d85c449aca6d | 6 | { |
taylorza | 0:d85c449aca6d | 7 | initialize(toneType, stepCount, stepDuration, pitch, pitchSlide, duty, dutySlide); |
taylorza | 0:d85c449aca6d | 8 | } |
taylorza | 0:d85c449aca6d | 9 | |
taylorza | 0:d85c449aca6d | 10 | SoundBlock::SoundBlock(ToneType toneType, uint16_t stepCount, uint16_t stepDuration) |
taylorza | 0:d85c449aca6d | 11 | { |
taylorza | 0:d85c449aca6d | 12 | initialize(toneType, stepCount, stepDuration, 0, 0, 128, 0); |
taylorza | 0:d85c449aca6d | 13 | } |
taylorza | 0:d85c449aca6d | 14 | |
taylorza | 0:d85c449aca6d | 15 | SoundBlock::SoundBlock() {} |
taylorza | 0:d85c449aca6d | 16 | |
taylorza | 0:d85c449aca6d | 17 | void SoundBlock::initialize(ToneType toneType, uint16_t stepCount, uint16_t stepDuration, uint16_t pitch, int16_t pitchSlide, uint8_t duty, int8_t dutySlide) |
taylorza | 0:d85c449aca6d | 18 | { |
taylorza | 0:d85c449aca6d | 19 | _toneType = toneType; |
taylorza | 0:d85c449aca6d | 20 | |
taylorza | 0:d85c449aca6d | 21 | _stepCount = stepCount; |
taylorza | 0:d85c449aca6d | 22 | _stepDuration = stepDuration; |
taylorza | 0:d85c449aca6d | 23 | _pitch = fix16_from(pitch); |
taylorza | 0:d85c449aca6d | 24 | _pitchSlide = fix16_from(pitchSlide); |
taylorza | 0:d85c449aca6d | 25 | _duty = duty; |
taylorza | 0:d85c449aca6d | 26 | _dutySlide = dutySlide; |
taylorza | 0:d85c449aca6d | 27 | } |
taylorza | 0:d85c449aca6d | 28 |