forked from len0rd/rockbox
Midiplay: only boost cpu in sensible code parts
Change-Id: I9aaf7f2844e9f90030dbf0a63ebec80db4851e18
This commit is contained in:
parent
5279d60e0a
commit
1728565e24
1 changed files with 27 additions and 7 deletions
|
|
@ -333,6 +333,9 @@ static inline void synthbuf(void)
|
||||||
int32_t *outptr;
|
int32_t *outptr;
|
||||||
int i = BUF_SIZE;
|
int i = BUF_SIZE;
|
||||||
|
|
||||||
|
#if defined(HAVE_ADJUSTABLE_CPU_FREQ)
|
||||||
|
rb->cpu_boost(true);
|
||||||
|
#endif
|
||||||
#ifndef SYNC
|
#ifndef SYNC
|
||||||
if (lastswap == swap)
|
if (lastswap == swap)
|
||||||
return;
|
return;
|
||||||
|
|
@ -363,6 +366,9 @@ static inline void synthbuf(void)
|
||||||
|
|
||||||
/* how many samples did we write to the buffer? */
|
/* how many samples did we write to the buffer? */
|
||||||
samples_in_buf = BUF_SIZE-i;
|
samples_in_buf = BUF_SIZE-i;
|
||||||
|
#if defined(HAVE_ADJUSTABLE_CPU_FREQ)
|
||||||
|
rb->cpu_boost(false);
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
static void get_more(const void** start, size_t* size)
|
static void get_more(const void** start, size_t* size)
|
||||||
|
|
@ -395,18 +401,29 @@ static int midimain(const void * filename)
|
||||||
int a, notes_used, vol;
|
int a, notes_used, vol;
|
||||||
bool is_playing = true; /* false = paused */
|
bool is_playing = true; /* false = paused */
|
||||||
|
|
||||||
|
#if defined(HAVE_ADJUSTABLE_CPU_FREQ)
|
||||||
|
rb->cpu_boost(true);
|
||||||
|
#endif
|
||||||
midi_debug("Loading file");
|
midi_debug("Loading file");
|
||||||
mf = loadFile(filename);
|
mf = loadFile(filename);
|
||||||
|
|
||||||
if (mf == NULL)
|
if (mf == NULL)
|
||||||
{
|
{
|
||||||
midi_debug("Error loading file.");
|
midi_debug("Error loading file.");
|
||||||
|
#if defined(HAVE_ADJUSTABLE_CPU_FREQ)
|
||||||
|
rb->cpu_boost(false);
|
||||||
|
#endif
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (initSynth(mf, ROCKBOX_DIR "/patchset/patchset.cfg",
|
if (initSynth(mf, ROCKBOX_DIR "/patchset/patchset.cfg",
|
||||||
ROCKBOX_DIR "/patchset/drums.cfg") == -1)
|
ROCKBOX_DIR "/patchset/drums.cfg") == -1)
|
||||||
|
{
|
||||||
|
#if defined(HAVE_ADJUSTABLE_CPU_FREQ)
|
||||||
|
rb->cpu_boost(false);
|
||||||
|
#endif
|
||||||
return -1;
|
return -1;
|
||||||
|
}
|
||||||
|
|
||||||
rb->pcm_play_stop();
|
rb->pcm_play_stop();
|
||||||
#if INPUT_SRC_CAPS != 0
|
#if INPUT_SRC_CAPS != 0
|
||||||
|
|
@ -442,6 +459,10 @@ static int midimain(const void * filename)
|
||||||
tick();
|
tick();
|
||||||
} while (notes_used == 0);
|
} while (notes_used == 0);
|
||||||
|
|
||||||
|
#if defined(HAVE_ADJUSTABLE_CPU_FREQ)
|
||||||
|
rb->cpu_boost(false);
|
||||||
|
#endif
|
||||||
|
|
||||||
playing_time = 0;
|
playing_time = 0;
|
||||||
samples_this_second = 0;
|
samples_this_second = 0;
|
||||||
|
|
||||||
|
|
@ -492,7 +513,13 @@ static int midimain(const void * filename)
|
||||||
/* Rewinding is tricky. Basically start the file over */
|
/* Rewinding is tricky. Basically start the file over */
|
||||||
/* but run through the tracks without the synth running */
|
/* but run through the tracks without the synth running */
|
||||||
rb->pcm_play_stop();
|
rb->pcm_play_stop();
|
||||||
|
#if defined(HAVE_ADJUSTABLE_CPU_FREQ)
|
||||||
|
rb->cpu_boost(true);
|
||||||
|
#endif
|
||||||
seekBackward(5);
|
seekBackward(5);
|
||||||
|
#if defined(HAVE_ADJUSTABLE_CPU_FREQ)
|
||||||
|
rb->cpu_boost(false);
|
||||||
|
#endif
|
||||||
lastswap = !swap;
|
lastswap = !swap;
|
||||||
synthbuf();
|
synthbuf();
|
||||||
midi_debug("Rewind to %d:%02d\n", playing_time/60, playing_time%60);
|
midi_debug("Rewind to %d:%02d\n", playing_time/60, playing_time%60);
|
||||||
|
|
@ -550,10 +577,6 @@ enum plugin_status plugin_start(const void* parameter)
|
||||||
}
|
}
|
||||||
rb->lcd_setfont(FONT_SYSFIXED);
|
rb->lcd_setfont(FONT_SYSFIXED);
|
||||||
|
|
||||||
#if defined(HAVE_ADJUSTABLE_CPU_FREQ)
|
|
||||||
rb->cpu_boost(true);
|
|
||||||
#endif
|
|
||||||
|
|
||||||
midi_debug("%s", parameter);
|
midi_debug("%s", parameter);
|
||||||
/* rb->splash(HZ, true, parameter); */
|
/* rb->splash(HZ, true, parameter); */
|
||||||
|
|
||||||
|
|
@ -570,9 +593,6 @@ enum plugin_status plugin_start(const void* parameter)
|
||||||
rb->pcm_play_stop();
|
rb->pcm_play_stop();
|
||||||
rb->pcm_set_frequency(HW_SAMPR_DEFAULT);
|
rb->pcm_set_frequency(HW_SAMPR_DEFAULT);
|
||||||
|
|
||||||
#if defined(HAVE_ADJUSTABLE_CPU_FREQ)
|
|
||||||
rb->cpu_boost(false);
|
|
||||||
#endif
|
|
||||||
rb->splash(HZ, "FINISHED PLAYING");
|
rb->splash(HZ, "FINISHED PLAYING");
|
||||||
|
|
||||||
if (retval == -1)
|
if (retval == -1)
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue