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
This commit is contained in:
Michael Sevakis 2008-12-14 11:42:47 +00:00
parent a89837ac61
commit 26bf32c8aa
2 changed files with 13 additions and 12 deletions

View file

@ -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;