forked from len0rd/rockbox
More audio code restructuring, mostly renaming functions so far
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@6246 a1c6a512-1295-4272-9138-f99709370657
This commit is contained in:
parent
ec4e9b8d60
commit
8a237a829e
26 changed files with 342 additions and 313 deletions
|
@ -26,7 +26,7 @@
|
||||||
#include "lcd.h"
|
#include "lcd.h"
|
||||||
#include "button.h"
|
#include "button.h"
|
||||||
#include "usb.h"
|
#include "usb.h"
|
||||||
#include "mpeg.h"
|
#include "audio.h"
|
||||||
#include "wps.h"
|
#include "wps.h"
|
||||||
#include "settings.h"
|
#include "settings.h"
|
||||||
#include "bookmark.h"
|
#include "bookmark.h"
|
||||||
|
@ -227,7 +227,7 @@ bool bookmark_autobookmark(void)
|
||||||
if (!system_check())
|
if (!system_check())
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
mpeg_pause(); /* first pause playback */
|
audio_pause(); /* first pause playback */
|
||||||
switch (global_settings.autocreatebookmark)
|
switch (global_settings.autocreatebookmark)
|
||||||
{
|
{
|
||||||
case BOOKMARK_YES:
|
case BOOKMARK_YES:
|
||||||
|
@ -404,7 +404,7 @@ static char* create_bookmark()
|
||||||
char *file;
|
char *file;
|
||||||
|
|
||||||
/* grab the currently playing track */
|
/* grab the currently playing track */
|
||||||
struct mp3entry *id3 = mpeg_current_track();
|
struct mp3entry *id3 = audio_current_track();
|
||||||
if(!id3)
|
if(!id3)
|
||||||
return NULL;
|
return NULL;
|
||||||
|
|
||||||
|
@ -1144,7 +1144,7 @@ static bool generate_bookmark_file_name(const char *in)
|
||||||
static bool system_check(void)
|
static bool system_check(void)
|
||||||
{
|
{
|
||||||
int resume_index = 0;
|
int resume_index = 0;
|
||||||
struct mp3entry *id3 = mpeg_current_track();
|
struct mp3entry *id3 = audio_current_track();
|
||||||
|
|
||||||
if (!id3)
|
if (!id3)
|
||||||
{
|
{
|
||||||
|
|
|
@ -38,7 +38,7 @@
|
||||||
#include "system.h"
|
#include "system.h"
|
||||||
#include "font.h"
|
#include "font.h"
|
||||||
#include "disk.h"
|
#include "disk.h"
|
||||||
#include "mpeg.h"
|
#include "audio.h"
|
||||||
#include "mp3_playback.h"
|
#include "mp3_playback.h"
|
||||||
#include "settings.h"
|
#include "settings.h"
|
||||||
#include "ata.h"
|
#include "ata.h"
|
||||||
|
@ -335,11 +335,11 @@ bool dbg_os(void)
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifdef HAVE_LCD_BITMAP
|
#ifdef HAVE_LCD_BITMAP
|
||||||
bool dbg_mpeg_thread(void)
|
bool dbg_audio_thread(void)
|
||||||
{
|
{
|
||||||
char buf[32];
|
char buf[32];
|
||||||
int button;
|
int button;
|
||||||
struct mpeg_debug d;
|
struct audio_debug d;
|
||||||
|
|
||||||
lcd_setmargins(0, 0);
|
lcd_setmargins(0, 0);
|
||||||
|
|
||||||
|
@ -352,7 +352,7 @@ bool dbg_mpeg_thread(void)
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
mpeg_get_debugdata(&d);
|
audio_get_debugdata(&d);
|
||||||
|
|
||||||
lcd_clear_display();
|
lcd_clear_display();
|
||||||
|
|
||||||
|
@ -1862,7 +1862,7 @@ static bool dbg_disk_info(void)
|
||||||
|
|
||||||
case SETTINGS_OK:
|
case SETTINGS_OK:
|
||||||
if (page == 3) {
|
if (page == 3) {
|
||||||
mpeg_stop(); /* stop playback, to avoid disk access */
|
audio_stop(); /* stop playback, to avoid disk access */
|
||||||
lcd_clear_display();
|
lcd_clear_display();
|
||||||
lcd_puts(0,0,"Scanning");
|
lcd_puts(0,0,"Scanning");
|
||||||
lcd_puts(0,1,"disk...");
|
lcd_puts(0,1,"disk...");
|
||||||
|
@ -2016,7 +2016,7 @@ bool debug_menu(void)
|
||||||
{ "View disk info", dbg_disk_info },
|
{ "View disk info", dbg_disk_info },
|
||||||
#endif
|
#endif
|
||||||
#ifdef HAVE_LCD_BITMAP
|
#ifdef HAVE_LCD_BITMAP
|
||||||
{ "View mpeg thread", dbg_mpeg_thread },
|
{ "View audio thread", dbg_audio_thread },
|
||||||
#ifdef PM_DEBUG
|
#ifdef PM_DEBUG
|
||||||
{ "pm histogram", peak_meter_histogram},
|
{ "pm histogram", peak_meter_histogram},
|
||||||
#endif /* PM_DEBUG */
|
#endif /* PM_DEBUG */
|
||||||
|
|
|
@ -38,7 +38,7 @@
|
||||||
#ifndef DEBUG
|
#ifndef DEBUG
|
||||||
#include "serial.h"
|
#include "serial.h"
|
||||||
#endif
|
#endif
|
||||||
#include "mpeg.h"
|
#include "audio.h"
|
||||||
#include "mp3_playback.h"
|
#include "mp3_playback.h"
|
||||||
#include "main_menu.h"
|
#include "main_menu.h"
|
||||||
#include "thread.h"
|
#include "thread.h"
|
||||||
|
@ -114,7 +114,7 @@ void init(void)
|
||||||
global_settings.mdb_shape,
|
global_settings.mdb_shape,
|
||||||
global_settings.mdb_enable,
|
global_settings.mdb_enable,
|
||||||
global_settings.superbass);
|
global_settings.superbass);
|
||||||
mpeg_init();
|
audio_init();
|
||||||
button_clear_queue(); /* Empty the keyboard buffer */
|
button_clear_queue(); /* Empty the keyboard buffer */
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -235,7 +235,7 @@ void init(void)
|
||||||
tree_init();
|
tree_init();
|
||||||
|
|
||||||
/* No buffer allocation (see buffer.c) may take place after the call to
|
/* No buffer allocation (see buffer.c) may take place after the call to
|
||||||
mpeg_init() since the mpeg thread takes the rest of the buffer space */
|
audio_init() since the mpeg thread takes the rest of the buffer space */
|
||||||
mp3_init( global_settings.volume,
|
mp3_init( global_settings.volume,
|
||||||
global_settings.bass,
|
global_settings.bass,
|
||||||
global_settings.treble,
|
global_settings.treble,
|
||||||
|
@ -250,7 +250,7 @@ void init(void)
|
||||||
global_settings.mdb_shape,
|
global_settings.mdb_shape,
|
||||||
global_settings.mdb_enable,
|
global_settings.mdb_enable,
|
||||||
global_settings.superbass);
|
global_settings.superbass);
|
||||||
mpeg_init();
|
audio_init();
|
||||||
talk_init();
|
talk_init();
|
||||||
|
|
||||||
#ifdef AUTOROCK
|
#ifdef AUTOROCK
|
||||||
|
|
|
@ -26,7 +26,7 @@
|
||||||
#include "lcd.h"
|
#include "lcd.h"
|
||||||
#include "dir.h"
|
#include "dir.h"
|
||||||
#include "file.h"
|
#include "file.h"
|
||||||
#include "mpeg.h"
|
#include "audio.h"
|
||||||
#include "menu.h"
|
#include "menu.h"
|
||||||
#include "lang.h"
|
#include "lang.h"
|
||||||
#include "playlist.h"
|
#include "playlist.h"
|
||||||
|
@ -84,7 +84,7 @@ struct playlist_args {
|
||||||
|
|
||||||
static bool add_to_playlist(int position, bool queue)
|
static bool add_to_playlist(int position, bool queue)
|
||||||
{
|
{
|
||||||
bool new_playlist = !(mpeg_status() & MPEG_STATUS_PLAY);
|
bool new_playlist = !(audio_status() & AUDIO_STATUS_PLAY);
|
||||||
|
|
||||||
if (new_playlist)
|
if (new_playlist)
|
||||||
playlist_create(NULL, NULL);
|
playlist_create(NULL, NULL);
|
||||||
|
@ -152,12 +152,12 @@ static bool add_to_playlist(int position, bool queue)
|
||||||
|
|
||||||
static bool view_playlist(void)
|
static bool view_playlist(void)
|
||||||
{
|
{
|
||||||
bool was_playing = mpeg_status() & MPEG_STATUS_PLAY;
|
bool was_playing = audio_status() & AUDIO_STATUS_PLAY;
|
||||||
bool result;
|
bool result;
|
||||||
|
|
||||||
result = playlist_viewer_ex(selected_file);
|
result = playlist_viewer_ex(selected_file);
|
||||||
|
|
||||||
if (!was_playing && (mpeg_status() & MPEG_STATUS_PLAY) &&
|
if (!was_playing && (audio_status() & AUDIO_STATUS_PLAY) &&
|
||||||
onplay_result == ONPLAY_OK)
|
onplay_result == ONPLAY_OK)
|
||||||
/* playlist was started from viewer */
|
/* playlist was started from viewer */
|
||||||
onplay_result = ONPLAY_START_PLAY;
|
onplay_result = ONPLAY_START_PLAY;
|
||||||
|
@ -181,7 +181,7 @@ static bool playlist_options(void)
|
||||||
pstart++;
|
pstart++;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (mpeg_status() & MPEG_STATUS_PLAY)
|
if (audio_status() & AUDIO_STATUS_PLAY)
|
||||||
{
|
{
|
||||||
items[i].desc = ID2P(LANG_INSERT);
|
items[i].desc = ID2P(LANG_INSERT);
|
||||||
args[i].position = PLAYLIST_INSERT;
|
args[i].position = PLAYLIST_INSERT;
|
||||||
|
|
|
@ -73,7 +73,7 @@
|
||||||
#include "dir.h"
|
#include "dir.h"
|
||||||
#include "sprintf.h"
|
#include "sprintf.h"
|
||||||
#include "debug.h"
|
#include "debug.h"
|
||||||
#include "mpeg.h"
|
#include "audio.h"
|
||||||
#include "lcd.h"
|
#include "lcd.h"
|
||||||
#include "kernel.h"
|
#include "kernel.h"
|
||||||
#include "settings.h"
|
#include "settings.h"
|
||||||
|
@ -348,7 +348,7 @@ static int add_indices_to_playlist(struct playlist_info* playlist,
|
||||||
if (!buffer)
|
if (!buffer)
|
||||||
{
|
{
|
||||||
/* use mp3 buffer for maximum load speed */
|
/* use mp3 buffer for maximum load speed */
|
||||||
mpeg_stop();
|
audio_stop();
|
||||||
talk_buffer_steal(); /* we use the mp3 buffer, need to tell */
|
talk_buffer_steal(); /* we use the mp3 buffer, need to tell */
|
||||||
|
|
||||||
buffer = mp3buf;
|
buffer = mp3buf;
|
||||||
|
@ -629,7 +629,7 @@ static int add_directory_to_playlist(struct playlist_info* playlist,
|
||||||
display_playlist_count(*count, count_str);
|
display_playlist_count(*count, count_str);
|
||||||
|
|
||||||
if (*count == PLAYLIST_DISPLAY_COUNT)
|
if (*count == PLAYLIST_DISPLAY_COUNT)
|
||||||
mpeg_flush_and_reload_tracks();
|
audio_flush_and_reload_tracks();
|
||||||
}
|
}
|
||||||
|
|
||||||
/* let the other threads work */
|
/* let the other threads work */
|
||||||
|
@ -1625,7 +1625,7 @@ int playlist_start(int start_index, int offset)
|
||||||
|
|
||||||
playlist->index = start_index;
|
playlist->index = start_index;
|
||||||
talk_buffer_steal(); /* will use the mp3 buffer */
|
talk_buffer_steal(); /* will use the mp3 buffer */
|
||||||
mpeg_play(offset);
|
audio_play(offset);
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
@ -1932,7 +1932,7 @@ int playlist_insert_track(struct playlist_info* playlist, const char *filename,
|
||||||
if (result != -1)
|
if (result != -1)
|
||||||
{
|
{
|
||||||
fsync(playlist->control_fd);
|
fsync(playlist->control_fd);
|
||||||
mpeg_flush_and_reload_tracks();
|
audio_flush_and_reload_tracks();
|
||||||
}
|
}
|
||||||
|
|
||||||
return result;
|
return result;
|
||||||
|
@ -1970,7 +1970,7 @@ int playlist_insert_directory(struct playlist_info* playlist,
|
||||||
fsync(playlist->control_fd);
|
fsync(playlist->control_fd);
|
||||||
|
|
||||||
display_playlist_count(count, count_str);
|
display_playlist_count(count, count_str);
|
||||||
mpeg_flush_and_reload_tracks();
|
audio_flush_and_reload_tracks();
|
||||||
|
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
@ -2063,7 +2063,7 @@ int playlist_insert_playlist(struct playlist_info* playlist, char *filename,
|
||||||
display_playlist_count(count, count_str);
|
display_playlist_count(count, count_str);
|
||||||
|
|
||||||
if (count == PLAYLIST_DISPLAY_COUNT)
|
if (count == PLAYLIST_DISPLAY_COUNT)
|
||||||
mpeg_flush_and_reload_tracks();
|
audio_flush_and_reload_tracks();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -2078,7 +2078,7 @@ int playlist_insert_playlist(struct playlist_info* playlist, char *filename,
|
||||||
*temp_ptr = '/';
|
*temp_ptr = '/';
|
||||||
|
|
||||||
display_playlist_count(count, count_str);
|
display_playlist_count(count, count_str);
|
||||||
mpeg_flush_and_reload_tracks();
|
audio_flush_and_reload_tracks();
|
||||||
|
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
@ -2106,7 +2106,7 @@ int playlist_delete(struct playlist_info* playlist, int index)
|
||||||
result = remove_track_from_playlist(playlist, index, true);
|
result = remove_track_from_playlist(playlist, index, true);
|
||||||
|
|
||||||
if (result != -1)
|
if (result != -1)
|
||||||
mpeg_flush_and_reload_tracks();
|
audio_flush_and_reload_tracks();
|
||||||
|
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
@ -2194,7 +2194,7 @@ int playlist_move(struct playlist_info* playlist, int index, int new_index)
|
||||||
}
|
}
|
||||||
|
|
||||||
fsync(playlist->control_fd);
|
fsync(playlist->control_fd);
|
||||||
mpeg_flush_and_reload_tracks();
|
audio_flush_and_reload_tracks();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -2215,7 +2215,7 @@ int playlist_randomise(struct playlist_info* playlist, unsigned int seed,
|
||||||
result = randomise_playlist(playlist, seed, start_current, true);
|
result = randomise_playlist(playlist, seed, start_current, true);
|
||||||
|
|
||||||
if (result != -1)
|
if (result != -1)
|
||||||
mpeg_flush_and_reload_tracks();
|
audio_flush_and_reload_tracks();
|
||||||
|
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
@ -2233,7 +2233,7 @@ int playlist_sort(struct playlist_info* playlist, bool start_current)
|
||||||
result = sort_playlist(playlist, start_current, true);
|
result = sort_playlist(playlist, start_current, true);
|
||||||
|
|
||||||
if (result != -1)
|
if (result != -1)
|
||||||
mpeg_flush_and_reload_tracks();
|
audio_flush_and_reload_tracks();
|
||||||
|
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
|
@ -21,7 +21,7 @@
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
#include <sprintf.h>
|
#include <sprintf.h>
|
||||||
#include "playlist.h"
|
#include "playlist.h"
|
||||||
#include "mpeg.h"
|
#include "audio.h"
|
||||||
#include "screens.h"
|
#include "screens.h"
|
||||||
#include "status.h"
|
#include "status.h"
|
||||||
#include "settings.h"
|
#include "settings.h"
|
||||||
|
@ -142,7 +142,7 @@ static bool initialize(char* filename, bool reload)
|
||||||
{
|
{
|
||||||
char* buffer;
|
char* buffer;
|
||||||
int buffer_size;
|
int buffer_size;
|
||||||
bool is_playing = mpeg_status() & MPEG_STATUS_PLAY;
|
bool is_playing = audio_status() & AUDIO_STATUS_PLAY;
|
||||||
|
|
||||||
if (!filename && !is_playing)
|
if (!filename && !is_playing)
|
||||||
/* Nothing is playing, exit */
|
/* Nothing is playing, exit */
|
||||||
|
@ -702,7 +702,7 @@ static int onplay_menu(int index)
|
||||||
case 0:
|
case 0:
|
||||||
/* delete track */
|
/* delete track */
|
||||||
if (current)
|
if (current)
|
||||||
mpeg_stop();
|
audio_stop();
|
||||||
|
|
||||||
playlist_delete(viewer.playlist, tracks[index].index);
|
playlist_delete(viewer.playlist, tracks[index].index);
|
||||||
|
|
||||||
|
@ -714,7 +714,7 @@ static int onplay_menu(int index)
|
||||||
global_settings.repeat_mode == REPEAT_ALL)
|
global_settings.repeat_mode == REPEAT_ALL)
|
||||||
{
|
{
|
||||||
talk_buffer_steal(); /* will use the mp3 buffer */
|
talk_buffer_steal(); /* will use the mp3 buffer */
|
||||||
mpeg_play(0);
|
audio_play(0);
|
||||||
viewer.current_playing_track = -1;
|
viewer.current_playing_track = -1;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -838,7 +838,7 @@ bool playlist_viewer_ex(char* filename)
|
||||||
{
|
{
|
||||||
int track;
|
int track;
|
||||||
|
|
||||||
if (!viewer.playlist && !(mpeg_status() & MPEG_STATUS_PLAY))
|
if (!viewer.playlist && !(audio_status() & AUDIO_STATUS_PLAY))
|
||||||
{
|
{
|
||||||
/* Play has stopped */
|
/* Play has stopped */
|
||||||
#ifdef HAVE_LCD_CHARCELLS
|
#ifdef HAVE_LCD_CHARCELLS
|
||||||
|
@ -954,14 +954,14 @@ bool playlist_viewer_ex(char* filename)
|
||||||
else if (!viewer.playlist)
|
else if (!viewer.playlist)
|
||||||
{
|
{
|
||||||
/* Stop current track and play new track */
|
/* Stop current track and play new track */
|
||||||
mpeg_stop();
|
audio_stop();
|
||||||
playlist_start(tracks[INDEX(viewer.cursor_pos)].index, 0);
|
playlist_start(tracks[INDEX(viewer.cursor_pos)].index, 0);
|
||||||
update_playlist(false);
|
update_playlist(false);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
/* Play track from playlist on disk */
|
/* Play track from playlist on disk */
|
||||||
mpeg_stop();
|
audio_stop();
|
||||||
|
|
||||||
/* New playlist */
|
/* New playlist */
|
||||||
if (playlist_set_current(viewer.playlist) < 0)
|
if (playlist_set_current(viewer.playlist) < 0)
|
||||||
|
|
|
@ -199,20 +199,20 @@ static const struct plugin_api rockbox_api = {
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
/* playback control */
|
/* playback control */
|
||||||
PREFIX(mpeg_play),
|
PREFIX(audio_play),
|
||||||
mpeg_stop,
|
audio_stop,
|
||||||
mpeg_pause,
|
audio_pause,
|
||||||
mpeg_resume,
|
audio_resume,
|
||||||
mpeg_next,
|
audio_next,
|
||||||
mpeg_prev,
|
audio_prev,
|
||||||
mpeg_ff_rewind,
|
audio_ff_rewind,
|
||||||
mpeg_next_track,
|
audio_next_track,
|
||||||
playlist_amount,
|
playlist_amount,
|
||||||
mpeg_status,
|
audio_status,
|
||||||
mpeg_has_changed_track,
|
audio_has_changed_track,
|
||||||
mpeg_current_track,
|
audio_current_track,
|
||||||
mpeg_flush_and_reload_tracks,
|
audio_flush_and_reload_tracks,
|
||||||
mpeg_get_file_pos,
|
audio_get_file_pos,
|
||||||
mpeg_get_last_header,
|
mpeg_get_last_header,
|
||||||
#if (CONFIG_HWCODEC == MAS3587F) || (CONFIG_HWCODEC == MAS3539F)
|
#if (CONFIG_HWCODEC == MAS3587F) || (CONFIG_HWCODEC == MAS3539F)
|
||||||
sound_set_pitch,
|
sound_set_pitch,
|
||||||
|
@ -409,7 +409,7 @@ void* plugin_get_buffer(int* buffer_size)
|
||||||
Playback gets stopped, to avoid conflicts. */
|
Playback gets stopped, to avoid conflicts. */
|
||||||
void* plugin_get_mp3_buffer(int* buffer_size)
|
void* plugin_get_mp3_buffer(int* buffer_size)
|
||||||
{
|
{
|
||||||
mpeg_stop();
|
audio_stop();
|
||||||
talk_buffer_steal(); /* we use the mp3 buffer, need to tell */
|
talk_buffer_steal(); /* we use the mp3 buffer, need to tell */
|
||||||
*buffer_size = mp3end - mp3buf;
|
*buffer_size = mp3end - mp3buf;
|
||||||
return mp3buf;
|
return mp3buf;
|
||||||
|
|
|
@ -42,6 +42,7 @@
|
||||||
#include "lcd.h"
|
#include "lcd.h"
|
||||||
#include "id3.h"
|
#include "id3.h"
|
||||||
#include "mpeg.h"
|
#include "mpeg.h"
|
||||||
|
#include "audio.h"
|
||||||
#include "mp3_playback.h"
|
#include "mp3_playback.h"
|
||||||
#include "pcm_playback.h"
|
#include "pcm_playback.h"
|
||||||
#include "settings.h"
|
#include "settings.h"
|
||||||
|
@ -239,20 +240,20 @@ struct plugin_api {
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
/* playback control */
|
/* playback control */
|
||||||
void (*PREFIX(mpeg_play))(int offset);
|
void (*PREFIX(audio_play))(int offset);
|
||||||
void (*mpeg_stop)(void);
|
void (*audio_stop)(void);
|
||||||
void (*mpeg_pause)(void);
|
void (*audio_pause)(void);
|
||||||
void (*mpeg_resume)(void);
|
void (*audio_resume)(void);
|
||||||
void (*mpeg_next)(void);
|
void (*audio_next)(void);
|
||||||
void (*mpeg_prev)(void);
|
void (*audio_prev)(void);
|
||||||
void (*mpeg_ff_rewind)(int newtime);
|
void (*audio_ff_rewind)(int newtime);
|
||||||
struct mp3entry* (*mpeg_next_track)(void);
|
struct mp3entry* (*audio_next_track)(void);
|
||||||
int (*playlist_amount)(void);
|
int (*playlist_amount)(void);
|
||||||
int (*mpeg_status)(void);
|
int (*audio_status)(void);
|
||||||
bool (*mpeg_has_changed_track)(void);
|
bool (*audio_has_changed_track)(void);
|
||||||
struct mp3entry* (*mpeg_current_track)(void);
|
struct mp3entry* (*audio_current_track)(void);
|
||||||
void (*mpeg_flush_and_reload_tracks)(void);
|
void (*audio_flush_and_reload_tracks)(void);
|
||||||
int (*mpeg_get_file_pos)(void);
|
int (*audio_get_file_pos)(void);
|
||||||
unsigned long (*mpeg_get_last_header)(void);
|
unsigned long (*mpeg_get_last_header)(void);
|
||||||
#if (CONFIG_HWCODEC == MAS3587F) || (CONFIG_HWCODEC == MAS3539F)
|
#if (CONFIG_HWCODEC == MAS3587F) || (CONFIG_HWCODEC == MAS3539F)
|
||||||
void (*sound_set_pitch)(int pitch);
|
void (*sound_set_pitch)(int pitch);
|
||||||
|
|
|
@ -817,7 +817,7 @@ void emu_process_packet(unsigned char* mbus_msg, int msg_size)
|
||||||
|
|
||||||
if (playmsg_dirty)
|
if (playmsg_dirty)
|
||||||
{
|
{
|
||||||
rb->yield(); /* give the mpeg thread a chance to process */
|
rb->yield(); /* give the audio thread a chance to process */
|
||||||
get_playmsg(); /* force update */
|
get_playmsg(); /* force update */
|
||||||
mbus_send(gEmu.playmsg, sizeof(gEmu.playmsg));
|
mbus_send(gEmu.playmsg, sizeof(gEmu.playmsg));
|
||||||
}
|
}
|
||||||
|
@ -876,10 +876,10 @@ void get_playmsg(void)
|
||||||
|
|
||||||
if (gEmu.set_state != EMU_FF && gEmu.set_state != EMU_FR)
|
if (gEmu.set_state != EMU_FF && gEmu.set_state != EMU_FR)
|
||||||
{
|
{
|
||||||
switch(rb->mpeg_status())
|
switch(rb->audio_status())
|
||||||
{
|
{
|
||||||
case MPEG_STATUS_PLAY:
|
case AUDIO_STATUS_PLAY:
|
||||||
print_scroll("MpegStat Play");
|
print_scroll("AudioStat Play");
|
||||||
if (gEmu.set_state == EMU_FF || gEmu.set_state == EMU_FR)
|
if (gEmu.set_state == EMU_FF || gEmu.set_state == EMU_FR)
|
||||||
gEmu.playmsg[2] = gEmu.set_state; /* set FF/FR */
|
gEmu.playmsg[2] = gEmu.set_state; /* set FF/FR */
|
||||||
else
|
else
|
||||||
|
@ -890,8 +890,8 @@ void get_playmsg(void)
|
||||||
bit_set(gEmu.playmsg, 59, false); /* clear stop */
|
bit_set(gEmu.playmsg, 59, false); /* clear stop */
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case MPEG_STATUS_PLAY | MPEG_STATUS_PAUSE:
|
case AUDIO_STATUS_PLAY | AUDIO_STATUS_PAUSE:
|
||||||
print_scroll("MpegStat Pause");
|
print_scroll("AudioStat Pause");
|
||||||
gEmu.playmsg[2] = EMU_PAUSED;
|
gEmu.playmsg[2] = EMU_PAUSED;
|
||||||
bit_set(gEmu.playmsg, 56, false); /* clear play */
|
bit_set(gEmu.playmsg, 56, false); /* clear play */
|
||||||
bit_set(gEmu.playmsg, 57, true); /* set pause */
|
bit_set(gEmu.playmsg, 57, true); /* set pause */
|
||||||
|
@ -899,7 +899,7 @@ void get_playmsg(void)
|
||||||
break;
|
break;
|
||||||
|
|
||||||
default:
|
default:
|
||||||
print_scroll("MpegStat 0");
|
print_scroll("AudioStat 0");
|
||||||
gEmu.playmsg[2] = EMU_STOPPED;
|
gEmu.playmsg[2] = EMU_STOPPED;
|
||||||
bit_set(gEmu.playmsg, 56, false); /* clear play */
|
bit_set(gEmu.playmsg, 56, false); /* clear play */
|
||||||
bit_set(gEmu.playmsg, 57, false); /* clear pause */
|
bit_set(gEmu.playmsg, 57, false); /* clear pause */
|
||||||
|
@ -943,7 +943,7 @@ int get_playtime(void)
|
||||||
{
|
{
|
||||||
struct mp3entry* p_mp3entry;
|
struct mp3entry* p_mp3entry;
|
||||||
|
|
||||||
p_mp3entry = rb->mpeg_current_track();
|
p_mp3entry = rb->audio_current_track();
|
||||||
if (p_mp3entry == NULL)
|
if (p_mp3entry == NULL)
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
|
@ -955,7 +955,7 @@ int get_tracklength(void)
|
||||||
{
|
{
|
||||||
struct mp3entry* p_mp3entry;
|
struct mp3entry* p_mp3entry;
|
||||||
|
|
||||||
p_mp3entry = rb->mpeg_current_track();
|
p_mp3entry = rb->audio_current_track();
|
||||||
if (p_mp3entry == NULL)
|
if (p_mp3entry == NULL)
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
|
@ -967,13 +967,13 @@ void set_track(int selected)
|
||||||
{
|
{
|
||||||
if (selected > get_track())
|
if (selected > get_track())
|
||||||
{
|
{
|
||||||
print_scroll("mpeg_next");
|
print_scroll("audio_next");
|
||||||
rb->mpeg_next();
|
rb->audio_next();
|
||||||
}
|
}
|
||||||
else if (selected < get_track())
|
else if (selected < get_track())
|
||||||
{
|
{
|
||||||
print_scroll("mpeg_prev");
|
print_scroll("audio_prev");
|
||||||
rb->mpeg_prev();
|
rb->audio_prev();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -982,7 +982,7 @@ int get_track(void)
|
||||||
{
|
{
|
||||||
struct mp3entry* p_mp3entry;
|
struct mp3entry* p_mp3entry;
|
||||||
|
|
||||||
p_mp3entry = rb->mpeg_current_track();
|
p_mp3entry = rb->audio_current_track();
|
||||||
if (p_mp3entry == NULL)
|
if (p_mp3entry == NULL)
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
|
@ -992,48 +992,48 @@ int get_track(void)
|
||||||
/* start or resume playback */
|
/* start or resume playback */
|
||||||
void set_play(void)
|
void set_play(void)
|
||||||
{
|
{
|
||||||
if (rb->mpeg_status() == MPEG_STATUS_PLAY)
|
if (rb->audio_status() == AUDIO_STATUS_PLAY)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
if (rb->mpeg_status() == (MPEG_STATUS_PLAY | MPEG_STATUS_PAUSE))
|
if (rb->audio_status() == (AUDIO_STATUS_PLAY | AUDIO_STATUS_PAUSE))
|
||||||
{
|
{
|
||||||
print_scroll("mpeg_resume");
|
print_scroll("audio_resume");
|
||||||
rb->mpeg_resume();
|
rb->audio_resume();
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
print_scroll("mpeg_play(0)");
|
print_scroll("audio_play(0)");
|
||||||
rb->mpeg_play(0);
|
rb->audio_play(0);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/* pause playback */
|
/* pause playback */
|
||||||
void set_pause(void)
|
void set_pause(void)
|
||||||
{
|
{
|
||||||
if (rb->mpeg_status() == MPEG_STATUS_PLAY)
|
if (rb->audio_status() == AUDIO_STATUS_PLAY)
|
||||||
{
|
{
|
||||||
print_scroll("mpeg_pause");
|
print_scroll("audio_pause");
|
||||||
rb->mpeg_pause();
|
rb->audio_pause();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/* stop playback */
|
/* stop playback */
|
||||||
void set_stop(void)
|
void set_stop(void)
|
||||||
{
|
{
|
||||||
if (rb->mpeg_status() & MPEG_STATUS_PLAY)
|
if (rb->audio_status() & AUDIO_STATUS_PLAY)
|
||||||
{
|
{
|
||||||
print_scroll("mpeg_stop");
|
print_scroll("audio_stop");
|
||||||
rb->mpeg_stop();
|
rb->audio_stop();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/* seek */
|
/* seek */
|
||||||
void set_position(int seconds)
|
void set_position(int seconds)
|
||||||
{
|
{
|
||||||
if (rb->mpeg_status() & MPEG_STATUS_PLAY)
|
if (rb->audio_status() & AUDIO_STATUS_PLAY)
|
||||||
{
|
{
|
||||||
print_scroll("mpeg_ff_rewind");
|
print_scroll("audio_ff_rewind");
|
||||||
rb->mpeg_ff_rewind(seconds * 1000);
|
rb->audio_ff_rewind(seconds * 1000);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -21,7 +21,7 @@ enum plugin_status plugin_start(struct plugin_api* api, void* parameter)
|
||||||
if(parameter) {
|
if(parameter) {
|
||||||
rb->strncpy(track_path, parameter, MAX_PATH);
|
rb->strncpy(track_path, parameter, MAX_PATH);
|
||||||
} else {
|
} else {
|
||||||
id3 = rb->mpeg_current_track();
|
id3 = rb->audio_current_track();
|
||||||
if (!id3) {
|
if (!id3) {
|
||||||
rb->splash(HZ*2, true, "Nothing To Save");
|
rb->splash(HZ*2, true, "Nothing To Save");
|
||||||
return PLUGIN_OK;
|
return PLUGIN_OK;
|
||||||
|
|
|
@ -614,11 +614,11 @@ static int save(
|
||||||
}
|
}
|
||||||
|
|
||||||
/* find the file position of the split point */
|
/* find the file position of the split point */
|
||||||
rb->mpeg_pause();
|
rb->audio_pause();
|
||||||
rb->mpeg_ff_rewind(splittime);
|
rb->audio_ff_rewind(splittime);
|
||||||
rb->yield();
|
rb->yield();
|
||||||
rb->yield();
|
rb->yield();
|
||||||
end = rb->mpeg_get_file_pos();
|
end = rb->audio_get_file_pos();
|
||||||
|
|
||||||
/* open the source file */
|
/* open the source file */
|
||||||
src_file = rb->open(mp3->path, O_RDONLY);
|
src_file = rb->open(mp3->path, O_RDONLY);
|
||||||
|
@ -720,7 +720,7 @@ static int save(
|
||||||
retval = -3;
|
retval = -3;
|
||||||
}
|
}
|
||||||
|
|
||||||
rb->mpeg_resume();
|
rb->audio_resume();
|
||||||
|
|
||||||
return retval;
|
return retval;
|
||||||
}
|
}
|
||||||
|
@ -985,27 +985,27 @@ unsigned long splitedit_editor(struct mp3entry * mp3_to_split,
|
||||||
|
|
||||||
case LOOP_MODE_ALL:
|
case LOOP_MODE_ALL:
|
||||||
case LOOP_MODE_TO:
|
case LOOP_MODE_TO:
|
||||||
rb->mpeg_pause();
|
rb->audio_pause();
|
||||||
rb->mpeg_ff_rewind(range_start);
|
rb->audio_ff_rewind(range_start);
|
||||||
#ifdef HAVE_MMC
|
#ifdef HAVE_MMC
|
||||||
/* MMC is slow - wait some time to allow track reload to finish */
|
/* MMC is slow - wait some time to allow track reload to finish */
|
||||||
rb->sleep(HZ/20);
|
rb->sleep(HZ/20);
|
||||||
if (mp3->elapsed > play_end) /* reload in progress */
|
if (mp3->elapsed > play_end) /* reload in progress */
|
||||||
rb->splash(10*HZ, true, "Wait - reloading");
|
rb->splash(10*HZ, true, "Wait - reloading");
|
||||||
#endif
|
#endif
|
||||||
rb->mpeg_resume();
|
rb->audio_resume();
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case LOOP_MODE_FROM:
|
case LOOP_MODE_FROM:
|
||||||
rb->mpeg_pause();
|
rb->audio_pause();
|
||||||
rb->mpeg_ff_rewind(xpos_to_time(split_x));
|
rb->audio_ff_rewind(xpos_to_time(split_x));
|
||||||
#ifdef HAVE_MMC
|
#ifdef HAVE_MMC
|
||||||
/* MMC is slow - wait some time to allow track reload to finish */
|
/* MMC is slow - wait some time to allow track reload to finish */
|
||||||
rb->sleep(HZ/20);
|
rb->sleep(HZ/20);
|
||||||
if (mp3->elapsed > play_end) /* reload in progress */
|
if (mp3->elapsed > play_end) /* reload in progress */
|
||||||
rb->splash(10*HZ, true, "Wait - reloading");
|
rb->splash(10*HZ, true, "Wait - reloading");
|
||||||
#endif
|
#endif
|
||||||
rb->mpeg_resume();
|
rb->audio_resume();
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case LOOP_MODE_FREE:
|
case LOOP_MODE_FREE:
|
||||||
|
@ -1037,9 +1037,9 @@ unsigned long splitedit_editor(struct mp3entry * mp3_to_split,
|
||||||
if (lastbutton != SPLITEDIT_PLAY_PRE)
|
if (lastbutton != SPLITEDIT_PLAY_PRE)
|
||||||
break;
|
break;
|
||||||
#endif
|
#endif
|
||||||
rb->mpeg_pause();
|
rb->audio_pause();
|
||||||
rb->mpeg_ff_rewind(xpos_to_time(split_x));
|
rb->audio_ff_rewind(xpos_to_time(split_x));
|
||||||
rb->mpeg_resume();
|
rb->audio_resume();
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case BUTTON_UP:
|
case BUTTON_UP:
|
||||||
|
@ -1159,9 +1159,9 @@ unsigned long splitedit_editor(struct mp3entry * mp3_to_split,
|
||||||
}
|
}
|
||||||
update_data();
|
update_data();
|
||||||
|
|
||||||
if (mp3 != rb->mpeg_current_track())
|
if (mp3 != rb->audio_current_track())
|
||||||
{
|
{
|
||||||
struct mp3entry *new_mp3 = rb->mpeg_current_track();
|
struct mp3entry *new_mp3 = rb->audio_current_track();
|
||||||
if (rb->strncasecmp(path_mp3, new_mp3->path,
|
if (rb->strncasecmp(path_mp3, new_mp3->path,
|
||||||
sizeof (path_mp3)))
|
sizeof (path_mp3)))
|
||||||
{
|
{
|
||||||
|
@ -1173,10 +1173,10 @@ unsigned long splitedit_editor(struct mp3entry * mp3_to_split,
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
mp3 = new_mp3;
|
mp3 = new_mp3;
|
||||||
rb->mpeg_pause();
|
rb->audio_pause();
|
||||||
rb->mpeg_flush_and_reload_tracks();
|
rb->audio_flush_and_reload_tracks();
|
||||||
rb->mpeg_ff_rewind(range_start);
|
rb->audio_ff_rewind(range_start);
|
||||||
rb->mpeg_resume();
|
rb->audio_resume();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1192,12 +1192,12 @@ enum plugin_status plugin_start(struct plugin_api* api, void* parameter)
|
||||||
rb = api;
|
rb = api;
|
||||||
rb->lcd_clear_display();
|
rb->lcd_clear_display();
|
||||||
rb->lcd_update();
|
rb->lcd_update();
|
||||||
mp3 = rb->mpeg_current_track();
|
mp3 = rb->audio_current_track();
|
||||||
if (mp3 != NULL)
|
if (mp3 != NULL)
|
||||||
{
|
{
|
||||||
if (rb->mpeg_status() & MPEG_STATUS_PAUSE)
|
if (rb->audio_status() & AUDIO_STATUS_PAUSE)
|
||||||
{
|
{
|
||||||
rb->mpeg_resume();
|
rb->audio_resume();
|
||||||
}
|
}
|
||||||
splitedit_editor(mp3, mp3->elapsed, MIN_RANGE_SIZE * 8);
|
splitedit_editor(mp3, mp3->elapsed, MIN_RANGE_SIZE * 8);
|
||||||
}
|
}
|
||||||
|
|
|
@ -27,6 +27,7 @@
|
||||||
#include "lcd.h"
|
#include "lcd.h"
|
||||||
#include "led.h"
|
#include "led.h"
|
||||||
#include "mpeg.h"
|
#include "mpeg.h"
|
||||||
|
#include "audio.h"
|
||||||
#include "mp3_playback.h"
|
#include "mp3_playback.h"
|
||||||
#include "mas.h"
|
#include "mas.h"
|
||||||
#include "button.h"
|
#include "button.h"
|
||||||
|
@ -256,7 +257,7 @@ static void trigger_listener(int trigger_status)
|
||||||
switch (trigger_status)
|
switch (trigger_status)
|
||||||
{
|
{
|
||||||
case TRIG_GO:
|
case TRIG_GO:
|
||||||
if((mpeg_status() & MPEG_STATUS_RECORD) != MPEG_STATUS_RECORD)
|
if((audio_status() & AUDIO_STATUS_RECORD) != AUDIO_STATUS_RECORD)
|
||||||
{
|
{
|
||||||
talk_buffer_steal(); /* we use the mp3 buffer */
|
talk_buffer_steal(); /* we use the mp3 buffer */
|
||||||
mpeg_record(rec_create_filename(path_buffer));
|
mpeg_record(rec_create_filename(path_buffer));
|
||||||
|
@ -276,9 +277,9 @@ static void trigger_listener(int trigger_status)
|
||||||
|
|
||||||
/* A _change_ to TRIG_READY means the current recording has stopped */
|
/* A _change_ to TRIG_READY means the current recording has stopped */
|
||||||
case TRIG_READY:
|
case TRIG_READY:
|
||||||
if(mpeg_status() & MPEG_STATUS_RECORD)
|
if(audio_status() & AUDIO_STATUS_RECORD)
|
||||||
{
|
{
|
||||||
mpeg_stop();
|
audio_stop();
|
||||||
if (global_settings.rec_trigger_mode != TRIG_MODE_REARM)
|
if (global_settings.rec_trigger_mode != TRIG_MODE_REARM)
|
||||||
{
|
{
|
||||||
peak_meter_set_trigger_listener(NULL);
|
peak_meter_set_trigger_listener(NULL);
|
||||||
|
@ -306,7 +307,7 @@ bool recording_screen(void)
|
||||||
int hours, minutes;
|
int hours, minutes;
|
||||||
char path_buffer[MAX_PATH];
|
char path_buffer[MAX_PATH];
|
||||||
bool been_in_usb_mode = false;
|
bool been_in_usb_mode = false;
|
||||||
int last_mpeg_stat = -1;
|
int last_audio_stat = -1;
|
||||||
bool last_led_stat = false;
|
bool last_led_stat = false;
|
||||||
|
|
||||||
const unsigned char *byte_units[] = {
|
const unsigned char *byte_units[] = {
|
||||||
|
@ -352,15 +353,15 @@ bool recording_screen(void)
|
||||||
|
|
||||||
while(!done)
|
while(!done)
|
||||||
{
|
{
|
||||||
int mpeg_stat = mpeg_status();
|
int audio_stat = audio_status();
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Flash the LED while waiting to record. Turn it on while
|
* Flash the LED while waiting to record. Turn it on while
|
||||||
* recording.
|
* recording.
|
||||||
*/
|
*/
|
||||||
if(mpeg_stat & MPEG_STATUS_RECORD)
|
if(audio_stat & AUDIO_STATUS_RECORD)
|
||||||
{
|
{
|
||||||
if (mpeg_stat & MPEG_STATUS_PAUSE)
|
if (audio_stat & AUDIO_STATUS_PAUSE)
|
||||||
{
|
{
|
||||||
/*
|
/*
|
||||||
This is supposed to be the same as
|
This is supposed to be the same as
|
||||||
|
@ -411,24 +412,24 @@ bool recording_screen(void)
|
||||||
/* Wait for a button while drawing the peak meter */
|
/* Wait for a button while drawing the peak meter */
|
||||||
button = peak_meter_draw_get_btn(0, 8 + h*2, LCD_WIDTH, h);
|
button = peak_meter_draw_get_btn(0, 8 + h*2, LCD_WIDTH, h);
|
||||||
|
|
||||||
if (last_mpeg_stat != mpeg_stat)
|
if (last_audio_stat != audio_stat)
|
||||||
{
|
{
|
||||||
if (mpeg_stat == MPEG_STATUS_RECORD)
|
if (audio_stat == AUDIO_STATUS_RECORD)
|
||||||
{
|
{
|
||||||
have_recorded = true;
|
have_recorded = true;
|
||||||
}
|
}
|
||||||
last_mpeg_stat = mpeg_stat;
|
last_audio_stat = audio_stat;
|
||||||
}
|
}
|
||||||
|
|
||||||
switch(button)
|
switch(button)
|
||||||
{
|
{
|
||||||
case REC_STOPEXIT:
|
case REC_STOPEXIT:
|
||||||
if(mpeg_stat & MPEG_STATUS_RECORD)
|
if(audio_stat & AUDIO_STATUS_RECORD)
|
||||||
{
|
{
|
||||||
/* turn off the trigger */
|
/* turn off the trigger */
|
||||||
peak_meter_trigger(false);
|
peak_meter_trigger(false);
|
||||||
peak_meter_set_trigger_listener(NULL);
|
peak_meter_set_trigger_listener(NULL);
|
||||||
mpeg_stop();
|
audio_stop();
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
@ -444,7 +445,7 @@ bool recording_screen(void)
|
||||||
|
|
||||||
case REC_RECPAUSE:
|
case REC_RECPAUSE:
|
||||||
/* Only act if the mpeg is stopped */
|
/* Only act if the mpeg is stopped */
|
||||||
if(!(mpeg_stat & MPEG_STATUS_RECORD))
|
if(!(audio_stat & AUDIO_STATUS_RECORD))
|
||||||
{
|
{
|
||||||
/* is this manual or triggered recording? */
|
/* is this manual or triggered recording? */
|
||||||
if ((global_settings.rec_trigger_mode == TRIG_MODE_OFF) ||
|
if ((global_settings.rec_trigger_mode == TRIG_MODE_OFF) ||
|
||||||
|
@ -458,7 +459,7 @@ bool recording_screen(void)
|
||||||
last_seconds = 0;
|
last_seconds = 0;
|
||||||
if (global_settings.talk_menu)
|
if (global_settings.talk_menu)
|
||||||
{ /* no voice possible here, but a beep */
|
{ /* no voice possible here, but a beep */
|
||||||
mpeg_beep(HZ/2); /* longer beep on start */
|
audio_beep(HZ/2); /* longer beep on start */
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -476,12 +477,12 @@ bool recording_screen(void)
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
if(mpeg_stat & MPEG_STATUS_PAUSE)
|
if(audio_stat & AUDIO_STATUS_PAUSE)
|
||||||
{
|
{
|
||||||
mpeg_resume_recording();
|
mpeg_resume_recording();
|
||||||
if (global_settings.talk_menu)
|
if (global_settings.talk_menu)
|
||||||
{ /* no voice possible here, but a beep */
|
{ /* no voice possible here, but a beep */
|
||||||
mpeg_beep(HZ/4); /* short beep on resume */
|
audio_beep(HZ/4); /* short beep on resume */
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
@ -594,7 +595,7 @@ bool recording_screen(void)
|
||||||
|
|
||||||
#ifdef REC_SETTINGS
|
#ifdef REC_SETTINGS
|
||||||
case REC_SETTINGS:
|
case REC_SETTINGS:
|
||||||
if(mpeg_stat != MPEG_STATUS_RECORD)
|
if(audio_stat != AUDIO_STATUS_RECORD)
|
||||||
{
|
{
|
||||||
/* led is restored at begin of loop / end of function */
|
/* led is restored at begin of loop / end of function */
|
||||||
led(false);
|
led(false);
|
||||||
|
@ -625,7 +626,7 @@ bool recording_screen(void)
|
||||||
|
|
||||||
#ifdef REC_F2
|
#ifdef REC_F2
|
||||||
case REC_F2:
|
case REC_F2:
|
||||||
if(mpeg_stat != MPEG_STATUS_RECORD)
|
if(audio_stat != AUDIO_STATUS_RECORD)
|
||||||
{
|
{
|
||||||
/* led is restored at begin of loop / end of function */
|
/* led is restored at begin of loop / end of function */
|
||||||
led(false);
|
led(false);
|
||||||
|
@ -642,14 +643,14 @@ bool recording_screen(void)
|
||||||
|
|
||||||
#ifdef REC_F3
|
#ifdef REC_F3
|
||||||
case REC_F3:
|
case REC_F3:
|
||||||
if(mpeg_stat & MPEG_STATUS_RECORD)
|
if(audio_stat & AUDIO_STATUS_RECORD)
|
||||||
{
|
{
|
||||||
mpeg_new_file(rec_create_filename(path_buffer));
|
mpeg_new_file(rec_create_filename(path_buffer));
|
||||||
last_seconds = 0;
|
last_seconds = 0;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
if(mpeg_stat != MPEG_STATUS_RECORD)
|
if(audio_stat != AUDIO_STATUS_RECORD)
|
||||||
{
|
{
|
||||||
/* led is restored at begin of loop / end of function */
|
/* led is restored at begin of loop / end of function */
|
||||||
led(false);
|
led(false);
|
||||||
|
@ -667,7 +668,7 @@ bool recording_screen(void)
|
||||||
|
|
||||||
case SYS_USB_CONNECTED:
|
case SYS_USB_CONNECTED:
|
||||||
/* Only accept USB connection when not recording */
|
/* Only accept USB connection when not recording */
|
||||||
if(mpeg_stat != MPEG_STATUS_RECORD)
|
if(audio_stat != AUDIO_STATUS_RECORD)
|
||||||
{
|
{
|
||||||
default_event_handler(SYS_USB_CONNECTED);
|
default_event_handler(SYS_USB_CONNECTED);
|
||||||
done = true;
|
done = true;
|
||||||
|
@ -708,7 +709,7 @@ bool recording_screen(void)
|
||||||
|
|
||||||
dseconds = rec_timesplit_seconds();
|
dseconds = rec_timesplit_seconds();
|
||||||
|
|
||||||
if(mpeg_stat & MPEG_STATUS_PRERECORD)
|
if(audio_stat & AUDIO_STATUS_PRERECORD)
|
||||||
{
|
{
|
||||||
snprintf(buf, 32, "%s...", str(LANG_RECORD_PRERECORD));
|
snprintf(buf, 32, "%s...", str(LANG_RECORD_PRERECORD));
|
||||||
}
|
}
|
||||||
|
@ -741,7 +742,7 @@ bool recording_screen(void)
|
||||||
/* We will do file splitting regardless, since the OFF
|
/* We will do file splitting regardless, since the OFF
|
||||||
setting really means 24 hours. This is to make sure
|
setting really means 24 hours. This is to make sure
|
||||||
that the recorded files don't get too big. */
|
that the recorded files don't get too big. */
|
||||||
if (mpeg_stat && (seconds >= dseconds))
|
if (audio_stat && (seconds >= dseconds))
|
||||||
{
|
{
|
||||||
mpeg_new_file(rec_create_filename(path_buffer));
|
mpeg_new_file(rec_create_filename(path_buffer));
|
||||||
update_countdown = 1;
|
update_countdown = 1;
|
||||||
|
@ -822,7 +823,7 @@ bool recording_screen(void)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if(mpeg_stat & MPEG_STATUS_ERROR)
|
if(audio_stat & AUDIO_STATUS_ERROR)
|
||||||
{
|
{
|
||||||
done = true;
|
done = true;
|
||||||
}
|
}
|
||||||
|
@ -830,12 +831,12 @@ bool recording_screen(void)
|
||||||
|
|
||||||
invert_led(false);
|
invert_led(false);
|
||||||
|
|
||||||
if(mpeg_status() & MPEG_STATUS_ERROR)
|
if(audio_status() & AUDIO_STATUS_ERROR)
|
||||||
{
|
{
|
||||||
splash(0, true, str(LANG_DISK_FULL));
|
splash(0, true, str(LANG_DISK_FULL));
|
||||||
status_draw(true);
|
status_draw(true);
|
||||||
lcd_update();
|
lcd_update();
|
||||||
mpeg_error_clear();
|
audio_error_clear();
|
||||||
|
|
||||||
while(1)
|
while(1)
|
||||||
{
|
{
|
||||||
|
@ -845,7 +846,7 @@ bool recording_screen(void)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
mpeg_init_playback();
|
audio_init_playback();
|
||||||
|
|
||||||
/* make sure the trigger is really turned off */
|
/* make sure the trigger is really turned off */
|
||||||
peak_meter_trigger(false);
|
peak_meter_trigger(false);
|
||||||
|
|
|
@ -25,7 +25,7 @@
|
||||||
#include "lang.h"
|
#include "lang.h"
|
||||||
#include "icons.h"
|
#include "icons.h"
|
||||||
#include "font.h"
|
#include "font.h"
|
||||||
#include "mpeg.h"
|
#include "audio.h"
|
||||||
#include "mp3_playback.h"
|
#include "mp3_playback.h"
|
||||||
#include "usb.h"
|
#include "usb.h"
|
||||||
#include "settings.h"
|
#include "settings.h"
|
||||||
|
@ -452,17 +452,17 @@ int pitch_screen(void)
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case BUTTON_ON | BUTTON_PLAY:
|
case BUTTON_ON | BUTTON_PLAY:
|
||||||
mpeg_pause();
|
audio_pause();
|
||||||
used = true;
|
used = true;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case BUTTON_PLAY | BUTTON_REL:
|
case BUTTON_PLAY | BUTTON_REL:
|
||||||
mpeg_resume();
|
audio_resume();
|
||||||
used = true;
|
used = true;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case BUTTON_ON | BUTTON_PLAY | BUTTON_REL:
|
case BUTTON_ON | BUTTON_PLAY | BUTTON_REL:
|
||||||
mpeg_resume();
|
audio_resume();
|
||||||
exit = true;
|
exit = true;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
@ -651,7 +651,7 @@ bool quick_screen(int context, int button)
|
||||||
global_settings.playlist_shuffle =
|
global_settings.playlist_shuffle =
|
||||||
!global_settings.playlist_shuffle;
|
!global_settings.playlist_shuffle;
|
||||||
|
|
||||||
if(mpeg_status() & MPEG_STATUS_PLAY)
|
if(audio_status() & AUDIO_STATUS_PLAY)
|
||||||
{
|
{
|
||||||
if (global_settings.playlist_shuffle)
|
if (global_settings.playlist_shuffle)
|
||||||
playlist_randomise(NULL, current_tick, true);
|
playlist_randomise(NULL, current_tick, true);
|
||||||
|
@ -727,7 +727,7 @@ bool quick_screen(int context, int button)
|
||||||
case BUTTON_F2:
|
case BUTTON_F2:
|
||||||
|
|
||||||
if ( oldrepeat != global_settings.repeat_mode )
|
if ( oldrepeat != global_settings.repeat_mode )
|
||||||
mpeg_flush_and_reload_tracks();
|
audio_flush_and_reload_tracks();
|
||||||
|
|
||||||
break;
|
break;
|
||||||
case BUTTON_F3:
|
case BUTTON_F3:
|
||||||
|
@ -1254,14 +1254,14 @@ bool shutdown_screen(void)
|
||||||
|
|
||||||
bool browse_id3(void)
|
bool browse_id3(void)
|
||||||
{
|
{
|
||||||
struct mp3entry* id3 = mpeg_current_track();
|
struct mp3entry* id3 = audio_current_track();
|
||||||
int button;
|
int button;
|
||||||
int menu_pos = 0;
|
int menu_pos = 0;
|
||||||
int menu_max = 8;
|
int menu_max = 8;
|
||||||
bool exit = false;
|
bool exit = false;
|
||||||
char scroll_text[MAX_PATH];
|
char scroll_text[MAX_PATH];
|
||||||
|
|
||||||
if (!(mpeg_status() & MPEG_STATUS_PLAY))
|
if (!(audio_status() & AUDIO_STATUS_PLAY))
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
while (!exit)
|
while (!exit)
|
||||||
|
|
|
@ -31,7 +31,7 @@
|
||||||
#include "usb.h"
|
#include "usb.h"
|
||||||
#include "backlight.h"
|
#include "backlight.h"
|
||||||
#include "lcd.h"
|
#include "lcd.h"
|
||||||
#include "mpeg.h"
|
#include "audio.h"
|
||||||
#include "mp3_playback.h"
|
#include "mp3_playback.h"
|
||||||
#include "talk.h"
|
#include "talk.h"
|
||||||
#include "string.h"
|
#include "string.h"
|
||||||
|
@ -757,7 +757,7 @@ void settings_apply(void)
|
||||||
|
|
||||||
sound_settings_apply();
|
sound_settings_apply();
|
||||||
|
|
||||||
mpeg_set_buffer_margin(global_settings.buffer_margin);
|
audio_set_buffer_margin(global_settings.buffer_margin);
|
||||||
|
|
||||||
lcd_set_contrast(global_settings.contrast);
|
lcd_set_contrast(global_settings.contrast);
|
||||||
lcd_scroll_speed(global_settings.scroll_speed);
|
lcd_scroll_speed(global_settings.scroll_speed);
|
||||||
|
|
|
@ -26,6 +26,7 @@
|
||||||
#include "lcd.h"
|
#include "lcd.h"
|
||||||
#include "menu.h"
|
#include "menu.h"
|
||||||
#include "mpeg.h"
|
#include "mpeg.h"
|
||||||
|
#include "audio.h"
|
||||||
#include "button.h"
|
#include "button.h"
|
||||||
#include "kernel.h"
|
#include "kernel.h"
|
||||||
#include "thread.h"
|
#include "thread.h"
|
||||||
|
@ -452,7 +453,7 @@ static bool repeat_mode(void)
|
||||||
INT, names, 3, NULL );
|
INT, names, 3, NULL );
|
||||||
|
|
||||||
if (old_repeat != global_settings.repeat_mode)
|
if (old_repeat != global_settings.repeat_mode)
|
||||||
mpeg_flush_and_reload_tracks();
|
audio_flush_and_reload_tracks();
|
||||||
|
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
@ -817,7 +818,7 @@ static bool buffer_margin(void)
|
||||||
{
|
{
|
||||||
return set_int(str(LANG_MP3BUFFER_MARGIN), "s", UNIT_SEC,
|
return set_int(str(LANG_MP3BUFFER_MARGIN), "s", UNIT_SEC,
|
||||||
&global_settings.buffer_margin,
|
&global_settings.buffer_margin,
|
||||||
mpeg_set_buffer_margin, 1, 0, 7 );
|
audio_set_buffer_margin, 1, 0, 7 );
|
||||||
}
|
}
|
||||||
|
|
||||||
static bool ff_rewind_min_step(void)
|
static bool ff_rewind_min_step(void)
|
||||||
|
|
|
@ -25,7 +25,7 @@
|
||||||
#include "settings.h"
|
#include "settings.h"
|
||||||
#include "status.h"
|
#include "status.h"
|
||||||
#include "mp3_playback.h"
|
#include "mp3_playback.h"
|
||||||
#include "mpeg.h"
|
#include "audio.h"
|
||||||
#include "wps.h"
|
#include "wps.h"
|
||||||
#ifdef HAVE_RTC
|
#ifdef HAVE_RTC
|
||||||
#include "timefuncs.h"
|
#include "timefuncs.h"
|
||||||
|
@ -75,16 +75,16 @@ void status_set_ffmode(enum playmode mode)
|
||||||
|
|
||||||
int current_playmode(void)
|
int current_playmode(void)
|
||||||
{
|
{
|
||||||
int mpeg_stat = mpeg_status();
|
int audio_stat = audio_status();
|
||||||
|
|
||||||
/* ff_mode can be either STATUS_FASTFORWARD or STATUS_FASTBACKWARD
|
/* ff_mode can be either STATUS_FASTFORWARD or STATUS_FASTBACKWARD
|
||||||
and that supercedes the other modes */
|
and that supercedes the other modes */
|
||||||
if(ff_mode)
|
if(ff_mode)
|
||||||
return ff_mode;
|
return ff_mode;
|
||||||
|
|
||||||
if(mpeg_stat & MPEG_STATUS_PLAY)
|
if(audio_stat & AUDIO_STATUS_PLAY)
|
||||||
{
|
{
|
||||||
if(mpeg_stat & MPEG_STATUS_PAUSE)
|
if(audio_stat & AUDIO_STATUS_PAUSE)
|
||||||
return STATUS_PAUSE;
|
return STATUS_PAUSE;
|
||||||
else
|
else
|
||||||
return STATUS_PLAY;
|
return STATUS_PLAY;
|
||||||
|
@ -92,9 +92,9 @@ int current_playmode(void)
|
||||||
#if CONFIG_HWCODEC == MAS3587F
|
#if CONFIG_HWCODEC == MAS3587F
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
if(mpeg_stat & MPEG_STATUS_RECORD)
|
if(audio_stat & AUDIO_STATUS_RECORD)
|
||||||
{
|
{
|
||||||
if(mpeg_stat & MPEG_STATUS_PAUSE)
|
if(audio_stat & AUDIO_STATUS_PAUSE)
|
||||||
return STATUS_RECORD_PAUSE;
|
return STATUS_RECORD_PAUSE;
|
||||||
else
|
else
|
||||||
return STATUS_RECORD;
|
return STATUS_RECORD;
|
||||||
|
|
12
apps/talk.c
12
apps/talk.c
|
@ -28,7 +28,7 @@
|
||||||
#include "system.h"
|
#include "system.h"
|
||||||
#include "settings.h"
|
#include "settings.h"
|
||||||
#include "mp3_playback.h"
|
#include "mp3_playback.h"
|
||||||
#include "mpeg.h"
|
#include "audio.h"
|
||||||
#include "lang.h"
|
#include "lang.h"
|
||||||
#include "talk.h"
|
#include "talk.h"
|
||||||
#include "id3.h"
|
#include "id3.h"
|
||||||
|
@ -432,7 +432,7 @@ int talk_id(long id, bool enqueue)
|
||||||
unsigned char* clipbuf;
|
unsigned char* clipbuf;
|
||||||
int unit;
|
int unit;
|
||||||
|
|
||||||
if (mpeg_status()) /* busy, buffer in use */
|
if (audio_status()) /* busy, buffer in use */
|
||||||
return -1;
|
return -1;
|
||||||
|
|
||||||
if (p_voicefile == NULL && has_voicefile)
|
if (p_voicefile == NULL && has_voicefile)
|
||||||
|
@ -471,7 +471,7 @@ int talk_file(const char* filename, bool enqueue)
|
||||||
int size;
|
int size;
|
||||||
struct mp3entry info;
|
struct mp3entry info;
|
||||||
|
|
||||||
if (mpeg_status()) /* busy, buffer in use */
|
if (audio_status()) /* busy, buffer in use */
|
||||||
return -1;
|
return -1;
|
||||||
|
|
||||||
if (p_thumbnail == NULL || size_for_thumbnail <= 0)
|
if (p_thumbnail == NULL || size_for_thumbnail <= 0)
|
||||||
|
@ -512,7 +512,7 @@ int talk_number(long n, bool enqueue)
|
||||||
int level = 0; /* mille count */
|
int level = 0; /* mille count */
|
||||||
long mil = 1000000000; /* highest possible "-illion" */
|
long mil = 1000000000; /* highest possible "-illion" */
|
||||||
|
|
||||||
if (mpeg_status()) /* busy, buffer in use */
|
if (audio_status()) /* busy, buffer in use */
|
||||||
return -1;
|
return -1;
|
||||||
|
|
||||||
if (!enqueue)
|
if (!enqueue)
|
||||||
|
@ -591,7 +591,7 @@ int talk_value(long n, int unit, bool enqueue)
|
||||||
VOICE_HERTZ,
|
VOICE_HERTZ,
|
||||||
};
|
};
|
||||||
|
|
||||||
if (mpeg_status()) /* busy, buffer in use */
|
if (audio_status()) /* busy, buffer in use */
|
||||||
return -1;
|
return -1;
|
||||||
|
|
||||||
if (unit < 0 || unit >= UNIT_LAST)
|
if (unit < 0 || unit >= UNIT_LAST)
|
||||||
|
@ -623,7 +623,7 @@ int talk_spell(const char* spell, bool enqueue)
|
||||||
{
|
{
|
||||||
char c; /* currently processed char */
|
char c; /* currently processed char */
|
||||||
|
|
||||||
if (mpeg_status()) /* busy, buffer in use */
|
if (audio_status()) /* busy, buffer in use */
|
||||||
return -1;
|
return -1;
|
||||||
|
|
||||||
if (!enqueue)
|
if (!enqueue)
|
||||||
|
|
12
apps/tree.c
12
apps/tree.c
|
@ -33,7 +33,7 @@
|
||||||
#include "tree.h"
|
#include "tree.h"
|
||||||
#include "main_menu.h"
|
#include "main_menu.h"
|
||||||
#include "sprintf.h"
|
#include "sprintf.h"
|
||||||
#include "mpeg.h"
|
#include "audio.h"
|
||||||
#include "playlist.h"
|
#include "playlist.h"
|
||||||
#include "menu.h"
|
#include "menu.h"
|
||||||
#include "wps.h"
|
#include "wps.h"
|
||||||
|
@ -799,8 +799,8 @@ static bool dirbrowse(void)
|
||||||
{
|
{
|
||||||
/* Stop the music if it is playing, else show the shutdown
|
/* Stop the music if it is playing, else show the shutdown
|
||||||
screen */
|
screen */
|
||||||
if(mpeg_status())
|
if(audio_status())
|
||||||
mpeg_stop();
|
audio_stop();
|
||||||
else {
|
else {
|
||||||
if (!charger_inserted()) {
|
if (!charger_inserted()) {
|
||||||
shutdown_screen();
|
shutdown_screen();
|
||||||
|
@ -998,7 +998,7 @@ static bool dirbrowse(void)
|
||||||
/* don't enter wps from plugin browser etc */
|
/* don't enter wps from plugin browser etc */
|
||||||
if (*tc.dirfilter < NUM_FILTER_MODES)
|
if (*tc.dirfilter < NUM_FILTER_MODES)
|
||||||
{
|
{
|
||||||
if (mpeg_status() & MPEG_STATUS_PLAY)
|
if (audio_status() & AUDIO_STATUS_PLAY)
|
||||||
{
|
{
|
||||||
start_wps=true;
|
start_wps=true;
|
||||||
}
|
}
|
||||||
|
@ -1539,7 +1539,7 @@ int ft_play_dirname(int start_index)
|
||||||
char dirname_mp3_filename[MAX_PATH+1];
|
char dirname_mp3_filename[MAX_PATH+1];
|
||||||
struct entry *dircache = tc.dircache;
|
struct entry *dircache = tc.dircache;
|
||||||
|
|
||||||
if (mpeg_status() & MPEG_STATUS_PLAY)
|
if (audio_status() & AUDIO_STATUS_PLAY)
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
snprintf(dirname_mp3_filename, sizeof(dirname_mp3_filename), "%s/%s/%s",
|
snprintf(dirname_mp3_filename, sizeof(dirname_mp3_filename), "%s/%s/%s",
|
||||||
|
@ -1566,7 +1566,7 @@ void ft_play_filename(char *dir, char *file)
|
||||||
{
|
{
|
||||||
char name_mp3_filename[MAX_PATH+1];
|
char name_mp3_filename[MAX_PATH+1];
|
||||||
|
|
||||||
if (mpeg_status() & MPEG_STATUS_PLAY)
|
if (audio_status() & AUDIO_STATUS_PLAY)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
if (strcasecmp(&file[strlen(file) - strlen(file_thumbnail_ext)],
|
if (strcasecmp(&file[strlen(file) - strlen(file_thumbnail_ext)],
|
||||||
|
|
|
@ -29,7 +29,7 @@
|
||||||
#include "lcd.h"
|
#include "lcd.h"
|
||||||
#include "hwcompat.h"
|
#include "hwcompat.h"
|
||||||
#include "font.h"
|
#include "font.h"
|
||||||
#include "mpeg.h"
|
#include "audio.h"
|
||||||
#include "id3.h"
|
#include "id3.h"
|
||||||
#include "settings.h"
|
#include "settings.h"
|
||||||
#include "playlist.h"
|
#include "playlist.h"
|
||||||
|
@ -1011,7 +1011,7 @@ bool wps_display(struct mp3entry* id3,
|
||||||
{
|
{
|
||||||
lcd_clear_display();
|
lcd_clear_display();
|
||||||
|
|
||||||
if (!id3 && !(mpeg_status() & MPEG_STATUS_PLAY))
|
if (!id3 && !(audio_status() & AUDIO_STATUS_PLAY))
|
||||||
{
|
{
|
||||||
#ifdef HAVE_LCD_CHARCELLS
|
#ifdef HAVE_LCD_CHARCELLS
|
||||||
lcd_puts(0, 0, str(LANG_END_PLAYLIST_PLAYER));
|
lcd_puts(0, 0, str(LANG_END_PLAYLIST_PLAYER));
|
||||||
|
|
62
apps/wps.c
62
apps/wps.c
|
@ -33,7 +33,7 @@
|
||||||
#include "settings.h"
|
#include "settings.h"
|
||||||
#include "wps.h"
|
#include "wps.h"
|
||||||
#include "wps-display.h"
|
#include "wps-display.h"
|
||||||
#include "mpeg.h"
|
#include "audio.h"
|
||||||
#include "mp3_playback.h"
|
#include "mp3_playback.h"
|
||||||
#include "usb.h"
|
#include "usb.h"
|
||||||
#include "status.h"
|
#include "status.h"
|
||||||
|
@ -262,11 +262,11 @@ static bool ffwd_rew(int button)
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
if ( (mpeg_status() & MPEG_STATUS_PLAY) &&
|
if ( (audio_status() & AUDIO_STATUS_PLAY) &&
|
||||||
id3 && id3->length )
|
id3 && id3->length )
|
||||||
{
|
{
|
||||||
if (!paused)
|
if (!paused)
|
||||||
mpeg_pause();
|
audio_pause();
|
||||||
#if CONFIG_KEYPAD == PLAYER_PAD
|
#if CONFIG_KEYPAD == PLAYER_PAD
|
||||||
lcd_stop_scroll();
|
lcd_stop_scroll();
|
||||||
#endif
|
#endif
|
||||||
|
@ -308,12 +308,12 @@ static bool ffwd_rew(int button)
|
||||||
|
|
||||||
case WPS_PREV:
|
case WPS_PREV:
|
||||||
case WPS_NEXT:
|
case WPS_NEXT:
|
||||||
mpeg_ff_rewind(id3->elapsed+ff_rewind_count);
|
audio_ff_rewind(id3->elapsed+ff_rewind_count);
|
||||||
ff_rewind_count = 0;
|
ff_rewind_count = 0;
|
||||||
ff_rewind = false;
|
ff_rewind = false;
|
||||||
status_set_ffmode(0);
|
status_set_ffmode(0);
|
||||||
if (!paused)
|
if (!paused)
|
||||||
mpeg_resume();
|
audio_resume();
|
||||||
#ifdef HAVE_LCD_CHARCELLS
|
#ifdef HAVE_LCD_CHARCELLS
|
||||||
wps_display(id3, nid3);
|
wps_display(id3, nid3);
|
||||||
#endif
|
#endif
|
||||||
|
@ -332,7 +332,7 @@ static bool ffwd_rew(int button)
|
||||||
button = button_get(true);
|
button = button_get(true);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* let mpeg thread update id3->elapsed before calling wps_refresh */
|
/* let audio thread update id3->elapsed before calling wps_refresh */
|
||||||
yield();
|
yield();
|
||||||
wps_refresh(id3, nid3, 0, WPS_REFRESH_ALL);
|
wps_refresh(id3, nid3, 0, WPS_REFRESH_ALL);
|
||||||
return usb;
|
return usb;
|
||||||
|
@ -340,14 +340,14 @@ static bool ffwd_rew(int button)
|
||||||
|
|
||||||
static bool update(void)
|
static bool update(void)
|
||||||
{
|
{
|
||||||
bool track_changed = mpeg_has_changed_track();
|
bool track_changed = audio_has_changed_track();
|
||||||
bool retcode = false;
|
bool retcode = false;
|
||||||
|
|
||||||
nid3 = mpeg_next_track();
|
nid3 = audio_next_track();
|
||||||
if (track_changed)
|
if (track_changed)
|
||||||
{
|
{
|
||||||
lcd_stop_scroll();
|
lcd_stop_scroll();
|
||||||
id3 = mpeg_current_track();
|
id3 = audio_current_track();
|
||||||
if (wps_display(id3, nid3))
|
if (wps_display(id3, nid3))
|
||||||
retcode = true;
|
retcode = true;
|
||||||
else
|
else
|
||||||
|
@ -391,8 +391,8 @@ static void fade(bool fade_in)
|
||||||
/* zero out the sound */
|
/* zero out the sound */
|
||||||
sound_set(SOUND_VOLUME, current_volume);
|
sound_set(SOUND_VOLUME, current_volume);
|
||||||
|
|
||||||
sleep(HZ/10); /* let mpeg thread run */
|
sleep(HZ/10); /* let audio thread run */
|
||||||
mpeg_resume();
|
audio_resume();
|
||||||
|
|
||||||
while (current_volume < global_settings.volume) {
|
while (current_volume < global_settings.volume) {
|
||||||
current_volume += 2;
|
current_volume += 2;
|
||||||
|
@ -410,8 +410,8 @@ static void fade(bool fade_in)
|
||||||
sleep(1);
|
sleep(1);
|
||||||
sound_set(SOUND_VOLUME, current_volume);
|
sound_set(SOUND_VOLUME, current_volume);
|
||||||
}
|
}
|
||||||
mpeg_pause();
|
audio_pause();
|
||||||
sleep(HZ/5); /* let mpeg thread run */
|
sleep(HZ/5); /* let audio thread run */
|
||||||
|
|
||||||
/* reset volume to what it was before the fade */
|
/* reset volume to what it was before the fade */
|
||||||
sound_set(SOUND_VOLUME, global_settings.volume);
|
sound_set(SOUND_VOLUME, global_settings.volume);
|
||||||
|
@ -451,10 +451,10 @@ long wps_show(void)
|
||||||
|
|
||||||
ff_rewind = false;
|
ff_rewind = false;
|
||||||
|
|
||||||
if(mpeg_status() & MPEG_STATUS_PLAY)
|
if(audio_status() & AUDIO_STATUS_PLAY)
|
||||||
{
|
{
|
||||||
id3 = mpeg_current_track();
|
id3 = audio_current_track();
|
||||||
nid3 = mpeg_next_track();
|
nid3 = audio_next_track();
|
||||||
if (id3) {
|
if (id3) {
|
||||||
if (wps_display(id3, nid3))
|
if (wps_display(id3, nid3))
|
||||||
return 0;
|
return 0;
|
||||||
|
@ -468,13 +468,13 @@ long wps_show(void)
|
||||||
|
|
||||||
while ( 1 )
|
while ( 1 )
|
||||||
{
|
{
|
||||||
bool mpeg_paused = (mpeg_status() & MPEG_STATUS_PAUSE)?true:false;
|
bool audio_paused = (audio_status() & AUDIO_STATUS_PAUSE)?true:false;
|
||||||
|
|
||||||
/* did someone else (i.e power thread) change mpeg pause mode? */
|
/* did someone else (i.e power thread) change audio pause mode? */
|
||||||
if (paused != mpeg_paused) {
|
if (paused != audio_paused) {
|
||||||
paused = mpeg_paused;
|
paused = audio_paused;
|
||||||
|
|
||||||
/* if another thread paused mpeg, we are probably in car mode,
|
/* if another thread paused audio, we are probably in car mode,
|
||||||
about to shut down. lets save the settings. */
|
about to shut down. lets save the settings. */
|
||||||
if (paused && global_settings.resume) {
|
if (paused && global_settings.resume) {
|
||||||
settings_save();
|
settings_save();
|
||||||
|
@ -560,10 +560,10 @@ long wps_show(void)
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
/* Exit if mpeg has stopped playing. This can happen if using the
|
/* Exit if audio has stopped playing. This can happen if using the
|
||||||
sleep timer with the charger plugged or if starting a recording
|
sleep timer with the charger plugged or if starting a recording
|
||||||
from F1 */
|
from F1 */
|
||||||
if (!mpeg_status())
|
if (!audio_status())
|
||||||
exit = true;
|
exit = true;
|
||||||
|
|
||||||
switch(button)
|
switch(button)
|
||||||
|
@ -598,7 +598,7 @@ long wps_show(void)
|
||||||
if ( global_settings.fade_on_stop )
|
if ( global_settings.fade_on_stop )
|
||||||
fade(1);
|
fade(1);
|
||||||
else
|
else
|
||||||
mpeg_resume();
|
audio_resume();
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
@ -606,7 +606,7 @@ long wps_show(void)
|
||||||
if ( global_settings.fade_on_stop )
|
if ( global_settings.fade_on_stop )
|
||||||
fade(0);
|
fade(0);
|
||||||
else
|
else
|
||||||
mpeg_pause();
|
audio_pause();
|
||||||
if (global_settings.resume) {
|
if (global_settings.resume) {
|
||||||
settings_save();
|
settings_save();
|
||||||
#ifndef HAVE_RTC
|
#ifndef HAVE_RTC
|
||||||
|
@ -662,16 +662,16 @@ long wps_show(void)
|
||||||
case WPS_RC_PREV:
|
case WPS_RC_PREV:
|
||||||
#endif
|
#endif
|
||||||
if (!id3 || (id3->elapsed < 3*1000)) {
|
if (!id3 || (id3->elapsed < 3*1000)) {
|
||||||
mpeg_prev();
|
audio_prev();
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
if (!paused)
|
if (!paused)
|
||||||
mpeg_pause();
|
audio_pause();
|
||||||
|
|
||||||
mpeg_ff_rewind(0);
|
audio_ff_rewind(0);
|
||||||
|
|
||||||
if (!paused)
|
if (!paused)
|
||||||
mpeg_resume();
|
audio_resume();
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
@ -684,7 +684,7 @@ long wps_show(void)
|
||||||
#ifdef WPS_RC_NEXT
|
#ifdef WPS_RC_NEXT
|
||||||
case WPS_RC_NEXT:
|
case WPS_RC_NEXT:
|
||||||
#endif
|
#endif
|
||||||
mpeg_next();
|
audio_next();
|
||||||
break;
|
break;
|
||||||
|
|
||||||
/* menu key functions */
|
/* menu key functions */
|
||||||
|
@ -789,7 +789,7 @@ long wps_show(void)
|
||||||
|
|
||||||
lcd_stop_scroll();
|
lcd_stop_scroll();
|
||||||
bookmark_autobookmark();
|
bookmark_autobookmark();
|
||||||
mpeg_stop();
|
audio_stop();
|
||||||
|
|
||||||
/* Keys can be locked when exiting, so either unlock here
|
/* Keys can be locked when exiting, so either unlock here
|
||||||
or implement key locking in tree.c too */
|
or implement key locking in tree.c too */
|
||||||
|
|
81
firmware/export/audio.h
Normal file
81
firmware/export/audio.h
Normal file
|
@ -0,0 +1,81 @@
|
||||||
|
/***************************************************************************
|
||||||
|
* __________ __ ___.
|
||||||
|
* Open \______ \ ____ ____ | | _\_ |__ _______ ___
|
||||||
|
* Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ /
|
||||||
|
* Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < <
|
||||||
|
* Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \
|
||||||
|
* \/ \/ \/ \/ \/
|
||||||
|
* $Id$
|
||||||
|
*
|
||||||
|
* Copyright (C) 2005 by Linus Nielsen Feltzing
|
||||||
|
*
|
||||||
|
* All files in this archive are subject to the GNU General Public License.
|
||||||
|
* See the file COPYING in the source tree root for full license agreement.
|
||||||
|
*
|
||||||
|
* This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY
|
||||||
|
* KIND, either express or implied.
|
||||||
|
*
|
||||||
|
****************************************************************************/
|
||||||
|
#ifndef AUDIO_H
|
||||||
|
#define AUDIO_H
|
||||||
|
|
||||||
|
#include <stdbool.h>
|
||||||
|
|
||||||
|
#ifdef SIMULATOR
|
||||||
|
#define audio_play(x) sim_audio_play(x)
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#define AUDIO_STATUS_PLAY 1
|
||||||
|
#define AUDIO_STATUS_PAUSE 2
|
||||||
|
#define AUDIO_STATUS_RECORD 4
|
||||||
|
#define AUDIO_STATUS_PRERECORD 8
|
||||||
|
#define AUDIO_STATUS_ERROR 16
|
||||||
|
|
||||||
|
#define AUDIOERR_DISK_FULL 1
|
||||||
|
|
||||||
|
struct audio_debug
|
||||||
|
{
|
||||||
|
int mp3buflen;
|
||||||
|
int mp3buf_write;
|
||||||
|
int mp3buf_swapwrite;
|
||||||
|
int mp3buf_read;
|
||||||
|
|
||||||
|
int last_dma_chunk_size;
|
||||||
|
|
||||||
|
bool dma_on;
|
||||||
|
bool playing;
|
||||||
|
bool play_pending;
|
||||||
|
bool is_playing;
|
||||||
|
bool filling;
|
||||||
|
bool dma_underrun;
|
||||||
|
|
||||||
|
int unplayed_space;
|
||||||
|
int playable_space;
|
||||||
|
int unswapped_space;
|
||||||
|
|
||||||
|
int low_watermark_level;
|
||||||
|
int lowest_watermark_level;
|
||||||
|
};
|
||||||
|
|
||||||
|
void audio_init(void);
|
||||||
|
void audio_play(int offset);
|
||||||
|
void audio_stop(void);
|
||||||
|
void audio_pause(void);
|
||||||
|
void audio_resume(void);
|
||||||
|
void audio_next(void);
|
||||||
|
void audio_prev(void);
|
||||||
|
int audio_status(void);
|
||||||
|
void audio_ff_rewind(int newtime);
|
||||||
|
void audio_flush_and_reload_tracks(void);
|
||||||
|
struct mp3entry* audio_current_track(void);
|
||||||
|
struct mp3entry* audio_next_track(void);
|
||||||
|
bool audio_has_changed_track(void);
|
||||||
|
void audio_get_debugdata(struct audio_debug *dbgdata);
|
||||||
|
void audio_set_buffer_margin(int seconds);
|
||||||
|
unsigned int audio_error(void);
|
||||||
|
void audio_error_clear(void);
|
||||||
|
int audio_get_file_pos(void);
|
||||||
|
void audio_beep(int duration);
|
||||||
|
void audio_init_playback(void);
|
||||||
|
|
||||||
|
#endif
|
|
@ -42,50 +42,8 @@
|
||||||
/* For ID3 info and VBR header */
|
/* For ID3 info and VBR header */
|
||||||
#define MPEG_RESERVED_HEADER_SPACE (4096 + 1500)
|
#define MPEG_RESERVED_HEADER_SPACE (4096 + 1500)
|
||||||
|
|
||||||
#ifdef SIMULATOR
|
|
||||||
#define mpeg_play(x) sim_mpeg_play(x)
|
|
||||||
#endif
|
|
||||||
|
|
||||||
struct mpeg_debug
|
|
||||||
{
|
|
||||||
int mp3buflen;
|
|
||||||
int mp3buf_write;
|
|
||||||
int mp3buf_swapwrite;
|
|
||||||
int mp3buf_read;
|
|
||||||
|
|
||||||
int last_dma_chunk_size;
|
|
||||||
|
|
||||||
bool dma_on;
|
|
||||||
bool playing;
|
|
||||||
bool play_pending;
|
|
||||||
bool is_playing;
|
|
||||||
bool filling;
|
|
||||||
bool dma_underrun;
|
|
||||||
|
|
||||||
int unplayed_space;
|
|
||||||
int playable_space;
|
|
||||||
int unswapped_space;
|
|
||||||
|
|
||||||
int low_watermark_level;
|
|
||||||
int lowest_watermark_level;
|
|
||||||
};
|
|
||||||
|
|
||||||
void mpeg_init(void);
|
|
||||||
void mpeg_play(int offset);
|
|
||||||
void mpeg_stop(void);
|
|
||||||
void mpeg_pause(void);
|
|
||||||
void mpeg_resume(void);
|
|
||||||
void mpeg_next(void);
|
|
||||||
void mpeg_prev(void);
|
|
||||||
void mpeg_ff_rewind(int newtime);
|
|
||||||
void mpeg_flush_and_reload_tracks(void);
|
|
||||||
struct mp3entry* mpeg_current_track(void);
|
|
||||||
struct mp3entry* mpeg_next_track(void);
|
|
||||||
bool mpeg_has_changed_track(void);
|
|
||||||
int mpeg_status(void);
|
|
||||||
#if (CONFIG_HWCODEC == MAS3587F) || defined(SIMULATOR)
|
#if (CONFIG_HWCODEC == MAS3587F) || defined(SIMULATOR)
|
||||||
void mpeg_init_recording(void);
|
void mpeg_init_recording(void);
|
||||||
void mpeg_init_playback(void);
|
|
||||||
void mpeg_record(const char *filename);
|
void mpeg_record(const char *filename);
|
||||||
void mpeg_new_file(const char *filename);
|
void mpeg_new_file(const char *filename);
|
||||||
void mpeg_set_recording_options(int frequency, int quality,
|
void mpeg_set_recording_options(int frequency, int quality,
|
||||||
|
@ -97,25 +55,11 @@ unsigned long mpeg_num_recorded_bytes(void);
|
||||||
void mpeg_pause_recording(void);
|
void mpeg_pause_recording(void);
|
||||||
void mpeg_resume_recording(void);
|
void mpeg_resume_recording(void);
|
||||||
#endif
|
#endif
|
||||||
void mpeg_get_debugdata(struct mpeg_debug *dbgdata);
|
|
||||||
void mpeg_set_buffer_margin(int seconds);
|
|
||||||
unsigned int mpeg_error(void);
|
|
||||||
void mpeg_error_clear(void);
|
|
||||||
int mpeg_get_file_pos(void);
|
|
||||||
unsigned long mpeg_get_last_header(void);
|
unsigned long mpeg_get_last_header(void);
|
||||||
void mpeg_beep(int duration);
|
|
||||||
|
|
||||||
/* in order to keep the recording here, I have to expose this */
|
/* in order to keep the recording here, I have to expose this */
|
||||||
void rec_tick(void);
|
void rec_tick(void);
|
||||||
void playback_tick(void); /* FixMe: get rid of this, use mp3_get_playtime() */
|
void playback_tick(void); /* FixMe: get rid of this, use mp3_get_playtime() */
|
||||||
void mpeg_id3_options(bool _v1first);
|
void mpeg_id3_options(bool _v1first);
|
||||||
|
|
||||||
#define MPEG_STATUS_PLAY 1
|
|
||||||
#define MPEG_STATUS_PAUSE 2
|
|
||||||
#define MPEG_STATUS_RECORD 4
|
|
||||||
#define MPEG_STATUS_PRERECORD 8
|
|
||||||
#define MPEG_STATUS_ERROR 16
|
|
||||||
|
|
||||||
#define MPEGERR_DISK_FULL 1
|
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
|
@ -23,6 +23,7 @@
|
||||||
#include "panic.h"
|
#include "panic.h"
|
||||||
#include "id3.h"
|
#include "id3.h"
|
||||||
#include "mpeg.h"
|
#include "mpeg.h"
|
||||||
|
#include "audio.h"
|
||||||
#include "ata.h"
|
#include "ata.h"
|
||||||
#include "string.h"
|
#include "string.h"
|
||||||
#include <kernel.h>
|
#include <kernel.h>
|
||||||
|
@ -220,10 +221,10 @@ static void set_elapsed(struct mp3entry* id3)
|
||||||
id3->elapsed = id3->offset / id3->bpf * id3->tpf;
|
id3->elapsed = id3->offset / id3->bpf * id3->tpf;
|
||||||
}
|
}
|
||||||
|
|
||||||
int mpeg_get_file_pos(void)
|
int audio_get_file_pos(void)
|
||||||
{
|
{
|
||||||
int pos = -1;
|
int pos = -1;
|
||||||
struct mp3entry *id3 = mpeg_current_track();
|
struct mp3entry *id3 = audio_current_track();
|
||||||
|
|
||||||
if (id3->vbr)
|
if (id3->vbr)
|
||||||
{
|
{
|
||||||
|
@ -402,12 +403,12 @@ static void recalculate_watermark(int bitrate)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void mpeg_set_buffer_margin(int seconds)
|
void audio_set_buffer_margin(int seconds)
|
||||||
{
|
{
|
||||||
low_watermark_margin = seconds;
|
low_watermark_margin = seconds;
|
||||||
}
|
}
|
||||||
|
|
||||||
void mpeg_get_debugdata(struct mpeg_debug *dbgdata)
|
void audio_get_debugdata(struct audio_debug *dbgdata)
|
||||||
{
|
{
|
||||||
dbgdata->mp3buflen = mp3buflen;
|
dbgdata->mp3buflen = mp3buflen;
|
||||||
dbgdata->mp3buf_write = mp3buf_write;
|
dbgdata->mp3buf_write = mp3buf_write;
|
||||||
|
@ -1264,7 +1265,7 @@ static void mpeg_thread(void)
|
||||||
}
|
}
|
||||||
|
|
||||||
case MPEG_FF_REWIND: {
|
case MPEG_FF_REWIND: {
|
||||||
struct mp3entry *id3 = mpeg_current_track();
|
struct mp3entry *id3 = audio_current_track();
|
||||||
unsigned int oldtime = id3->elapsed;
|
unsigned int oldtime = id3->elapsed;
|
||||||
unsigned int newtime = (unsigned int)ev.data;
|
unsigned int newtime = (unsigned int)ev.data;
|
||||||
int curpos, newpos, diffpos;
|
int curpos, newpos, diffpos;
|
||||||
|
@ -1272,7 +1273,7 @@ static void mpeg_thread(void)
|
||||||
|
|
||||||
id3->elapsed = newtime;
|
id3->elapsed = newtime;
|
||||||
|
|
||||||
newpos = mpeg_get_file_pos();
|
newpos = audio_get_file_pos();
|
||||||
if(newpos < 0)
|
if(newpos < 0)
|
||||||
{
|
{
|
||||||
id3->elapsed = oldtime;
|
id3->elapsed = oldtime;
|
||||||
|
@ -1808,7 +1809,7 @@ static void mpeg_thread(void)
|
||||||
{
|
{
|
||||||
if(errno == ENOSPC)
|
if(errno == ENOSPC)
|
||||||
{
|
{
|
||||||
mpeg_errno = MPEGERR_DISK_FULL;
|
mpeg_errno = AUDIOERR_DISK_FULL;
|
||||||
demand_irq_enable(false);
|
demand_irq_enable(false);
|
||||||
stop_recording();
|
stop_recording();
|
||||||
queue_post(&mpeg_queue, MPEG_STOP_DONE, 0);
|
queue_post(&mpeg_queue, MPEG_STOP_DONE, 0);
|
||||||
|
@ -1830,7 +1831,7 @@ static void mpeg_thread(void)
|
||||||
{
|
{
|
||||||
if(errno == ENOSPC)
|
if(errno == ENOSPC)
|
||||||
{
|
{
|
||||||
mpeg_errno = MPEGERR_DISK_FULL;
|
mpeg_errno = AUDIOERR_DISK_FULL;
|
||||||
demand_irq_enable(false);
|
demand_irq_enable(false);
|
||||||
stop_recording();
|
stop_recording();
|
||||||
queue_post(&mpeg_queue, MPEG_STOP_DONE, 0);
|
queue_post(&mpeg_queue, MPEG_STOP_DONE, 0);
|
||||||
|
@ -1902,7 +1903,7 @@ static void mpeg_thread(void)
|
||||||
{
|
{
|
||||||
if(errno == ENOSPC)
|
if(errno == ENOSPC)
|
||||||
{
|
{
|
||||||
mpeg_errno = MPEGERR_DISK_FULL;
|
mpeg_errno = AUDIOERR_DISK_FULL;
|
||||||
stop_recording();
|
stop_recording();
|
||||||
queue_post(&mpeg_queue, MPEG_STOP_DONE, 0);
|
queue_post(&mpeg_queue, MPEG_STOP_DONE, 0);
|
||||||
break;
|
break;
|
||||||
|
@ -2013,7 +2014,7 @@ void mpeg_id3_options(bool _v1first)
|
||||||
v1first = _v1first;
|
v1first = _v1first;
|
||||||
}
|
}
|
||||||
|
|
||||||
struct mp3entry* mpeg_current_track()
|
struct mp3entry* audio_current_track()
|
||||||
{
|
{
|
||||||
#ifdef SIMULATOR
|
#ifdef SIMULATOR
|
||||||
return &taginfo;
|
return &taginfo;
|
||||||
|
@ -2025,7 +2026,7 @@ struct mp3entry* mpeg_current_track()
|
||||||
#endif /* #ifdef SIMULATOR */
|
#endif /* #ifdef SIMULATOR */
|
||||||
}
|
}
|
||||||
|
|
||||||
struct mp3entry* mpeg_next_track()
|
struct mp3entry* audio_next_track()
|
||||||
{
|
{
|
||||||
#ifdef SIMULATOR
|
#ifdef SIMULATOR
|
||||||
return &taginfo;
|
return &taginfo;
|
||||||
|
@ -2037,7 +2038,7 @@ struct mp3entry* mpeg_next_track()
|
||||||
#endif /* #ifdef SIMULATOR */
|
#endif /* #ifdef SIMULATOR */
|
||||||
}
|
}
|
||||||
|
|
||||||
bool mpeg_has_changed_track(void)
|
bool audio_has_changed_track(void)
|
||||||
{
|
{
|
||||||
if(last_track_counter != current_track_counter)
|
if(last_track_counter != current_track_counter)
|
||||||
{
|
{
|
||||||
|
@ -2048,7 +2049,7 @@ bool mpeg_has_changed_track(void)
|
||||||
}
|
}
|
||||||
|
|
||||||
#if CONFIG_HWCODEC == MAS3587F
|
#if CONFIG_HWCODEC == MAS3587F
|
||||||
void mpeg_init_playback(void)
|
void audio_init_playback(void)
|
||||||
{
|
{
|
||||||
init_playback_done = false;
|
init_playback_done = false;
|
||||||
queue_post(&mpeg_queue, MPEG_INIT_PLAYBACK, NULL);
|
queue_post(&mpeg_queue, MPEG_INIT_PLAYBACK, NULL);
|
||||||
|
@ -2407,7 +2408,7 @@ void mpeg_set_recording_gain(int left, int right, bool use_mic)
|
||||||
}
|
}
|
||||||
|
|
||||||
/* try to make some kind of beep, also in recording mode */
|
/* try to make some kind of beep, also in recording mode */
|
||||||
void mpeg_beep(int duration)
|
void audio_beep(int duration)
|
||||||
{
|
{
|
||||||
long starttick = current_tick;
|
long starttick = current_tick;
|
||||||
do
|
do
|
||||||
|
@ -2495,7 +2496,7 @@ void bitswap(unsigned char *data, int length)
|
||||||
(void)length;
|
(void)length;
|
||||||
}
|
}
|
||||||
|
|
||||||
void mpeg_init_playback(void)
|
void audio_init_playback(void)
|
||||||
{
|
{
|
||||||
/* a dummy */
|
/* a dummy */
|
||||||
}
|
}
|
||||||
|
@ -2504,7 +2505,7 @@ unsigned long mpeg_recorded_time(void)
|
||||||
/* a dummy */
|
/* a dummy */
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
void mpeg_beep(int duration)
|
void audio_beep(int duration)
|
||||||
{
|
{
|
||||||
/* a dummy */
|
/* a dummy */
|
||||||
(void)duration;
|
(void)duration;
|
||||||
|
@ -2558,7 +2559,7 @@ void mpeg_set_recording_options(int frequency, int quality,
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
void mpeg_play(int offset)
|
void audio_play(int offset)
|
||||||
{
|
{
|
||||||
#ifdef SIMULATOR
|
#ifdef SIMULATOR
|
||||||
char* trackname;
|
char* trackname;
|
||||||
|
@ -2595,7 +2596,7 @@ void mpeg_play(int offset)
|
||||||
mpeg_errno = 0;
|
mpeg_errno = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
void mpeg_stop(void)
|
void audio_stop(void)
|
||||||
{
|
{
|
||||||
#ifndef SIMULATOR
|
#ifndef SIMULATOR
|
||||||
mpeg_stop_done = false;
|
mpeg_stop_done = false;
|
||||||
|
@ -2610,7 +2611,7 @@ void mpeg_stop(void)
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void mpeg_pause(void)
|
void audio_pause(void)
|
||||||
{
|
{
|
||||||
#ifndef SIMULATOR
|
#ifndef SIMULATOR
|
||||||
queue_post(&mpeg_queue, MPEG_PAUSE, NULL);
|
queue_post(&mpeg_queue, MPEG_PAUSE, NULL);
|
||||||
|
@ -2621,7 +2622,7 @@ void mpeg_pause(void)
|
||||||
#endif /* #ifndef SIMULATOR */
|
#endif /* #ifndef SIMULATOR */
|
||||||
}
|
}
|
||||||
|
|
||||||
void mpeg_resume(void)
|
void audio_resume(void)
|
||||||
{
|
{
|
||||||
#ifndef SIMULATOR
|
#ifndef SIMULATOR
|
||||||
queue_post(&mpeg_queue, MPEG_RESUME, NULL);
|
queue_post(&mpeg_queue, MPEG_RESUME, NULL);
|
||||||
|
@ -2632,7 +2633,7 @@ void mpeg_resume(void)
|
||||||
#endif /* #ifndef SIMULATOR */
|
#endif /* #ifndef SIMULATOR */
|
||||||
}
|
}
|
||||||
|
|
||||||
void mpeg_next(void)
|
void audio_next(void)
|
||||||
{
|
{
|
||||||
#ifndef SIMULATOR
|
#ifndef SIMULATOR
|
||||||
queue_post(&mpeg_queue, MPEG_NEXT, NULL);
|
queue_post(&mpeg_queue, MPEG_NEXT, NULL);
|
||||||
|
@ -2660,7 +2661,7 @@ void mpeg_next(void)
|
||||||
#endif /* #ifndef SIMULATOR */
|
#endif /* #ifndef SIMULATOR */
|
||||||
}
|
}
|
||||||
|
|
||||||
void mpeg_prev(void)
|
void audio_prev(void)
|
||||||
{
|
{
|
||||||
#ifndef SIMULATOR
|
#ifndef SIMULATOR
|
||||||
queue_post(&mpeg_queue, MPEG_PREV, NULL);
|
queue_post(&mpeg_queue, MPEG_PREV, NULL);
|
||||||
|
@ -2687,7 +2688,7 @@ void mpeg_prev(void)
|
||||||
#endif /* #ifndef SIMULATOR */
|
#endif /* #ifndef SIMULATOR */
|
||||||
}
|
}
|
||||||
|
|
||||||
void mpeg_ff_rewind(int newtime)
|
void audio_ff_rewind(int newtime)
|
||||||
{
|
{
|
||||||
#ifndef SIMULATOR
|
#ifndef SIMULATOR
|
||||||
queue_post(&mpeg_queue, MPEG_FF_REWIND, (void *)newtime);
|
queue_post(&mpeg_queue, MPEG_FF_REWIND, (void *)newtime);
|
||||||
|
@ -2696,43 +2697,43 @@ void mpeg_ff_rewind(int newtime)
|
||||||
#endif /* #ifndef SIMULATOR */
|
#endif /* #ifndef SIMULATOR */
|
||||||
}
|
}
|
||||||
|
|
||||||
void mpeg_flush_and_reload_tracks(void)
|
void audio_flush_and_reload_tracks(void)
|
||||||
{
|
{
|
||||||
#ifndef SIMULATOR
|
#ifndef SIMULATOR
|
||||||
queue_post(&mpeg_queue, MPEG_FLUSH_RELOAD, NULL);
|
queue_post(&mpeg_queue, MPEG_FLUSH_RELOAD, NULL);
|
||||||
#endif /* #ifndef SIMULATOR*/
|
#endif /* #ifndef SIMULATOR*/
|
||||||
}
|
}
|
||||||
|
|
||||||
int mpeg_status(void)
|
int audio_status(void)
|
||||||
{
|
{
|
||||||
int ret = 0;
|
int ret = 0;
|
||||||
|
|
||||||
if(is_playing)
|
if(is_playing)
|
||||||
ret |= MPEG_STATUS_PLAY;
|
ret |= AUDIO_STATUS_PLAY;
|
||||||
|
|
||||||
if(paused)
|
if(paused)
|
||||||
ret |= MPEG_STATUS_PAUSE;
|
ret |= AUDIO_STATUS_PAUSE;
|
||||||
|
|
||||||
#if CONFIG_HWCODEC == MAS3587F
|
#if CONFIG_HWCODEC == MAS3587F
|
||||||
if(is_recording && !is_prerecording)
|
if(is_recording && !is_prerecording)
|
||||||
ret |= MPEG_STATUS_RECORD;
|
ret |= AUDIO_STATUS_RECORD;
|
||||||
|
|
||||||
if(is_prerecording)
|
if(is_prerecording)
|
||||||
ret |= MPEG_STATUS_PRERECORD;
|
ret |= AUDIO_STATUS_PRERECORD;
|
||||||
#endif /* #if CONFIG_HWCODEC == MAS3587F */
|
#endif /* #if CONFIG_HWCODEC == MAS3587F */
|
||||||
|
|
||||||
if(mpeg_errno)
|
if(mpeg_errno)
|
||||||
ret |= MPEG_STATUS_ERROR;
|
ret |= AUDIO_STATUS_ERROR;
|
||||||
|
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
unsigned int mpeg_error(void)
|
unsigned int audio_error(void)
|
||||||
{
|
{
|
||||||
return mpeg_errno;
|
return mpeg_errno;
|
||||||
}
|
}
|
||||||
|
|
||||||
void mpeg_error_clear(void)
|
void audio_error_clear(void)
|
||||||
{
|
{
|
||||||
mpeg_errno = 0;
|
mpeg_errno = 0;
|
||||||
}
|
}
|
||||||
|
@ -2745,21 +2746,21 @@ static void mpeg_thread(void)
|
||||||
struct mp3entry* id3;
|
struct mp3entry* id3;
|
||||||
while ( 1 ) {
|
while ( 1 ) {
|
||||||
if (is_playing) {
|
if (is_playing) {
|
||||||
id3 = mpeg_current_track();
|
id3 = audio_current_track();
|
||||||
if (!paused)
|
if (!paused)
|
||||||
{
|
{
|
||||||
id3->elapsed+=1000;
|
id3->elapsed+=1000;
|
||||||
id3->offset+=1000;
|
id3->offset+=1000;
|
||||||
}
|
}
|
||||||
if (id3->elapsed>=id3->length)
|
if (id3->elapsed>=id3->length)
|
||||||
mpeg_next();
|
audio_next();
|
||||||
}
|
}
|
||||||
sleep(HZ);
|
sleep(HZ);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
#endif /* #ifdef SIMULATOR */
|
#endif /* #ifdef SIMULATOR */
|
||||||
|
|
||||||
void mpeg_init(void)
|
void audio_init(void)
|
||||||
{
|
{
|
||||||
mpeg_errno = 0;
|
mpeg_errno = 0;
|
||||||
|
|
||||||
|
|
|
@ -31,7 +31,7 @@
|
||||||
#include "power.h"
|
#include "power.h"
|
||||||
#include "button.h"
|
#include "button.h"
|
||||||
#include "ata.h"
|
#include "ata.h"
|
||||||
#include "mpeg.h"
|
#include "audio.h"
|
||||||
#include "mp3_playback.h"
|
#include "mp3_playback.h"
|
||||||
#include "usb.h"
|
#include "usb.h"
|
||||||
#include "powermgmt.h"
|
#include "powermgmt.h"
|
||||||
|
@ -343,7 +343,7 @@ static void battery_level_update(void)
|
||||||
static void handle_auto_poweroff(void)
|
static void handle_auto_poweroff(void)
|
||||||
{
|
{
|
||||||
long timeout = poweroff_idle_timeout_value[poweroff_timeout]*60*HZ;
|
long timeout = poweroff_idle_timeout_value[poweroff_timeout]*60*HZ;
|
||||||
int mpeg_stat = mpeg_status();
|
int audio_stat = audio_status();
|
||||||
|
|
||||||
#ifdef HAVE_CHARGING
|
#ifdef HAVE_CHARGING
|
||||||
/*
|
/*
|
||||||
|
@ -360,8 +360,8 @@ static void handle_auto_poweroff(void)
|
||||||
(radio_get_status() != FMRADIO_PLAYING) &&
|
(radio_get_status() != FMRADIO_PLAYING) &&
|
||||||
#endif
|
#endif
|
||||||
!usb_inserted() &&
|
!usb_inserted() &&
|
||||||
((mpeg_stat == 0) ||
|
((audio_stat == 0) ||
|
||||||
((mpeg_stat == (MPEG_STATUS_PLAY | MPEG_STATUS_PAUSE)) &&
|
((audio_stat == (AUDIO_STATUS_PLAY | AUDIO_STATUS_PAUSE)) &&
|
||||||
!sleeptimer_active)))
|
!sleeptimer_active)))
|
||||||
{
|
{
|
||||||
if(TIME_AFTER(current_tick, last_event_tick + timeout) &&
|
if(TIME_AFTER(current_tick, last_event_tick + timeout) &&
|
||||||
|
@ -377,7 +377,7 @@ static void handle_auto_poweroff(void)
|
||||||
{
|
{
|
||||||
if(TIME_AFTER(current_tick, sleeptimer_endtick))
|
if(TIME_AFTER(current_tick, sleeptimer_endtick))
|
||||||
{
|
{
|
||||||
mpeg_stop();
|
audio_stop();
|
||||||
#ifdef HAVE_CHARGING
|
#ifdef HAVE_CHARGING
|
||||||
if((charger_input_state == CHARGER) ||
|
if((charger_input_state == CHARGER) ||
|
||||||
(charger_input_state == CHARGER_PLUGGED))
|
(charger_input_state == CHARGER_PLUGGED))
|
||||||
|
@ -413,8 +413,8 @@ static void car_adapter_mode_processing(void)
|
||||||
|
|
||||||
if (waiting_to_resume_play) {
|
if (waiting_to_resume_play) {
|
||||||
if (TIME_AFTER(current_tick, play_resume_time)) {
|
if (TIME_AFTER(current_tick, play_resume_time)) {
|
||||||
if (mpeg_status() & MPEG_STATUS_PAUSE) {
|
if (audio_status() & AUDIO_STATUS_PAUSE) {
|
||||||
mpeg_resume();
|
audio_resume();
|
||||||
}
|
}
|
||||||
waiting_to_resume_play = false;
|
waiting_to_resume_play = false;
|
||||||
}
|
}
|
||||||
|
@ -423,15 +423,15 @@ static void car_adapter_mode_processing(void)
|
||||||
/*
|
/*
|
||||||
* Just got unplugged, pause if playing
|
* Just got unplugged, pause if playing
|
||||||
*/
|
*/
|
||||||
if ((mpeg_status() & MPEG_STATUS_PLAY) &&
|
if ((audio_status() & AUDIO_STATUS_PLAY) &&
|
||||||
!(mpeg_status() & MPEG_STATUS_PAUSE)) {
|
!(audio_status() & AUDIO_STATUS_PAUSE)) {
|
||||||
mpeg_pause();
|
audio_pause();
|
||||||
}
|
}
|
||||||
} else if(charger_input_state == CHARGER_PLUGGED) {
|
} else if(charger_input_state == CHARGER_PLUGGED) {
|
||||||
/*
|
/*
|
||||||
* Just got plugged in, delay & resume if we were playing
|
* Just got plugged in, delay & resume if we were playing
|
||||||
*/
|
*/
|
||||||
if (mpeg_status() & MPEG_STATUS_PAUSE) {
|
if (audio_status() & AUDIO_STATUS_PAUSE) {
|
||||||
/* delay resume a bit while the engine is cranking */
|
/* delay resume a bit while the engine is cranking */
|
||||||
play_resume_time = current_tick + HZ*5;
|
play_resume_time = current_tick + HZ*5;
|
||||||
waiting_to_resume_play = true;
|
waiting_to_resume_play = true;
|
||||||
|
@ -920,7 +920,7 @@ void shutdown_hw(void)
|
||||||
fd = -1;
|
fd = -1;
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
mpeg_stop();
|
audio_stop();
|
||||||
ata_flush();
|
ata_flush();
|
||||||
ata_spindown(1);
|
ata_spindown(1);
|
||||||
while(ata_disk_is_active())
|
while(ata_disk_is_active())
|
||||||
|
|
|
@ -23,7 +23,7 @@
|
||||||
#include "sprintf.h"
|
#include "sprintf.h"
|
||||||
#include "button.h"
|
#include "button.h"
|
||||||
#include "file.h"
|
#include "file.h"
|
||||||
#include "mpeg.h"
|
#include "audio.h"
|
||||||
#include "system.h"
|
#include "system.h"
|
||||||
#include "i2c.h"
|
#include "i2c.h"
|
||||||
#include "string.h"
|
#include "string.h"
|
||||||
|
@ -101,7 +101,7 @@ int rolo_load(const char* filename)
|
||||||
lcd_puts(0, 1, "Loading");
|
lcd_puts(0, 1, "Loading");
|
||||||
lcd_update();
|
lcd_update();
|
||||||
|
|
||||||
mpeg_stop();
|
audio_stop();
|
||||||
|
|
||||||
fd = open(filename, O_RDONLY);
|
fd = open(filename, O_RDONLY);
|
||||||
if(-1 == fd) {
|
if(-1 == fd) {
|
||||||
|
|
|
@ -183,7 +183,7 @@ void mpeg_set_pitch(int pitch)
|
||||||
(void)pitch;
|
(void)pitch;
|
||||||
}
|
}
|
||||||
|
|
||||||
void mpeg_set_buffer_margin(int seconds)
|
void audio_set_buffer_margin(int seconds)
|
||||||
{
|
{
|
||||||
(void)seconds;
|
(void)seconds;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue