From 9290ccc988ff24b4cfd95a5b0ea4eba1c513a6d3 Mon Sep 17 00:00:00 2001 From: bsongis Date: Mon, 21 Jan 2013 07:27:35 +0000 Subject: [PATCH] [X9D] Volume fixed --- src/x9d/audio_driver.h | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/src/x9d/audio_driver.h b/src/x9d/audio_driver.h index c4beed3ed..ce59ceb59 100644 --- a/src/x9d/audio_driver.h +++ b/src/x9d/audio_driver.h @@ -85,8 +85,14 @@ inline uint16_t dacQueue(uint16_t *data, uint16_t size) } } +static const int8_t volumeScale[NUM_VOL_LEVELS] = +{ + 0, 2, 4, 6, 8, 10, 13, 17, 22, 27, 33, 40, + 64, 82, 96, 105, 112, 117, 120, 122, 124, 125, 126, 127 +} ; + #if !defined(SIMU) -#define setVolume(v) I2C_set_volume(v) +#define setVolume(v) I2C_set_volume(volumeScale[min(v, NUM_VOL_LEVELS-1)]) #else #define setVolume(v) #endif