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:
William Wilgus 2021-08-19 22:20:56 -04:00 committed by William Wilgus
parent 67fb558c89
commit cf009b4cbb
8 changed files with 1314 additions and 1071 deletions

File diff suppressed because it is too large Load diff

View file

@ -352,6 +352,7 @@ static const struct plugin_api rockbox_api = {
get_action,
#ifdef HAVE_TOUCHSCREEN
action_get_touchscreen_press,
action_get_touchscreen_press_in_vp,
#endif
action_userabort,
@ -413,6 +414,7 @@ static const struct plugin_api rockbox_api = {
FS_PREFIX(file_exists),
strip_extension,
crc_32,
crc_32r,
filetype_get_attr,
/* dir */
@ -593,6 +595,7 @@ static const struct plugin_api rockbox_api = {
sound_enum_hw_eq_band_setting,
#endif
#if defined (HAVE_PITCHCONTROL)
sound_get_pitch,
sound_set_pitch,
#endif
&audio_master_sampr_list[0],
@ -622,7 +625,10 @@ static const struct plugin_api rockbox_api = {
dsp_eq_enable,
dsp_dither_enable,
#ifdef HAVE_PITCHCONTROL
dsp_get_timestretch,
dsp_set_timestretch,
dsp_timestretch_enable,
dsp_timestretch_available,
#endif
dsp_configure,
dsp_get_config,
@ -641,6 +647,7 @@ static const struct plugin_api rockbox_api = {
mixer_get_frequency,
pcmbuf_fade,
pcmbuf_set_low_latency,
system_sound_play,
keyclick_click,
@ -692,6 +699,9 @@ static const struct plugin_api rockbox_api = {
audio_current_track,
audio_flush_and_reload_tracks,
audio_get_file_pos,
#ifdef PLUGIN_USE_IRAM
audio_hard_stop,
#endif
/* menu */
root_menu_get_options,
@ -735,6 +745,7 @@ static const struct plugin_api rockbox_api = {
#if (CONFIG_PLATFORM & PLATFORM_NATIVE)
__errno,
#endif
led,
srand,
rand,
(void *)qsort,
@ -780,7 +791,6 @@ static const struct plugin_api rockbox_api = {
detect_flashed_ramimage,
detect_flashed_romimage,
#endif
led,
/*plugin*/
plugin_open,
@ -789,11 +799,6 @@ static const struct plugin_api rockbox_api = {
plugin_release_audio_buffer, /* defined in plugin.c */
plugin_tsr, /* defined in plugin.c */
plugin_get_current_filename,
#ifdef PLUGIN_USE_IRAM
audio_hard_stop,
#endif
crc_32r,
/* new stuff at the end, sort into place next time
the API gets incompatible */

View file

@ -155,12 +155,12 @@ int plugin_open(const char *plugin, const char *parameter);
#define PLUGIN_MAGIC 0x526F634B /* RocK */
/* 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
backwards compatibility (and please take the opportunity to sort in any
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 */
@ -400,6 +400,7 @@ struct plugin_api {
int (*get_action)(int context, int timeout);
#ifdef HAVE_TOUCHSCREEN
int (*action_get_touchscreen_press)(short *x, short *y);
int (*action_get_touchscreen_press_in_vp)(short *x1, short *y1, struct viewport *vp);
#endif
bool (*action_userabort)(int timeout);
@ -462,6 +463,7 @@ struct plugin_api {
bool (*file_exists)(const char *path);
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_32r)(const void *src, uint32_t len, uint32_t crc32);
int (*filetype_get_attr)(const char* file);
@ -667,6 +669,7 @@ struct plugin_api {
unsigned int band_setting);
#endif /* AUDIOHW_HAVE_EQ */
#if defined (HAVE_PITCHCONTROL)
int32_t (*sound_get_pitch)(void);
void (*sound_set_pitch)(int32_t pitch);
#endif
const unsigned long *audio_master_sampr_list;
@ -701,7 +704,10 @@ struct plugin_api {
void (*dsp_eq_enable)(bool enable);
void (*dsp_dither_enable)(bool enable);
#ifdef HAVE_PITCHCONTROL
int32_t (*dsp_get_timestretch)(void);
void (*dsp_set_timestretch)(int32_t percent);
void (*dsp_timestretch_enable)(bool enabled);
bool (*dsp_timestretch_available)(void);
#endif
intptr_t (*dsp_configure)(struct dsp_config *dsp,
unsigned int setting, intptr_t value);
@ -727,6 +733,7 @@ struct plugin_api {
void (*mixer_set_frequency)(unsigned int samplerate);
unsigned int (*mixer_get_frequency)(void);
void (*pcmbuf_fade)(bool fade, bool in);
void (*pcmbuf_set_low_latency)(bool state);
void (*system_sound_play)(enum system_sound sound);
void (*keyclick_click)(bool rawbutton, int action);
@ -793,6 +800,9 @@ struct plugin_api {
struct mp3entry* (*audio_current_track)(void);
void (*audio_flush_and_reload_tracks)(void);
int (*audio_get_file_pos)(void);
#ifdef PLUGIN_USE_IRAM
void (*audio_hard_stop)(void);
#endif
/* menu */
struct menu_table *(*root_menu_get_options)(int *nb_options);
@ -853,6 +863,7 @@ struct plugin_api {
#if (CONFIG_PLATFORM & PLATFORM_NATIVE)
int * (*__errno)(void);
#endif
void (*led)(bool on);
void (*srand)(unsigned int seed);
int (*rand)(void);
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_romimage)(void);
#endif
void (*led)(bool on);
/*plugin*/
int (*plugin_open)(const char *path, const char *parameter);
void* (*plugin_get_buffer)(size_t *buffer_size);
@ -917,11 +925,6 @@ struct plugin_api {
void (*plugin_release_audio_buffer)(void);
void (*plugin_tsr)(bool (*exit_callback)(bool reenter));
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
the API gets incompatible */

View file

@ -76,6 +76,7 @@ pegbox,games
periodic_table,apps
pictureflow,demos
pitch_detector,apps
pitch_screen,viewers
pixel-painter,games
plasma,demos
png,viewers

View file

@ -48,6 +48,10 @@ lamp.c
pitch_detector.c
#endif
#ifdef HAVE_PITCHCONTROL
pitch_screen.c
#endif
mp3_encoder.c
wav2wv.c

View file

@ -28,7 +28,9 @@
#define SWCHAR '-'
#define DECSEPCHAR '.'
#ifdef PLUGIN
#define strchr rb->strchr
#endif
int string_parse(const char **parameter, char* buf, size_t buf_sz)
{
/* fills buf with a string upto buf_sz, null terminates the buffer

View file

@ -26,7 +26,7 @@
#define ARGPARSE_MAX_FRAC_DIGITS 9 /* Uses 30 bits max (0.999999999) */
#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 \
(long)ARGP_FRAC_DEC_MULTIPLIER(ARGPARSE_MAX_FRAC_DIGITS)

1279
apps/plugins/pitch_screen.c Normal file

File diff suppressed because it is too large Load diff