summaryrefslogtreecommitdiff
path: root/apps
diff options
context:
space:
mode:
authorLinus Nielsen Feltzing <linus@haxx.se>2006-01-10 22:22:19 +0000
committerLinus Nielsen Feltzing <linus@haxx.se>2006-01-10 22:22:19 +0000
commitbefd0ac3a61b70a86ee909ebb9dd59e074a9f9e8 (patch)
treeea3f7a06ada3ae4bc3e1adfce1e59f445cff55c6 /apps
parentcf218e33eca3abcc1067b9e78f1c82510bfe7c69 (diff)
Correct metronome sound on PCM playback targets
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@8325 a1c6a512-1295-4272-9138-f99709370657
Diffstat (limited to 'apps')
-rw-r--r--apps/plugins/metronome.c17
1 files changed, 15 insertions, 2 deletions
diff --git a/apps/plugins/metronome.c b/apps/plugins/metronome.c
index 587d9f5fe1..c1e156075b 100644
--- a/apps/plugins/metronome.c
+++ b/apps/plugins/metronome.c
@@ -711,11 +711,23 @@ static signed short sound[] = {
int tock;
+short sndbuf[sizeof(sound)*2];
+
+/* Convert the mono "tock" sample to interleaved stereo */
+void prepare_tock(void)
+{
+ int i;
+ for(i = 0;i < (int)sizeof(sound)/2;i++) {
+ sndbuf[i*2] = sound[i];
+ sndbuf[i*2+1] = sound[i];
+ }
+}
+
void callback_pcm(unsigned char** start, long* size)
{
if(sound_active) {
- *start = (unsigned char *)sound;
- *size = sizeof(sound);
+ *start = (unsigned char *)sndbuf;
+ *size = sizeof(sndbuf);
sound_active = false;
}
}
@@ -876,6 +888,7 @@ enum plugin_status plugin_start(struct plugin_api* api, void* parameter){
#if CONFIG_CODEC != SWCODEC
rb->bitswap(sound, sizeof(sound));
#else
+ prepare_tock();
rb->pcm_set_frequency(44100);
#endif