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: 86c7ca6
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: cf76930
Choose a head ref
  • 2 commits
  • 1 file changed
  • 1 contributor

Commits on Jan 14, 2012

  1. gui/performance.c: simplify and break down refresh_callback

    The code to start rendering isn't too bad as it is, but it'll get
    worse when we fix the title bug, so better separate it now.
    wpwrak committed Jan 14, 2012
    Copy the full SHA
    b14cecd View commit details
  2. gui/performance.c: fix - move advancing into skip_unsuitable

    The simplificaiton in commit 86c7ca6
    was a bit too simplistic. We still have to make sure simple_mode_current
    wraps around the ends of the patch array.
    wpwrak committed Jan 14, 2012
    Copy the full SHA
    cf76930 View commit details
Showing with 50 additions and 35 deletions.
  1. +50 −35 src/gui/performance.c
85 changes: 50 additions & 35 deletions src/gui/performance.c
Original file line number Diff line number Diff line change
@@ -391,15 +391,23 @@ static int suitable_for_simple(struct patch *p)
return suitable;
}

static void skip_unsuitable(void)
static void skip_unsuitable(int next)
{
int looped;

looped = simple_mode_current;
while(!suitable_for_simple(patches[simple_mode_current].p)) {
simple_mode_current++;
while(1) {
simple_mode_current += next;
if(simple_mode_current == npatches)
simple_mode_current = 0;
if(simple_mode_current < 0)
simple_mode_current = npatches - 1;
if(suitable_for_simple(patches[simple_mode_current].p))
break;
if(!next) {
next = 1;
continue;
}
if(looped == simple_mode_current)
break;
}
@@ -419,8 +427,7 @@ static void simple_mode_event(mtk_event *e, int *next)

static void simple_mode_next(int next)
{
simple_mode_current += next;
skip_unsuitable();
skip_unsuitable(next);
renderer_pulse_patch(patches[simple_mode_current].p);
if(as_mode)
update_next_as_time();
@@ -505,45 +512,53 @@ static void stop_callback(void)
input_delete_callback(event_callback);
}

static void start_rendering(void)
{
int index = 0;

update_next_as_time();
input_add_callback(event_callback);
mtk_cmd(appid, "l_status.set(-text \"Ready.\")");

if(simple_mode) {
skip_unsuitable(0);
index = simple_mode_current;
}

if(!guirender(appid, patches[index].p, stop_callback))
stop_callback();
}

static void refresh_callback(mtk_event *e, int count)
{
rtems_interval t;
int index;

t = rtems_clock_get_ticks_since_boot();
if(t >= next_update) {
if(compiled_patches >= 0) {
mtk_cmdf(appid, "progress.barconfig(load, -value %d)", (100*compiled_patches)/npatches);
if(compiled_patches == npatches) {
/* All patches compiled. Start rendering. */
input_delete_callback(refresh_callback);
update_next_as_time();
input_add_callback(event_callback);
mtk_cmd(appid, "l_status.set(-text \"Ready.\")");

if(simple_mode) {
skip_unsuitable();
index = simple_mode_current;
} else
index = 0;

if(!guirender(appid, patches[index].p, stop_callback))
stop_callback();
return;
}
} else {
int error_patch;

error_patch = -compiled_patches-1;
mtk_cmdf(appid, "l_status.set(-text \"Failed to compile patch %s\")", patches[error_patch].filename);
if(t < next_update)
return;
if(compiled_patches >= 0) {
mtk_cmdf(appid, "progress.barconfig(load, -value %d)",
(100*compiled_patches)/npatches);
if(compiled_patches == npatches) {
/* All patches compiled. Start rendering. */
input_delete_callback(refresh_callback);
started = 0;
free_patches();
fb_unblank();
start_rendering();
return;
}
next_update = t + UPDATE_PERIOD;
} else {
int error_patch;

error_patch = -compiled_patches-1;
mtk_cmdf(appid,
"l_status.set(-text \"Failed to compile patch %s\")",
patches[error_patch].filename);
input_delete_callback(refresh_callback);
started = 0;
free_patches();
fb_unblank();
return;
}
next_update = t + UPDATE_PERIOD;
}

void open_performance_window(void)