Commit Graph

5 Commits

Author SHA1 Message Date
Jeff Epler fae6e29546 nrf: PWMAudioOut: deactivate PWM when deinitting self
.. otherwise, when an AudioPWMOut object was deinitted without being
explicitly stop()ped, it would use up a slot in active_audio[]; the
5th iteration would create a non-working audio object which would just
buzz instead of playing the right thing.

Closes: #2203
2019-10-12 14:01:35 +09:00
Jeff Epler ef459326cb nrf: PWMAudioOut: coding style 2019-10-12 13:57:31 +09:00
Jeff Epler 77bc1ba03e nrf: PWMAudioOut: Remove the need to wait in "pause"
The original formulation was because I saw the need to avoid a transition
from playing to stopped exactly when a resume was taking place.  However,
@tannewt was concerned about this pause causing trouble, because it could
be relatively lengthy (several ms even in a typical case).

After reflection, I've convinced myself that updating the registers
in this order in resume avoids a window where a "stopped" event can
be missed as long as the shortcut is updated first.

Testing re-performed: pause/resume testing of looped RawSample and
WaveFile audio sources.
2019-08-03 08:19:25 -05:00
Jeff Epler 76f65ac694 Implement play/pause
.. and also incidentally fix a problem where a RawSample could only
be looped 131070 times.
2019-07-31 20:02:56 -05:00
Jeff Epler b72352949b PWM audio: Rename AudioOut -> PWMAudioOut, _audioio_ -> _audiopwmio_ 2019-07-29 18:39:00 -04:00