Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

performance: implement automatic switch and title display

  • Loading branch information...
commit 5213f6a29368be9710646823d129398af41f860e 1 parent 007009f
@sbourdeauducq sbourdeauducq authored
Showing with 33 additions and 11 deletions.
  1. +6 −4 src/cp.c
  2. +26 −6 src/performance.c
  3. +1 −1  src/performance.h
View
10 src/cp.c
@@ -180,10 +180,10 @@ static void cp_callback(mtk_event *e, void *arg)
open_firstpatch_window();
break;
case CP_ITEM_START:
- start_performance(false);
+ start_performance(0, 0, 0);
break;
case CP_ITEM_STARTSIMPLE:
- start_performance(true);
+ start_performance(1, 1, 0);
break;
case CP_ITEM_FILEMANAGER:
@@ -374,12 +374,14 @@ void init_cp()
void cp_autostart()
{
char autostart[256];
+ int dt, as;
switch(sysconfig_get_autostart_mode()) {
case SC_AUTOSTART_NONE:
break;
case SC_AUTOSTART_SIMPLE:
- start_performance(true);
+ sysconfig_get_autostart_mode_simple(&dt, &as);
+ start_performance(1, dt, as);
break;
case SC_AUTOSTART_FILE:
sysconfig_get_autostart(autostart);
@@ -394,7 +396,7 @@ void cp_autostart()
return;
}
on_config_change();
- start_performance(false);
+ start_performance(0, 0, 0);
break;
}
}
View
32 src/performance.c
@@ -47,6 +47,8 @@ static int npatches;
static int current_patch;
static struct patch_info patches[MAX_PATCHES];
static bool simple_mode;
+static int dt_mode;
+static int as_mode;
static int add_patch(const char *filename)
{
@@ -283,21 +285,37 @@ static int keycode_to_index(int keycode)
}
}
+static rtems_interval next_as_time;
+
static void event_callback(mtk_event *e, int count)
{
int i;
int index;
+ int next;
+ rtems_interval t;
index = -1;
if(simple_mode) {
+ next = 0;
for(i=0;i<count;i++) {
- if((e[i].type == EVENT_TYPE_PRESS) && (e[i].press.code == MTK_KEY_F11)) {
- current_patch++;
- if(current_patch == npatches)
- current_patch = 0;
- index = current_patch;
+ if((e[i].type == EVENT_TYPE_PRESS) && (e[i].press.code == MTK_KEY_F11))
+ next = 1;
+ }
+ if(as_mode) {
+ t = rtems_clock_get_ticks_since_boot();
+ if(t >= next_as_time) {
+ next = 1;
+ next_as_time = t + 3000;
}
}
+ if(next) {
+ current_patch++;
+ if(current_patch == npatches)
+ current_patch = 0;
+ index = current_patch;
+ }
+ if(dt_mode && (index != -1))
+ osd_event(patches[index].filename);
} else {
for(i=0;i<count;i++) {
if(e[i].type == EVENT_TYPE_PRESS) {
@@ -370,7 +388,7 @@ static void refresh_callback(mtk_event *e, int count)
static rtems_id comp_task_id;
-void start_performance(bool simple)
+void start_performance(int simple, int dt, int as)
{
rtems_status_code sc;
@@ -379,6 +397,8 @@ void start_performance(bool simple)
/* build patch list */
simple_mode = simple;
+ dt_mode = dt;
+ as_mode = as;
npatches = 0;
current_patch = 0;
if(simple) {
View
2  src/performance.h
@@ -21,6 +21,6 @@
#define SIMPLE_PATCHES_FOLDER "/ssd/patchpool/"
void init_performance();
-void start_performance(bool simple);
+void start_performance(int simple, int dt, int as);
#endif /* __PERFORMANCE_H */
Please sign in to comment.
Something went wrong with that request. Please try again.