summaryrefslogtreecommitdiff
path: root/apps/pcmbuf.c
diff options
context:
space:
mode:
authorMichael Sevakis <jethead71@rockbox.org>2008-12-14 11:42:47 +0000
committerMichael Sevakis <jethead71@rockbox.org>2008-12-14 11:42:47 +0000
commit26bf32c8aacb115528fafae552d576227b08ea7a (patch)
tree64e0a4fba6576ebf0b4c23882351a1fb70710929 /apps/pcmbuf.c
parenta89837ac61c75e335cbb1d722872bb8ae9cbc9b8 (diff)
Check that PCM is playing/recording *after* getting the current position from the hardware layer.
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@19435 a1c6a512-1295-4272-9138-f99709370657
Diffstat (limited to 'apps/pcmbuf.c')
-rw-r--r--apps/pcmbuf.c5
1 files changed, 3 insertions, 2 deletions
diff --git a/apps/pcmbuf.c b/apps/pcmbuf.c
index b22fd789a6..095b5209eb 100644
--- a/apps/pcmbuf.c
+++ b/apps/pcmbuf.c
@@ -978,8 +978,9 @@ void pcmbuf_beep(unsigned int frequency, size_t duration, int amplitude)
/* Get the currently playing chunk at the current position. */
bufstart = (int16_t *)pcm_play_dma_get_peak_buffer(&i);
- if (!bufstart)
- return; /* If above isn't implemented, no beepeth */
+ /* If above isn't implemented or pcm is stopped, no beepeth. */
+ if (!bufstart || !pcm_is_playing())
+ return;
/* Give 5ms clearance. */
bufstart += NATIVE_FREQUENCY * 4 / 200;