From 7f084628214926f1489ddf6a54b62601e9eb80cf Mon Sep 17 00:00:00 2001 From: Björn Stenberg Date: Tue, 25 Jun 2002 09:09:45 +0000 Subject: Made the code compile. Added header. Fixed spacing. git-svn-id: svn://svn.rockbox.org/rockbox/trunk@1172 a1c6a512-1295-4272-9138-f99709370657 --- apps/wps.c | 142 ++++++++++++++++++++++++++++++++++--------------------------- apps/wps.h | 18 ++++++++ 2 files changed, 98 insertions(+), 62 deletions(-) (limited to 'apps') diff --git a/apps/wps.c b/apps/wps.c index eb9b4ba3af..1d4a807be6 100644 --- a/apps/wps.c +++ b/apps/wps.c @@ -1,3 +1,21 @@ +/*************************************************************************** + * __________ __ ___. + * Open \______ \ ____ ____ | | _\_ |__ _______ ___ + * Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ / + * Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < < + * Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \ + * \/ \/ \/ \/ \/ + * $Id$ + * + * Copyright (C) 2002 Jerome Kuptz + * + * 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. + * + ****************************************************************************/ #include #include #include @@ -22,81 +40,82 @@ /* demonstrates showing different formats from playtune */ void wps_show_play(char* filename) { - mp3entry mp3; - mp3info(&mp3,filename); + char buffer[256]; + mp3entry mp3; + mp3info(&mp3,filename); - char buffer[256]; - snprintf(buffer,sizeof(buffer), "%s", mp3.path); + snprintf(buffer,sizeof(buffer), "%s", mp3.path); - lcd_clear_display(); + lcd_clear_display(); - switch (global_settings.wps_display) - { - case PLAY_DISPLAY_TRACK_TITLE: - { - int ch = '/'; - char* end; - char szArtist[26]; + switch (global_settings.wps_display) + { + case PLAY_DISPLAY_TRACK_TITLE: + { + char ch = '/'; + char* end; + char* szDelimit; + char szArtist[32]; - char* szTok = strtok_r(buffer, "/", &end); - szTok = strtok_r(NULL, "/", &end); + char* szTok = strtok_r(buffer, "/", &end); + szTok = strtok_r(NULL, "/", &end); - // Assume path format of: Genre/Artist/Album/Mp3_file - strncpy(szArtist,szTok,sizeof(szArtist)); - szArtist[sizeof(szArtist)-1] = 0; - char* szDelimit = strrchr(buffer, ch); + /* Assume path format of: Genre/Artist/Album/Mp3_file */ + strncpy(szArtist,szTok,sizeof(szArtist)); + szArtist[sizeof(szArtist)-1] = 0; + szDelimit = strrchr(buffer, ch); #ifdef HAVE_LCD_BITMAP - lcd_puts(0,0, szArtist?szArtist:""); - lcd_puts_scroll(0,LINE_Y,(++szDelimit)); + lcd_puts(0,0, szArtist?szArtist:""); + lcd_puts_scroll(0,LINE_Y,(++szDelimit)); #else - lcd_puts(0,0, szArtist?szArtist:""); - lcd_puts_scroll(0,1,(++szDelimit)); + lcd_puts(0,0, szArtist?szArtist:""); + lcd_puts_scroll(0,1,(++szDelimit)); #endif - break; - } - case PLAY_DISPLAY_FILENAME_SCROLL: - { - int ch = '/'; - char* szLast = strrchr(buffer, ch); - - if (szLast) - { - lcd_puts_scroll(0,0, (++szLast)); - } else { - lcd_puts_scroll(0,0, buffer); - } - - break; - } - case PLAY_DISPLAY_DEFAULT: - { + break; + } + case PLAY_DISPLAY_FILENAME_SCROLL: + { + int ch = '/'; + char* szLast = strrchr(buffer, ch); + + if (szLast) + { + lcd_puts_scroll(0,0, (++szLast)); + } else { + lcd_puts_scroll(0,0, buffer); + } + + break; + } + case PLAY_DISPLAY_DEFAULT: + { #ifdef HAVE_LCD_BITMAP - lcd_puts(0, 0, "[id3 info]"); - lcd_puts(0, LINE_Y, mp3.title?mp3.title:""); - lcd_puts(0, LINE_Y+1, mp3.album?mp3.album:""); - lcd_puts(0, LINE_Y+2, mp3.artist?mp3.artist:""); + lcd_puts(0, 0, "[id3 info]"); + lcd_puts(0, LINE_Y, mp3.title?mp3.title:""); + lcd_puts(0, LINE_Y+1, mp3.album?mp3.album:""); + lcd_puts(0, LINE_Y+2, mp3.artist?mp3.artist:""); - snprintf(buffer,sizeof(buffer), "%d ms", mp3.length); - lcd_puts(0, LINE_Y+3, buffer); + snprintf(buffer,sizeof(buffer), "%d ms", mp3.length); + lcd_puts(0, LINE_Y+3, buffer); - snprintf(buffer,sizeof(buffer), "%d kbits", mp3.bitrate); + snprintf(buffer,sizeof(buffer), "%d kbits", mp3.bitrate); - lcd_puts(0, LINE_Y+4, buffer); + lcd_puts(0, LINE_Y+4, buffer); - snprintf(buffer,sizeof(buffer), "%d Hz", mp3.frequency); - lcd_puts(0, LINE_Y+5, buffer); + snprintf(buffer,sizeof(buffer), "%d Hz", mp3.frequency); + lcd_puts(0, LINE_Y+5, buffer); #else - lcd_puts(0, 0, mp3.artist?mp3.artist:""); - lcd_puts(0, 1, mp3.title?mp3.title:""); + lcd_puts(0, 0, mp3.artist?mp3.artist:""); + lcd_puts(0, 1, mp3.title?mp3.title:""); #endif - break; - } + break; + } - } + } lcd_update(); } @@ -105,7 +124,6 @@ void wps_show_play(char* filename) #if 0 void wps_show_playlist(char* current, playlist_info_t *list) { - int ch = '/'; char* szLast = strrchr(current, ch); char buf[16]; @@ -117,15 +135,15 @@ void wps_show_playlist(char* current, playlist_info_t *list) lcd_clear_display(); #ifdef HAVE_LCD_BITMAP - lcd_puts(0, 0, "[Playlist Mode]"); - lcd_puts_scroll(0,LINE_Y, (++szLast)); - lcd_puts(0, LINE_Y+1, buf); + lcd_puts(0, 0, "[Playlist Mode]"); + lcd_puts_scroll(0,LINE_Y, (++szLast)); + lcd_puts(0, LINE_Y+1, buf); #else - lcd_puts_scroll(0,0, (++szLast)); - lcd_puts(0,1,buf); + lcd_puts_scroll(0,0, (++szLast)); + lcd_puts(0,1,buf); #endif - lcd_update(); + lcd_update(); } #endif diff --git a/apps/wps.h b/apps/wps.h index 7b72baa915..2bc6fbf8dc 100644 --- a/apps/wps.h +++ b/apps/wps.h @@ -1,3 +1,21 @@ +/*************************************************************************** + * __________ __ ___. + * Open \______ \ ____ ____ | | _\_ |__ _______ ___ + * Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ / + * Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < < + * Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \ + * \/ \/ \/ \/ \/ + * $Id$ + * + * Copyright (C) 2002 Jerome Kuptz + * + * 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 _WPS_H #define _WPS_H #include "id3.h" -- cgit v1.2.3