summaryrefslogtreecommitdiffstats
path: root/apps
diff options
context:
space:
mode:
Diffstat (limited to 'apps')
-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
6 files changed, 38 insertions, 82 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);