summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--apps/plugin.c3
-rw-r--r--apps/plugin.h15
-rw-r--r--apps/plugins/imageviewer/imageviewer.c2
-rw-r--r--apps/talk.c66
-rw-r--r--apps/voice_thread.c20
-rw-r--r--apps/voice_thread.h14
-rw-r--r--docs/PLUGIN_API41
7 files changed, 46 insertions, 115 deletions
diff --git a/apps/plugin.c b/apps/plugin.c
index 749132cde8..7ece50bfd3 100644
--- a/apps/plugin.c
+++ b/apps/plugin.c
@@ -597,9 +597,6 @@ static const struct plugin_api rockbox_api = {
#if defined (HAVE_PITCHCONTROL)
sound_set_pitch,
#endif
-#if (CONFIG_PLATFORM & PLATFORM_NATIVE) && defined(HAVE_DISK_STORAGE)
- mp3_is_playing,
-#endif
&audio_master_sampr_list[0],
&hw_freq_sampr[0],
pcm_apply_settings,
diff --git a/apps/plugin.h b/apps/plugin.h
index fc3da61c57..38d0ee0fff 100644
--- a/apps/plugin.h
+++ b/apps/plugin.h
@@ -155,12 +155,12 @@ int plugin_open(char *plugin, char *parameter);
#define PLUGIN_MAGIC 0x526F634B /* RocK */
/* increase this every time the api struct changes */
-#define PLUGIN_API_VERSION 240
+#define PLUGIN_API_VERSION 241
/* 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 239
+#define PLUGIN_MIN_API_VERSION 241
/* 239 Marks the removal of ARCHOS HWCODEC and CHARCELL */
@@ -669,9 +669,6 @@ struct plugin_api {
#if defined (HAVE_PITCHCONTROL)
void (*sound_set_pitch)(int32_t pitch);
#endif
-#if (CONFIG_PLATFORM & PLATFORM_NATIVE) && defined(HAVE_DISK_STORAGE)
- bool (*mp3_is_playing)(void);
-#endif /* PLATFORM_NATIVE */
const unsigned long *audio_master_sampr_list;
const unsigned long *hw_freq_sampr;
void (*pcm_apply_settings)(void);
@@ -765,6 +762,7 @@ struct plugin_api {
#if defined(HAVE_TC_RAMCACHE) && defined(HAVE_DIRCACHE)
bool (*tagcache_fill_tags)(struct mp3entry *id3, const char *filename);
#endif
+ struct tagcache_stat* (*tagcache_get_stat)(void);
#endif /* HAVE_TAGCACHE */
#ifdef HAVE_ALBUMART
@@ -920,6 +918,7 @@ struct plugin_api {
void (*led)(bool on);
/*plugin*/
+ int (*plugin_open)(char *path, char *parameter);
void* (*plugin_get_buffer)(size_t *buffer_size);
void* (*plugin_get_audio_buffer)(size_t *buffer_size);
void (*plugin_release_audio_buffer)(void);
@@ -929,14 +928,8 @@ struct plugin_api {
void (*audio_hard_stop)(void);
#endif
-
/* new stuff at the end, sort into place next time
the API gets incompatible */
-
-#ifdef HAVE_TAGCACHE
- struct tagcache_stat* (*tagcache_get_stat)(void);
-#endif
- int (*plugin_open)(char *path, char *parameter);
};
diff --git a/apps/plugins/imageviewer/imageviewer.c b/apps/plugins/imageviewer/imageviewer.c
index 4070f4b513..8e23787704 100644
--- a/apps/plugins/imageviewer/imageviewer.c
+++ b/apps/plugins/imageviewer/imageviewer.c
@@ -326,7 +326,7 @@ static int show_menu(void) /* return 1 to quit */
/* slideshow times < 10s keep disk spinning */
rb->storage_spindown(0);
}
- else if (!rb->mp3_is_playing())
+ else if (!rb->pcm_is_playing())
{
/* slideshow times > 10s and not playing: ata_off after load */
iv_api.immediate_ata_off = true;
diff --git a/apps/talk.c b/apps/talk.c
index 4b65700a5d..5d292b05d1 100644
--- a/apps/talk.c
+++ b/apps/talk.c
@@ -46,25 +46,6 @@
#include "panic.h"
#include "misc.h" /* time_split_units() */
-/* Memory layout varies between targets because the
- Archos (MASCODEC) devices cannot mix voice and audio playback
-
- MASCODEC | MASCODEC | SWCODEC
- (playing) | (stopped) |
- voicebuf-----------+-----------+------------
- audio | voice | voice
- |-----------|------------
- | thumbnail | thumbnail
- | |------------
- | | filebuf
- | |------------
- | | audio
- voicebufend----------+-----------+------------
-
- SWCODEC allocates dedicated buffers (except voice and thumbnail are together
- in the talkbuf), MASCODEC reuses audiobuf. */
-
-
/***************** Constants *****************/
#define QUEUE_SIZE 64 /* must be a power of two */
@@ -128,7 +109,7 @@ static int queue_write; /* write index of queue, by application */
static int queue_read; /* read index of queue, by ISR context */
static enum talk_status talk_status = TALK_STATUS_OK;
/* protects queue_read, queue_write and thumbnail_buf_used */
-static struct mutex queue_mutex SHAREDBSS_ATTR;
+static struct mutex queue_mutex SHAREDBSS_ATTR;
#define talk_queue_lock() ({ mutex_lock(&queue_mutex); })
#define talk_queue_unlock() ({ mutex_unlock(&queue_mutex); })
static int sent; /* how many bytes handed over to playback, owned by ISR */
@@ -182,7 +163,7 @@ static inline bool check_audio_status(void)
return true;
}
-/* ISR (mp3_callback()) must not run during moving of the clip buffer,
+/* ISR (voice_callback()) must not run during moving of the clip buffer,
* because the MAS may get out-of-sync */
static void sync_callback(int handle, bool sync_on)
{
@@ -269,13 +250,13 @@ static int open_voicefile(void)
char* p_lang = DEFAULT_VOICE_LANG; /* default */
if ( global_settings.lang_file[0] &&
- global_settings.lang_file[0] != 0xff )
+ global_settings.lang_file[0] != 0xff )
{ /* try to open the voice file of the selected language */
p_lang = (char *)global_settings.lang_file;
}
snprintf(buf, sizeof(buf), LANG_DIR "/%s.voice", p_lang);
-
+
return open(buf, O_RDONLY);
}
@@ -725,7 +706,7 @@ static void mp3_callback(const void** start, size_t* size)
curr_hd[1] = commit_buffer[2];
curr_hd[2] = commit_buffer[3];
}
-
+
talk_queue_unlock();
}
@@ -735,7 +716,7 @@ static void mp3_callback(const void** start, size_t* size)
void talk_force_shutup(void)
{
/* Had nothing to do (was frame boundary or not our clip) */
- mp3_play_stop();
+ voice_play_stop();
talk_queue_lock();
queue_write = queue_read = 0; /* reset the queue */
thumbnail_buf_used = 0;
@@ -761,7 +742,7 @@ static void queue_clip(struct queue_entry *clip, bool enqueue)
/* Something is being enqueued, force_enqueue_next override is no
longer in effect. */
force_enqueue_next = false;
-
+
if (!clip->length)
return; /* safety check */
talk_queue_lock();
@@ -780,11 +761,10 @@ static void queue_clip(struct queue_entry *clip, bool enqueue)
size_t size;
void *buf = commit_transfer(qe, &size);
last_clip = qe;
- mp3_play_data(buf, size, mp3_callback);
+ voice_play_data(buf, size, mp3_callback);
curr_hd[0] = commit_buffer[1];
curr_hd[1] = commit_buffer[2];
curr_hd[2] = commit_buffer[3];
- mp3_play_pause(true); /* kickoff audio */
}
need_shutup = true;
@@ -864,7 +844,7 @@ void talk_init(void)
}
avg_size = total_size / non_empty;
max_clips = MIN((int)(MAX_CLIP_BUFFER_SIZE/avg_size) + 1, non_empty);
- /* account for possible thumb clips */
+ /* account for possible thumb clips */
total_size += THUMBNAIL_RESERVE;
max_clips += 16;
voicefile_size = total_size;
@@ -1156,19 +1136,19 @@ int talk_number(long n, bool enqueue)
if (!enqueue)
talk_shutup(); /* cut off all the pending stuff */
-
+
if (n==0)
{ /* special case */
talk_id(VOICE_ZERO, true);
return 0;
}
-
+
if (n<0)
{
talk_id(VOICE_MINUS, true);
n = -n;
}
-
+
while (n)
{
int segment = n / mil; /* extract in groups of 3 digits */
@@ -1197,7 +1177,7 @@ int talk_number(long n, bool enqueue)
/* direct indexing */
if (ones)
talk_id(VOICE_ZERO + ones, true);
-
+
/* add billion, million, thousand */
if (mil)
talk_id(VOICE_THOUSAND + level, true);
@@ -1261,21 +1241,21 @@ int talk_value(long n, int unit, bool enqueue)
int talk_value_decimal(long n, int unit, int decimals, bool enqueue)
{
int unit_id;
- static const int unit_voiced[] =
+ static const int unit_voiced[] =
{ /* lookup table for the voice ID of the units */
[0 ... UNIT_LAST-1] = -1, /* regular ID, int, signed */
[UNIT_MS]
= VOICE_MILLISECONDS, /* here come the "real" units */
[UNIT_SEC]
- = VOICE_SECONDS,
+ = VOICE_SECONDS,
[UNIT_MIN]
- = VOICE_MINUTES,
+ = VOICE_MINUTES,
[UNIT_HOUR]
- = VOICE_HOURS,
+ = VOICE_HOURS,
[UNIT_KHZ]
- = VOICE_KHZ,
+ = VOICE_KHZ,
[UNIT_DB]
- = VOICE_DB,
+ = VOICE_DB,
[UNIT_PERCENT]
= VOICE_PERCENT,
[UNIT_MAH]
@@ -1411,7 +1391,7 @@ int talk_time_intervals(long time, int unit_idx, bool enqueue)
int talk_spell(const char* spell, bool enqueue)
{
char c; /* currently processed char */
-
+
if (talk_temp_disable_count > 0)
return -1; /* talking has been disabled */
if (!check_audio_status())
@@ -1419,7 +1399,7 @@ int talk_spell(const char* spell, bool enqueue)
if (!enqueue)
talk_shutup(); /* cut off all the pending stuff */
-
+
while ((c = *spell++) != '\0')
{
/* if this grows into too many cases, I should use a table */
@@ -1434,7 +1414,7 @@ int talk_spell(const char* spell, bool enqueue)
else if (c == '+')
talk_id(VOICE_PLUS, true);
else if (c == '.')
- talk_id(VOICE_DOT, true);
+ talk_id(VOICE_DOT, true);
else if (c == ' ')
talk_id(VOICE_PAUSE, true);
else if (c == '/')
@@ -1448,7 +1428,7 @@ void talk_disable(bool disable)
{
if (disable)
talk_temp_disable_count++;
- else
+ else
talk_temp_disable_count--;
}
diff --git a/apps/voice_thread.c b/apps/voice_thread.c
index 325860be27..171902d10f 100644
--- a/apps/voice_thread.c
+++ b/apps/voice_thread.c
@@ -121,7 +121,7 @@ enum voice_thread_messages
struct voice_info
{
/* Callback to get more clips */
- mp3_play_callback_t get_more;
+ voice_play_callback_t get_more;
/* Start of clip */
const void *start;
/* Size of clip */
@@ -276,8 +276,8 @@ static void voice_buf_commit(int count)
}
/* Stop any current clip and start playing a new one */
-void mp3_play_data(const void *start, size_t size,
- mp3_play_callback_t get_more)
+void voice_play_data(const void *start, size_t size,
+ voice_play_callback_t get_more)
{
if (voice_thread_id && start && size && get_more)
{
@@ -294,7 +294,7 @@ void mp3_play_data(const void *start, size_t size,
}
/* Stop current voice clip from playing */
-void mp3_play_stop(void)
+void voice_play_stop(void)
{
if (voice_thread_id != 0)
{
@@ -303,18 +303,6 @@ void mp3_play_stop(void)
}
}
-void mp3_play_pause(bool play)
-{
- /* a dummy */
- (void)play;
-}
-
-/* Tell if voice is still in a playing state */
-bool mp3_is_playing(void)
-{
- return voice_playing;
-}
-
/* This function is meant to be used by the buffer request functions to
ensure the codec is no longer active */
void voice_stop(void)
diff --git a/apps/voice_thread.h b/apps/voice_thread.h
index 8a17ee09e3..d662aaee33 100644
--- a/apps/voice_thread.h
+++ b/apps/voice_thread.h
@@ -23,16 +23,14 @@
#include "config.h"
-#ifndef MP3_PLAY_CALLBACK_DEFINED
-#define MP3_PLAY_CALLBACK_DEFINED
-typedef void (*mp3_play_callback_t)(const void **start, size_t *size);
+#ifndef VOICE_PLAY_CALLBACK_DEFINED
+#define VOICE_PLAY_CALLBACK_DEFINED
+typedef void (*voice_play_callback_t)(const void **start, size_t *size);
#endif
-void mp3_play_data(const void *start, size_t size,
- mp3_play_callback_t get_more);
-void mp3_play_stop(void);
-void mp3_play_pause(bool play);
-bool mp3_is_playing(void);
+void voice_play_data(const void *start, size_t size,
+ voice_play_callback_t get_more);
+void voice_play_stop(void);
void voice_wait(void);
void voice_stop(void);
diff --git a/docs/PLUGIN_API b/docs/PLUGIN_API
index 1febe9fdf4..84c203c05a 100644
--- a/docs/PLUGIN_API
+++ b/docs/PLUGIN_API
@@ -402,7 +402,7 @@ int count_mp3_frames(int fd, int startpos, int filesize, void (*progressfunc)(in
\description
void cpu_boost(bool on_off)
- \conditions (!defined(SIMULATOR)) && (defined(HAVE_ADJUSTABLE_CPU_FREQ)) && !defined(CPU_BOOST_LOGGING)
+ \conditions (!defined(SIMULATOR)) && (defined(HAVE_ADJUSTABLE_CPU_FREQ)) && !defined(CPU_BOOST_LOGGING)
\param on_off
\description Boosts the CPU if =on_off= is true, otherwise it unboosts the CPU
@@ -1368,31 +1368,6 @@ bool mp3info(struct mp3entry *entry, const char *filename)
\return FALSE if successfull
\description The given =entry= is filled in with whatever id3 info it could find about the given =filename=
-bool mp3_is_playing(void)
- \group sound
- \conditions (!defined(SIMULATOR))
- \return true if an mp3 is playing, else return false
- \description Note: a paused mp3 is considered as a playing mp3
-
-void mp3_play_data(const unsigned char* start, int size, void (*get_more)(unsigned char** start, size_t* size))
- \group sound
- \conditions (!defined(SIMULATOR))
- \param start points to the begining of the file to play
- \param size is the size to play
- \param get_more is a callback function
- \description Plays a chunk of an mp3 file
-
-void mp3_play_pause(bool play)
- \group sound
- \conditions (!defined(SIMULATOR))
- \param play
- \description If playback was paused and =play= is TRUE, resume playback. If playback isn't paused and =play= is FALSE, pause playback.
-
-void mp3_play_stop(void)
- \group sound
- \conditions (!defined(SIMULATOR))
- \description Stops playback
-
void mutex_init(struct mutex *m)
\group kernel/ system
\param m
@@ -1470,7 +1445,7 @@ void pcm_play_data(pcm_more_callback_type get_more, unsigned char* start, size_t
\param get_more Optional callback
\param start is the address of raw 16-16, interleaved PCM data
\param size is the size of the data to play
- \description May be used without the callback parameter in order to play a single clip. If you wish to play sound continuously, then use the callback instead and return the buffer address and size to be played from that callback. Every time that a buffer is played out, the callback is asked for the next buffer to play but without stopping and starting playback. The callback is called asynchronously in interrupt context so what you may do in there is limited.
+ \description May be used without the callback parameter in order to play a single clip. If you wish to play sound continuously, then use the callback instead and return the buffer address and size to be played from that callback. Every time that a buffer is played out, the callback is asked for the next buffer to play but without stopping and starting playback. The callback is called asynchronously in interrupt context so what you may do in there is limited.
void pcm_play_lock(void)
\group sound
@@ -2031,8 +2006,8 @@ struct gui_syncstatusbar *statusbars
int strcasecmp(const char *, const char *)
\group strings and memory
- \param
- \param
+ \param
+ \param
\return an integer less than, equal to, or greater than zero if s1 is found, respectively, to be less than, to match, or be greater than s2
\description The strcasecmp() function compares the two strings s1 and s2, ignoring the case of the characters
@@ -2052,8 +2027,8 @@ char *strchr(const char *s, int c)
int strcmp(const char *, const char *)
\group strings and memory
- \param
- \param
+ \param
+ \param
\return
\description strcmp() compares the string a to string b. If a sorts lexicographically after b, strcmp returns a number greater than zero. If the two strings match, strcmp returns zero. If a sorts lexicographically before b, strcmp returns a number less than zero.
@@ -2081,8 +2056,8 @@ int strncasecmp(const char *s1, const char *s2, size_t n)
int strncmp(const char *, const char *, size_t)
\group strings and memory
- \param
- \param
+ \param
+ \param
\param size_t
\return
\description