diff options
author | Alexander Levin <al.le@rockbox.org> | 2009-07-11 16:46:19 +0000 |
---|---|---|
committer | Alexander Levin <al.le@rockbox.org> | 2009-07-11 16:46:19 +0000 |
commit | cc7c665d9b5e6d801f248799dabe05e3729bb1c8 (patch) | |
tree | 3c82c6774acc78e814bad736496c693877295866 /firmware/sound.c | |
parent | 17ac0d7ff9604664a1894fd49883e44291f06451 (diff) | |
download | rockbox-cc7c665d9b5e6d801f248799dabe05e3729bb1c8.tar.gz 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.c | 19 |
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 @@ | |||
25 | #include "sound.h" | 25 | #include "sound.h" |
26 | #include "logf.h" | 26 | #include "logf.h" |
27 | #include "system.h" | 27 | #include "system.h" |
28 | /* for the pitch and speed precision #defines: */ | ||
29 | #include "pitchscreen.h" | ||
28 | #ifndef SIMULATOR | 30 | #ifndef SIMULATOR |
29 | #include "i2c.h" | 31 | #include "i2c.h" |
30 | #include "mas.h" | 32 | #include "mas.h" |
@@ -159,6 +161,7 @@ sound_set_type* sound_get_fn(int setting) | |||
159 | 161 | ||
160 | #if CONFIG_CODEC == SWCODEC | 162 | #if CONFIG_CODEC == SWCODEC |
161 | /* Copied from dsp.h, nasty nasty, but we don't want to include dsp.h */ | 163 | /* Copied from dsp.h, nasty nasty, but we don't want to include dsp.h */ |
164 | |||
162 | enum { | 165 | enum { |
163 | DSP_CALLBACK_SET_PRESCALE = 0, | 166 | DSP_CALLBACK_SET_PRESCALE = 0, |
164 | DSP_CALLBACK_SET_BASS, | 167 | DSP_CALLBACK_SET_BASS, |
@@ -698,18 +701,18 @@ int sound_val2phys(int setting, int value) | |||
698 | crystal frequency than we actually have. It will adjust its internal | 701 | crystal frequency than we actually have. It will adjust its internal |
699 | parameters and the result is that the audio is played at another pitch. | 702 | parameters and the result is that the audio is played at another pitch. |
700 | 703 | ||
701 | The pitch value is in tenths of percent. | 704 | The pitch value precision is based on PITCH_SPEED_PRECISION (in dsp.h) |
702 | */ | 705 | */ |
703 | static int last_pitch = 1000; | 706 | static int last_pitch = PITCH_SPEED_100; |
704 | 707 | ||
705 | void sound_set_pitch(int pitch) | 708 | void sound_set_pitch(int32_t pitch) |
706 | { | 709 | { |
707 | unsigned long val; | 710 | unsigned long val; |
708 | 711 | ||
709 | if (pitch != last_pitch) | 712 | if (pitch != last_pitch) |
710 | { | 713 | { |
711 | /* Calculate the new (bogus) frequency */ | 714 | /* Calculate the new (bogus) frequency */ |
712 | val = 18432 * 1000 / pitch; | 715 | val = 18432 * PITCH_SPEED_100 / pitch; |
713 | 716 | ||
714 | mas_writemem(MAS_BANK_D0, MAS_D0_OFREQ_CONTROL, &val, 1); | 717 | mas_writemem(MAS_BANK_D0, MAS_D0_OFREQ_CONTROL, &val, 1); |
715 | 718 | ||
@@ -721,19 +724,19 @@ void sound_set_pitch(int pitch) | |||
721 | } | 724 | } |
722 | } | 725 | } |
723 | 726 | ||
724 | int sound_get_pitch(void) | 727 | int32_t sound_get_pitch(void) |
725 | { | 728 | { |
726 | return last_pitch; | 729 | return last_pitch; |
727 | } | 730 | } |
728 | #else /* SIMULATOR */ | 731 | #else /* SIMULATOR */ |
729 | void sound_set_pitch(int pitch) | 732 | void sound_set_pitch(int32_t pitch) |
730 | { | 733 | { |
731 | (void)pitch; | 734 | (void)pitch; |
732 | } | 735 | } |
733 | 736 | ||
734 | int sound_get_pitch(void) | 737 | int32_t sound_get_pitch(void) |
735 | { | 738 | { |
736 | return 1000; | 739 | return PITCH_SPEED_100; |
737 | } | 740 | } |
738 | #endif /* SIMULATOR */ | 741 | #endif /* SIMULATOR */ |
739 | #endif /* (CONFIG_CODEC == MAS3587F) || (CONFIG_CODEC == MAS3539F) */ | 742 | #endif /* (CONFIG_CODEC == MAS3587F) || (CONFIG_CODEC == MAS3539F) */ |