Skip to content
Permalink

Comparing changes

Choose two branches to see what’s changed or to start a new pull request. If you need to, you can also or learn more about diff comparisons.

Open a pull request

Create a new pull request by comparing changes across two branches. If you need to, you can also . Learn more about diff comparisons here.
base repository: m-labs/flickernoise
Failed to load repositories. Confirm that selected base ref is valid, then try again.
Loading
base: b86463c
Choose a base ref
...
head repository: m-labs/flickernoise
Failed to load repositories. Confirm that selected head ref is valid, then try again.
Loading
compare: 6bc121b
Choose a head ref
  • 8 commits
  • 2 files changed
  • 1 contributor

Commits on Jan 13, 2012

  1. gui/audio add Bass Mid Treb indication bar

    Signed-off-by: Xiangfu Liu <xiangfu@sharism.cc>
    Xiangfu Liu committed Jan 13, 2012
    Copy the full SHA
    e9ad307 View commit details
  2. 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
    Xiangfu Liu committed Jan 13, 2012
    Copy the full SHA
    0139aeb View commit details
  3. gui/audio: make the bar from bottom to top

    Xiangfu Liu committed Jan 13, 2012
    Copy the full SHA
    614d449 View commit details
  4. gui/audio: using XXX_att which is better for GUI

    Xiangfu Liu committed Jan 13, 2012
    Copy the full SHA
    5783649 View commit details
  5. gui/audio: move the indicate to right

    Xiangfu Liu committed Jan 13, 2012
    Copy the full SHA
    80e6b13 View commit details
  6. gui/audio: do resmgr_acquire before open

    Xiangfu Liu committed Jan 13, 2012
    Copy the full SHA
    766f86d View commit details
  7. gui/monitor: output the windows title in resmgr_acquire

    Xiangfu Liu committed Jan 13, 2012
    Copy the full SHA
    22e2890 View commit details
  8. gui/audio: using float value directly

    Xiangfu Liu committed Jan 13, 2012
    Copy the full SHA
    6bc121b View commit details
Showing with 81 additions and 6 deletions.
  1. +80 −5 src/gui/audio.c
  2. +1 −1 src/gui/monitor.c
85 changes: 80 additions & 5 deletions src/gui/audio.c
Original file line number Diff line number Diff line change
@@ -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,13 +156,23 @@ 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)
{
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);
}
2 changes: 1 addition & 1 deletion src/gui/monitor.c
Original file line number Diff line number Diff line change
@@ -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,