forked from len0rd/rockbox
pitchscreen make it a plugin
full commandline parsing -has pitch, speed, time_stretch /* pitch_screen * accepts args -q, -g, -p=, -s=, -k=; (= sign is optional) * -q silences output splash * -g runs the gui (Runs immediately) * -p100 would set pitch to 100% * -s=90 sets speed to 90% if timestrech is enabled * -k=true -k1 enables time stretch -k0 -kf-kn disables */ Change-Id: I900c4b5d184e12ddbe47509f66fdf3e55193a520
This commit is contained in:
parent
67fb558c89
commit
cf009b4cbb
8 changed files with 1314 additions and 1071 deletions
File diff suppressed because it is too large
Load diff
|
@ -352,6 +352,7 @@ static const struct plugin_api rockbox_api = {
|
||||||
get_action,
|
get_action,
|
||||||
#ifdef HAVE_TOUCHSCREEN
|
#ifdef HAVE_TOUCHSCREEN
|
||||||
action_get_touchscreen_press,
|
action_get_touchscreen_press,
|
||||||
|
action_get_touchscreen_press_in_vp,
|
||||||
#endif
|
#endif
|
||||||
action_userabort,
|
action_userabort,
|
||||||
|
|
||||||
|
@ -413,6 +414,7 @@ static const struct plugin_api rockbox_api = {
|
||||||
FS_PREFIX(file_exists),
|
FS_PREFIX(file_exists),
|
||||||
strip_extension,
|
strip_extension,
|
||||||
crc_32,
|
crc_32,
|
||||||
|
crc_32r,
|
||||||
filetype_get_attr,
|
filetype_get_attr,
|
||||||
|
|
||||||
/* dir */
|
/* dir */
|
||||||
|
@ -593,6 +595,7 @@ static const struct plugin_api rockbox_api = {
|
||||||
sound_enum_hw_eq_band_setting,
|
sound_enum_hw_eq_band_setting,
|
||||||
#endif
|
#endif
|
||||||
#if defined (HAVE_PITCHCONTROL)
|
#if defined (HAVE_PITCHCONTROL)
|
||||||
|
sound_get_pitch,
|
||||||
sound_set_pitch,
|
sound_set_pitch,
|
||||||
#endif
|
#endif
|
||||||
&audio_master_sampr_list[0],
|
&audio_master_sampr_list[0],
|
||||||
|
@ -622,7 +625,10 @@ static const struct plugin_api rockbox_api = {
|
||||||
dsp_eq_enable,
|
dsp_eq_enable,
|
||||||
dsp_dither_enable,
|
dsp_dither_enable,
|
||||||
#ifdef HAVE_PITCHCONTROL
|
#ifdef HAVE_PITCHCONTROL
|
||||||
|
dsp_get_timestretch,
|
||||||
dsp_set_timestretch,
|
dsp_set_timestretch,
|
||||||
|
dsp_timestretch_enable,
|
||||||
|
dsp_timestretch_available,
|
||||||
#endif
|
#endif
|
||||||
dsp_configure,
|
dsp_configure,
|
||||||
dsp_get_config,
|
dsp_get_config,
|
||||||
|
@ -641,6 +647,7 @@ static const struct plugin_api rockbox_api = {
|
||||||
mixer_get_frequency,
|
mixer_get_frequency,
|
||||||
|
|
||||||
pcmbuf_fade,
|
pcmbuf_fade,
|
||||||
|
pcmbuf_set_low_latency,
|
||||||
system_sound_play,
|
system_sound_play,
|
||||||
keyclick_click,
|
keyclick_click,
|
||||||
|
|
||||||
|
@ -692,6 +699,9 @@ static const struct plugin_api rockbox_api = {
|
||||||
audio_current_track,
|
audio_current_track,
|
||||||
audio_flush_and_reload_tracks,
|
audio_flush_and_reload_tracks,
|
||||||
audio_get_file_pos,
|
audio_get_file_pos,
|
||||||
|
#ifdef PLUGIN_USE_IRAM
|
||||||
|
audio_hard_stop,
|
||||||
|
#endif
|
||||||
|
|
||||||
/* menu */
|
/* menu */
|
||||||
root_menu_get_options,
|
root_menu_get_options,
|
||||||
|
@ -735,6 +745,7 @@ static const struct plugin_api rockbox_api = {
|
||||||
#if (CONFIG_PLATFORM & PLATFORM_NATIVE)
|
#if (CONFIG_PLATFORM & PLATFORM_NATIVE)
|
||||||
__errno,
|
__errno,
|
||||||
#endif
|
#endif
|
||||||
|
led,
|
||||||
srand,
|
srand,
|
||||||
rand,
|
rand,
|
||||||
(void *)qsort,
|
(void *)qsort,
|
||||||
|
@ -780,7 +791,6 @@ static const struct plugin_api rockbox_api = {
|
||||||
detect_flashed_ramimage,
|
detect_flashed_ramimage,
|
||||||
detect_flashed_romimage,
|
detect_flashed_romimage,
|
||||||
#endif
|
#endif
|
||||||
led,
|
|
||||||
|
|
||||||
/*plugin*/
|
/*plugin*/
|
||||||
plugin_open,
|
plugin_open,
|
||||||
|
@ -789,11 +799,6 @@ static const struct plugin_api rockbox_api = {
|
||||||
plugin_release_audio_buffer, /* defined in plugin.c */
|
plugin_release_audio_buffer, /* defined in plugin.c */
|
||||||
plugin_tsr, /* defined in plugin.c */
|
plugin_tsr, /* defined in plugin.c */
|
||||||
plugin_get_current_filename,
|
plugin_get_current_filename,
|
||||||
#ifdef PLUGIN_USE_IRAM
|
|
||||||
audio_hard_stop,
|
|
||||||
#endif
|
|
||||||
crc_32r,
|
|
||||||
|
|
||||||
/* new stuff at the end, sort into place next time
|
/* new stuff at the end, sort into place next time
|
||||||
the API gets incompatible */
|
the API gets incompatible */
|
||||||
|
|
||||||
|
|
|
@ -155,12 +155,12 @@ int plugin_open(const char *plugin, const char *parameter);
|
||||||
#define PLUGIN_MAGIC 0x526F634B /* RocK */
|
#define PLUGIN_MAGIC 0x526F634B /* RocK */
|
||||||
|
|
||||||
/* increase this every time the api struct changes */
|
/* increase this every time the api struct changes */
|
||||||
#define PLUGIN_API_VERSION 244
|
#define PLUGIN_API_VERSION 245
|
||||||
|
|
||||||
/* update this to latest version if a change to the api struct breaks
|
/* update this to latest version if a change to the api struct breaks
|
||||||
backwards compatibility (and please take the opportunity to sort in any
|
backwards compatibility (and please take the opportunity to sort in any
|
||||||
new function which are "waiting" at the end of the function table) */
|
new function which are "waiting" at the end of the function table) */
|
||||||
#define PLUGIN_MIN_API_VERSION 244
|
#define PLUGIN_MIN_API_VERSION 245
|
||||||
|
|
||||||
/* 239 Marks the removal of ARCHOS HWCODEC and CHARCELL */
|
/* 239 Marks the removal of ARCHOS HWCODEC and CHARCELL */
|
||||||
|
|
||||||
|
@ -400,6 +400,7 @@ struct plugin_api {
|
||||||
int (*get_action)(int context, int timeout);
|
int (*get_action)(int context, int timeout);
|
||||||
#ifdef HAVE_TOUCHSCREEN
|
#ifdef HAVE_TOUCHSCREEN
|
||||||
int (*action_get_touchscreen_press)(short *x, short *y);
|
int (*action_get_touchscreen_press)(short *x, short *y);
|
||||||
|
int (*action_get_touchscreen_press_in_vp)(short *x1, short *y1, struct viewport *vp);
|
||||||
#endif
|
#endif
|
||||||
bool (*action_userabort)(int timeout);
|
bool (*action_userabort)(int timeout);
|
||||||
|
|
||||||
|
@ -462,6 +463,7 @@ struct plugin_api {
|
||||||
bool (*file_exists)(const char *path);
|
bool (*file_exists)(const char *path);
|
||||||
char* (*strip_extension)(char* buffer, int buffer_size, const char *filename);
|
char* (*strip_extension)(char* buffer, int buffer_size, const char *filename);
|
||||||
uint32_t (*crc_32)(const void *src, uint32_t len, uint32_t crc32);
|
uint32_t (*crc_32)(const void *src, uint32_t len, uint32_t crc32);
|
||||||
|
uint32_t (*crc_32r)(const void *src, uint32_t len, uint32_t crc32);
|
||||||
|
|
||||||
int (*filetype_get_attr)(const char* file);
|
int (*filetype_get_attr)(const char* file);
|
||||||
|
|
||||||
|
@ -667,6 +669,7 @@ struct plugin_api {
|
||||||
unsigned int band_setting);
|
unsigned int band_setting);
|
||||||
#endif /* AUDIOHW_HAVE_EQ */
|
#endif /* AUDIOHW_HAVE_EQ */
|
||||||
#if defined (HAVE_PITCHCONTROL)
|
#if defined (HAVE_PITCHCONTROL)
|
||||||
|
int32_t (*sound_get_pitch)(void);
|
||||||
void (*sound_set_pitch)(int32_t pitch);
|
void (*sound_set_pitch)(int32_t pitch);
|
||||||
#endif
|
#endif
|
||||||
const unsigned long *audio_master_sampr_list;
|
const unsigned long *audio_master_sampr_list;
|
||||||
|
@ -701,7 +704,10 @@ struct plugin_api {
|
||||||
void (*dsp_eq_enable)(bool enable);
|
void (*dsp_eq_enable)(bool enable);
|
||||||
void (*dsp_dither_enable)(bool enable);
|
void (*dsp_dither_enable)(bool enable);
|
||||||
#ifdef HAVE_PITCHCONTROL
|
#ifdef HAVE_PITCHCONTROL
|
||||||
|
int32_t (*dsp_get_timestretch)(void);
|
||||||
void (*dsp_set_timestretch)(int32_t percent);
|
void (*dsp_set_timestretch)(int32_t percent);
|
||||||
|
void (*dsp_timestretch_enable)(bool enabled);
|
||||||
|
bool (*dsp_timestretch_available)(void);
|
||||||
#endif
|
#endif
|
||||||
intptr_t (*dsp_configure)(struct dsp_config *dsp,
|
intptr_t (*dsp_configure)(struct dsp_config *dsp,
|
||||||
unsigned int setting, intptr_t value);
|
unsigned int setting, intptr_t value);
|
||||||
|
@ -727,6 +733,7 @@ struct plugin_api {
|
||||||
void (*mixer_set_frequency)(unsigned int samplerate);
|
void (*mixer_set_frequency)(unsigned int samplerate);
|
||||||
unsigned int (*mixer_get_frequency)(void);
|
unsigned int (*mixer_get_frequency)(void);
|
||||||
void (*pcmbuf_fade)(bool fade, bool in);
|
void (*pcmbuf_fade)(bool fade, bool in);
|
||||||
|
void (*pcmbuf_set_low_latency)(bool state);
|
||||||
void (*system_sound_play)(enum system_sound sound);
|
void (*system_sound_play)(enum system_sound sound);
|
||||||
void (*keyclick_click)(bool rawbutton, int action);
|
void (*keyclick_click)(bool rawbutton, int action);
|
||||||
|
|
||||||
|
@ -793,6 +800,9 @@ struct plugin_api {
|
||||||
struct mp3entry* (*audio_current_track)(void);
|
struct mp3entry* (*audio_current_track)(void);
|
||||||
void (*audio_flush_and_reload_tracks)(void);
|
void (*audio_flush_and_reload_tracks)(void);
|
||||||
int (*audio_get_file_pos)(void);
|
int (*audio_get_file_pos)(void);
|
||||||
|
#ifdef PLUGIN_USE_IRAM
|
||||||
|
void (*audio_hard_stop)(void);
|
||||||
|
#endif
|
||||||
|
|
||||||
/* menu */
|
/* menu */
|
||||||
struct menu_table *(*root_menu_get_options)(int *nb_options);
|
struct menu_table *(*root_menu_get_options)(int *nb_options);
|
||||||
|
@ -853,6 +863,7 @@ struct plugin_api {
|
||||||
#if (CONFIG_PLATFORM & PLATFORM_NATIVE)
|
#if (CONFIG_PLATFORM & PLATFORM_NATIVE)
|
||||||
int * (*__errno)(void);
|
int * (*__errno)(void);
|
||||||
#endif
|
#endif
|
||||||
|
void (*led)(bool on);
|
||||||
void (*srand)(unsigned int seed);
|
void (*srand)(unsigned int seed);
|
||||||
int (*rand)(void);
|
int (*rand)(void);
|
||||||
void (*qsort)(void *base, size_t nmemb, size_t size,
|
void (*qsort)(void *base, size_t nmemb, size_t size,
|
||||||
|
@ -907,9 +918,6 @@ struct plugin_api {
|
||||||
bool (*detect_flashed_ramimage)(void);
|
bool (*detect_flashed_ramimage)(void);
|
||||||
bool (*detect_flashed_romimage)(void);
|
bool (*detect_flashed_romimage)(void);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
void (*led)(bool on);
|
|
||||||
|
|
||||||
/*plugin*/
|
/*plugin*/
|
||||||
int (*plugin_open)(const char *path, const char *parameter);
|
int (*plugin_open)(const char *path, const char *parameter);
|
||||||
void* (*plugin_get_buffer)(size_t *buffer_size);
|
void* (*plugin_get_buffer)(size_t *buffer_size);
|
||||||
|
@ -917,11 +925,6 @@ struct plugin_api {
|
||||||
void (*plugin_release_audio_buffer)(void);
|
void (*plugin_release_audio_buffer)(void);
|
||||||
void (*plugin_tsr)(bool (*exit_callback)(bool reenter));
|
void (*plugin_tsr)(bool (*exit_callback)(bool reenter));
|
||||||
char* (*plugin_get_current_filename)(void);
|
char* (*plugin_get_current_filename)(void);
|
||||||
#ifdef PLUGIN_USE_IRAM
|
|
||||||
void (*audio_hard_stop)(void);
|
|
||||||
#endif
|
|
||||||
uint32_t (*crc_32r)(const void *src, uint32_t len, uint32_t crc32);
|
|
||||||
|
|
||||||
/* new stuff at the end, sort into place next time
|
/* new stuff at the end, sort into place next time
|
||||||
the API gets incompatible */
|
the API gets incompatible */
|
||||||
|
|
||||||
|
|
|
@ -76,6 +76,7 @@ pegbox,games
|
||||||
periodic_table,apps
|
periodic_table,apps
|
||||||
pictureflow,demos
|
pictureflow,demos
|
||||||
pitch_detector,apps
|
pitch_detector,apps
|
||||||
|
pitch_screen,viewers
|
||||||
pixel-painter,games
|
pixel-painter,games
|
||||||
plasma,demos
|
plasma,demos
|
||||||
png,viewers
|
png,viewers
|
||||||
|
|
|
@ -48,6 +48,10 @@ lamp.c
|
||||||
pitch_detector.c
|
pitch_detector.c
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#ifdef HAVE_PITCHCONTROL
|
||||||
|
pitch_screen.c
|
||||||
|
#endif
|
||||||
|
|
||||||
mp3_encoder.c
|
mp3_encoder.c
|
||||||
wav2wv.c
|
wav2wv.c
|
||||||
|
|
||||||
|
|
|
@ -28,7 +28,9 @@
|
||||||
|
|
||||||
#define SWCHAR '-'
|
#define SWCHAR '-'
|
||||||
#define DECSEPCHAR '.'
|
#define DECSEPCHAR '.'
|
||||||
|
#ifdef PLUGIN
|
||||||
|
#define strchr rb->strchr
|
||||||
|
#endif
|
||||||
int string_parse(const char **parameter, char* buf, size_t buf_sz)
|
int string_parse(const char **parameter, char* buf, size_t buf_sz)
|
||||||
{
|
{
|
||||||
/* fills buf with a string upto buf_sz, null terminates the buffer
|
/* fills buf with a string upto buf_sz, null terminates the buffer
|
||||||
|
|
|
@ -26,7 +26,7 @@
|
||||||
#define ARGPARSE_MAX_FRAC_DIGITS 9 /* Uses 30 bits max (0.999999999) */
|
#define ARGPARSE_MAX_FRAC_DIGITS 9 /* Uses 30 bits max (0.999999999) */
|
||||||
|
|
||||||
#define ARGP_EXP(a, b) (a ##E## b)
|
#define ARGP_EXP(a, b) (a ##E## b)
|
||||||
#define ARGP_FRAC_DEC_MULTIPLIER(n) AP_EXP(1,n) /*1x10^n*/
|
#define ARGP_FRAC_DEC_MULTIPLIER(n) ARGP_EXP(1,n) /*1x10^n*/
|
||||||
#define ARGPARSE_FRAC_DEC_MULTIPLIER \
|
#define ARGPARSE_FRAC_DEC_MULTIPLIER \
|
||||||
(long)ARGP_FRAC_DEC_MULTIPLIER(ARGPARSE_MAX_FRAC_DIGITS)
|
(long)ARGP_FRAC_DEC_MULTIPLIER(ARGPARSE_MAX_FRAC_DIGITS)
|
||||||
|
|
||||||
|
|
1279
apps/plugins/pitch_screen.c
Normal file
1279
apps/plugins/pitch_screen.c
Normal file
File diff suppressed because it is too large
Load diff
Loading…
Add table
Add a link
Reference in a new issue