summaryrefslogtreecommitdiffstats
path: root/firmware/sound.c
diff options
context:
space:
mode:
authorAlexander Levin <al.le@rockbox.org>2009-07-11 16:46:19 +0000
committerAlexander Levin <al.le@rockbox.org>2009-07-11 16:46:19 +0000
commitcc7c665d9b5e6d801f248799dabe05e3729bb1c8 (patch)
tree3c82c6774acc78e814bad736496c693877295866 /firmware/sound.c
parent17ac0d7ff9604664a1894fd49883e44291f06451 (diff)
downloadrockbox-cc7c665d9b5e6d801f248799dabe05e3729bb1c8.tar.gz
rockbox-cc7c665d9b5e6d801f248799dabe05e3729bb1c8.tar.bz2
rockbox-cc7c665d9b5e6d801f248799dabe05e3729bb1c8.zip
Improvements to the pitch screen UI (FS#10359 by David Johnston)
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@21781 a1c6a512-1295-4272-9138-f99709370657
Diffstat (limited to 'firmware/sound.c')
-rw-r--r--firmware/sound.c19
1 files changed, 11 insertions, 8 deletions
diff --git a/firmware/sound.c b/firmware/sound.c
index f4a2f87ca5..6a2f03df00 100644
--- a/firmware/sound.c
+++ b/firmware/sound.c
@@ -25,6 +25,8 @@
#include "sound.h"
#include "logf.h"
#include "system.h"
+/* for the pitch and speed precision #defines: */
+#include "pitchscreen.h"
#ifndef SIMULATOR
#include "i2c.h"
#include "mas.h"
@@ -159,6 +161,7 @@ sound_set_type* sound_get_fn(int setting)
#if CONFIG_CODEC == SWCODEC
/* Copied from dsp.h, nasty nasty, but we don't want to include dsp.h */
+
enum {
DSP_CALLBACK_SET_PRESCALE = 0,
DSP_CALLBACK_SET_BASS,
@@ -698,18 +701,18 @@ int sound_val2phys(int setting, int value)
crystal frequency than we actually have. It will adjust its internal
parameters and the result is that the audio is played at another pitch.
- The pitch value is in tenths of percent.
+ The pitch value precision is based on PITCH_SPEED_PRECISION (in dsp.h)
*/
-static int last_pitch = 1000;
+static int last_pitch = PITCH_SPEED_100;
-void sound_set_pitch(int pitch)
+void sound_set_pitch(int32_t pitch)
{
unsigned long val;
if (pitch != last_pitch)
{
/* Calculate the new (bogus) frequency */
- val = 18432 * 1000 / pitch;
+ val = 18432 * PITCH_SPEED_100 / pitch;
mas_writemem(MAS_BANK_D0, MAS_D0_OFREQ_CONTROL, &val, 1);
@@ -721,19 +724,19 @@ void sound_set_pitch(int pitch)
}
}
-int sound_get_pitch(void)
+int32_t sound_get_pitch(void)
{
return last_pitch;
}
#else /* SIMULATOR */
-void sound_set_pitch(int pitch)
+void sound_set_pitch(int32_t pitch)
{
(void)pitch;
}
-int sound_get_pitch(void)
+int32_t sound_get_pitch(void)
{
- return 1000;
+ return PITCH_SPEED_100;
}
#endif /* SIMULATOR */
#endif /* (CONFIG_CODEC == MAS3587F) || (CONFIG_CODEC == MAS3539F) */