Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP

Comparing changes

Choose two branches to see what's changed or to start a new pull request. If you need to, you can also compare across forks.

Open a pull request

Create a new pull request by comparing changes across two branches. If you need to, you can also compare across forks.
base fork: m-labs/flickernoise
base: b86463c
...
head fork: m-labs/flickernoise
compare: 6bc121b
Checking mergeability… Don't worry, you can still create the pull request.
  • 8 commits
  • 2 files changed
  • 0 commit comments
  • 1 contributor
Commits on Jan 13, 2012
Xiangfu Liu gui/audio add Bass Mid Treb indication bar
Signed-off-by: Xiangfu Liu <xiangfu@sharism.cc>
e9ad307
Xiangfu Liu gui/audio: connect the indicate bar to bass,mid,treb
  set the bass from 0 to 200
  set the mid  from 0 to 600
  set the treb from 0 to 600

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
0139aeb
Xiangfu Liu gui/audio: make the bar from bottom to top 614d449
Xiangfu Liu gui/audio: using XXX_att which is better for GUI 5783649
Xiangfu Liu gui/audio: move the indicate to right 80e6b13
Xiangfu Liu gui/audio: do resmgr_acquire before open 766f86d
Xiangfu Liu gui/monitor: output the windows title in resmgr_acquire 22e2890
Xiangfu Liu gui/audio: using float value directly 6bc121b
Showing with 81 additions and 6 deletions.
  1. +80 −5 src/gui/audio.c
  2. +1 −1  src/gui/monitor.c
View
85 src/gui/audio.c
@@ -33,6 +33,9 @@
#include "flash.h"
#include "about.h"
#include "audio.h"
+#include "resmgr.h"
+#include "../input.h"
+#include "../renderer/sampler.h"
static int appid;
@@ -43,6 +46,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_att;
+ mid = frd->mid_att;
+ treb = frd->treb_att;
+
+ 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 %f)", bass);
+ mtk_cmdf(appid, "ld_mid.barconfig(load, -value %f)", mid);
+ mtk_cmdf(appid, "ld_treb.barconfig(load, -value %f)", treb);
+
+ next_update = t + UPDATE_PERIOD;
+ }
+}
+
static void set_level(int channel, unsigned int val)
{
int request;
@@ -125,6 +156,11 @@ 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);
+ resmgr_release(RESOURCE_AUDIO);
+ resmgr_release(RESOURCE_DMX_IN);
+ resmgr_release(RESOURCE_SAMPLER);
}
static void close_callback(mtk_event *e, void *arg)
@@ -132,6 +168,11 @@ 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);
+ resmgr_release(RESOURCE_AUDIO);
+ resmgr_release(RESOURCE_DMX_IN);
+ resmgr_release(RESOURCE_SAMPLER);
}
void init_audio(void)
@@ -142,6 +183,14 @@ void init_audio(void)
"g = new Grid()",
"gv = new Grid()",
+
+ "l_bass = new Label(-text \"Bass\")",
+ "l_mid = new Label(-text \"Mid\")",
+ "l_treb = new Label(-text \"Treb\")",
+ "ld_bass = new LoadDisplay(-from 3 -to 0 -orient vertical)",
+ "ld_mid = new LoadDisplay(-from 6 -to 0 -orient vertical)",
+ "ld_treb = new LoadDisplay(-from 6 -to 0 -orient vertical)",
+
"l_linevol = new Label(-text \"Line volume\")",
"s_linevol = new Scale(-from 0 -to 100 -value 0 -orient vertical)",
"l_micvol = new Label(-text \"Mic volume\")",
@@ -153,24 +202,39 @@ void init_audio(void)
"gv.place(l_linevol, -column 1 -row 1)",
"gv.place(s_linevol, -column 1 -row 2)",
"gv.place(b_mutline, -column 1 -row 3)",
+
"gv.place(l_micvol, -column 2 -row 1)",
"gv.place(s_micvol, -column 2 -row 2)",
"gv.place(b_mutmic, -column 2 -row 3)",
- "gv.rowconfig(2, -size 150)",
+ "gv.rowconfig(2, -size 180)",
"g.place(gv, -column 1 -row 1)",
+ "sep = new Separator(-vertical yes)",
+ "g.place(sep, -column 2 -row 1)",
+
+ "gb = new Grid()",
+
+ "gb.place(l_bass, -column 1 -row 1)",
+ "gb.place(ld_bass, -column 1 -row 2)",
+ "gb.place(l_mid, -column 2 -row 1)",
+ "gb.place(ld_mid, -column 2 -row 2)",
+ "gb.place(l_treb, -column 3 -row 1)",
+ "gb.place(ld_treb, -column 3 -row 2)",
+
+ "g.place(gb, -column 3 -row 1)",
+
"g_btn = new Grid()",
"b_ok = new Button(-text \"OK\")",
"b_cancel = new Button(-text \"Cancel\")",
- "g_btn.columnconfig(1, -size 90)",
- "g_btn.place(b_ok, -column 2 -row 1)",
- "g_btn.place(b_cancel, -column 3 -row 1)",
+ "g_btn.place(b_ok, -column 1 -row 1)",
+ "g_btn.place(b_cancel, -column 2 -row 1)",
- "g.place(g_btn, -column 1 -row 2)",
+ "g.rowconfig(2, -size 10)",
+ "g.place(g_btn, -column 3 -row 3)",
"w = new Window(-content g -title \"Audio settings\")",
0);
@@ -196,6 +260,17 @@ void init_audio(void)
void open_audio_window(void)
{
if(w_open) return;
+
+ if(!resmgr_acquire_multiple("Audio settings",
+ RESOURCE_AUDIO,
+ RESOURCE_DMX_IN,
+ RESOURCE_SAMPLER,
+ INVALID_RESOURCE))
+ 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);
}
View
2  src/gui/monitor.c
@@ -171,7 +171,7 @@ void open_monitor_window(void)
{
if(w_open) return;
- if(!resmgr_acquire_multiple("monitor",
+ if(!resmgr_acquire_multiple("Variable monitor",
RESOURCE_AUDIO,
RESOURCE_DMX_IN,
RESOURCE_SAMPLER,

No commit comments for this range

Something went wrong with that request. Please try again.