blow is the output of bass mid treb:
bass        mid      treb
0.875562, 2.837142, 3.324385
1.810086, 1.343698, 3.975147
0.588209, 1.993805, 5.159028
2.064919, 2.064337, 1.319500
1.914740, 1.852213, 1.077198
0.120748, 2.099725, 9.086357
0.038853, 0.507175, 4.591012
0.083254, 2.366420, 7.137532
2.098818, 1.917822, 1.701536
2.109711, 1.425635, 0.479246
0.063677, 2.136738, 11.364171
0.034193, 1.012987, 15.184698
0.080345, 1.995278, 14.193623
1.757692, 1.649233, 4.319139
1.246085, 0.817685, 5.233008
---
 src/gui/audio.c |   43 ++++++++++++++++++++++++++++++++++++++++---
 1 files changed, 40 insertions(+), 3 deletions(-)

diff --git a/src/gui/audio.c b/src/gui/audio.c
index 4f30c0f..774cce1 100644
--- a/src/gui/audio.c
+++ b/src/gui/audio.c
@@ -33,6 +33,8 @@
 #include "flash.h"
 #include "about.h"
 #include "audio.h"
+#include "../input.h"
+#include "../renderer/sampler.h"
 
 static int appid;
 
@@ -43,6 +45,34 @@ static int line_mute;
 static int mic_vol;
 static int mic_mute;
 
+static float bass, mid, treb;
+
+static void sampler_callback(struct frame_descriptor *frd)
+{
+       bass = frd->bass;
+       mid = frd->mid;
+       treb = frd->treb;
+
+       sampler_return(frd);
+}
+
+#define UPDATE_PERIOD 10
+static rtems_interval next_update;
+
+static void monitor_update(mtk_event *e, int count)
+{
+       rtems_interval t;
+
+       t = rtems_clock_get_ticks_since_boot();
+       if(t >= next_update) {
+               mtk_cmdf(appid, "ld_bass.barconfig(load, -value %d)", 
(int)(bass * 100));
+               mtk_cmdf(appid, "ld_mid.barconfig(load, -value %d)", (int)(mid 
* 100));
+               mtk_cmdf(appid, "ld_treb.barconfig(load, -value %d)", 
(int)(treb * 100));
+
+               next_update = t + UPDATE_PERIOD;
+       }
+}
+
 static void set_level(int channel, unsigned int val)
 {
        int request;
@@ -125,6 +155,8 @@ static void ok_callback(mtk_event *e, void *arg)
        w_open = 0;
        mtk_cmd(appid, "w.close()");
        set_config();
+       sampler_stop();
+       input_delete_callback(monitor_update);
 }
 
 static void close_callback(mtk_event *e, void *arg)
@@ -132,6 +164,8 @@ static void close_callback(mtk_event *e, void *arg)
        w_open = 0;
        mtk_cmd(appid, "w.close()");
        load_audio_config();
+       sampler_stop();
+       input_delete_callback(monitor_update);
 }
 
 void init_audio(void)
@@ -146,9 +180,9 @@ void init_audio(void)
                "l_bass = new Label(-text \"Bass\")",
                "l_mid  = new Label(-text \"Mid\")",
                "l_treb = new Label(-text \"Treb\")",
-               "ld_bass = new LoadDisplay(-from 0 -to 20 -orient vertical)",
-               "ld_mid  = new LoadDisplay(-from 0 -to 20 -orient vertical)",
-               "ld_treb = new LoadDisplay(-from 0 -to 20 -orient vertical)",
+               "ld_bass = new LoadDisplay(-from 0 -to 300 -orient vertical)",
+               "ld_mid  = new LoadDisplay(-from 0 -to 600 -orient vertical)",
+               "ld_treb = new LoadDisplay(-from 0 -to 600 -orient vertical)",
 
                "l_linevol = new Label(-text \"Line volume\")",
                "s_linevol = new Scale(-from 0 -to 100 -value 0 -orient 
vertical)",
@@ -214,4 +248,7 @@ void open_audio_window(void)
        if(w_open) return;
        w_open = 1;
        mtk_cmd(appid, "w.open()");
+       next_update = rtems_clock_get_ticks_since_boot() + UPDATE_PERIOD;
+       input_add_callback(monitor_update);
+       sampler_start(sampler_callback);
 }
-- 
1.7.5.4

_______________________________________________
http://lists.milkymist.org/listinfo.cgi/devel-milkymist.org
IRC: #milkymist@Freenode

Reply via email to