voice: rename mp3_play_* functions to voice_play_*

Remove mp3_is_playing() entirely, in favor of pcm_is_playing()
Remove mp3_play_pause() entirely, as it's a dummy/no-op call
Remoce some archos-specific comments

Change-Id: I4e9ff323490a93add00809efd19e0d4e3f198b2d
This commit is contained in:
Solomon Peachy 2020-09-20 10:36:25 -04:00
parent e404026308
commit 5d40d97585
7 changed files with 46 additions and 115 deletions

View file

@ -596,9 +596,6 @@ static const struct plugin_api rockbox_api = {
#endif
#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],

View file

@ -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,15 +928,9 @@ 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);
};
/* plugin header */

View file

@ -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;

View file

@ -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 */
@ -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)
{
@ -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;
@ -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;

View file

@ -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)

View file

@ -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);

View file

@ -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