summaryrefslogtreecommitdiff
path: root/apps
diff options
context:
space:
mode:
authorJerome Kuptz <jeromekuptz@gmail.com>2002-06-25 08:58:11 +0000
committerJerome Kuptz <jeromekuptz@gmail.com>2002-06-25 08:58:11 +0000
commit1f254d8574f68d9bff59fe57507be5f9e8249545 (patch)
tree70a6bd297c07c0ea2ffb1ba2a6428a500c1570fa /apps
parent4032f2ed76c98eba74164d2d21d6765d54cc1844 (diff)
downloadrockbox-1f254d8574f68d9bff59fe57507be5f9e8249545.tar.gz
rockbox-1f254d8574f68d9bff59fe57507be5f9e8249545.zip
initial wps functions
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@1169 a1c6a512-1295-4272-9138-f99709370657
Diffstat (limited to 'apps')
-rw-r--r--apps/wps.c131
-rw-r--r--apps/wps.h9
2 files changed, 140 insertions, 0 deletions
diff --git a/apps/wps.c b/apps/wps.c
new file mode 100644
index 0000000000..eb9b4ba3af
--- /dev/null
+++ b/apps/wps.c
@@ -0,0 +1,131 @@
1#include <stdio.h>
2#include <string.h>
3#include <stdlib.h>
4
5#include "file.h"
6#include "lcd.h"
7#include "button.h"
8#include "kernel.h"
9#include "tree.h"
10#include "debug.h"
11#include "sprintf.h"
12#include "settings.h"
13#include "wps.h"
14
15
16#define LINE_Y 1 /* initial line */
17
18#define PLAY_DISPLAY_DEFAULT 0
19#define PLAY_DISPLAY_FILENAME_SCROLL 1
20#define PLAY_DISPLAY_TRACK_TITLE 2
21
22/* demonstrates showing different formats from playtune */
23void wps_show_play(char* filename)
24{
25 mp3entry mp3;
26 mp3info(&mp3,filename);
27
28 char buffer[256];
29 snprintf(buffer,sizeof(buffer), "%s", mp3.path);
30
31 lcd_clear_display();
32
33 switch (global_settings.wps_display)
34 {
35 case PLAY_DISPLAY_TRACK_TITLE:
36 {
37 int ch = '/';
38 char* end;
39 char szArtist[26];
40
41 char* szTok = strtok_r(buffer, "/", &end);
42 szTok = strtok_r(NULL, "/", &end);
43
44 // Assume path format of: Genre/Artist/Album/Mp3_file
45 strncpy(szArtist,szTok,sizeof(szArtist));
46 szArtist[sizeof(szArtist)-1] = 0;
47 char* szDelimit = strrchr(buffer, ch);
48
49#ifdef HAVE_LCD_BITMAP
50 lcd_puts(0,0, szArtist?szArtist:"<nothing>");
51 lcd_puts_scroll(0,LINE_Y,(++szDelimit));
52#else
53 lcd_puts(0,0, szArtist?szArtist:"<nothing>");
54 lcd_puts_scroll(0,1,(++szDelimit));
55#endif
56
57
58 break;
59 }
60 case PLAY_DISPLAY_FILENAME_SCROLL:
61 {
62 int ch = '/';
63 char* szLast = strrchr(buffer, ch);
64
65 if (szLast)
66 {
67 lcd_puts_scroll(0,0, (++szLast));
68 } else {
69 lcd_puts_scroll(0,0, buffer);
70 }
71
72 break;
73 }
74 case PLAY_DISPLAY_DEFAULT:
75 {
76#ifdef HAVE_LCD_BITMAP
77 lcd_puts(0, 0, "[id3 info]");
78 lcd_puts(0, LINE_Y, mp3.title?mp3.title:"");
79 lcd_puts(0, LINE_Y+1, mp3.album?mp3.album:"");
80 lcd_puts(0, LINE_Y+2, mp3.artist?mp3.artist:"");
81
82 snprintf(buffer,sizeof(buffer), "%d ms", mp3.length);
83 lcd_puts(0, LINE_Y+3, buffer);
84
85 snprintf(buffer,sizeof(buffer), "%d kbits", mp3.bitrate);
86
87 lcd_puts(0, LINE_Y+4, buffer);
88
89 snprintf(buffer,sizeof(buffer), "%d Hz", mp3.frequency);
90 lcd_puts(0, LINE_Y+5, buffer);
91#else
92
93 lcd_puts(0, 0, mp3.artist?mp3.artist:"<no artist>");
94 lcd_puts(0, 1, mp3.title?mp3.title:"<no title>");
95#endif
96 break;
97 }
98
99 }
100
101 lcd_update();
102}
103
104/* experimental idea still being sorted out, but want it in the the code tree still so that important playlist info is not forgotten. */
105#if 0
106void wps_show_playlist(char* current, playlist_info_t *list)
107{
108
109 int ch = '/';
110 char* szLast = strrchr(current, ch);
111 char buf[16];
112
113 buf[15] = 0;
114
115 snprintf(buf, sizeof(buf), "[%d/%d]", list->index, list->amount);
116
117 lcd_clear_display();
118
119#ifdef HAVE_LCD_BITMAP
120 lcd_puts(0, 0, "[Playlist Mode]");
121 lcd_puts_scroll(0,LINE_Y, (++szLast));
122 lcd_puts(0, LINE_Y+1, buf);
123#else
124 lcd_puts_scroll(0,0, (++szLast));
125 lcd_puts(0,1,buf);
126#endif
127
128
129 lcd_update();
130}
131#endif
diff --git a/apps/wps.h b/apps/wps.h
new file mode 100644
index 0000000000..7b72baa915
--- /dev/null
+++ b/apps/wps.h
@@ -0,0 +1,9 @@
1#ifndef _WPS_H
2#define _WPS_H
3#include "id3.h"
4#include "playlist.h"
5
6void wps_show_play(char* filename);
7//void wps_show_playlist(char* current, playlist_info_t *list);
8
9#endif