summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--apps/bookmark.c8
-rw-r--r--apps/debug_menu.c12
-rw-r--r--apps/main.c8
-rw-r--r--apps/onplay.c10
-rw-r--r--apps/playlist.c24
-rw-r--r--apps/playlist_viewer.c14
-rw-r--r--apps/plugin.c28
-rw-r--r--apps/plugin.h27
-rw-r--r--apps/plugins/alpine_cdc.c58
-rw-r--r--apps/plugins/favorites.c2
-rw-r--r--apps/plugins/splitedit.c44
-rw-r--r--apps/recorder/recording.c55
-rw-r--r--apps/screens.c16
-rw-r--r--apps/settings.c4
-rw-r--r--apps/settings_menu.c5
-rw-r--r--apps/status.c12
-rw-r--r--apps/talk.c12
-rw-r--r--apps/tree.c12
-rw-r--r--apps/wps-display.c4
-rw-r--r--apps/wps.c62
-rw-r--r--firmware/export/audio.h81
-rw-r--r--firmware/export/mpeg.h56
-rw-r--r--firmware/mpeg.c71
-rw-r--r--firmware/powermgmt.c24
-rw-r--r--firmware/rolo.c4
-rw-r--r--uisimulator/common/stubs.c2
26 files changed, 342 insertions, 313 deletions
diff --git a/apps/bookmark.c b/apps/bookmark.c
index 04de581eb5..4af4b967b9 100644
--- a/apps/bookmark.c
+++ b/apps/bookmark.c
@@ -26,7 +26,7 @@
26#include "lcd.h" 26#include "lcd.h"
27#include "button.h" 27#include "button.h"
28#include "usb.h" 28#include "usb.h"
29#include "mpeg.h" 29#include "audio.h"
30#include "wps.h" 30#include "wps.h"
31#include "settings.h" 31#include "settings.h"
32#include "bookmark.h" 32#include "bookmark.h"
@@ -227,7 +227,7 @@ bool bookmark_autobookmark(void)
227 if (!system_check()) 227 if (!system_check())
228 return false; 228 return false;
229 229
230 mpeg_pause(); /* first pause playback */ 230 audio_pause(); /* first pause playback */
231 switch (global_settings.autocreatebookmark) 231 switch (global_settings.autocreatebookmark)
232 { 232 {
233 case BOOKMARK_YES: 233 case BOOKMARK_YES:
@@ -404,7 +404,7 @@ static char* create_bookmark()
404 char *file; 404 char *file;
405 405
406 /* grab the currently playing track */ 406 /* grab the currently playing track */
407 struct mp3entry *id3 = mpeg_current_track(); 407 struct mp3entry *id3 = audio_current_track();
408 if(!id3) 408 if(!id3)
409 return NULL; 409 return NULL;
410 410
@@ -1144,7 +1144,7 @@ static bool generate_bookmark_file_name(const char *in)
1144static bool system_check(void) 1144static bool system_check(void)
1145{ 1145{
1146 int resume_index = 0; 1146 int resume_index = 0;
1147 struct mp3entry *id3 = mpeg_current_track(); 1147 struct mp3entry *id3 = audio_current_track();
1148 1148
1149 if (!id3) 1149 if (!id3)
1150 { 1150 {
diff --git a/apps/debug_menu.c b/apps/debug_menu.c
index f8d3f36f02..d8ebe9bfb1 100644
--- a/apps/debug_menu.c
+++ b/apps/debug_menu.c
@@ -38,7 +38,7 @@
38#include "system.h" 38#include "system.h"
39#include "font.h" 39#include "font.h"
40#include "disk.h" 40#include "disk.h"
41#include "mpeg.h" 41#include "audio.h"
42#include "mp3_playback.h" 42#include "mp3_playback.h"
43#include "settings.h" 43#include "settings.h"
44#include "ata.h" 44#include "ata.h"
@@ -335,11 +335,11 @@ bool dbg_os(void)
335#endif 335#endif
336 336
337#ifdef HAVE_LCD_BITMAP 337#ifdef HAVE_LCD_BITMAP
338bool dbg_mpeg_thread(void) 338bool dbg_audio_thread(void)
339{ 339{
340 char buf[32]; 340 char buf[32];
341 int button; 341 int button;
342 struct mpeg_debug d; 342 struct audio_debug d;
343 343
344 lcd_setmargins(0, 0); 344 lcd_setmargins(0, 0);
345 345
@@ -352,7 +352,7 @@ bool dbg_mpeg_thread(void)
352 return false; 352 return false;
353 } 353 }
354 354
355 mpeg_get_debugdata(&d); 355 audio_get_debugdata(&d);
356 356
357 lcd_clear_display(); 357 lcd_clear_display();
358 358
@@ -1862,7 +1862,7 @@ static bool dbg_disk_info(void)
1862 1862
1863 case SETTINGS_OK: 1863 case SETTINGS_OK:
1864 if (page == 3) { 1864 if (page == 3) {
1865 mpeg_stop(); /* stop playback, to avoid disk access */ 1865 audio_stop(); /* stop playback, to avoid disk access */
1866 lcd_clear_display(); 1866 lcd_clear_display();
1867 lcd_puts(0,0,"Scanning"); 1867 lcd_puts(0,0,"Scanning");
1868 lcd_puts(0,1,"disk..."); 1868 lcd_puts(0,1,"disk...");
@@ -2016,7 +2016,7 @@ bool debug_menu(void)
2016 { "View disk info", dbg_disk_info }, 2016 { "View disk info", dbg_disk_info },
2017#endif 2017#endif
2018#ifdef HAVE_LCD_BITMAP 2018#ifdef HAVE_LCD_BITMAP
2019 { "View mpeg thread", dbg_mpeg_thread }, 2019 { "View audio thread", dbg_audio_thread },
2020#ifdef PM_DEBUG 2020#ifdef PM_DEBUG
2021 { "pm histogram", peak_meter_histogram}, 2021 { "pm histogram", peak_meter_histogram},
2022#endif /* PM_DEBUG */ 2022#endif /* PM_DEBUG */
diff --git a/apps/main.c b/apps/main.c
index 505022481e..b5c6364080 100644
--- a/apps/main.c
+++ b/apps/main.c
@@ -38,7 +38,7 @@
38#ifndef DEBUG 38#ifndef DEBUG
39#include "serial.h" 39#include "serial.h"
40#endif 40#endif
41#include "mpeg.h" 41#include "audio.h"
42#include "mp3_playback.h" 42#include "mp3_playback.h"
43#include "main_menu.h" 43#include "main_menu.h"
44#include "thread.h" 44#include "thread.h"
@@ -114,7 +114,7 @@ void init(void)
114 global_settings.mdb_shape, 114 global_settings.mdb_shape,
115 global_settings.mdb_enable, 115 global_settings.mdb_enable,
116 global_settings.superbass); 116 global_settings.superbass);
117 mpeg_init(); 117 audio_init();
118 button_clear_queue(); /* Empty the keyboard buffer */ 118 button_clear_queue(); /* Empty the keyboard buffer */
119} 119}
120 120
@@ -235,7 +235,7 @@ void init(void)
235 tree_init(); 235 tree_init();
236 236
237 /* No buffer allocation (see buffer.c) may take place after the call to 237 /* No buffer allocation (see buffer.c) may take place after the call to
238 mpeg_init() since the mpeg thread takes the rest of the buffer space */ 238 audio_init() since the mpeg thread takes the rest of the buffer space */
239 mp3_init( global_settings.volume, 239 mp3_init( global_settings.volume,
240 global_settings.bass, 240 global_settings.bass,
241 global_settings.treble, 241 global_settings.treble,
@@ -250,7 +250,7 @@ void init(void)
250 global_settings.mdb_shape, 250 global_settings.mdb_shape,
251 global_settings.mdb_enable, 251 global_settings.mdb_enable,
252 global_settings.superbass); 252 global_settings.superbass);
253 mpeg_init(); 253 audio_init();
254 talk_init(); 254 talk_init();
255 255
256#ifdef AUTOROCK 256#ifdef AUTOROCK
diff --git a/apps/onplay.c b/apps/onplay.c
index 7ebe4e1f45..f761014bbf 100644
--- a/apps/onplay.c
+++ b/apps/onplay.c
@@ -26,7 +26,7 @@
26#include "lcd.h" 26#include "lcd.h"
27#include "dir.h" 27#include "dir.h"
28#include "file.h" 28#include "file.h"
29#include "mpeg.h" 29#include "audio.h"
30#include "menu.h" 30#include "menu.h"
31#include "lang.h" 31#include "lang.h"
32#include "playlist.h" 32#include "playlist.h"
@@ -84,7 +84,7 @@ struct playlist_args {
84 84
85static bool add_to_playlist(int position, bool queue) 85static bool add_to_playlist(int position, bool queue)
86{ 86{
87 bool new_playlist = !(mpeg_status() & MPEG_STATUS_PLAY); 87 bool new_playlist = !(audio_status() & AUDIO_STATUS_PLAY);
88 88
89 if (new_playlist) 89 if (new_playlist)
90 playlist_create(NULL, NULL); 90 playlist_create(NULL, NULL);
@@ -152,12 +152,12 @@ static bool add_to_playlist(int position, bool queue)
152 152
153static bool view_playlist(void) 153static bool view_playlist(void)
154{ 154{
155 bool was_playing = mpeg_status() & MPEG_STATUS_PLAY; 155 bool was_playing = audio_status() & AUDIO_STATUS_PLAY;
156 bool result; 156 bool result;
157 157
158 result = playlist_viewer_ex(selected_file); 158 result = playlist_viewer_ex(selected_file);
159 159
160 if (!was_playing && (mpeg_status() & MPEG_STATUS_PLAY) && 160 if (!was_playing && (audio_status() & AUDIO_STATUS_PLAY) &&
161 onplay_result == ONPLAY_OK) 161 onplay_result == ONPLAY_OK)
162 /* playlist was started from viewer */ 162 /* playlist was started from viewer */
163 onplay_result = ONPLAY_START_PLAY; 163 onplay_result = ONPLAY_START_PLAY;
@@ -181,7 +181,7 @@ static bool playlist_options(void)
181 pstart++; 181 pstart++;
182 } 182 }
183 183
184 if (mpeg_status() & MPEG_STATUS_PLAY) 184 if (audio_status() & AUDIO_STATUS_PLAY)
185 { 185 {
186 items[i].desc = ID2P(LANG_INSERT); 186 items[i].desc = ID2P(LANG_INSERT);
187 args[i].position = PLAYLIST_INSERT; 187 args[i].position = PLAYLIST_INSERT;
diff --git a/apps/playlist.c b/apps/playlist.c
index cb9d2ba3ea..3370937a69 100644
--- a/apps/playlist.c
+++ b/apps/playlist.c
@@ -73,7 +73,7 @@
73#include "dir.h" 73#include "dir.h"
74#include "sprintf.h" 74#include "sprintf.h"
75#include "debug.h" 75#include "debug.h"
76#include "mpeg.h" 76#include "audio.h"
77#include "lcd.h" 77#include "lcd.h"
78#include "kernel.h" 78#include "kernel.h"
79#include "settings.h" 79#include "settings.h"
@@ -348,7 +348,7 @@ static int add_indices_to_playlist(struct playlist_info* playlist,
348 if (!buffer) 348 if (!buffer)
349 { 349 {
350 /* use mp3 buffer for maximum load speed */ 350 /* use mp3 buffer for maximum load speed */
351 mpeg_stop(); 351 audio_stop();
352 talk_buffer_steal(); /* we use the mp3 buffer, need to tell */ 352 talk_buffer_steal(); /* we use the mp3 buffer, need to tell */
353 353
354 buffer = mp3buf; 354 buffer = mp3buf;
@@ -629,7 +629,7 @@ static int add_directory_to_playlist(struct playlist_info* playlist,
629 display_playlist_count(*count, count_str); 629 display_playlist_count(*count, count_str);
630 630
631 if (*count == PLAYLIST_DISPLAY_COUNT) 631 if (*count == PLAYLIST_DISPLAY_COUNT)
632 mpeg_flush_and_reload_tracks(); 632 audio_flush_and_reload_tracks();
633 } 633 }
634 634
635 /* let the other threads work */ 635 /* let the other threads work */
@@ -1625,7 +1625,7 @@ int playlist_start(int start_index, int offset)
1625 1625
1626 playlist->index = start_index; 1626 playlist->index = start_index;
1627 talk_buffer_steal(); /* will use the mp3 buffer */ 1627 talk_buffer_steal(); /* will use the mp3 buffer */
1628 mpeg_play(offset); 1628 audio_play(offset);
1629 1629
1630 return 0; 1630 return 0;
1631} 1631}
@@ -1932,7 +1932,7 @@ int playlist_insert_track(struct playlist_info* playlist, const char *filename,
1932 if (result != -1) 1932 if (result != -1)
1933 { 1933 {
1934 fsync(playlist->control_fd); 1934 fsync(playlist->control_fd);
1935 mpeg_flush_and_reload_tracks(); 1935 audio_flush_and_reload_tracks();
1936 } 1936 }
1937 1937
1938 return result; 1938 return result;
@@ -1970,7 +1970,7 @@ int playlist_insert_directory(struct playlist_info* playlist,
1970 fsync(playlist->control_fd); 1970 fsync(playlist->control_fd);
1971 1971
1972 display_playlist_count(count, count_str); 1972 display_playlist_count(count, count_str);
1973 mpeg_flush_and_reload_tracks(); 1973 audio_flush_and_reload_tracks();
1974 1974
1975 return result; 1975 return result;
1976} 1976}
@@ -2063,7 +2063,7 @@ int playlist_insert_playlist(struct playlist_info* playlist, char *filename,
2063 display_playlist_count(count, count_str); 2063 display_playlist_count(count, count_str);
2064 2064
2065 if (count == PLAYLIST_DISPLAY_COUNT) 2065 if (count == PLAYLIST_DISPLAY_COUNT)
2066 mpeg_flush_and_reload_tracks(); 2066 audio_flush_and_reload_tracks();
2067 } 2067 }
2068 } 2068 }
2069 2069
@@ -2078,7 +2078,7 @@ int playlist_insert_playlist(struct playlist_info* playlist, char *filename,
2078 *temp_ptr = '/'; 2078 *temp_ptr = '/';
2079 2079
2080 display_playlist_count(count, count_str); 2080 display_playlist_count(count, count_str);
2081 mpeg_flush_and_reload_tracks(); 2081 audio_flush_and_reload_tracks();
2082 2082
2083 return result; 2083 return result;
2084} 2084}
@@ -2106,7 +2106,7 @@ int playlist_delete(struct playlist_info* playlist, int index)
2106 result = remove_track_from_playlist(playlist, index, true); 2106 result = remove_track_from_playlist(playlist, index, true);
2107 2107
2108 if (result != -1) 2108 if (result != -1)
2109 mpeg_flush_and_reload_tracks(); 2109 audio_flush_and_reload_tracks();
2110 2110
2111 return result; 2111 return result;
2112} 2112}
@@ -2194,7 +2194,7 @@ int playlist_move(struct playlist_info* playlist, int index, int new_index)
2194 } 2194 }
2195 2195
2196 fsync(playlist->control_fd); 2196 fsync(playlist->control_fd);
2197 mpeg_flush_and_reload_tracks(); 2197 audio_flush_and_reload_tracks();
2198 } 2198 }
2199 } 2199 }
2200 2200
@@ -2215,7 +2215,7 @@ int playlist_randomise(struct playlist_info* playlist, unsigned int seed,
2215 result = randomise_playlist(playlist, seed, start_current, true); 2215 result = randomise_playlist(playlist, seed, start_current, true);
2216 2216
2217 if (result != -1) 2217 if (result != -1)
2218 mpeg_flush_and_reload_tracks(); 2218 audio_flush_and_reload_tracks();
2219 2219
2220 return result; 2220 return result;
2221} 2221}
@@ -2233,7 +2233,7 @@ int playlist_sort(struct playlist_info* playlist, bool start_current)
2233 result = sort_playlist(playlist, start_current, true); 2233 result = sort_playlist(playlist, start_current, true);
2234 2234
2235 if (result != -1) 2235 if (result != -1)
2236 mpeg_flush_and_reload_tracks(); 2236 audio_flush_and_reload_tracks();
2237 2237
2238 return result; 2238 return result;
2239} 2239}
diff --git a/apps/playlist_viewer.c b/apps/playlist_viewer.c
index f1235301cf..64d57d7d2e 100644
--- a/apps/playlist_viewer.c
+++ b/apps/playlist_viewer.c
@@ -21,7 +21,7 @@
21#include <string.h> 21#include <string.h>
22#include <sprintf.h> 22#include <sprintf.h>
23#include "playlist.h" 23#include "playlist.h"
24#include "mpeg.h" 24#include "audio.h"
25#include "screens.h" 25#include "screens.h"
26#include "status.h" 26#include "status.h"
27#include "settings.h" 27#include "settings.h"
@@ -142,7 +142,7 @@ static bool initialize(char* filename, bool reload)
142{ 142{
143 char* buffer; 143 char* buffer;
144 int buffer_size; 144 int buffer_size;
145 bool is_playing = mpeg_status() & MPEG_STATUS_PLAY; 145 bool is_playing = audio_status() & AUDIO_STATUS_PLAY;
146 146
147 if (!filename && !is_playing) 147 if (!filename && !is_playing)
148 /* Nothing is playing, exit */ 148 /* Nothing is playing, exit */
@@ -702,7 +702,7 @@ static int onplay_menu(int index)
702 case 0: 702 case 0:
703 /* delete track */ 703 /* delete track */
704 if (current) 704 if (current)
705 mpeg_stop(); 705 audio_stop();
706 706
707 playlist_delete(viewer.playlist, tracks[index].index); 707 playlist_delete(viewer.playlist, tracks[index].index);
708 708
@@ -714,7 +714,7 @@ static int onplay_menu(int index)
714 global_settings.repeat_mode == REPEAT_ALL) 714 global_settings.repeat_mode == REPEAT_ALL)
715 { 715 {
716 talk_buffer_steal(); /* will use the mp3 buffer */ 716 talk_buffer_steal(); /* will use the mp3 buffer */
717 mpeg_play(0); 717 audio_play(0);
718 viewer.current_playing_track = -1; 718 viewer.current_playing_track = -1;
719 } 719 }
720 } 720 }
@@ -838,7 +838,7 @@ bool playlist_viewer_ex(char* filename)
838 { 838 {
839 int track; 839 int track;
840 840
841 if (!viewer.playlist && !(mpeg_status() & MPEG_STATUS_PLAY)) 841 if (!viewer.playlist && !(audio_status() & AUDIO_STATUS_PLAY))
842 { 842 {
843 /* Play has stopped */ 843 /* Play has stopped */
844#ifdef HAVE_LCD_CHARCELLS 844#ifdef HAVE_LCD_CHARCELLS
@@ -954,14 +954,14 @@ bool playlist_viewer_ex(char* filename)
954 else if (!viewer.playlist) 954 else if (!viewer.playlist)
955 { 955 {
956 /* Stop current track and play new track */ 956 /* Stop current track and play new track */
957 mpeg_stop(); 957 audio_stop();
958 playlist_start(tracks[INDEX(viewer.cursor_pos)].index, 0); 958 playlist_start(tracks[INDEX(viewer.cursor_pos)].index, 0);
959 update_playlist(false); 959 update_playlist(false);
960 } 960 }
961 else 961 else
962 { 962 {
963 /* Play track from playlist on disk */ 963 /* Play track from playlist on disk */
964 mpeg_stop(); 964 audio_stop();
965 965
966 /* New playlist */ 966 /* New playlist */
967 if (playlist_set_current(viewer.playlist) < 0) 967 if (playlist_set_current(viewer.playlist) < 0)
diff --git a/apps/plugin.c b/apps/plugin.c
index 2031f0d450..412d86b4c9 100644
--- a/apps/plugin.c
+++ b/apps/plugin.c
@@ -199,20 +199,20 @@ static const struct plugin_api rockbox_api = {
199#endif 199#endif
200 200
201 /* playback control */ 201 /* playback control */
202 PREFIX(mpeg_play), 202 PREFIX(audio_play),
203 mpeg_stop, 203 audio_stop,
204 mpeg_pause, 204 audio_pause,
205 mpeg_resume, 205 audio_resume,
206 mpeg_next, 206 audio_next,
207 mpeg_prev, 207 audio_prev,
208 mpeg_ff_rewind, 208 audio_ff_rewind,
209 mpeg_next_track, 209 audio_next_track,
210 playlist_amount, 210 playlist_amount,
211 mpeg_status, 211 audio_status,
212 mpeg_has_changed_track, 212 audio_has_changed_track,
213 mpeg_current_track, 213 audio_current_track,
214 mpeg_flush_and_reload_tracks, 214 audio_flush_and_reload_tracks,
215 mpeg_get_file_pos, 215 audio_get_file_pos,
216 mpeg_get_last_header, 216 mpeg_get_last_header,
217#if (CONFIG_HWCODEC == MAS3587F) || (CONFIG_HWCODEC == MAS3539F) 217#if (CONFIG_HWCODEC == MAS3587F) || (CONFIG_HWCODEC == MAS3539F)
218 sound_set_pitch, 218 sound_set_pitch,
@@ -409,7 +409,7 @@ void* plugin_get_buffer(int* buffer_size)
409 Playback gets stopped, to avoid conflicts. */ 409 Playback gets stopped, to avoid conflicts. */
410void* plugin_get_mp3_buffer(int* buffer_size) 410void* plugin_get_mp3_buffer(int* buffer_size)
411{ 411{
412 mpeg_stop(); 412 audio_stop();
413 talk_buffer_steal(); /* we use the mp3 buffer, need to tell */ 413 talk_buffer_steal(); /* we use the mp3 buffer, need to tell */
414 *buffer_size = mp3end - mp3buf; 414 *buffer_size = mp3end - mp3buf;
415 return mp3buf; 415 return mp3buf;
diff --git a/apps/plugin.h b/apps/plugin.h
index 45f03555ec..ff37a7c46d 100644
--- a/apps/plugin.h
+++ b/apps/plugin.h
@@ -42,6 +42,7 @@
42#include "lcd.h" 42#include "lcd.h"
43#include "id3.h" 43#include "id3.h"
44#include "mpeg.h" 44#include "mpeg.h"
45#include "audio.h"
45#include "mp3_playback.h" 46#include "mp3_playback.h"
46#include "pcm_playback.h" 47#include "pcm_playback.h"
47#include "settings.h" 48#include "settings.h"
@@ -239,20 +240,20 @@ struct plugin_api {
239#endif 240#endif
240 241
241 /* playback control */ 242 /* playback control */
242 void (*PREFIX(mpeg_play))(int offset); 243 void (*PREFIX(audio_play))(int offset);
243 void (*mpeg_stop)(void); 244 void (*audio_stop)(void);
244 void (*mpeg_pause)(void); 245 void (*audio_pause)(void);
245 void (*mpeg_resume)(void); 246 void (*audio_resume)(void);
246 void (*mpeg_next)(void); 247 void (*audio_next)(void);
247 void (*mpeg_prev)(void); 248 void (*audio_prev)(void);
248 void (*mpeg_ff_rewind)(int newtime); 249 void (*audio_ff_rewind)(int newtime);
249 struct mp3entry* (*mpeg_next_track)(void); 250 struct mp3entry* (*audio_next_track)(void);
250 int (*playlist_amount)(void); 251 int (*playlist_amount)(void);
251 int (*mpeg_status)(void); 252 int (*audio_status)(void);
252 bool (*mpeg_has_changed_track)(void); 253 bool (*audio_has_changed_track)(void);
253 struct mp3entry* (*mpeg_current_track)(void); 254 struct mp3entry* (*audio_current_track)(void);
254 void (*mpeg_flush_and_reload_tracks)(void); 255 void (*audio_flush_and_reload_tracks)(void);
255 int (*mpeg_get_file_pos)(void); 256 int (*audio_get_file_pos)(void);
256 unsigned long (*mpeg_get_last_header)(void); 257 unsigned long (*mpeg_get_last_header)(void);
257#if (CONFIG_HWCODEC == MAS3587F) || (CONFIG_HWCODEC == MAS3539F) 258#if (CONFIG_HWCODEC == MAS3587F) || (CONFIG_HWCODEC == MAS3539F)
258 void (*sound_set_pitch)(int pitch); 259 void (*sound_set_pitch)(int pitch);
diff --git a/apps/plugins/alpine_cdc.c b/apps/plugins/alpine_cdc.c
index d944810b31..d0b3b1d8d1 100644
--- a/apps/plugins/alpine_cdc.c
+++ b/apps/plugins/alpine_cdc.c
@@ -817,7 +817,7 @@ void emu_process_packet(unsigned char* mbus_msg, int msg_size)
817 817
818 if (playmsg_dirty) 818 if (playmsg_dirty)
819 { 819 {
820 rb->yield(); /* give the mpeg thread a chance to process */ 820 rb->yield(); /* give the audio thread a chance to process */
821 get_playmsg(); /* force update */ 821 get_playmsg(); /* force update */
822 mbus_send(gEmu.playmsg, sizeof(gEmu.playmsg)); 822 mbus_send(gEmu.playmsg, sizeof(gEmu.playmsg));
823 } 823 }
@@ -876,10 +876,10 @@ void get_playmsg(void)
876 876
877 if (gEmu.set_state != EMU_FF && gEmu.set_state != EMU_FR) 877 if (gEmu.set_state != EMU_FF && gEmu.set_state != EMU_FR)
878 { 878 {
879 switch(rb->mpeg_status()) 879 switch(rb->audio_status())
880 { 880 {
881 case MPEG_STATUS_PLAY: 881 case AUDIO_STATUS_PLAY:
882 print_scroll("MpegStat Play"); 882 print_scroll("AudioStat Play");
883 if (gEmu.set_state == EMU_FF || gEmu.set_state == EMU_FR) 883 if (gEmu.set_state == EMU_FF || gEmu.set_state == EMU_FR)
884 gEmu.playmsg[2] = gEmu.set_state; /* set FF/FR */ 884 gEmu.playmsg[2] = gEmu.set_state; /* set FF/FR */
885 else 885 else
@@ -890,8 +890,8 @@ void get_playmsg(void)
890 bit_set(gEmu.playmsg, 59, false); /* clear stop */ 890 bit_set(gEmu.playmsg, 59, false); /* clear stop */
891 break; 891 break;
892 892
893 case MPEG_STATUS_PLAY | MPEG_STATUS_PAUSE: 893 case AUDIO_STATUS_PLAY | AUDIO_STATUS_PAUSE:
894 print_scroll("MpegStat Pause"); 894 print_scroll("AudioStat Pause");
895 gEmu.playmsg[2] = EMU_PAUSED; 895 gEmu.playmsg[2] = EMU_PAUSED;
896 bit_set(gEmu.playmsg, 56, false); /* clear play */ 896 bit_set(gEmu.playmsg, 56, false); /* clear play */
897 bit_set(gEmu.playmsg, 57, true); /* set pause */ 897 bit_set(gEmu.playmsg, 57, true); /* set pause */
@@ -899,7 +899,7 @@ void get_playmsg(void)
899 break; 899 break;
900 900
901 default: 901 default:
902 print_scroll("MpegStat 0"); 902 print_scroll("AudioStat 0");
903 gEmu.playmsg[2] = EMU_STOPPED; 903 gEmu.playmsg[2] = EMU_STOPPED;
904 bit_set(gEmu.playmsg, 56, false); /* clear play */ 904 bit_set(gEmu.playmsg, 56, false); /* clear play */
905 bit_set(gEmu.playmsg, 57, false); /* clear pause */ 905 bit_set(gEmu.playmsg, 57, false); /* clear pause */
@@ -943,7 +943,7 @@ int get_playtime(void)
943{ 943{
944 struct mp3entry* p_mp3entry; 944 struct mp3entry* p_mp3entry;
945 945
946 p_mp3entry = rb->mpeg_current_track(); 946 p_mp3entry = rb->audio_current_track();
947 if (p_mp3entry == NULL) 947 if (p_mp3entry == NULL)
948 return 0; 948 return 0;
949 949
@@ -955,7 +955,7 @@ int get_tracklength(void)
955{ 955{
956 struct mp3entry* p_mp3entry; 956 struct mp3entry* p_mp3entry;
957 957
958 p_mp3entry = rb->mpeg_current_track(); 958 p_mp3entry = rb->audio_current_track();
959 if (p_mp3entry == NULL) 959 if (p_mp3entry == NULL)
960 return 0; 960 return 0;
961 961
@@ -967,13 +967,13 @@ void set_track(int selected)
967{ 967{
968 if (selected > get_track()) 968 if (selected > get_track())
969 { 969 {
970 print_scroll("mpeg_next"); 970 print_scroll("audio_next");
971 rb->mpeg_next(); 971 rb->audio_next();
972 } 972 }
973 else if (selected < get_track()) 973 else if (selected < get_track())
974 { 974 {
975 print_scroll("mpeg_prev"); 975 print_scroll("audio_prev");
976 rb->mpeg_prev(); 976 rb->audio_prev();
977 } 977 }
978} 978}
979 979
@@ -982,7 +982,7 @@ int get_track(void)
982{ 982{
983 struct mp3entry* p_mp3entry; 983 struct mp3entry* p_mp3entry;
984 984
985 p_mp3entry = rb->mpeg_current_track(); 985 p_mp3entry = rb->audio_current_track();
986 if (p_mp3entry == NULL) 986 if (p_mp3entry == NULL)
987 return 0; 987 return 0;
988 988
@@ -992,48 +992,48 @@ int get_track(void)
992/* start or resume playback */ 992/* start or resume playback */
993void set_play(void) 993void set_play(void)
994{ 994{
995 if (rb->mpeg_status() == MPEG_STATUS_PLAY) 995 if (rb->audio_status() == AUDIO_STATUS_PLAY)
996 return; 996 return;
997 997
998 if (rb->mpeg_status() == (MPEG_STATUS_PLAY | MPEG_STATUS_PAUSE)) 998 if (rb->audio_status() == (AUDIO_STATUS_PLAY | AUDIO_STATUS_PAUSE))
999 { 999 {
1000 print_scroll("mpeg_resume"); 1000 print_scroll("audio_resume");
1001 rb->mpeg_resume(); 1001 rb->audio_resume();
1002 } 1002 }
1003 else 1003 else
1004 { 1004 {
1005 print_scroll("mpeg_play(0)"); 1005 print_scroll("audio_play(0)");
1006 rb->mpeg_play(0); 1006 rb->audio_play(0);
1007 } 1007 }
1008} 1008}
1009 1009
1010/* pause playback */ 1010/* pause playback */
1011void set_pause(void) 1011void set_pause(void)
1012{ 1012{
1013 if (rb->mpeg_status() == MPEG_STATUS_PLAY) 1013 if (rb->audio_status() == AUDIO_STATUS_PLAY)
1014 { 1014 {
1015 print_scroll("mpeg_pause"); 1015 print_scroll("audio_pause");
1016 rb->mpeg_pause(); 1016 rb->audio_pause();
1017 } 1017 }
1018} 1018}
1019 1019
1020/* stop playback */ 1020/* stop playback */
1021void set_stop(void) 1021void set_stop(void)
1022{ 1022{
1023 if (rb->mpeg_status() & MPEG_STATUS_PLAY) 1023 if (rb->audio_status() & AUDIO_STATUS_PLAY)
1024 { 1024 {
1025 print_scroll("mpeg_stop"); 1025 print_scroll("audio_stop");
1026 rb->mpeg_stop(); 1026 rb->audio_stop();
1027 } 1027 }
1028} 1028}
1029 1029
1030/* seek */ 1030/* seek */
1031void set_position(int seconds) 1031void set_position(int seconds)
1032{ 1032{
1033 if (rb->mpeg_status() & MPEG_STATUS_PLAY) 1033 if (rb->audio_status() & AUDIO_STATUS_PLAY)
1034 { 1034 {
1035 print_scroll("mpeg_ff_rewind"); 1035 print_scroll("audio_ff_rewind");
1036 rb->mpeg_ff_rewind(seconds * 1000); 1036 rb->audio_ff_rewind(seconds * 1000);
1037 } 1037 }
1038} 1038}
1039 1039
diff --git a/apps/plugins/favorites.c b/apps/plugins/favorites.c
index c4b969f920..68eab43298 100644
--- a/apps/plugins/favorites.c
+++ b/apps/plugins/favorites.c
@@ -21,7 +21,7 @@ enum plugin_status plugin_start(struct plugin_api* api, void* parameter)
21 if(parameter) { 21 if(parameter) {
22 rb->strncpy(track_path, parameter, MAX_PATH); 22 rb->strncpy(track_path, parameter, MAX_PATH);
23 } else { 23 } else {
24 id3 = rb->mpeg_current_track(); 24 id3 = rb->audio_current_track();
25 if (!id3) { 25 if (!id3) {
26 rb->splash(HZ*2, true, "Nothing To Save"); 26 rb->splash(HZ*2, true, "Nothing To Save");
27 return PLUGIN_OK; 27 return PLUGIN_OK;
diff --git a/apps/plugins/splitedit.c b/apps/plugins/splitedit.c
index c2cdc8de6e..d38223827b 100644
--- a/apps/plugins/splitedit.c
+++ b/apps/plugins/splitedit.c
@@ -614,11 +614,11 @@ static int save(
614 } 614 }
615 615
616 /* find the file position of the split point */ 616 /* find the file position of the split point */
617 rb->mpeg_pause(); 617 rb->audio_pause();
618 rb->mpeg_ff_rewind(splittime); 618 rb->audio_ff_rewind(splittime);
619 rb->yield(); 619 rb->yield();
620 rb->yield(); 620 rb->yield();
621 end = rb->mpeg_get_file_pos(); 621 end = rb->audio_get_file_pos();
622 622
623 /* open the source file */ 623 /* open the source file */
624 src_file = rb->open(mp3->path, O_RDONLY); 624 src_file = rb->open(mp3->path, O_RDONLY);
@@ -720,7 +720,7 @@ static int save(
720 retval = -3; 720 retval = -3;
721 } 721 }
722 722
723 rb->mpeg_resume(); 723 rb->audio_resume();
724 724
725 return retval; 725 return retval;
726} 726}
@@ -985,27 +985,27 @@ unsigned long splitedit_editor(struct mp3entry * mp3_to_split,
985 985
986 case LOOP_MODE_ALL: 986 case LOOP_MODE_ALL:
987 case LOOP_MODE_TO: 987 case LOOP_MODE_TO:
988 rb->mpeg_pause(); 988 rb->audio_pause();
989 rb->mpeg_ff_rewind(range_start); 989 rb->audio_ff_rewind(range_start);
990#ifdef HAVE_MMC 990#ifdef HAVE_MMC
991/* MMC is slow - wait some time to allow track reload to finish */ 991/* MMC is slow - wait some time to allow track reload to finish */
992 rb->sleep(HZ/20); 992 rb->sleep(HZ/20);
993 if (mp3->elapsed > play_end) /* reload in progress */ 993 if (mp3->elapsed > play_end) /* reload in progress */
994 rb->splash(10*HZ, true, "Wait - reloading"); 994 rb->splash(10*HZ, true, "Wait - reloading");
995#endif 995#endif
996 rb->mpeg_resume(); 996 rb->audio_resume();
997 break; 997 break;
998 998
999 case LOOP_MODE_FROM: 999 case LOOP_MODE_FROM:
1000 rb->mpeg_pause(); 1000 rb->audio_pause();
1001 rb->mpeg_ff_rewind(xpos_to_time(split_x)); 1001 rb->audio_ff_rewind(xpos_to_time(split_x));
1002#ifdef HAVE_MMC 1002#ifdef HAVE_MMC
1003/* MMC is slow - wait some time to allow track reload to finish */ 1003/* MMC is slow - wait some time to allow track reload to finish */
1004 rb->sleep(HZ/20); 1004 rb->sleep(HZ/20);
1005 if (mp3->elapsed > play_end) /* reload in progress */ 1005 if (mp3->elapsed > play_end) /* reload in progress */
1006 rb->splash(10*HZ, true, "Wait - reloading"); 1006 rb->splash(10*HZ, true, "Wait - reloading");
1007#endif 1007#endif
1008 rb->mpeg_resume(); 1008 rb->audio_resume();
1009 break; 1009 break;
1010 1010
1011 case LOOP_MODE_FREE: 1011 case LOOP_MODE_FREE:
@@ -1037,9 +1037,9 @@ unsigned long splitedit_editor(struct mp3entry * mp3_to_split,
1037 if (lastbutton != SPLITEDIT_PLAY_PRE) 1037 if (lastbutton != SPLITEDIT_PLAY_PRE)
1038 break; 1038 break;
1039#endif 1039#endif
1040 rb->mpeg_pause(); 1040 rb->audio_pause();
1041 rb->mpeg_ff_rewind(xpos_to_time(split_x)); 1041 rb->audio_ff_rewind(xpos_to_time(split_x));
1042 rb->mpeg_resume(); 1042 rb->audio_resume();
1043 break; 1043 break;
1044 1044
1045 case BUTTON_UP: 1045 case BUTTON_UP:
@@ -1159,9 +1159,9 @@ unsigned long splitedit_editor(struct mp3entry * mp3_to_split,
1159 } 1159 }
1160 update_data(); 1160 update_data();
1161 1161
1162 if (mp3 != rb->mpeg_current_track()) 1162 if (mp3 != rb->audio_current_track())
1163 { 1163 {
1164 struct mp3entry *new_mp3 = rb->mpeg_current_track(); 1164 struct mp3entry *new_mp3 = rb->audio_current_track();
1165 if (rb->strncasecmp(path_mp3, new_mp3->path, 1165 if (rb->strncasecmp(path_mp3, new_mp3->path,
1166 sizeof (path_mp3))) 1166 sizeof (path_mp3)))
1167 { 1167 {
@@ -1173,10 +1173,10 @@ unsigned long splitedit_editor(struct mp3entry * mp3_to_split,
1173 else 1173 else
1174 { 1174 {
1175 mp3 = new_mp3; 1175 mp3 = new_mp3;
1176 rb->mpeg_pause(); 1176 rb->audio_pause();
1177 rb->mpeg_flush_and_reload_tracks(); 1177 rb->audio_flush_and_reload_tracks();
1178 rb->mpeg_ff_rewind(range_start); 1178 rb->audio_ff_rewind(range_start);
1179 rb->mpeg_resume(); 1179 rb->audio_resume();
1180 } 1180 }
1181 } 1181 }
1182 } 1182 }
@@ -1192,12 +1192,12 @@ enum plugin_status plugin_start(struct plugin_api* api, void* parameter)
1192 rb = api; 1192 rb = api;
1193 rb->lcd_clear_display(); 1193 rb->lcd_clear_display();
1194 rb->lcd_update(); 1194 rb->lcd_update();
1195 mp3 = rb->mpeg_current_track(); 1195 mp3 = rb->audio_current_track();
1196 if (mp3 != NULL) 1196 if (mp3 != NULL)
1197 { 1197 {
1198 if (rb->mpeg_status() & MPEG_STATUS_PAUSE) 1198 if (rb->audio_status() & AUDIO_STATUS_PAUSE)
1199 { 1199 {
1200 rb->mpeg_resume(); 1200 rb->audio_resume();
1201 } 1201 }
1202 splitedit_editor(mp3, mp3->elapsed, MIN_RANGE_SIZE * 8); 1202 splitedit_editor(mp3, mp3->elapsed, MIN_RANGE_SIZE * 8);
1203 } 1203 }
diff --git a/apps/recorder/recording.c b/apps/recorder/recording.c
index 39e94739b5..9ef6d4a521 100644
--- a/apps/recorder/recording.c
+++ b/apps/recorder/recording.c
@@ -27,6 +27,7 @@
27#include "lcd.h" 27#include "lcd.h"
28#include "led.h" 28#include "led.h"
29#include "mpeg.h" 29#include "mpeg.h"
30#include "audio.h"
30#include "mp3_playback.h" 31#include "mp3_playback.h"
31#include "mas.h" 32#include "mas.h"
32#include "button.h" 33#include "button.h"
@@ -256,7 +257,7 @@ static void trigger_listener(int trigger_status)
256 switch (trigger_status) 257 switch (trigger_status)
257 { 258 {
258 case TRIG_GO: 259 case TRIG_GO:
259 if((mpeg_status() & MPEG_STATUS_RECORD) != MPEG_STATUS_RECORD) 260 if((audio_status() & AUDIO_STATUS_RECORD) != AUDIO_STATUS_RECORD)
260 { 261 {
261 talk_buffer_steal(); /* we use the mp3 buffer */ 262 talk_buffer_steal(); /* we use the mp3 buffer */
262 mpeg_record(rec_create_filename(path_buffer)); 263 mpeg_record(rec_create_filename(path_buffer));
@@ -276,9 +277,9 @@ static void trigger_listener(int trigger_status)
276 277
277 /* A _change_ to TRIG_READY means the current recording has stopped */ 278 /* A _change_ to TRIG_READY means the current recording has stopped */
278 case TRIG_READY: 279 case TRIG_READY:
279 if(mpeg_status() & MPEG_STATUS_RECORD) 280 if(audio_status() & AUDIO_STATUS_RECORD)
280 { 281 {
281 mpeg_stop(); 282 audio_stop();
282 if (global_settings.rec_trigger_mode != TRIG_MODE_REARM) 283 if (global_settings.rec_trigger_mode != TRIG_MODE_REARM)
283 { 284 {
284 peak_meter_set_trigger_listener(NULL); 285 peak_meter_set_trigger_listener(NULL);
@@ -306,7 +307,7 @@ bool recording_screen(void)
306 int hours, minutes; 307 int hours, minutes;
307 char path_buffer[MAX_PATH]; 308 char path_buffer[MAX_PATH];
308 bool been_in_usb_mode = false; 309 bool been_in_usb_mode = false;
309 int last_mpeg_stat = -1; 310 int last_audio_stat = -1;
310 bool last_led_stat = false; 311 bool last_led_stat = false;
311 312
312 const unsigned char *byte_units[] = { 313 const unsigned char *byte_units[] = {
@@ -352,15 +353,15 @@ bool recording_screen(void)
352 353
353 while(!done) 354 while(!done)
354 { 355 {
355 int mpeg_stat = mpeg_status(); 356 int audio_stat = audio_status();
356 357
357 /* 358 /*
358 * Flash the LED while waiting to record. Turn it on while 359 * Flash the LED while waiting to record. Turn it on while
359 * recording. 360 * recording.
360 */ 361 */
361 if(mpeg_stat & MPEG_STATUS_RECORD) 362 if(audio_stat & AUDIO_STATUS_RECORD)
362 { 363 {
363 if (mpeg_stat & MPEG_STATUS_PAUSE) 364 if (audio_stat & AUDIO_STATUS_PAUSE)
364 { 365 {
365 /* 366 /*
366 This is supposed to be the same as 367 This is supposed to be the same as
@@ -411,24 +412,24 @@ bool recording_screen(void)
411 /* Wait for a button while drawing the peak meter */ 412 /* Wait for a button while drawing the peak meter */
412 button = peak_meter_draw_get_btn(0, 8 + h*2, LCD_WIDTH, h); 413 button = peak_meter_draw_get_btn(0, 8 + h*2, LCD_WIDTH, h);
413 414
414 if (last_mpeg_stat != mpeg_stat) 415 if (last_audio_stat != audio_stat)
415 { 416 {
416 if (mpeg_stat == MPEG_STATUS_RECORD) 417 if (audio_stat == AUDIO_STATUS_RECORD)
417 { 418 {
418 have_recorded = true; 419 have_recorded = true;
419 } 420 }
420 last_mpeg_stat = mpeg_stat; 421 last_audio_stat = audio_stat;
421 } 422 }
422 423
423 switch(button) 424 switch(button)
424 { 425 {
425 case REC_STOPEXIT: 426 case REC_STOPEXIT:
426 if(mpeg_stat & MPEG_STATUS_RECORD) 427 if(audio_stat & AUDIO_STATUS_RECORD)
427 { 428 {
428 /* turn off the trigger */ 429 /* turn off the trigger */
429 peak_meter_trigger(false); 430 peak_meter_trigger(false);
430 peak_meter_set_trigger_listener(NULL); 431 peak_meter_set_trigger_listener(NULL);
431 mpeg_stop(); 432 audio_stop();
432 } 433 }
433 else 434 else
434 { 435 {
@@ -444,7 +445,7 @@ bool recording_screen(void)
444 445
445 case REC_RECPAUSE: 446 case REC_RECPAUSE:
446 /* Only act if the mpeg is stopped */ 447 /* Only act if the mpeg is stopped */
447 if(!(mpeg_stat & MPEG_STATUS_RECORD)) 448 if(!(audio_stat & AUDIO_STATUS_RECORD))
448 { 449 {
449 /* is this manual or triggered recording? */ 450 /* is this manual or triggered recording? */
450 if ((global_settings.rec_trigger_mode == TRIG_MODE_OFF) || 451 if ((global_settings.rec_trigger_mode == TRIG_MODE_OFF) ||
@@ -458,7 +459,7 @@ bool recording_screen(void)
458 last_seconds = 0; 459 last_seconds = 0;
459 if (global_settings.talk_menu) 460 if (global_settings.talk_menu)
460 { /* no voice possible here, but a beep */ 461 { /* no voice possible here, but a beep */
461 mpeg_beep(HZ/2); /* longer beep on start */ 462 audio_beep(HZ/2); /* longer beep on start */
462 } 463 }
463 } 464 }
464 465
@@ -476,12 +477,12 @@ bool recording_screen(void)
476 } 477 }
477 else 478 else
478 { 479 {
479 if(mpeg_stat & MPEG_STATUS_PAUSE) 480 if(audio_stat & AUDIO_STATUS_PAUSE)
480 { 481 {
481 mpeg_resume_recording(); 482 mpeg_resume_recording();
482 if (global_settings.talk_menu) 483 if (global_settings.talk_menu)
483 { /* no voice possible here, but a beep */ 484 { /* no voice possible here, but a beep */
484 mpeg_beep(HZ/4); /* short beep on resume */ 485 audio_beep(HZ/4); /* short beep on resume */
485 } 486 }
486 } 487 }
487 else 488 else
@@ -594,7 +595,7 @@ bool recording_screen(void)
594 595
595#ifdef REC_SETTINGS 596#ifdef REC_SETTINGS
596 case REC_SETTINGS: 597 case REC_SETTINGS:
597 if(mpeg_stat != MPEG_STATUS_RECORD) 598 if(audio_stat != AUDIO_STATUS_RECORD)
598 { 599 {
599 /* led is restored at begin of loop / end of function */ 600 /* led is restored at begin of loop / end of function */
600 led(false); 601 led(false);
@@ -625,7 +626,7 @@ bool recording_screen(void)
625 626
626#ifdef REC_F2 627#ifdef REC_F2
627 case REC_F2: 628 case REC_F2:
628 if(mpeg_stat != MPEG_STATUS_RECORD) 629 if(audio_stat != AUDIO_STATUS_RECORD)
629 { 630 {
630 /* led is restored at begin of loop / end of function */ 631 /* led is restored at begin of loop / end of function */
631 led(false); 632 led(false);
@@ -642,14 +643,14 @@ bool recording_screen(void)
642 643
643#ifdef REC_F3 644#ifdef REC_F3
644 case REC_F3: 645 case REC_F3:
645 if(mpeg_stat & MPEG_STATUS_RECORD) 646 if(audio_stat & AUDIO_STATUS_RECORD)
646 { 647 {
647 mpeg_new_file(rec_create_filename(path_buffer)); 648 mpeg_new_file(rec_create_filename(path_buffer));
648 last_seconds = 0; 649 last_seconds = 0;
649 } 650 }
650 else 651 else
651 { 652 {
652 if(mpeg_stat != MPEG_STATUS_RECORD) 653 if(audio_stat != AUDIO_STATUS_RECORD)
653 { 654 {
654 /* led is restored at begin of loop / end of function */ 655 /* led is restored at begin of loop / end of function */
655 led(false); 656 led(false);
@@ -667,7 +668,7 @@ bool recording_screen(void)
667 668
668 case SYS_USB_CONNECTED: 669 case SYS_USB_CONNECTED:
669 /* Only accept USB connection when not recording */ 670 /* Only accept USB connection when not recording */
670 if(mpeg_stat != MPEG_STATUS_RECORD) 671 if(audio_stat != AUDIO_STATUS_RECORD)
671 { 672 {
672 default_event_handler(SYS_USB_CONNECTED); 673 default_event_handler(SYS_USB_CONNECTED);
673 done = true; 674 done = true;
@@ -708,7 +709,7 @@ bool recording_screen(void)
708 709
709 dseconds = rec_timesplit_seconds(); 710 dseconds = rec_timesplit_seconds();
710 711
711 if(mpeg_stat & MPEG_STATUS_PRERECORD) 712 if(audio_stat & AUDIO_STATUS_PRERECORD)
712 { 713 {
713 snprintf(buf, 32, "%s...", str(LANG_RECORD_PRERECORD)); 714 snprintf(buf, 32, "%s...", str(LANG_RECORD_PRERECORD));
714 } 715 }
@@ -741,7 +742,7 @@ bool recording_screen(void)
741 /* We will do file splitting regardless, since the OFF 742 /* We will do file splitting regardless, since the OFF
742 setting really means 24 hours. This is to make sure 743 setting really means 24 hours. This is to make sure
743 that the recorded files don't get too big. */ 744 that the recorded files don't get too big. */
744 if (mpeg_stat && (seconds >= dseconds)) 745 if (audio_stat && (seconds >= dseconds))
745 { 746 {
746 mpeg_new_file(rec_create_filename(path_buffer)); 747 mpeg_new_file(rec_create_filename(path_buffer));
747 update_countdown = 1; 748 update_countdown = 1;
@@ -822,7 +823,7 @@ bool recording_screen(void)
822 } 823 }
823 } 824 }
824 825
825 if(mpeg_stat & MPEG_STATUS_ERROR) 826 if(audio_stat & AUDIO_STATUS_ERROR)
826 { 827 {
827 done = true; 828 done = true;
828 } 829 }
@@ -830,12 +831,12 @@ bool recording_screen(void)
830 831
831 invert_led(false); 832 invert_led(false);
832 833
833 if(mpeg_status() & MPEG_STATUS_ERROR) 834 if(audio_status() & AUDIO_STATUS_ERROR)
834 { 835 {
835 splash(0, true, str(LANG_DISK_FULL)); 836 splash(0, true, str(LANG_DISK_FULL));
836 status_draw(true); 837 status_draw(true);
837 lcd_update(); 838 lcd_update();
838 mpeg_error_clear(); 839 audio_error_clear();
839 840
840 while(1) 841 while(1)
841 { 842 {
@@ -845,7 +846,7 @@ bool recording_screen(void)
845 } 846 }
846 } 847 }
847 848
848 mpeg_init_playback(); 849 audio_init_playback();
849 850
850 /* make sure the trigger is really turned off */ 851 /* make sure the trigger is really turned off */
851 peak_meter_trigger(false); 852 peak_meter_trigger(false);
diff --git a/apps/screens.c b/apps/screens.c
index f56c28a165..1d11fdbb5e 100644
--- a/apps/screens.c
+++ b/apps/screens.c
@@ -25,7 +25,7 @@
25#include "lang.h" 25#include "lang.h"
26#include "icons.h" 26#include "icons.h"
27#include "font.h" 27#include "font.h"
28#include "mpeg.h" 28#include "audio.h"
29#include "mp3_playback.h" 29#include "mp3_playback.h"
30#include "usb.h" 30#include "usb.h"
31#include "settings.h" 31#include "settings.h"
@@ -452,17 +452,17 @@ int pitch_screen(void)
452 break; 452 break;
453 453
454 case BUTTON_ON | BUTTON_PLAY: 454 case BUTTON_ON | BUTTON_PLAY:
455 mpeg_pause(); 455 audio_pause();
456 used = true; 456 used = true;
457 break; 457 break;
458 458
459 case BUTTON_PLAY | BUTTON_REL: 459 case BUTTON_PLAY | BUTTON_REL:
460 mpeg_resume(); 460 audio_resume();
461 used = true; 461 used = true;
462 break; 462 break;
463 463
464 case BUTTON_ON | BUTTON_PLAY | BUTTON_REL: 464 case BUTTON_ON | BUTTON_PLAY | BUTTON_REL:
465 mpeg_resume(); 465 audio_resume();
466 exit = true; 466 exit = true;
467 break; 467 break;
468 468
@@ -651,7 +651,7 @@ bool quick_screen(int context, int button)
651 global_settings.playlist_shuffle = 651 global_settings.playlist_shuffle =
652 !global_settings.playlist_shuffle; 652 !global_settings.playlist_shuffle;
653 653
654 if(mpeg_status() & MPEG_STATUS_PLAY) 654 if(audio_status() & AUDIO_STATUS_PLAY)
655 { 655 {
656 if (global_settings.playlist_shuffle) 656 if (global_settings.playlist_shuffle)
657 playlist_randomise(NULL, current_tick, true); 657 playlist_randomise(NULL, current_tick, true);
@@ -727,7 +727,7 @@ bool quick_screen(int context, int button)
727 case BUTTON_F2: 727 case BUTTON_F2:
728 728
729 if ( oldrepeat != global_settings.repeat_mode ) 729 if ( oldrepeat != global_settings.repeat_mode )
730 mpeg_flush_and_reload_tracks(); 730 audio_flush_and_reload_tracks();
731 731
732 break; 732 break;
733 case BUTTON_F3: 733 case BUTTON_F3:
@@ -1254,14 +1254,14 @@ bool shutdown_screen(void)
1254 1254
1255bool browse_id3(void) 1255bool browse_id3(void)
1256{ 1256{
1257 struct mp3entry* id3 = mpeg_current_track(); 1257 struct mp3entry* id3 = audio_current_track();
1258 int button; 1258 int button;
1259 int menu_pos = 0; 1259 int menu_pos = 0;
1260 int menu_max = 8; 1260 int menu_max = 8;
1261 bool exit = false; 1261 bool exit = false;
1262 char scroll_text[MAX_PATH]; 1262 char scroll_text[MAX_PATH];
1263 1263
1264 if (!(mpeg_status() & MPEG_STATUS_PLAY)) 1264 if (!(audio_status() & AUDIO_STATUS_PLAY))
1265 return false; 1265 return false;
1266 1266
1267 while (!exit) 1267 while (!exit)
diff --git a/apps/settings.c b/apps/settings.c
index bad8fa29ab..39bb9b4d26 100644
--- a/apps/settings.c
+++ b/apps/settings.c
@@ -31,7 +31,7 @@
31#include "usb.h" 31#include "usb.h"
32#include "backlight.h" 32#include "backlight.h"
33#include "lcd.h" 33#include "lcd.h"
34#include "mpeg.h" 34#include "audio.h"
35#include "mp3_playback.h" 35#include "mp3_playback.h"
36#include "talk.h" 36#include "talk.h"
37#include "string.h" 37#include "string.h"
@@ -757,7 +757,7 @@ void settings_apply(void)
757 757
758 sound_settings_apply(); 758 sound_settings_apply();
759 759
760 mpeg_set_buffer_margin(global_settings.buffer_margin); 760 audio_set_buffer_margin(global_settings.buffer_margin);
761 761
762 lcd_set_contrast(global_settings.contrast); 762 lcd_set_contrast(global_settings.contrast);
763 lcd_scroll_speed(global_settings.scroll_speed); 763 lcd_scroll_speed(global_settings.scroll_speed);
diff --git a/apps/settings_menu.c b/apps/settings_menu.c
index bc87ec141d..9590e15476 100644
--- a/apps/settings_menu.c
+++ b/apps/settings_menu.c
@@ -26,6 +26,7 @@
26#include "lcd.h" 26#include "lcd.h"
27#include "menu.h" 27#include "menu.h"
28#include "mpeg.h" 28#include "mpeg.h"
29#include "audio.h"
29#include "button.h" 30#include "button.h"
30#include "kernel.h" 31#include "kernel.h"
31#include "thread.h" 32#include "thread.h"
@@ -452,7 +453,7 @@ static bool repeat_mode(void)
452 INT, names, 3, NULL ); 453 INT, names, 3, NULL );
453 454
454 if (old_repeat != global_settings.repeat_mode) 455 if (old_repeat != global_settings.repeat_mode)
455 mpeg_flush_and_reload_tracks(); 456 audio_flush_and_reload_tracks();
456 457
457 return result; 458 return result;
458} 459}
@@ -817,7 +818,7 @@ static bool buffer_margin(void)
817{ 818{
818 return set_int(str(LANG_MP3BUFFER_MARGIN), "s", UNIT_SEC, 819 return set_int(str(LANG_MP3BUFFER_MARGIN), "s", UNIT_SEC,
819 &global_settings.buffer_margin, 820 &global_settings.buffer_margin,
820 mpeg_set_buffer_margin, 1, 0, 7 ); 821 audio_set_buffer_margin, 1, 0, 7 );
821} 822}
822 823
823static bool ff_rewind_min_step(void) 824static bool ff_rewind_min_step(void)
diff --git a/apps/status.c b/apps/status.c
index d4736f3773..62eb03465c 100644
--- a/apps/status.c
+++ b/apps/status.c
@@ -25,7 +25,7 @@
25#include "settings.h" 25#include "settings.h"
26#include "status.h" 26#include "status.h"
27#include "mp3_playback.h" 27#include "mp3_playback.h"
28#include "mpeg.h" 28#include "audio.h"
29#include "wps.h" 29#include "wps.h"
30#ifdef HAVE_RTC 30#ifdef HAVE_RTC
31#include "timefuncs.h" 31#include "timefuncs.h"
@@ -75,16 +75,16 @@ void status_set_ffmode(enum playmode mode)
75 75
76int current_playmode(void) 76int current_playmode(void)
77{ 77{
78 int mpeg_stat = mpeg_status(); 78 int audio_stat = audio_status();
79 79
80 /* ff_mode can be either STATUS_FASTFORWARD or STATUS_FASTBACKWARD 80 /* ff_mode can be either STATUS_FASTFORWARD or STATUS_FASTBACKWARD
81 and that supercedes the other modes */ 81 and that supercedes the other modes */
82 if(ff_mode) 82 if(ff_mode)
83 return ff_mode; 83 return ff_mode;
84 84
85 if(mpeg_stat & MPEG_STATUS_PLAY) 85 if(audio_stat & AUDIO_STATUS_PLAY)
86 { 86 {
87 if(mpeg_stat & MPEG_STATUS_PAUSE) 87 if(audio_stat & AUDIO_STATUS_PAUSE)
88 return STATUS_PAUSE; 88 return STATUS_PAUSE;
89 else 89 else
90 return STATUS_PLAY; 90 return STATUS_PLAY;
@@ -92,9 +92,9 @@ int current_playmode(void)
92#if CONFIG_HWCODEC == MAS3587F 92#if CONFIG_HWCODEC == MAS3587F
93 else 93 else
94 { 94 {
95 if(mpeg_stat & MPEG_STATUS_RECORD) 95 if(audio_stat & AUDIO_STATUS_RECORD)
96 { 96 {
97 if(mpeg_stat & MPEG_STATUS_PAUSE) 97 if(audio_stat & AUDIO_STATUS_PAUSE)
98 return STATUS_RECORD_PAUSE; 98 return STATUS_RECORD_PAUSE;
99 else 99 else
100 return STATUS_RECORD; 100 return STATUS_RECORD;
diff --git a/apps/talk.c b/apps/talk.c
index 6fb75c2601..2b97629d55 100644
--- a/apps/talk.c
+++ b/apps/talk.c
@@ -28,7 +28,7 @@
28#include "system.h" 28#include "system.h"
29#include "settings.h" 29#include "settings.h"
30#include "mp3_playback.h" 30#include "mp3_playback.h"
31#include "mpeg.h" 31#include "audio.h"
32#include "lang.h" 32#include "lang.h"
33#include "talk.h" 33#include "talk.h"
34#include "id3.h" 34#include "id3.h"
@@ -432,7 +432,7 @@ int talk_id(long id, bool enqueue)
432 unsigned char* clipbuf; 432 unsigned char* clipbuf;
433 int unit; 433 int unit;
434 434
435 if (mpeg_status()) /* busy, buffer in use */ 435 if (audio_status()) /* busy, buffer in use */
436 return -1; 436 return -1;
437 437
438 if (p_voicefile == NULL && has_voicefile) 438 if (p_voicefile == NULL && has_voicefile)
@@ -471,7 +471,7 @@ int talk_file(const char* filename, bool enqueue)
471 int size; 471 int size;
472 struct mp3entry info; 472 struct mp3entry info;
473 473
474 if (mpeg_status()) /* busy, buffer in use */ 474 if (audio_status()) /* busy, buffer in use */
475 return -1; 475 return -1;
476 476
477 if (p_thumbnail == NULL || size_for_thumbnail <= 0) 477 if (p_thumbnail == NULL || size_for_thumbnail <= 0)
@@ -512,7 +512,7 @@ int talk_number(long n, bool enqueue)
512 int level = 0; /* mille count */ 512 int level = 0; /* mille count */
513 long mil = 1000000000; /* highest possible "-illion" */ 513 long mil = 1000000000; /* highest possible "-illion" */
514 514
515 if (mpeg_status()) /* busy, buffer in use */ 515 if (audio_status()) /* busy, buffer in use */
516 return -1; 516 return -1;
517 517
518 if (!enqueue) 518 if (!enqueue)
@@ -591,7 +591,7 @@ int talk_value(long n, int unit, bool enqueue)
591 VOICE_HERTZ, 591 VOICE_HERTZ,
592 }; 592 };
593 593
594 if (mpeg_status()) /* busy, buffer in use */ 594 if (audio_status()) /* busy, buffer in use */
595 return -1; 595 return -1;
596 596
597 if (unit < 0 || unit >= UNIT_LAST) 597 if (unit < 0 || unit >= UNIT_LAST)
@@ -623,7 +623,7 @@ int talk_spell(const char* spell, bool enqueue)
623{ 623{
624 char c; /* currently processed char */ 624 char c; /* currently processed char */
625 625
626 if (mpeg_status()) /* busy, buffer in use */ 626 if (audio_status()) /* busy, buffer in use */
627 return -1; 627 return -1;
628 628
629 if (!enqueue) 629 if (!enqueue)
diff --git a/apps/tree.c b/apps/tree.c
index d2b78f9872..139043ab04 100644
--- a/apps/tree.c
+++ b/apps/tree.c
@@ -33,7 +33,7 @@
33#include "tree.h" 33#include "tree.h"
34#include "main_menu.h" 34#include "main_menu.h"
35#include "sprintf.h" 35#include "sprintf.h"
36#include "mpeg.h" 36#include "audio.h"
37#include "playlist.h" 37#include "playlist.h"
38#include "menu.h" 38#include "menu.h"
39#include "wps.h" 39#include "wps.h"
@@ -799,8 +799,8 @@ static bool dirbrowse(void)
799 { 799 {
800 /* Stop the music if it is playing, else show the shutdown 800 /* Stop the music if it is playing, else show the shutdown
801 screen */ 801 screen */
802 if(mpeg_status()) 802 if(audio_status())
803 mpeg_stop(); 803 audio_stop();
804 else { 804 else {
805 if (!charger_inserted()) { 805 if (!charger_inserted()) {
806 shutdown_screen(); 806 shutdown_screen();
@@ -998,7 +998,7 @@ static bool dirbrowse(void)
998 /* don't enter wps from plugin browser etc */ 998 /* don't enter wps from plugin browser etc */
999 if (*tc.dirfilter < NUM_FILTER_MODES) 999 if (*tc.dirfilter < NUM_FILTER_MODES)
1000 { 1000 {
1001 if (mpeg_status() & MPEG_STATUS_PLAY) 1001 if (audio_status() & AUDIO_STATUS_PLAY)
1002 { 1002 {
1003 start_wps=true; 1003 start_wps=true;
1004 } 1004 }
@@ -1539,7 +1539,7 @@ int ft_play_dirname(int start_index)
1539 char dirname_mp3_filename[MAX_PATH+1]; 1539 char dirname_mp3_filename[MAX_PATH+1];
1540 struct entry *dircache = tc.dircache; 1540 struct entry *dircache = tc.dircache;
1541 1541
1542 if (mpeg_status() & MPEG_STATUS_PLAY) 1542 if (audio_status() & AUDIO_STATUS_PLAY)
1543 return 0; 1543 return 0;
1544 1544
1545 snprintf(dirname_mp3_filename, sizeof(dirname_mp3_filename), "%s/%s/%s", 1545 snprintf(dirname_mp3_filename, sizeof(dirname_mp3_filename), "%s/%s/%s",
@@ -1566,7 +1566,7 @@ void ft_play_filename(char *dir, char *file)
1566{ 1566{
1567 char name_mp3_filename[MAX_PATH+1]; 1567 char name_mp3_filename[MAX_PATH+1];
1568 1568
1569 if (mpeg_status() & MPEG_STATUS_PLAY) 1569 if (audio_status() & AUDIO_STATUS_PLAY)
1570 return; 1570 return;
1571 1571
1572 if (strcasecmp(&file[strlen(file) - strlen(file_thumbnail_ext)], 1572 if (strcasecmp(&file[strlen(file) - strlen(file_thumbnail_ext)],
diff --git a/apps/wps-display.c b/apps/wps-display.c
index 9c8619fa66..1ed70541dc 100644
--- a/apps/wps-display.c
+++ b/apps/wps-display.c
@@ -29,7 +29,7 @@
29#include "lcd.h" 29#include "lcd.h"
30#include "hwcompat.h" 30#include "hwcompat.h"
31#include "font.h" 31#include "font.h"
32#include "mpeg.h" 32#include "audio.h"
33#include "id3.h" 33#include "id3.h"
34#include "settings.h" 34#include "settings.h"
35#include "playlist.h" 35#include "playlist.h"
@@ -1011,7 +1011,7 @@ bool wps_display(struct mp3entry* id3,
1011{ 1011{
1012 lcd_clear_display(); 1012 lcd_clear_display();
1013 1013
1014 if (!id3 && !(mpeg_status() & MPEG_STATUS_PLAY)) 1014 if (!id3 && !(audio_status() & AUDIO_STATUS_PLAY))
1015 { 1015 {
1016#ifdef HAVE_LCD_CHARCELLS 1016#ifdef HAVE_LCD_CHARCELLS
1017 lcd_puts(0, 0, str(LANG_END_PLAYLIST_PLAYER)); 1017 lcd_puts(0, 0, str(LANG_END_PLAYLIST_PLAYER));
diff --git a/apps/wps.c b/apps/wps.c
index d5f921c350..e281131836 100644
--- a/apps/wps.c
+++ b/apps/wps.c
@@ -33,7 +33,7 @@
33#include "settings.h" 33#include "settings.h"
34#include "wps.h" 34#include "wps.h"
35#include "wps-display.h" 35#include "wps-display.h"
36#include "mpeg.h" 36#include "audio.h"
37#include "mp3_playback.h" 37#include "mp3_playback.h"
38#include "usb.h" 38#include "usb.h"
39#include "status.h" 39#include "status.h"
@@ -262,11 +262,11 @@ static bool ffwd_rew(int button)
262 } 262 }
263 else 263 else
264 { 264 {
265 if ( (mpeg_status() & MPEG_STATUS_PLAY) && 265 if ( (audio_status() & AUDIO_STATUS_PLAY) &&
266 id3 && id3->length ) 266 id3 && id3->length )
267 { 267 {
268 if (!paused) 268 if (!paused)
269 mpeg_pause(); 269 audio_pause();
270#if CONFIG_KEYPAD == PLAYER_PAD 270#if CONFIG_KEYPAD == PLAYER_PAD
271 lcd_stop_scroll(); 271 lcd_stop_scroll();
272#endif 272#endif
@@ -308,12 +308,12 @@ static bool ffwd_rew(int button)
308 308
309 case WPS_PREV: 309 case WPS_PREV:
310 case WPS_NEXT: 310 case WPS_NEXT:
311 mpeg_ff_rewind(id3->elapsed+ff_rewind_count); 311 audio_ff_rewind(id3->elapsed+ff_rewind_count);
312 ff_rewind_count = 0; 312 ff_rewind_count = 0;
313 ff_rewind = false; 313 ff_rewind = false;
314 status_set_ffmode(0); 314 status_set_ffmode(0);
315 if (!paused) 315 if (!paused)
316 mpeg_resume(); 316 audio_resume();
317#ifdef HAVE_LCD_CHARCELLS 317#ifdef HAVE_LCD_CHARCELLS
318 wps_display(id3, nid3); 318 wps_display(id3, nid3);
319#endif 319#endif
@@ -332,7 +332,7 @@ static bool ffwd_rew(int button)
332 button = button_get(true); 332 button = button_get(true);
333 } 333 }
334 334
335 /* let mpeg thread update id3->elapsed before calling wps_refresh */ 335 /* let audio thread update id3->elapsed before calling wps_refresh */
336 yield(); 336 yield();
337 wps_refresh(id3, nid3, 0, WPS_REFRESH_ALL); 337 wps_refresh(id3, nid3, 0, WPS_REFRESH_ALL);
338 return usb; 338 return usb;
@@ -340,14 +340,14 @@ static bool ffwd_rew(int button)
340 340
341static bool update(void) 341static bool update(void)
342{ 342{
343 bool track_changed = mpeg_has_changed_track(); 343 bool track_changed = audio_has_changed_track();
344 bool retcode = false; 344 bool retcode = false;
345 345
346 nid3 = mpeg_next_track(); 346 nid3 = audio_next_track();
347 if (track_changed) 347 if (track_changed)
348 { 348 {
349 lcd_stop_scroll(); 349 lcd_stop_scroll();
350 id3 = mpeg_current_track(); 350 id3 = audio_current_track();
351 if (wps_display(id3, nid3)) 351 if (wps_display(id3, nid3))
352 retcode = true; 352 retcode = true;
353 else 353 else
@@ -391,8 +391,8 @@ static void fade(bool fade_in)
391 /* zero out the sound */ 391 /* zero out the sound */
392 sound_set(SOUND_VOLUME, current_volume); 392 sound_set(SOUND_VOLUME, current_volume);
393 393
394 sleep(HZ/10); /* let mpeg thread run */ 394 sleep(HZ/10); /* let audio thread run */
395 mpeg_resume(); 395 audio_resume();
396 396
397 while (current_volume < global_settings.volume) { 397 while (current_volume < global_settings.volume) {
398 current_volume += 2; 398 current_volume += 2;
@@ -410,8 +410,8 @@ static void fade(bool fade_in)
410 sleep(1); 410 sleep(1);
411 sound_set(SOUND_VOLUME, current_volume); 411 sound_set(SOUND_VOLUME, current_volume);
412 } 412 }
413 mpeg_pause(); 413 audio_pause();
414 sleep(HZ/5); /* let mpeg thread run */ 414 sleep(HZ/5); /* let audio thread run */
415 415
416 /* reset volume to what it was before the fade */ 416 /* reset volume to what it was before the fade */
417 sound_set(SOUND_VOLUME, global_settings.volume); 417 sound_set(SOUND_VOLUME, global_settings.volume);
@@ -451,10 +451,10 @@ long wps_show(void)
451 451
452 ff_rewind = false; 452 ff_rewind = false;
453 453
454 if(mpeg_status() & MPEG_STATUS_PLAY) 454 if(audio_status() & AUDIO_STATUS_PLAY)
455 { 455 {
456 id3 = mpeg_current_track(); 456 id3 = audio_current_track();
457 nid3 = mpeg_next_track(); 457 nid3 = audio_next_track();
458 if (id3) { 458 if (id3) {
459 if (wps_display(id3, nid3)) 459 if (wps_display(id3, nid3))
460 return 0; 460 return 0;
@@ -468,13 +468,13 @@ long wps_show(void)
468 468
469 while ( 1 ) 469 while ( 1 )
470 { 470 {
471 bool mpeg_paused = (mpeg_status() & MPEG_STATUS_PAUSE)?true:false; 471 bool audio_paused = (audio_status() & AUDIO_STATUS_PAUSE)?true:false;
472 472
473 /* did someone else (i.e power thread) change mpeg pause mode? */ 473 /* did someone else (i.e power thread) change audio pause mode? */
474 if (paused != mpeg_paused) { 474 if (paused != audio_paused) {
475 paused = mpeg_paused; 475 paused = audio_paused;
476 476
477 /* if another thread paused mpeg, we are probably in car mode, 477 /* if another thread paused audio, we are probably in car mode,
478 about to shut down. lets save the settings. */ 478 about to shut down. lets save the settings. */
479 if (paused && global_settings.resume) { 479 if (paused && global_settings.resume) {
480 settings_save(); 480 settings_save();
@@ -560,10 +560,10 @@ long wps_show(void)
560 } 560 }
561#endif 561#endif
562 562
563 /* Exit if mpeg has stopped playing. This can happen if using the 563 /* Exit if audio has stopped playing. This can happen if using the
564 sleep timer with the charger plugged or if starting a recording 564 sleep timer with the charger plugged or if starting a recording
565 from F1 */ 565 from F1 */
566 if (!mpeg_status()) 566 if (!audio_status())
567 exit = true; 567 exit = true;
568 568
569 switch(button) 569 switch(button)
@@ -598,7 +598,7 @@ long wps_show(void)
598 if ( global_settings.fade_on_stop ) 598 if ( global_settings.fade_on_stop )
599 fade(1); 599 fade(1);
600 else 600 else
601 mpeg_resume(); 601 audio_resume();
602 } 602 }
603 else 603 else
604 { 604 {
@@ -606,7 +606,7 @@ long wps_show(void)
606 if ( global_settings.fade_on_stop ) 606 if ( global_settings.fade_on_stop )
607 fade(0); 607 fade(0);
608 else 608 else
609 mpeg_pause(); 609 audio_pause();
610 if (global_settings.resume) { 610 if (global_settings.resume) {
611 settings_save(); 611 settings_save();
612#ifndef HAVE_RTC 612#ifndef HAVE_RTC
@@ -662,16 +662,16 @@ long wps_show(void)
662 case WPS_RC_PREV: 662 case WPS_RC_PREV:
663#endif 663#endif
664 if (!id3 || (id3->elapsed < 3*1000)) { 664 if (!id3 || (id3->elapsed < 3*1000)) {
665 mpeg_prev(); 665 audio_prev();
666 } 666 }
667 else { 667 else {
668 if (!paused) 668 if (!paused)
669 mpeg_pause(); 669 audio_pause();
670 670
671 mpeg_ff_rewind(0); 671 audio_ff_rewind(0);
672 672
673 if (!paused) 673 if (!paused)
674 mpeg_resume(); 674 audio_resume();
675 } 675 }
676 break; 676 break;
677 677
@@ -684,7 +684,7 @@ long wps_show(void)
684#ifdef WPS_RC_NEXT 684#ifdef WPS_RC_NEXT
685 case WPS_RC_NEXT: 685 case WPS_RC_NEXT:
686#endif 686#endif
687 mpeg_next(); 687 audio_next();
688 break; 688 break;
689 689
690 /* menu key functions */ 690 /* menu key functions */
@@ -789,7 +789,7 @@ long wps_show(void)
789 789
790 lcd_stop_scroll(); 790 lcd_stop_scroll();
791 bookmark_autobookmark(); 791 bookmark_autobookmark();
792 mpeg_stop(); 792 audio_stop();
793 793
794 /* Keys can be locked when exiting, so either unlock here 794 /* Keys can be locked when exiting, so either unlock here
795 or implement key locking in tree.c too */ 795 or implement key locking in tree.c too */
diff --git a/firmware/export/audio.h b/firmware/export/audio.h
new file mode 100644
index 0000000000..b276490ab3
--- /dev/null
+++ b/firmware/export/audio.h
@@ -0,0 +1,81 @@
1/***************************************************************************
2 * __________ __ ___.
3 * Open \______ \ ____ ____ | | _\_ |__ _______ ___
4 * Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ /
5 * Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < <
6 * Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \
7 * \/ \/ \/ \/ \/
8 * $Id$
9 *
10 * Copyright (C) 2005 by Linus Nielsen Feltzing
11 *
12 * All files in this archive are subject to the GNU General Public License.
13 * See the file COPYING in the source tree root for full license agreement.
14 *
15 * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY
16 * KIND, either express or implied.
17 *
18 ****************************************************************************/
19#ifndef AUDIO_H
20#define AUDIO_H
21
22#include <stdbool.h>
23
24#ifdef SIMULATOR
25#define audio_play(x) sim_audio_play(x)
26#endif
27
28#define AUDIO_STATUS_PLAY 1
29#define AUDIO_STATUS_PAUSE 2
30#define AUDIO_STATUS_RECORD 4
31#define AUDIO_STATUS_PRERECORD 8
32#define AUDIO_STATUS_ERROR 16
33
34#define AUDIOERR_DISK_FULL 1
35
36struct audio_debug
37{
38 int mp3buflen;
39 int mp3buf_write;
40 int mp3buf_swapwrite;
41 int mp3buf_read;
42
43 int last_dma_chunk_size;
44
45 bool dma_on;
46 bool playing;
47 bool play_pending;
48 bool is_playing;
49 bool filling;
50 bool dma_underrun;
51
52 int unplayed_space;
53 int playable_space;
54 int unswapped_space;
55
56 int low_watermark_level;
57 int lowest_watermark_level;
58};
59
60void audio_init(void);
61void audio_play(int offset);
62void audio_stop(void);
63void audio_pause(void);
64void audio_resume(void);
65void audio_next(void);
66void audio_prev(void);
67int audio_status(void);
68void audio_ff_rewind(int newtime);
69void audio_flush_and_reload_tracks(void);
70struct mp3entry* audio_current_track(void);
71struct mp3entry* audio_next_track(void);
72bool audio_has_changed_track(void);
73void audio_get_debugdata(struct audio_debug *dbgdata);
74void audio_set_buffer_margin(int seconds);
75unsigned int audio_error(void);
76void audio_error_clear(void);
77int audio_get_file_pos(void);
78void audio_beep(int duration);
79void audio_init_playback(void);
80
81#endif
diff --git a/firmware/export/mpeg.h b/firmware/export/mpeg.h
index 479c5f2317..ca0de1f823 100644
--- a/firmware/export/mpeg.h
+++ b/firmware/export/mpeg.h
@@ -42,50 +42,8 @@
42/* For ID3 info and VBR header */ 42/* For ID3 info and VBR header */
43#define MPEG_RESERVED_HEADER_SPACE (4096 + 1500) 43#define MPEG_RESERVED_HEADER_SPACE (4096 + 1500)
44 44
45#ifdef SIMULATOR
46#define mpeg_play(x) sim_mpeg_play(x)
47#endif
48
49struct mpeg_debug
50{
51 int mp3buflen;
52 int mp3buf_write;
53 int mp3buf_swapwrite;
54 int mp3buf_read;
55
56 int last_dma_chunk_size;
57
58 bool dma_on;
59 bool playing;
60 bool play_pending;
61 bool is_playing;
62 bool filling;
63 bool dma_underrun;
64
65 int unplayed_space;
66 int playable_space;
67 int unswapped_space;
68
69 int low_watermark_level;
70 int lowest_watermark_level;
71};
72
73void mpeg_init(void);
74void mpeg_play(int offset);
75void mpeg_stop(void);
76void mpeg_pause(void);
77void mpeg_resume(void);
78void mpeg_next(void);
79void mpeg_prev(void);
80void mpeg_ff_rewind(int newtime);
81void mpeg_flush_and_reload_tracks(void);
82struct mp3entry* mpeg_current_track(void);
83struct mp3entry* mpeg_next_track(void);
84bool mpeg_has_changed_track(void);
85int mpeg_status(void);
86#if (CONFIG_HWCODEC == MAS3587F) || defined(SIMULATOR) 45#if (CONFIG_HWCODEC == MAS3587F) || defined(SIMULATOR)
87void mpeg_init_recording(void); 46void mpeg_init_recording(void);
88void mpeg_init_playback(void);
89void mpeg_record(const char *filename); 47void mpeg_record(const char *filename);
90void mpeg_new_file(const char *filename); 48void mpeg_new_file(const char *filename);
91void mpeg_set_recording_options(int frequency, int quality, 49void mpeg_set_recording_options(int frequency, int quality,
@@ -97,25 +55,11 @@ unsigned long mpeg_num_recorded_bytes(void);
97void mpeg_pause_recording(void); 55void mpeg_pause_recording(void);
98void mpeg_resume_recording(void); 56void mpeg_resume_recording(void);
99#endif 57#endif
100void mpeg_get_debugdata(struct mpeg_debug *dbgdata);
101void mpeg_set_buffer_margin(int seconds);
102unsigned int mpeg_error(void);
103void mpeg_error_clear(void);
104int mpeg_get_file_pos(void);
105unsigned long mpeg_get_last_header(void); 58unsigned long mpeg_get_last_header(void);
106void mpeg_beep(int duration);
107 59
108/* in order to keep the recording here, I have to expose this */ 60/* in order to keep the recording here, I have to expose this */
109void rec_tick(void); 61void rec_tick(void);
110void playback_tick(void); /* FixMe: get rid of this, use mp3_get_playtime() */ 62void playback_tick(void); /* FixMe: get rid of this, use mp3_get_playtime() */
111void mpeg_id3_options(bool _v1first); 63void mpeg_id3_options(bool _v1first);
112 64
113#define MPEG_STATUS_PLAY 1
114#define MPEG_STATUS_PAUSE 2
115#define MPEG_STATUS_RECORD 4
116#define MPEG_STATUS_PRERECORD 8
117#define MPEG_STATUS_ERROR 16
118
119#define MPEGERR_DISK_FULL 1
120
121#endif 65#endif
diff --git a/firmware/mpeg.c b/firmware/mpeg.c
index d8de1a37b4..79265e4452 100644
--- a/firmware/mpeg.c
+++ b/firmware/mpeg.c
@@ -23,6 +23,7 @@
23#include "panic.h" 23#include "panic.h"
24#include "id3.h" 24#include "id3.h"
25#include "mpeg.h" 25#include "mpeg.h"
26#include "audio.h"
26#include "ata.h" 27#include "ata.h"
27#include "string.h" 28#include "string.h"
28#include <kernel.h> 29#include <kernel.h>
@@ -220,10 +221,10 @@ static void set_elapsed(struct mp3entry* id3)
220 id3->elapsed = id3->offset / id3->bpf * id3->tpf; 221 id3->elapsed = id3->offset / id3->bpf * id3->tpf;
221} 222}
222 223
223int mpeg_get_file_pos(void) 224int audio_get_file_pos(void)
224{ 225{
225 int pos = -1; 226 int pos = -1;
226 struct mp3entry *id3 = mpeg_current_track(); 227 struct mp3entry *id3 = audio_current_track();
227 228
228 if (id3->vbr) 229 if (id3->vbr)
229 { 230 {
@@ -402,12 +403,12 @@ static void recalculate_watermark(int bitrate)
402 } 403 }
403} 404}
404 405
405void mpeg_set_buffer_margin(int seconds) 406void audio_set_buffer_margin(int seconds)
406{ 407{
407 low_watermark_margin = seconds; 408 low_watermark_margin = seconds;
408} 409}
409 410
410void mpeg_get_debugdata(struct mpeg_debug *dbgdata) 411void audio_get_debugdata(struct audio_debug *dbgdata)
411{ 412{
412 dbgdata->mp3buflen = mp3buflen; 413 dbgdata->mp3buflen = mp3buflen;
413 dbgdata->mp3buf_write = mp3buf_write; 414 dbgdata->mp3buf_write = mp3buf_write;
@@ -1264,7 +1265,7 @@ static void mpeg_thread(void)
1264 } 1265 }
1265 1266
1266 case MPEG_FF_REWIND: { 1267 case MPEG_FF_REWIND: {
1267 struct mp3entry *id3 = mpeg_current_track(); 1268 struct mp3entry *id3 = audio_current_track();
1268 unsigned int oldtime = id3->elapsed; 1269 unsigned int oldtime = id3->elapsed;
1269 unsigned int newtime = (unsigned int)ev.data; 1270 unsigned int newtime = (unsigned int)ev.data;
1270 int curpos, newpos, diffpos; 1271 int curpos, newpos, diffpos;
@@ -1272,7 +1273,7 @@ static void mpeg_thread(void)
1272 1273
1273 id3->elapsed = newtime; 1274 id3->elapsed = newtime;
1274 1275
1275 newpos = mpeg_get_file_pos(); 1276 newpos = audio_get_file_pos();
1276 if(newpos < 0) 1277 if(newpos < 0)
1277 { 1278 {
1278 id3->elapsed = oldtime; 1279 id3->elapsed = oldtime;
@@ -1808,7 +1809,7 @@ static void mpeg_thread(void)
1808 { 1809 {
1809 if(errno == ENOSPC) 1810 if(errno == ENOSPC)
1810 { 1811 {
1811 mpeg_errno = MPEGERR_DISK_FULL; 1812 mpeg_errno = AUDIOERR_DISK_FULL;
1812 demand_irq_enable(false); 1813 demand_irq_enable(false);
1813 stop_recording(); 1814 stop_recording();
1814 queue_post(&mpeg_queue, MPEG_STOP_DONE, 0); 1815 queue_post(&mpeg_queue, MPEG_STOP_DONE, 0);
@@ -1830,7 +1831,7 @@ static void mpeg_thread(void)
1830 { 1831 {
1831 if(errno == ENOSPC) 1832 if(errno == ENOSPC)
1832 { 1833 {
1833 mpeg_errno = MPEGERR_DISK_FULL; 1834 mpeg_errno = AUDIOERR_DISK_FULL;
1834 demand_irq_enable(false); 1835 demand_irq_enable(false);
1835 stop_recording(); 1836 stop_recording();
1836 queue_post(&mpeg_queue, MPEG_STOP_DONE, 0); 1837 queue_post(&mpeg_queue, MPEG_STOP_DONE, 0);
@@ -1902,7 +1903,7 @@ static void mpeg_thread(void)
1902 { 1903 {
1903 if(errno == ENOSPC) 1904 if(errno == ENOSPC)
1904 { 1905 {
1905 mpeg_errno = MPEGERR_DISK_FULL; 1906 mpeg_errno = AUDIOERR_DISK_FULL;
1906 stop_recording(); 1907 stop_recording();
1907 queue_post(&mpeg_queue, MPEG_STOP_DONE, 0); 1908 queue_post(&mpeg_queue, MPEG_STOP_DONE, 0);
1908 break; 1909 break;
@@ -2013,7 +2014,7 @@ void mpeg_id3_options(bool _v1first)
2013 v1first = _v1first; 2014 v1first = _v1first;
2014} 2015}
2015 2016
2016struct mp3entry* mpeg_current_track() 2017struct mp3entry* audio_current_track()
2017{ 2018{
2018#ifdef SIMULATOR 2019#ifdef SIMULATOR
2019 return &taginfo; 2020 return &taginfo;
@@ -2025,7 +2026,7 @@ struct mp3entry* mpeg_current_track()
2025#endif /* #ifdef SIMULATOR */ 2026#endif /* #ifdef SIMULATOR */
2026} 2027}
2027 2028
2028struct mp3entry* mpeg_next_track() 2029struct mp3entry* audio_next_track()
2029{ 2030{
2030#ifdef SIMULATOR 2031#ifdef SIMULATOR
2031 return &taginfo; 2032 return &taginfo;
@@ -2037,7 +2038,7 @@ struct mp3entry* mpeg_next_track()
2037#endif /* #ifdef SIMULATOR */ 2038#endif /* #ifdef SIMULATOR */
2038} 2039}
2039 2040
2040bool mpeg_has_changed_track(void) 2041bool audio_has_changed_track(void)
2041{ 2042{
2042 if(last_track_counter != current_track_counter) 2043 if(last_track_counter != current_track_counter)
2043 { 2044 {
@@ -2048,7 +2049,7 @@ bool mpeg_has_changed_track(void)
2048} 2049}
2049 2050
2050#if CONFIG_HWCODEC == MAS3587F 2051#if CONFIG_HWCODEC == MAS3587F
2051void mpeg_init_playback(void) 2052void audio_init_playback(void)
2052{ 2053{
2053 init_playback_done = false; 2054 init_playback_done = false;
2054 queue_post(&mpeg_queue, MPEG_INIT_PLAYBACK, NULL); 2055 queue_post(&mpeg_queue, MPEG_INIT_PLAYBACK, NULL);
@@ -2407,7 +2408,7 @@ void mpeg_set_recording_gain(int left, int right, bool use_mic)
2407} 2408}
2408 2409
2409/* try to make some kind of beep, also in recording mode */ 2410/* try to make some kind of beep, also in recording mode */
2410void mpeg_beep(int duration) 2411void audio_beep(int duration)
2411{ 2412{
2412 long starttick = current_tick; 2413 long starttick = current_tick;
2413 do 2414 do
@@ -2495,7 +2496,7 @@ void bitswap(unsigned char *data, int length)
2495 (void)length; 2496 (void)length;
2496} 2497}
2497 2498
2498void mpeg_init_playback(void) 2499void audio_init_playback(void)
2499{ 2500{
2500 /* a dummy */ 2501 /* a dummy */
2501} 2502}
@@ -2504,7 +2505,7 @@ unsigned long mpeg_recorded_time(void)
2504 /* a dummy */ 2505 /* a dummy */
2505 return 0; 2506 return 0;
2506} 2507}
2507void mpeg_beep(int duration) 2508void audio_beep(int duration)
2508{ 2509{
2509 /* a dummy */ 2510 /* a dummy */
2510 (void)duration; 2511 (void)duration;
@@ -2558,7 +2559,7 @@ void mpeg_set_recording_options(int frequency, int quality,
2558} 2559}
2559#endif 2560#endif
2560 2561
2561void mpeg_play(int offset) 2562void audio_play(int offset)
2562{ 2563{
2563#ifdef SIMULATOR 2564#ifdef SIMULATOR
2564 char* trackname; 2565 char* trackname;
@@ -2595,7 +2596,7 @@ void mpeg_play(int offset)
2595 mpeg_errno = 0; 2596 mpeg_errno = 0;
2596} 2597}
2597 2598
2598void mpeg_stop(void) 2599void audio_stop(void)
2599{ 2600{
2600#ifndef SIMULATOR 2601#ifndef SIMULATOR
2601 mpeg_stop_done = false; 2602 mpeg_stop_done = false;
@@ -2610,7 +2611,7 @@ void mpeg_stop(void)
2610 2611
2611} 2612}
2612 2613
2613void mpeg_pause(void) 2614void audio_pause(void)
2614{ 2615{
2615#ifndef SIMULATOR 2616#ifndef SIMULATOR
2616 queue_post(&mpeg_queue, MPEG_PAUSE, NULL); 2617 queue_post(&mpeg_queue, MPEG_PAUSE, NULL);
@@ -2621,7 +2622,7 @@ void mpeg_pause(void)
2621#endif /* #ifndef SIMULATOR */ 2622#endif /* #ifndef SIMULATOR */
2622} 2623}
2623 2624
2624void mpeg_resume(void) 2625void audio_resume(void)
2625{ 2626{
2626#ifndef SIMULATOR 2627#ifndef SIMULATOR
2627 queue_post(&mpeg_queue, MPEG_RESUME, NULL); 2628 queue_post(&mpeg_queue, MPEG_RESUME, NULL);
@@ -2632,7 +2633,7 @@ void mpeg_resume(void)
2632#endif /* #ifndef SIMULATOR */ 2633#endif /* #ifndef SIMULATOR */
2633} 2634}
2634 2635
2635void mpeg_next(void) 2636void audio_next(void)
2636{ 2637{
2637#ifndef SIMULATOR 2638#ifndef SIMULATOR
2638 queue_post(&mpeg_queue, MPEG_NEXT, NULL); 2639 queue_post(&mpeg_queue, MPEG_NEXT, NULL);
@@ -2660,7 +2661,7 @@ void mpeg_next(void)
2660#endif /* #ifndef SIMULATOR */ 2661#endif /* #ifndef SIMULATOR */
2661} 2662}
2662 2663
2663void mpeg_prev(void) 2664void audio_prev(void)
2664{ 2665{
2665#ifndef SIMULATOR 2666#ifndef SIMULATOR
2666 queue_post(&mpeg_queue, MPEG_PREV, NULL); 2667 queue_post(&mpeg_queue, MPEG_PREV, NULL);
@@ -2687,7 +2688,7 @@ void mpeg_prev(void)
2687#endif /* #ifndef SIMULATOR */ 2688#endif /* #ifndef SIMULATOR */
2688} 2689}
2689 2690
2690void mpeg_ff_rewind(int newtime) 2691void audio_ff_rewind(int newtime)
2691{ 2692{
2692#ifndef SIMULATOR 2693#ifndef SIMULATOR
2693 queue_post(&mpeg_queue, MPEG_FF_REWIND, (void *)newtime); 2694 queue_post(&mpeg_queue, MPEG_FF_REWIND, (void *)newtime);
@@ -2696,43 +2697,43 @@ void mpeg_ff_rewind(int newtime)
2696#endif /* #ifndef SIMULATOR */ 2697#endif /* #ifndef SIMULATOR */
2697} 2698}
2698 2699
2699void mpeg_flush_and_reload_tracks(void) 2700void audio_flush_and_reload_tracks(void)
2700{ 2701{
2701#ifndef SIMULATOR 2702#ifndef SIMULATOR
2702 queue_post(&mpeg_queue, MPEG_FLUSH_RELOAD, NULL); 2703 queue_post(&mpeg_queue, MPEG_FLUSH_RELOAD, NULL);
2703#endif /* #ifndef SIMULATOR*/ 2704#endif /* #ifndef SIMULATOR*/
2704} 2705}
2705 2706
2706int mpeg_status(void) 2707int audio_status(void)
2707{ 2708{
2708 int ret = 0; 2709 int ret = 0;
2709 2710
2710 if(is_playing) 2711 if(is_playing)
2711 ret |= MPEG_STATUS_PLAY; 2712 ret |= AUDIO_STATUS_PLAY;
2712 2713
2713 if(paused) 2714 if(paused)
2714 ret |= MPEG_STATUS_PAUSE; 2715 ret |= AUDIO_STATUS_PAUSE;
2715 2716
2716#if CONFIG_HWCODEC == MAS3587F 2717#if CONFIG_HWCODEC == MAS3587F
2717 if(is_recording && !is_prerecording) 2718 if(is_recording && !is_prerecording)
2718 ret |= MPEG_STATUS_RECORD; 2719 ret |= AUDIO_STATUS_RECORD;
2719 2720
2720 if(is_prerecording) 2721 if(is_prerecording)
2721 ret |= MPEG_STATUS_PRERECORD; 2722 ret |= AUDIO_STATUS_PRERECORD;
2722#endif /* #if CONFIG_HWCODEC == MAS3587F */ 2723#endif /* #if CONFIG_HWCODEC == MAS3587F */
2723 2724
2724 if(mpeg_errno) 2725 if(mpeg_errno)
2725 ret |= MPEG_STATUS_ERROR; 2726 ret |= AUDIO_STATUS_ERROR;
2726 2727
2727 return ret; 2728 return ret;
2728} 2729}
2729 2730
2730unsigned int mpeg_error(void) 2731unsigned int audio_error(void)
2731{ 2732{
2732 return mpeg_errno; 2733 return mpeg_errno;
2733} 2734}
2734 2735
2735void mpeg_error_clear(void) 2736void audio_error_clear(void)
2736{ 2737{
2737 mpeg_errno = 0; 2738 mpeg_errno = 0;
2738} 2739}
@@ -2745,21 +2746,21 @@ static void mpeg_thread(void)
2745 struct mp3entry* id3; 2746 struct mp3entry* id3;
2746 while ( 1 ) { 2747 while ( 1 ) {
2747 if (is_playing) { 2748 if (is_playing) {
2748 id3 = mpeg_current_track(); 2749 id3 = audio_current_track();
2749 if (!paused) 2750 if (!paused)
2750 { 2751 {
2751 id3->elapsed+=1000; 2752 id3->elapsed+=1000;
2752 id3->offset+=1000; 2753 id3->offset+=1000;
2753 } 2754 }
2754 if (id3->elapsed>=id3->length) 2755 if (id3->elapsed>=id3->length)
2755 mpeg_next(); 2756 audio_next();
2756 } 2757 }
2757 sleep(HZ); 2758 sleep(HZ);
2758 } 2759 }
2759} 2760}
2760#endif /* #ifdef SIMULATOR */ 2761#endif /* #ifdef SIMULATOR */
2761 2762
2762void mpeg_init(void) 2763void audio_init(void)
2763{ 2764{
2764 mpeg_errno = 0; 2765 mpeg_errno = 0;
2765 2766
diff --git a/firmware/powermgmt.c b/firmware/powermgmt.c
index 71b0f08fff..9cfacad9b0 100644
--- a/firmware/powermgmt.c
+++ b/firmware/powermgmt.c
@@ -31,7 +31,7 @@
31#include "power.h" 31#include "power.h"
32#include "button.h" 32#include "button.h"
33#include "ata.h" 33#include "ata.h"
34#include "mpeg.h" 34#include "audio.h"
35#include "mp3_playback.h" 35#include "mp3_playback.h"
36#include "usb.h" 36#include "usb.h"
37#include "powermgmt.h" 37#include "powermgmt.h"
@@ -343,7 +343,7 @@ static void battery_level_update(void)
343static void handle_auto_poweroff(void) 343static void handle_auto_poweroff(void)
344{ 344{
345 long timeout = poweroff_idle_timeout_value[poweroff_timeout]*60*HZ; 345 long timeout = poweroff_idle_timeout_value[poweroff_timeout]*60*HZ;
346 int mpeg_stat = mpeg_status(); 346 int audio_stat = audio_status();
347 347
348#ifdef HAVE_CHARGING 348#ifdef HAVE_CHARGING
349 /* 349 /*
@@ -360,8 +360,8 @@ static void handle_auto_poweroff(void)
360 (radio_get_status() != FMRADIO_PLAYING) && 360 (radio_get_status() != FMRADIO_PLAYING) &&
361#endif 361#endif
362 !usb_inserted() && 362 !usb_inserted() &&
363 ((mpeg_stat == 0) || 363 ((audio_stat == 0) ||
364 ((mpeg_stat == (MPEG_STATUS_PLAY | MPEG_STATUS_PAUSE)) && 364 ((audio_stat == (AUDIO_STATUS_PLAY | AUDIO_STATUS_PAUSE)) &&
365 !sleeptimer_active))) 365 !sleeptimer_active)))
366 { 366 {
367 if(TIME_AFTER(current_tick, last_event_tick + timeout) && 367 if(TIME_AFTER(current_tick, last_event_tick + timeout) &&
@@ -377,7 +377,7 @@ static void handle_auto_poweroff(void)
377 { 377 {
378 if(TIME_AFTER(current_tick, sleeptimer_endtick)) 378 if(TIME_AFTER(current_tick, sleeptimer_endtick))
379 { 379 {
380 mpeg_stop(); 380 audio_stop();
381#ifdef HAVE_CHARGING 381#ifdef HAVE_CHARGING
382 if((charger_input_state == CHARGER) || 382 if((charger_input_state == CHARGER) ||
383 (charger_input_state == CHARGER_PLUGGED)) 383 (charger_input_state == CHARGER_PLUGGED))
@@ -413,8 +413,8 @@ static void car_adapter_mode_processing(void)
413 413
414 if (waiting_to_resume_play) { 414 if (waiting_to_resume_play) {
415 if (TIME_AFTER(current_tick, play_resume_time)) { 415 if (TIME_AFTER(current_tick, play_resume_time)) {
416 if (mpeg_status() & MPEG_STATUS_PAUSE) { 416 if (audio_status() & AUDIO_STATUS_PAUSE) {
417 mpeg_resume(); 417 audio_resume();
418 } 418 }
419 waiting_to_resume_play = false; 419 waiting_to_resume_play = false;
420 } 420 }
@@ -423,15 +423,15 @@ static void car_adapter_mode_processing(void)
423 /* 423 /*
424 * Just got unplugged, pause if playing 424 * Just got unplugged, pause if playing
425 */ 425 */
426 if ((mpeg_status() & MPEG_STATUS_PLAY) && 426 if ((audio_status() & AUDIO_STATUS_PLAY) &&
427 !(mpeg_status() & MPEG_STATUS_PAUSE)) { 427 !(audio_status() & AUDIO_STATUS_PAUSE)) {
428 mpeg_pause(); 428 audio_pause();
429 } 429 }
430 } else if(charger_input_state == CHARGER_PLUGGED) { 430 } else if(charger_input_state == CHARGER_PLUGGED) {
431 /* 431 /*
432 * Just got plugged in, delay & resume if we were playing 432 * Just got plugged in, delay & resume if we were playing
433 */ 433 */
434 if (mpeg_status() & MPEG_STATUS_PAUSE) { 434 if (audio_status() & AUDIO_STATUS_PAUSE) {
435 /* delay resume a bit while the engine is cranking */ 435 /* delay resume a bit while the engine is cranking */
436 play_resume_time = current_tick + HZ*5; 436 play_resume_time = current_tick + HZ*5;
437 waiting_to_resume_play = true; 437 waiting_to_resume_play = true;
@@ -920,7 +920,7 @@ void shutdown_hw(void)
920 fd = -1; 920 fd = -1;
921 } 921 }
922#endif 922#endif
923 mpeg_stop(); 923 audio_stop();
924 ata_flush(); 924 ata_flush();
925 ata_spindown(1); 925 ata_spindown(1);
926 while(ata_disk_is_active()) 926 while(ata_disk_is_active())
diff --git a/firmware/rolo.c b/firmware/rolo.c
index ceb70791cf..e2ef26b3aa 100644
--- a/firmware/rolo.c
+++ b/firmware/rolo.c
@@ -23,7 +23,7 @@
23#include "sprintf.h" 23#include "sprintf.h"
24#include "button.h" 24#include "button.h"
25#include "file.h" 25#include "file.h"
26#include "mpeg.h" 26#include "audio.h"
27#include "system.h" 27#include "system.h"
28#include "i2c.h" 28#include "i2c.h"
29#include "string.h" 29#include "string.h"
@@ -101,7 +101,7 @@ int rolo_load(const char* filename)
101 lcd_puts(0, 1, "Loading"); 101 lcd_puts(0, 1, "Loading");
102 lcd_update(); 102 lcd_update();
103 103
104 mpeg_stop(); 104 audio_stop();
105 105
106 fd = open(filename, O_RDONLY); 106 fd = open(filename, O_RDONLY);
107 if(-1 == fd) { 107 if(-1 == fd) {
diff --git a/uisimulator/common/stubs.c b/uisimulator/common/stubs.c
index 3ed16e8e34..043744388c 100644
--- a/uisimulator/common/stubs.c
+++ b/uisimulator/common/stubs.c
@@ -183,7 +183,7 @@ void mpeg_set_pitch(int pitch)
183 (void)pitch; 183 (void)pitch;
184} 184}
185 185
186void mpeg_set_buffer_margin(int seconds) 186void audio_set_buffer_margin(int seconds)
187{ 187{
188 (void)seconds; 188 (void)seconds;
189} 189}